rake aborted while creating admin user - ruby-on-rails

I am using ubuntu 18.4, Ruby 2.7.3 , rails 4.2.11.1, Rake 10.0.0
While trying to run the rake admin:create, I am getting the below error message. Can any one help me on this.
/home/ubuntu/.rbenv/versions/2.7.3/lib/ruby/2.7.0/uri/version.rb:3: warning: already initialized constant URI::VERSION_CODE
/home/ubuntu/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/uri-0.10.1/lib/uri/version.rb:3: warning: previous definition of VERSION_CODE was here
/home/ubuntu/.rbenv/versions/2.7.3/lib/ruby/2.7.0/uri/version.rb:4: warning: already initialized constant URI::VERSION

Related

Unable to push migrations to Heroku

I have a rails app on Heroku. I can connect to it, push builds, and see that it's running.
The problem: I am unable to push builds that include migrations in the db>migrate folder. Any attempt to do so gives me an error of
remote: Run `bin/rails db:migrate` to update your database then try again. remote: You have 3 pending migrations: remote: 20210326003113 CreateUsers remote: 20210326004504 CreateAlerts remote: 20210326004819 CreateContacts remote: Waiting for release.... failed. To https://git.heroku.com/*appname* 3dca123..cc0f499 master -> master
I ran my migrations locally, committed, tested them locally (they work), then pushed to heroku with the same response as above.
I can run heroku run bin/rails db:migrate
which gives me a response of a bunch of warnings.
// ♥ heroku run bin/rails db:migrate -a *app name*
Running bin/rails db:migrate on ⬢ *app name*... up, run.1211 (Free)
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/rubygems_integration.rb:12: warning: already initialized constant Bundler::RubygemsIntegration::EXT_LOCK
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/rubygems_integration.rb:12: warning: previous definition of EXT_LOCK was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/version.rb:4: warning: already initialized constant Bundler::VERSION
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/version.rb:10: warning: previous definition of VERSION was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:4: warning: already initialized constant Bundler::WINDOWS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:4: warning: previous definition of WINDOWS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:5: warning: already initialized constant Bundler::FREEBSD
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:5: warning: previous definition of FREEBSD was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:6: warning: already initialized constant Bundler::NULL
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:6: warning: previous definition of NULL was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:12: warning: already initialized constant Bundler::CurrentRuby::KNOWN_MINOR_VERSIONS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:12: warning: previous definition of KNOWN_MINOR_VERSIONS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:25: warning: already initialized constant Bundler::CurrentRuby::KNOWN_MAJOR_VERSIONS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:24: warning: previous definition of KNOWN_MAJOR_VERSIONS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:27: warning: already initialized constant Bundler::CurrentRuby::KNOWN_PLATFORMS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:26: warning: previous definition of KNOWN_PLATFORMS was here
Checking the logs, it tells me it could not create a user because my user table doesn't exist. User table doesn't exist because there are no migrations. Using heroku run rake db:migrate does nothing because the build on Heroku contains no migrations. I cannot push a build with migrations because it tells me I have pending migrations.
Any assistance with this catch-22 would be lovely. Can readily post the logs if requested.
Solution was inside of my Procfile.
I needed to use bundle exec rails s.
Before I was using release: bin/rails db:migrate

Rake tasks, "warning: already initialized constant STATS_DIRECTORIES"

when executing the rake tasks, it issues this message:
warning: already initialized constant STATS_DIRECTORIES
¿how can I load it, using rails 4?.
thanks for you help.

Console error in any rake command in my rails app

