RubyGems使用汇总

示例说明:
项目名称:hola / ruby_android_apk
gem账号:account

1.查看依赖

gem dependency ruby_android_apk
image.png

2.发布自己的gem

https://guides.rubygems.org/make-your-own-gem/

//a.文件结构
.
├── hola.gemspec
└── lib
    └── hola.rb

//b.查看 lib/hola.rb
class Hola
  def self.hi
    puts "Hello world!"
  end
end

//c.配置gem基本信息
% cat hola.gemspec
Gem::Specification.new do |s|
  s.name        = 'hola'
  s.version     = '0.0.0'
  s.date        = '2010-04-28'
  s.summary     = "Hola!"
  s.description = "A simple hello world gem"
  s.authors     = ["Nick Quaranto"]
  s.email       = '[email protected]'
  s.files       = ["lib/hola.rb"]
  s.homepage    =
    'https://rubygems.org/gems/hola'
  s.license       = 'MIT'
end

//d.build
gem build hola.gemspec

//e.setup account,期间会提示填写账号密码
curl -u account https://rubygems.org/api/v1/api_key.yaml >
~/.gem/credentials; chmod 0600 ~/.gem/credentials

//f.push
gem push hola-0.0.0.gem

//g. push success
gem list -r hola

//h.install
gem install hola

你可能感兴趣的:(RubyGems使用汇总)