Ruby on Rails 3 : Playing with Spree - ruby-on-rails-3.1

I am running SPREE.
I am already follow the tutorial but when I reach this line, the warning is show up.
I am already googling it but there is no solution.
$ bundle exec rake spree_sample:load
[DEPRECATION WARNING] Nested I18n namespace lookup under "activerecord.attributes.order" is no longer supported
Help me please.. :)

This is a known issue with Spree and will be fixed when Rails 3.2 comes out. Please just disregard this warning.

Related

Updating Ruby from 2.3 to 4.2 with RVM: "The requested url does not exist(22)"

When running
rvm install ruby-4.2.7
I get the following error:
The requested url does not exist(22): 'https://cache.ruby-lang.org/pub/ruby/4.2/ruby-4.2.7.tar.bz2'
It then tries the fallback which also fails. I've run through a couple different SO articles, tried different versions of RVM, and also specified a desired patch level (p95) to no avail.
I think there is something that I don't understand about how that URL is generated. It's my first day at my new job, I'm setting up my environment and this error is killing me!
Thanks!
You can update Ruby but only to version 2.4.0.
Try reading "Installfest". That's the quickest Ruby and Rails installation instruction I know and it includes installing RVM.

Error using module bzip2

I'm running into problems building bzip2-ruby.
Here is the error I am getting while building it...
Can someone help me understand what's going on?
/tmp/ruby/bin/gem -v
2.6.8
/tmp/ruby/bin/ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
In file included from bzip2.c:5:
/tmp/ruby/include/ruby-2.4.0/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"
bzip2.c:6:21: error: version.h: No such file or directory
bzip2.c: In function ‘bz_find_struct’:
The error is described in https://github.com/brianmario/bzip2-ruby/issues/19 and fixed in the master branch of the gem.
Unfortunately, the fix is not yet released and given that the issue is now almost 4 years old, I'd wager the guess that it won't be released anymore. If you still want to use the gem, you can force to use the version directly from github by adding this to your Gemfile:
gem 'bzip2-ruby', git: 'https://github.com/brianmario/bzip2-ruby.git'
Generally, it is probably a good idea to switch to a gem which is actually maintained. A quick google search pointed e.g. to https://github.com/philr/bzip2-ffi.

Why did my minitest/pride alias break?

Silly, cosmetic question for everyone.
I take pride in my testing. That is, I like to use minitest/pride. Unfortunately, not everyone on my team is a fan, so I have activated it in the past using the command line instead of modifying the code by setting an alias to this:
RUBYOPT=-rminitest/pride bex rake`
(bex is an alias to bundle exec, and the default rake task runs our tests.)
Recently, we updated the ruby version of our project from 1.9.3 to 2.2.0. This has broken my alias, and now when I try to run it, I get this error instead:
/Users/cf5455/.rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- minitest/pride (LoadError)
from /Users/cf5455/.rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
My best guess as to why this is happening is that MiniTest was changed since our last Ruby version and pride has been renamed or moved, but I have not been successfully able to Google its new name or location.
Does someone know a way that I can fix my arguments to get pride working again?
Duplicated your error by switching to ruby 2.3.0. I just ran the tests before installing any gems.
I managed to get the tests running with your alias by simply doing a gem minitest install. Not sure if your problem is caused by the same reason since I'm using rbenv for managing my rubies and gems but it does feel like you are having a package management issue. Hope this helps.

Undefined method Zip::ZipOutputStream.write_buffer on Heroku

I'm making a basic Sinatra app to play around with the Passbook gem.
My app runs fine on localhost, but when I try and run it on Heroku I get this error message:
/app/vendor/bundle/ruby/2.0.0/gems/passbook-0.2.1/lib/passbook/pkpass.rb:122:in `outputZip'
/app/vendor/bundle/ruby/2.0.0/gems/passbook-0.2.1/lib/passbook/pkpass.rb:60:in `stream'
/app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.4/lib/sinatra/base.rb:1593:in `call'
NoMethodError - undefined method `write_buffer' for Zip::ZipOutputStream:Class:
This happens when I call the line passbook.stream.string in my app file.
I don't think Passbook is the problem here - it seems that the class method write_buffer exists in the version of Zip::ZipOutputStream on my local machine but isn't there on Heroku. Why is this? How can I get around it?
I've tried including both zip and rubyzip in my Gemfile, individually and at the same time, and neither of them solve the issue.
Whenever I see something like this, I always ask myself Do you have Dev/Prod parity?.
So:
What Ruby version do you use locally, and does it differ from what you're using on Heroku?
Do you specify a Ruby version in your Gemfile?
How do you run locally? Do you use bundle exec to ensure you run in the same way, with the same gems?
Finally figured it out.
When I ran ruby app.rb, things worked locally, but when I ran bundle exec ruby app.rb, I got the same error as I did on heroku.
I upgraded to the latest version of passbook (which was just updated today to handle the latest changes to rubyzip), but things still didn't work.
Turns out I needed to remove gem 'zip' from my Gemfile and just include gem 'rubyzip' - previously I had both.

rcov outside rails

This may seem obvious but I don't find a way to run Rcov or coverMe outside a Rails project.
I would like to use it with Rspec 2.5
I am using Ruby 1.9.2 so I guess this may be the problem.
I also would like not to use rake tasks but a command on the command line. I have tried several things and the best result I got is Rcov report for :
/var/lib/gems/1.9.1/gems/rcov-0.9.9/lib/rcov/code_coverage_analyzer.rb
and
/var/lib/gems/1.9.1/gems/rcov-0.9.9/lib/rcov/code_coverage_analyzer.rb
No idea why
Check out http://ruby-toolbox.com/categories/code_metrics.html for some alternatives to RCov if using Ruby 1.9 is the problem.
SimpleCov, it runs awesome outside the Rails box.
http://rubydoc.info/gems/simplecov/0.5.4/frames
The latest available version of rcov (0.9.8) still doesn't have good support for 1.9.2. You can try to run it on your project by doing:
rcov spec/*.rb
But you'll most likely get something like:
** WARNING: Ruby 1.9 Support is experimental at best. Don't expect correct results! **
And then some errors after that.

Resources