rake db:create the error - ruby-on-rails

give me solution for this
when i'm running rake db:create
it is showing warning like these
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <class:Engine> at /home/shajin/.rvm/gems/ruby-1.9.2-p0/bundler/gems/spree_paypal_express-073f2f814dd8/lib/spree_paypal_express.rb:5)
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /home/shajin/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/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 Soletronspree::Application#task called at /home/shajin/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead.
at /home/shajin/.rvm/gems/ruby-1.9.2-p0/gems/deface-0.5.2a/tasks/deface.rake:3:in `block in <top (required)>'
soletronspree_test already exists
soletronspree_development already exists

First of all try updating your gems, specifically spree_paypal_express.
bundle update
It is currently locked at 073f2f814dd8... and according to GitHub that SHA1 hash points to a 6 months old commit.
If you are currently not using the latest from the git repository, try them out by changing the gem line to this:
gem "spree_paypal_express", :git => "git://github.com/spree/spree_paypal_express.git"
The latest paypal extension release depends on Spree 1.0.0 or later. To install 1.0.0 change your current spree gem line to this:
gem 'spree', '1.0.0'
and run bundle update
Keep in mind, that updating Spree may break previous functionality elsewhere.
But it's always a great idea to stay up-to-date to have all the newest features.

Related

Bundler::GemRequireError when trying to run a rails app

While trying to run a rails app, I am getting the following error
rails s -p 5000
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: already initialized constant Net::SMTPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: previous definition of SMTPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: already initialized constant Net::POP
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: previous definition of POP was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: already initialized constant Net::POPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: previous definition of POPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: already initialized constant Net::POP3Session
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: previous definition of POP3Session was here
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: already initialized constant Net::APOPSession
/home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:702: warning: previous definition of APOPSession was here
/home/user/.rvm/gems/ruby-2.1.6/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'activeadmin'. (Bundler::GemRequireError)
What causes a Gem Require error in bundler?
I hope its trying to load activeadmin
May be the problem in activeadmin
check the gemfile and installation
gem 'activeadmin'
Use this to install activeadmin : Active admin install with Rails 4
It seems like you have multiple versions of the gem tlsmail being installed/loaded. That is the reason, you get the warning of it being already initialized. What you can do is run:
gem list --local | grep 'tlsmail'
which will return a list of versions of the gem installed. Then you can remove one of the versions (as per the dependency of your project) and see if that works.
gem uninstall tlsmail -v <version>
You might also want to check, whether you have same gem with different versions in the Gemfile.
Hope that helps!
Did you initialize your gemset? (Because you're using RVM)
Initialize your gemset as follows before running server,
rvm use ruby-2.3.0#rails425
replace the version of ruby and the name of gemset with your version of ruby and name of gemset.

`rake spec` fails with no error message

OS X Mavericks
Ruby 1.8.7
Rails 2.3.18
Rspec 1.3.2
Rspec-rails 1.3.4
Output of rake spec
$ rake spec
(in /Users/timosand/Dropbox/Development/epassi)
Please install RDoc 2.4.2+ to generate documentation.
DEPRECATION WARNING: Rake tasks in vendor/plugins/annotate_models/tasks, vendor/plugins/barcode_generator/tasks, vendor/plugins/crypted_authentication/tasks, vendor/plugins/oauth-plugin/tasks, vendor/plugins/tarantula/tasks, and vendor/plugins/ym4r_gm/tasks are deprecated. Use lib/tasks instead. (called from /usr/local/var/rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/rails-2.3.18/lib/tasks/rails.rb:10)
DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is deprecated, please use autoload_paths instead. (called from /usr/local/var/rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/carrierwave-0.4.10/lib/carrierwave.rb:84)
/Users/timosand/Dropbox/Development/epassi/config/initializers/oauth_consumers.rb:7: warning: already initialized constant VERSION
/Users/timosand/Dropbox/Development/epassi/lib/spreadsheet/format.rb:21: warning: already initialized constant COLORS
I have 45 spec files
$ find spec -name '*_spec.rb' | wc -l
45
I've added p __FILE_ to each spec and every filename gets printed. Still the actual tests are not run.
Any advice on how to solve this?
Here is my spec_helper.rb and one controller spec as an example

How to address "DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases"?

After upgrading to Rails 3.2.0, I started seeing the following deprecation warning in my development log and test output:
DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from <top (required)> at /Users/foo/bar/baz/bif/config/environment.rb:5)
Note the ending config/environment.rb:5, which is different than other related (Memoizable) SO questions.
I traced this down to this rails issue (specifically this comment) and this carrierwave issue.
The solution is to upgrade carrierwave:
Gemfile diff
-gem 'carrierwave', '~> 0.5.8'
+gem 'carrierwave'
Remember to run bundle update.

upgraded rails 3 app rake db:reset error

I upgraded my rails 2.3.8 app to rails 3. when I run the rake db:reset command, it returns the following error
rake aborted!
test-unit is not part of the bundle. Add it to Gemfile.
/Users/Shenario/Desktop/stack24/Rakefile:7:in `'
(See full trace by running task with --trace)
i'm new to rails, and wud be glad if you guys out ther coud help me! thanks!
the trace --
rake aborted!
test-unit is not part of the bundle. Add it to Gemfile.
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.7/lib/bundler/shared_helpers.rb:102:in block in cripple_rubygems'
/Users/Shenario/Desktop/stack24/lib/tasks/rspec.rake:1:in'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:131:in load'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:131:inblock in load_tasks'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:131:in each'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:131:inload_tasks'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:141:in load_tasks'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:77:inmethod_missing'
/Users/Shenario/Desktop/stack24/Rakefile:7:in <top (required)>'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2383:inload'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2383:in raw_load_rakefile'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2017:inblock in load_rakefile'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2016:inload_rakefile'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2000:in block in run'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:1998:in run'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/bin/rake:31:in'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in load'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in'
After searching for "test-unit", found this:
gem 'test-unit', '2.0.7' if RUBY_VERSION.to_f >= 1.9
in lib/tasks/rspec.rake
I suspected it was caused by me copying the whole lib folder from older rails version to this new one.
Solution: removed that file, then things seem to work fine after.
Basically I suggest you look at lib/tasks and see if there are rake tasks that are incompatible with rails 3.
you must have at least
gem "rails", "~> 3.0.3"
in your Gemfile, then remove Gemfile.lock (if any) and run:
bundle check
if you need some missing gems, run:
bundle install
bundler will install all required gems at least for rails 3.0.3, including test-unit gem. btw remember that a migration from rails 2.3.x to 3.0.x in most cases requires some code changes.
Add this to your Gemfile (replacing VERSION with your required version number).
gem 'test-unit', 'VERSION', :platform => :ruby_19
For Rails 2.3.11, I needed version 1.2.3 of the test-unit gem.

