I'm getting this error when I run:
rake generate_secret_token
rake aborted!
Don't know how to build task 'generate_secret_token'
/usr/local/rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
when I run full trace
rake generate_secret_token --trace
this is what I'm getting;
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/task_manager.rb:62:in `[]'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:149:in `invoke_task'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.1.3/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.1.3/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.1.3/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
Check if your rake task has the following format:
namespace :your_namespace do
desc 'Description for rake task'
task generate_secret_token: :environment do
end
end
While running rake task, run as 'rake namespace:generate_secret_token'
rake db:migrate
This command is used to run your db migrations.
rake task_name
This command is used to run your rake tasks which you have written lib/tasks folder
Related
i have rails app ubuntu 18.04. bundle install run successful but when i run rake db:setup it shows
rake aborted!
KeyError: key not found: "URL_HOST"
/var/www/myapp/code/config/environments/production.rb:71:in fetch'
/var/www/myapp/code/config/environments/production.rb:71:inblock in '
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/railtie.rb:210:in instance_eval'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/railtie.rb:210:inconfigure'
/var/www/myapp/code/config/environments/production.rb:3:in <top (required)>'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in block in require'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:inload_dependency'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in require'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/engine.rb:598:inblock (2 levels) in '
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/engine.rb:597:in each'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/engine.rb:597:inblock in '
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:30:in instance_exec'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:30:inrun'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:55:in block in run_initializers'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:44:ineach'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:44:in tsort_each_child'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/initializable.rb:54:inrun_initializers'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/application.rb:352:in initialize!'
/var/www/myapp/code/config/environment.rb:5:in'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in require'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inblock in require'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in load_dependency'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/application.rb:328:in require_environment!'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/railties-4.2.11.1/lib/rails/application.rb:457:inblock in run_tasks_blocks'
/home/myappuser/.rvm/gems/ruby-2.5.0/gems/rake-13.0.0/exe/rake:27:in <top (required)>'
/home/myappuser/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:ineval'
/home/myappuser/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `'
Tasks: TOP => db:setup => db:schema:load_if_ruby => environment
(See full trace by running task with --trace)
Need help
Seems like some config settings for URL_HOST is missing.
I'm not sure when this happened, but I've gotten my environment into a state where I can't rake build. I looked at the stack trace, but nothing in it is helpful for me.
$ bundle exec rake build --trace
rake aborted!
Don't know how to build task 'build' (see --tasks)
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/task_manager.rb:71:in `[]'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:149:in `invoke_task'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.3.0/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
I'm having some problems with running bundle exec rake db:migrate.
The terminal prints out the following:
[RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it.
rake aborted!
Failed to connect to a master node at 127.0.0.1:9100
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/mongo-1.6.4/lib/mongo/connection.rb:420:in `connect'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/mongo-1.6.4/lib/mongo/connection.rb:594:in `setup'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/mongo-1.6.4/lib/mongo/connection.rb:130:in `initialize'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/mongo_mapper-0.12.0/lib/mongo_mapper/connection.rb:79:in `new'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/mongo_mapper-0.12.0/lib/mongo_mapper/connection.rb:79:in `connect'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/mongo_mapper-0.12.0/lib/mongo_mapper/connection.rb:89:in `setup'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/mongo_mapper-0.12.0/lib/mongo_mapper/railtie.rb:28:in `block in <class:Railtie>'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/User/app/config/environment.rb:5:in `<top (required)>'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/User.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/gems/railties-3.2.11/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/bin/ruby_noexec_wrapper:14:in `eval'
/Users/User/.rvm/gems/ruby-1.9.3-p327#rails3tutorial2ndEd/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Just to clarify: before running bundle exec rake db:migrate I did bundle install and everything was OK.
Anyone?
Is your database running? This error message shows that it can't connect to your database.
I'm trying to add a dropdown field to an already existing engine that I created. I followed this guide http://refinerycms.com/guides/multiple-resources-in-an-extension and when i ran the command rails g refinery:engine categories name:string --extension group_classes
I then tried running bundle install and then rails generate refinery:group_classes and then i got this error:
rake aborted!
Multiple migrations have the version number 1
I looked at the migrations in the vender/extensions/group_classes/db/migrate folder and they both had the prefix of 1. I changed the categories prefix to 2 and reran everything and it worked but then when i tried running rake db:seed, I get this error:
rake aborted!
uninitialized constant Refinery::GroupClasses::Engine
Full stack trace:
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
rake aborted!
uninitialized constant Refinery::GroupClasses::Engine
/var/www/vhosts/tomstestsite.us/PersonalTrainingKT/db/seeds.rb:46:in `<top (required)>'
/var/www/vhosts/tomstestsite.us/PersonalTrainingKT/refinerycms/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:520:in `load_seed'
/var/www/vhosts/tomstestsite.us/PersonalTrainingKT/refinerycms/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/railties/databases.rake:309:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `<main>'
Tasks: TOP => db:seed
What would cause this?
try use again without --extension group_classes OR you try to restart your server?
I'm trying to create a rake task that restarts my heroku servier. I've found this post, which has helped immensely: http://railspikes.com/2010/2/13/rake-task-for-deploying-to-heroku.
I've cobbled together this rake task, but it's giving me an error. The rake abouts and I get the message:
uninitialized constant Heroku::Command::BaseWithApp.
This is my method.
desc 'restarts the server'
task restart_server: :environment do
require 'heroku'
require 'heroku/command'
user, pass = File.read(File.expand_path("~/.heroku/credentials.txt")).split("\n")
heroku = Heroku::Client.new(user, pass)
cmd = Heroku::Command::BaseWithApp.new([])
remotes = cmd.git_remotes(File.dirname(__FILE__) + "/../..")
remote, app = remotes.detect {|key, value| value == (ENV['APP'])}# || cmd.app)}
if remote.nil?
raise "Could not find a git remote for the '#{ENV['APP']}' app"
end
heroku.restart(ENV['APP'])
end
I'm not sure why it's rejecting Heroku::Command. The app is already live on Heroku, so I know it's Heroku compliant.
Any advice?
EDIT: Here's my stack trace.
** Invoke restart_server (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute restart_server
rake aborted!
uninitialized constant Heroku::Command::BaseWithApp
/Users/bendowney/Sites/ProblemChildApp/lib/tasks/scheduler.rake:51:in `block in <top (required)>'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/bendowney/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `load'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `<main>'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#ProblemChildApp/bin/ruby_noexec_wrapper:14:in `eval'
/Users/bendowney/.rvm/gems/ruby-1.9.3-p194#ProblemChildApp/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => restart_server