Tag: 捆绑器

如何通过bundler处理rails 3.1中的:assets组?

我不明白这个组究竟发生了什么,以及捆绑器正在做什么。 它只在开发模式下加载吗? 如果我想创建一个新的环境类型,我应该如何处理这个组? 等等。 group :assets do gem ‘coffee-rails’, “~> 3.1.0” gem ‘uglifier’ end

Rails未初始化的常量Bundler(NameError)

我在运行任何rails命令(如rails s或rails c时遇到以下错误,它也阻止了我的heroku应用程序启动(同样的错误): app/config/application.rb:7:in `’: uninitialized constant Bundler (NameError) from /Users/you/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require’ 错误消息中的第7行是: Bundler.require(:default, Rails.env) 将命令作为bundle exec rails s成功,但这对heroku应用程序没有帮助。 我已经validation了which ruby , which rails和which bundler 。 我也尝试启动一个新的rvm gemset并重新安装捆绑包。 heroku错误相同: /app/config/application.rb:7:in `’: uninitialized constant Bundler (NameError) 运行bundle check没有问题。 一些类似的问题表明: bundle config –delete bin # Turn off Bundler’s stub generator rake rails:update:bin # Use the new Rails […]

Rails 3的“捆绑安装”和“捆绑安装 – 部署”都运行良好,除了第二个只使用更多的磁盘空间?

似乎在开发机器上(比如在Macbook上),如果我们使用bundle install –deployment ,所有的gem都会被安装到vendor/bundle文件夹中,如果我们有多个Rails 3项目,它只会占用更多的磁盘空间(一些项目仅用于测试Rails 3)。 如果不是–deployment ,那么gem将位于“generic”文件夹中而不是项目文件夹中,因此可以跨项目共享。 这是真的? 另一件事是,我们是否需要将vendor/bundle下的所有文件添加到我们的存储库并推送它? 似乎如果我们这样做,我们只是堵塞了回购,因为如果我们不这样做,所有适当的gem将通过bundle install使用Gemfile.lock指定的所有gem来安装。 ( Gemfile.lock是repo中的一个小文件)。 这也是真的吗?

Passenger说Bundler:GemNotFound错误,而捆绑安装说它就在那里

我在共享主机上遇到Passenger错误 Could not find i18n-0.6.0 in any of the sources (Bundler::GemNotFound) 但如果我运行“捆绑安装”它说一切都好:( 并且Gemfile的内容是: source ‘http://rubygems.org’ gem ‘rake’, ‘0.8.7’ gem ‘tzinfo’, ‘0.3.27’ gem ‘mail’, ‘2.2.16’ gem ‘arel’, ‘2.0.9’ gem ‘rack’, ‘1.2.2’ gem ‘i18n’, ‘0.6.0’ gem ‘rails’, ‘3.0.5’ gem ‘mysql2’ gem ‘paperclip’ gem ‘devise’ gem ‘jquery-rails’ gem ‘acts-as-taggable-on’ gem “will_paginate”, “~> 3.0.pre2” gem ‘tiny_mce’ gem “oa-oauth”, :require […]

Rails / Bundler预编译与延迟编译

在Rails应用config/application.rb的config/application.rb文件中,有以下代码部分: if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require *Rails.groups(:assets => %w(development test)) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end 我可能不清楚Bundler.require正在做什么。 我的印象是它需要Gemfile中的指定部分,但我不清楚为什么Bundler.require *Rails.groups(…)导致它预编译和Bundler.require(…)导致懒惰的资产。

如何在RubyMine中运行’gem install bundler’?

我在RubyMine IDE中更新Ruby时遇到了麻烦。 我收到一个错误报告,我需要运行gem bundle install但是我在IDE中找不到运行该命令的位置。 我已经在我的Ubuntu控制台中运行它,一切正常,但我在IDE中找不到可以用来运行命令和更新该环境的控制台。 我认为这是一个简单的解决方案,但谷歌找不到多少帮助。 任何帮助将非常感激。

使用NoMethodError自定义Gem执行失败

我写了我的第一个gem(ruby noob alert!)。 要将它部署到我的本地gem目录中,我运行: bundle install bundle exec rake install 此时我尝试从命令行运行我的gem。 我得到一个神秘的错误: my_gem Gem File Location: C:/ruby193/lib/ruby/gems/1.9.1/gems/my_gem-0.0.1/Gemfile fatal: Not a git repository (or any of the parent directories): .git getting Gem.bin_path() C:/ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.6.3/lib/bundler/rubygems_integration.rb:305:in `block in replace_bin_path’: undefined method `name’ for nil:NilClass (NoMethodError) from C:/ruby193/lib/ruby/gems/1.9.1/gems/my_gem-0.0.1/bin/my_gem:20:in `’ from C:/ruby193/bin/my_gem:23:in `load’ from C:/ruby193/bin/my_gem:23:in `’ 当我运行bundle install时,它用它自己的代码替换了bin / my_gem的内容。 我确实添加了修改此文件稍微尝试调试。 […]

无法安装linecache19 gem

当我做捆绑安装即时收到以下错误”An error occurred while installing linecache19 (0.5.11), and Bundler cannot continue” 。 完整的跟踪如下: Installing linecache19 (0.5.11) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /home/raza/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb checking for vm_core.h… no /home/raza/.rvm/gems/ruby-1.9.3-p362@holla/gems/ruby_core_source-0.1.4/lib/ruby_core_source.rb:39: Use RbConfig instead of obsolete and deprecated Config. checking for vm_core.h… yes checking for version.h… yes checking for RUBY_VERSION_MAJOR in version.h… […]

如何在hash-bang可执行文件中引用本地ruby?

我有一个Ruby可执行文件(它是一个bundler binstub),它以 #!/usr/bin/env ruby 在我的服务器上,我通过RVM安装了Ruby 193。 $ which ruby -> /home/dtuite/.rvm/rubies/ruby-1.9.3-p0/bin/ruby 在我的本地机器上,我也通过RVM安装了Ruby,但是在不同的位置(显然!) $ which ruby -> /Users/davidtuite/.rvm/rubies/ruby-1.9.3-p0/bin/ruby 当我尝试在服务器上运行此可执行文件时,我收到错误 /usr/bin/env: ruby: No such file or directory 有没有办法可以在hash-bang中引用本地可用的ruby,以便在服务器和本地机器上执行相同的脚本?

在Bundler中,如何覆盖依赖项对其自身依赖项的版本要求?

我在我的应用程序中有一些需求,在边缘Rails(3.1)上工作将帮助我更快地完成我的任务。 问题是我依赖的其中一个gem还没有正式支持Rails 3.1,它有一个“〜> 3.0.0”的铁路依赖,它会产生一个依赖冲突,而捆绑器无法解决我的依赖关系。 我能以某种方式在我的应用程序的Gemfile中覆盖该要求,还是我唯一的解决方法来分配我的依赖?