GEM Version Requirements Deprecated

When creating a new Rails project using:
rails sample
Then creating a model using:
script/generate model person first_name:string last_name:string
Everything is fine. However, if I add any gems to my environment.rb:
config.gem "authlogic"
And run the same generator, I get the following:
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning:
Gem::Dependency#version_requirements
is deprecated and will be removed on
or after August 2010.
The warning just recently appeared (I think), but I would like to fix it if possible. Any hints or similar experiences?
Thanks.
did you try:
rake gems:install
Btw. If you are using rubygems 1.3.6 then you get this deprecation warning. Previous versions never gave a warning. Also i suggest installing any gem using the command line rather than adding it in the environment.rb file. If the gem(s) you have added in the file is/are not installed, then the generator or any rake task will simply not run. Its a minor bug.
Here is an article that describes a way to prevent the warning:
http://www.mattvsworld.com/blog/2010/03/version_requirements-deprecated-warning-in-rails/
Its no big deal though. Just install gems the normal way and don't add any to your environment.rb file. You'll never get the deprecation warning.
This may be irrelevant as it is rails 3.0 but the answer you are looking for is in this article:
http://omgbloglol.com/post/353978923/the-path-to-rails-3-approaching-the-upgrade
down by the section titled "config.gem is dead, long live bundler", although the article does explain some new things.
You may want to consider upgrading to rails 3.0 and when you do, you will be using the Gemfile inside your application. in here, you will want to include the line:
gem 'authlogic'
and then on the command line, run
sudo bundle install
After that, all should be set :)
Check https://gist.github.com/807008 they suggest to downgrade and upgrade again rubygems.
Worked for me...
Putting these lines in your config/environment.rb between your bootstrap and your initializer will remove the deprecation warning:
if Gem::VERSION >= "1.3.6"
module Rails
class GemDependency
def requirement
super == Gem::Requirement.default ? nil : super
end
end
end
end

Resources