美文网首页
RubyGems使用汇总

RubyGems使用汇总

作者: 德罗德 | 来源:发表于2019-07-26 11:41 被阅读0次

    示例说明:
    项目名称: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       = 'nick@quaran.to'
      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使用汇总

          本文链接:https://www.haomeiwen.com/subject/dksrrctx.html