Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rubygems 从Github分支安装Gem?_Rubygems_Branch_Github - Fatal编程技术网

Rubygems 从Github分支安装Gem?

Rubygems 从Github分支安装Gem?,rubygems,branch,github,Rubygems,Branch,Github,在我的GEM文件中,我有以下内容: gem "authlogic", :git => "git://github.com/odorcicd/authlogic.git", :branch => "rails3" 如何将其安装为gem,以便对其进行测试 克隆Git存储库 $ git clone git://github.com/odorcicd/authlogic.git $ git clone git://github.com/odorcicd/authlogic.git 更

在我的GEM文件中,我有以下内容:

gem "authlogic", :git => "git://github.com/odorcicd/authlogic.git", :branch => "rails3"
如何将其安装为gem,以便对其进行测试

  • 克隆Git存储库

    $ git clone git://github.com/odorcicd/authlogic.git
    
    $ git clone git://github.com/odorcicd/authlogic.git
    
  • 更改到新目录

    cd authlogic
    
    $ cd authlogic
    
  • 结帐处

    $ git checkout -b rails3 remotes/origin/rails3
    
    $ git checkout -b rails3 remotes/origin/rails3
    
  • 建造宝石

    $ rake build gem
    
    $ rake build
    
  • 安装gem

    $ gem install pkg/gemname-1.23.gem
    
    $ gem install pkg/gemname-1.23.gem
    

  • 您不需要在本地构建gem。在gemfile中,可以使用ref、branch或tag指定github源

    gem 'rails', :git => "git://github.com/rails/rails.git", :ref => "4aded"
    gem 'rails', :git => "git://github.com/rails/rails.git", :branch => "2-3-stable"
    gem 'rails', :git => "git://github.com/rails/rails.git", :tag => "v2.3.5"
    
    然后运行
    bundle安装
    ,或者简称为
    bundle

    请在此处阅读更多信息:

    更新:

    但是,他们警告不要使用它:
    注意:在Bundler 2.0之前应该避免使用这种速记,因为它当前扩展为不安全的git://URL。这允许中间人攻击者危害您的系统。

    在Bundler 2.0之后,您可以通过文件顶部附近的以下语句绕过上述问题:

    git_source(:github) { |repo| "https://github.com/#{repo}.git" }
    

    我必须修改@janic!的答案才能使其生效。 希望它能帮助像我这样的ruby Noob

  • 克隆Git存储库

    $ git clone git://github.com/odorcicd/authlogic.git
    
    $ git clone git://github.com/odorcicd/authlogic.git
    
  • 更改到新目录

    cd authlogic
    
    $ cd authlogic
    
  • 结帐处

    $ git checkout -b rails3 remotes/origin/rails3
    
    $ git checkout -b rails3 remotes/origin/rails3
    
  • 安装捆绑包

    $ bundle install
    
  • 建造宝石

    $ rake build gem
    
    $ rake build
    
  • 安装gem

    $ gem install pkg/gemname-1.23.gem
    
    $ gem install pkg/gemname-1.23.gem
    

  • 我需要换衣服。用“耙造”来造宝石,而不是4。我不得不使用gem build name-of-file.gempec来构建gem-rake-build o rake-gem对我不起作用除了4和5你可以做“rake-install”或者直接从github开始:
    gem'rails',:github=>'rails',:branch=>'5.0-stable'
    -link:for me
    gem-build.gempec
    起作用。我没有在GEM文件中列出
    rake
    。因此,
    rake build gem
    抛出的rake不是捆绑包的一部分。从2017年开始将其添加到gemfileupdate中,我无法使GitHub源标识符正常工作,但:git=>ref很好地工作可能是它的Windows操作系统,但在Windows 10上的RubyInstaller 2.3中,我对一个未发布的gem进行了相同的设置,我发出了
    bundle install
    命令,RubyGems说它正在获取git repo,而且它已经安装,但是当我执行
    gem列表gemname
    时,它不会显示在我本地安装的gems.nvm中,这是因为我希望
    bundle install
    能够像全局安装一样安装,或者针对所有rubygems。然而,它是按照每个项目进行的,有时是按照每个用户进行的。至少在我们的环境中,
    github:
    标识符给出了我希望避免的
    无加密传输数据的警告。使用
    https
    转换为
    git:
    标识符可能不够,因为我还需要指定一个分支。关于使用github源标识符进行安装:
    注意:在Bundler 2.0之前,应该避免使用此缩写,因为它当前扩展为不安全的git://URL。这允许中间人攻击者危害您的系统。
    -根据