I'm having some problem when running any rake command in my rails application:
humberto#asterix:/var/www/avante-q-a$ rake db
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:11: warning: already initialized constant DEFAULT_HOOKS
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:23: warning: already initialized constant DEFAULT_PRINT
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:48: warning: already initialized constant SIMPLE_PRINT
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:57: warning: already initialized constant CLIPPED_PRINT
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:62: warning: already initialized constant DEFAULT_EXCEPTION_HANDLER
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:68: warning: already initialized constant DEFAULT_EXCEPTION_WHITELIST
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:71: warning: already initialized constant DEFAULT_PROMPT
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:82: warning: already initialized constant SIMPLE_PROMPT
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:84: warning: already initialized constant SHELL_PROMPT
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:91: warning: already initialized constant NAV_PROMPT
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:107: warning: already initialized constant DEFAULT_CONTROL_D_HANDLER
/home/humberto/.rvm/gems/ruby-1.9.3-p327/gems/pry-0.9.9.6/lib/pry.rb:121: warning: already initialized constant DEFAULT_SYSTEM
rake aborted!
cannot load such file -- pry/nav
(See full trace by running task with --trace)
I've already run bundle install and it worked succesfull. Do someone know what is missing here? Thanks since now.
You should try re-running it within a bundler context:
bundle exec rake db
Bundle exec loads bundler first and hooks all of the gems into the current environment before rake is loaded.

Rake spec fails with no error message

I have a Rails app that runs on Phusion+Apache in the following environment:
RHEL 5 x64
Ruby 1.9.2 p290 x64
Rails 3.0.4
Rake 0.9.2.2
I'm using and Oracle 11g database so I've also installed:
activerecord-oracle_enhanced-adapter (1.4.0)
ruby-oci8 (2.0.6)
database.yml is correctly configured.
My application correctly runs in production mode.
The problem is when I try to run my tests with rake spec I have the following Warnings and then the rake process stops with no error message at all.
Here is the output:
alex#rhel:~/projects/app$ rake spec
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /usr/local/lib/ruby/gems/1.9.1/lib/rake/rdoctask.rb
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Api::Application#task called at /usr/local/lib/ruby/gems/1.9.1/railties-3.0.4/lib/rails/application.rb:214:in `initialize_tasks'
alex#rhel:~/projects/app$
I've checked the exit code of the rake process and is set on 0 -> success.
Do you have any ideas ?
Thanks
These are deprecation warnings, informing you that some of the code you're calling has been deprecated.
Are your tests actually failing? Getting deprecation warnings doesn't mean you spec is failing. I see three dots ... Rake::DSL
Are those dots your passing specs? How many specs do you have?

Unable to run rake db:migrate

I new to rails,
i've done all steps from this tutorial http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac on my ubuntu 11.04 but i'm unable to run rake db:migrate.
It gives to this output:
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: warning: already initialized constant EMPTY_TASK_ARGS
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49: warning: already initialized constant EMPTY
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143: warning: already initialized constant Commands
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_list.rb:44: warning: already initialized constant ARRAY_METHODS
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_list.rb:47: warning: already initialized constant MUST_DEFINE
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_list.rb:51: warning: already initialized constant MUST_NOT_DEFINE
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_list.rb:55: warning: already initialized constant SPECIAL_RETURN
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_list.rb:61: warning: already initialized constant DELEGATING_METHODS
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_list.rb:364: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake/file_list.rb:370: warning: already initialized constant DEFAULT_IGNORE_PROCS
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake.rb:64: warning: already initialized constant FileList
/home/breedish/.rvm/gems/ruby-1.9.2-p290#global/gems/rake-0.9.2/lib/rake.rb:65: warning: already initialized constant RakeFileUtils
rake aborted!
stack level too deep
How can i fix rake to run my initial migration
I have 1.9.2 ruby, 3.0.10 rails
thx for any help
I ran into this error recently too. Resolved it by placing bundle exec in front of the command.
bundle exec rake db:migrate
Here's a previous StackOverflow question with the same error.
And, there's more information about bundle exec here.
Try to install an older version of rake.
gem install rake -v=0.8.7
You might get a warning message when using rake.
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
You can just add "include Rake::DSL" to the Rakefile before the applications load_tasks were called.
I found a post to fix that issue.
Global access to Rake DSL methods is deprecated

Resources