Запуск команды на консоли героя из грабли - PullRequest
2 голосов
/ 19 января 2012

Я пытаюсь запустить консольную команду heroku из рейка, поэтому мой подход - попытаться сделать все это в одной строке.Обратите внимание, что это работает

heroku запустить консоль Rails.cache.clear

Вот мое задание по рейку:

task :setup_staging_env do
  sh "heroku run console Rails.cache.clear"
end

Но это не удается.Итак, чтобы упростить, я попытался просто эту команду в командной строке и получить это:

heroku run console Rails.cache.clear
Running console Rails.cache.clear attached to terminal... up, run.1
You did not specify how you would like Rails to report deprecation notices for your Rails.cache.clear environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/Rails.cache.clear.rb
/usr/local/lib/ruby/1.9.1/uri/common.rb:156:in `split': bad URI(is not URI?): (URI::InvalidURIError)
from /usr/local/lib/ruby/1.9.1/uri/common.rb:174:in `parse'
from /usr/local/lib/ruby/1.9.1/uri/common.rb:628:in `parse'
from /app/config/initializers/resque.rb:2:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:555:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:555:in `block in <class:Engine>'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /app/config/environment.rb:6:in `<top (required)>'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

Так, как я могу запустить эту команду из задачи rake?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...