可能不是将rails 3应用程序迁移到rails 4的最佳方法,但我只是删除了所有文件(隐藏的.git文件除外)并重新构建了一个没有数据库或单元测试的静态webapp({ {1}})。在我的localhost上一切正常。我删除然后运行rails new testapp -O --skip-bundle -T
以重新创建我的Gemfile.lock。
我还测试了在config / application.rb中添加bundle install
,但继续看到警告“检测到的Rails没有设置为提供static_assets。”
以下是我的Gemfile的内容:
config.serve_static_assets = true;
这是我尝试推送到Heroku时得到的输出:
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.2'
group :development do
#gem 'sqlite3', '1.3.8'
end
group :production do
gem 'rails_12factor' # for heroku
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
我的完整Gemfile.lock文件显示了更高版本的bundler和rails:
me-mbp:testapp me$ git push heroku master
Fetching repository, done.
Counting objects: 275, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (197/197), done.
Writing objects: 100% (211/211), 56.08 KiB | 0 bytes/s, done.
Total 211 (delta 117), reused 3 (delta 0)
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
Unresolved dependencies detected; Installing...
Using --without development:test
/tmp/build_25e2c7af-af3f-4901-8e75-4d3e12337bf8/Gemfile:2:in `evaluate': undefined method `ruby' for #<Bundler::Dsl:0x000000025d3c78> (NoMethodError)
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/dsl.rb:7:in `instance_eval'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/dsl.rb:7:in `evaluate'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/definition.rb:17:in `build'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler.rb:128:in `definition'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/bin/bundle:13:in `<top (required)>'
from /usr/ruby1.9.2/bin/bundle:19:in `load'
from /usr/ruby1.9.2/bin/bundle:19:in `<main>'
FAILED: http://devcenter.heroku.com/articles/bundler
! Push failed: failed to install gems via Bundler
! If the problem persists, see http://help.heroku.com and provide Request ID 25e2c7af-af3f-4901-8e75-4d3e12337bf8.
答案 0 :(得分:0)
使用不支持Gemfile中ruby
方法的旧版本Bundler时会发生该错误。
部署输出
确认了这一点-----> Gemfile detected, running Bundler version 1.0.7
因为Cedar堆栈已更新,我假设您正在使用Bamboo堆栈。你应该升级到Cedar。