ruby – 如何使用vendor / bundle目录中安装的gem
发布时间:2020-12-16 23:21:22 所属栏目:百科 来源:网络整理
导读:我在vendor / bundle中的项目目录中安装了gems bundle install --path vendor/bundle 所有的宝石都得到了正确的安装. .bundle / config文件 BUNDLE_PATH: vendor/bundleBUNDLE_DISABLE_SHARED_GEMS: '1' 捆绑环境 环境 Bundler 1.10.6Rubygems 2.4.8Ruby 2.0
我在vendor / bundle中的项目目录中安装了gems
bundle install --path vendor/bundle 所有的宝石都得到了正确的安装. .bundle / config文件 BUNDLE_PATH: vendor/bundle BUNDLE_DISABLE_SHARED_GEMS: '1' 捆绑环境 环境 Bundler 1.10.6 Rubygems 2.4.8 Ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux] GEM_HOME /home/xyz/.rvm/gems/ruby-2.0.0-p643 GEM_PATH /home/xyz/.rvm/gems/ruby-2.0.0-p643:/home/xyz/.rvm/gems/ruby-2.0.0-p643@global RVM 1.26.11 (1.26.11) Git 1.9.1 rubygems-bundler (1.4.4) Bundler设置 path Set for your local app (/home/xyz/code/project/.bundle/config): "vendor/bundle" Set for the current user (/home/xyz/.bundle/config): "vendor/bundle" disable_shared_gems Set for your local app (/home/xyz/code/project/.bundle/config): "1" Set for the current user (/home/xyz/.bundle/config): "1" 的Gemfile source 'https://rubygems.org' gem 'creek' gem 'faraday' gem 'faraday_middleware' gem 'json' gem 'logger' gem 'mechanize' gem 'nokogiri' gem 'trollop' gem 'yajl-ruby' gem 'simplecov',:require => false,:group => :test gem 'test-unit' Gemfile.lock的 GEM remote: https://rubygems.org/ specs: creek (1.0.8) nokogiri (~> 1.6.0) rubyzip (>= 1.0.0) docile (1.1.5) domain_name (0.5.24) unf (>= 0.0.5,< 1.0.0) faraday (0.9.1) multipart-post (>= 1.2,< 3) faraday_middleware (0.10.0) faraday (>= 0.7.4,< 0.10) http-cookie (1.0.2) domain_name (~> 0.5) json (1.8.3) logger (1.2.8) mechanize (2.7.3) domain_name (~> 0.5,>= 0.5.1) http-cookie (~> 1.0) mime-types (~> 2.0) net-http-digest_auth (~> 1.1,>= 1.1.1) net-http-persistent (~> 2.5,>= 2.5.2) nokogiri (~> 1.4) ntlm-http (~> 0.1,>= 0.1.1) webrobots (>= 0.0.9,< 0.2) mime-types (2.6.1) mini_portile (0.6.2) multipart-post (2.0.0) net-http-digest_auth (1.4) net-http-persistent (2.9.4) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) ntlm-http (0.1.1) power_assert (0.2.4) rubyzip (1.1.7) simplecov (0.10.0) docile (~> 1.1.0) json (~> 1.8) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) test-unit (3.1.3) power_assert trollop (2.1.2) unf (0.1.4) unf_ext unf_ext (0.0.7.1) webrobots (0.1.1) yajl-ruby (1.2.1) PLATFORMS ruby DEPENDENCIES creek faraday faraday_middleware json logger mechanize nokogiri simplecov test-unit trollop yajl-ruby BUNDLED WITH 1.10.6 捆绑秀 – 路径 /home/xyz/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.10.6/lib/gems/bundler-1.10.6 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/creek-1.0.8 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/docile-1.1.5 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/domain_name-0.5.24 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.1 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/faraday_middleware-0.10.0 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/http-cookie-1.0.2 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/json-1.8.3 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/logger-1.2.8 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/mechanize-2.7.3 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/mime-types-2.6.1 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/mini_portile-0.6.2 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/multipart-post-2.0.0 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/net-http-digest_auth-1.4 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/net-http-persistent-2.9.4 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.6.2 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/ntlm-http-0.1.1 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/power_assert-0.2.4 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/rubyzip-1.1.7 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/simplecov-0.10.0 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/simplecov-html-0.10.0 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/test-unit-3.1.3 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/trollop-2.1.2 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/unf-0.1.4 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/unf_ext-0.0.7.1 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/webrobots-0.1.1 /home/xyz/code/project/vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.2.1 问题是在我的文件中,当我尝试使用任何gem说simplecov它的抛出错误. 我的Ruby文件TestExample.rb require 'rubygems' require 'simplecov' .... rest of the code ..... enter code here 当我尝试运行此文件时,它给了我这个错误 /home/xyz/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- simplecov (LoadError) 我错过了什么吗?也许我要求文件是错的? 解决方法
你能尝试在你的rb中添加这一行吗?
require 'bundler/setup' 然后运行它 bundle exec ruby TestExample.rb 我认为这应该适合你. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- reactjs – 为React webpack bundle预加载动画
- c# – 关于Josh Smith的示例应用程序的MVVM问题
- 在Ruby中使用Marshal :: dump进行对象序列化时如何写入文件
- Webstorm使用教程详解
- c# – 方法重载解析如何工作(LINQ Where扩展方法)?
- 使用JSON.NET在C#中进行不正确的序列化
- swift 中的高阶函数 map、flatMap、filter、reduce
- Xcode 4.4.1错误验证Mac应用程序:两个软件包的CFBundleExe
- Cocos2D v3.4.9粒子效果不能显示的原因分析及解决办法
- 如何使用R的XML库使用xpath查询?