Create your own gem and upload it to GitHub
Environment: Centos7,git version 1.8.3.1
Create a GEM1 installation bundler
#gem Install Bundler
2 frames required to create a gem using bundler
#bundler Gem File_manipulate
3 Modify File_manipulate.gemspec File
#vim File_manipulate.gemspec
(The description and summary are mostly modified because Rubygem does not actually let the description in spec contain "TODO" packages, packaged into gems)
The contents of the modified File_manipulate.gemspec file are as follows:
# Coding:utf-8
lib = File.expand_path ('.. /lib ', __file__)
$LOAD _path.unshift (Lib) unless $LOAD _path.include? (Lib)
Require ' file_manipulate/version '
Gem::specification.new do |spec|
Spec.name = "File_manipulate"
Spec.version = Filemanipulate::version
Spec.authors = ["Liyongkuan"]
Spec.email = ["[Email protected]"]
Spec.summary =%q{this is a file manipulate library}
Spec.description =%q{this is a file manipulate library}
Spec.homepage = "Http://blog.csdn.net/li_yong_kuan"
Spec.license = "MIT"
Spec.files = ' git ls-files-z '. Split ("\x0")
Spec.executables = Spec.files.grep (%r{^bin/}) {|f| File.basename (f)}
Spec.test_files = Spec.files.grep (%r{^ (test|spec|features)/})
Spec.require_paths = ["Lib"]
Spec.add_development_dependency "Bundler", "~> 1.7"
Spec.add_development_dependency "Rake", "~> 10.0"
End
4 Write the Lib/file_manipulate.rb file and process the file into a file that just introduces the library file
#vim lib/file_manipulate.rb
The contents are as follows:
Require "file_manipulate/version"
Require "File_manipulate/file_manipulate"
5 under lib/file_manipulate new pieces of file_manipulate.rb file, write in the inside of the concrete what to do
#touch file_manipulate.rb
6 Write a specific method in File_manipulate.rb, save exit
#vim file_manipulate.rb
7 Commit to Git
#git Add.
#git commit-m "Create a document library operation"
8 Packaging Gems
#gem Build File_manipulate.gemspec
Or
#rake Build
When execution is complete, it is generated: File_manipulate-0.0.1.gem
9 Local Installation File_manipulate
#gem Install File_manipulate.gem-l, you can #gem list to see if the Gem list has this gem
OK, generate the Gem end (after the test is finished, remove the File_manipulate.gem and upload the project to GitHub later)
Two uploads to GitHub server 1 Create a warehouse on GitHub file_manipulate
Details Link: https://help.github.com/articles/create-a-repo/
2 Creating a key
Detailed Link: https://help.github.com/articles/generating-ssh-keys/
#ssh-keygen-t rsa-c "[Email protected]"
The private key and the public key are generated at the end of the. SSH in your home directory after the creation.
/home/oss/.ssh (. SSH is a hidden file, #ls-a can be viewed)
3 Copy the public key to SSH created on GitHub and then name it yourself (the name is on your own)
4 go to the File_manipulate file that we created earlier
#cd file_manipulate
5 Creating an alias for a URL link
#git remote Add kuange [email protected]:liyongkuan/file_manipulate.git
([email protected]:liyongkuan/file_manipulate.git is the warehouse SSH address created by Operation 1 and can be copied directly on GitHub)
6 Uploading the scheduled item to GitHub
#git Push Kuange Master
(Kuange is the link alias created in the previous step)
The project has been uploaded to the GitHub server with the link address: https://github.com/liyongkuan/file_manipulate
Reprint please specify the original Http://blog.csdn.net/li_yong_kuan
Create your own gem and upload it to GitHub