Why did my minitest/pride alias break? - ruby

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.

Related

How to start Middleman? cannot load such file -- less (LoadError)

I am learning Middleman. I installed Vagrant and have set up everything about that. But I have a problem at the end, when I call "bundle exec middleman", the Middleman should start after that regularly. But I get this message:
"var/lib/gems/2.2.0/gems/tilt-1.4.1/lib/tilt/template.rb:144:in 'require':cannot load such file -- less (LoadError)"
What should I do? I am working on Linux.
Maybe you forgot to add less to your Gemfile:
gem 'less'
As #tadman has pointed out adding
gem 'less'
is (possibly) a solution, but here is a little more detail on why you might have this problem migrating or developing a site:
If you initialise a middleman project with middleman init, then start working on your site with 'middleman serve' everything should be fine. But if, at some point you add a file with a .less extension you will get this error when you next restart middleman. Note that you might not knowingly have added less files - fontawsome for example can add .less versions of the css deep in it's directory structure.
I say that installing less is only possibly a solution since the 'less' gem was broken when I tried it (it was not able to install due to an old dependency on therubyracer
Deleting .less files that you didn't want or know you had is also a solution.

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.

compass failing to load singularitygs gem

Trying to get a new project set up using Singularity.gs but I keep running into a snag with Compass.
First I used Terminal to install the necessary Ruby Gems (sass, compass, singularitygs, respectively).
Next I created a new project using the command:
compass create project1 -r singularitygs --using singularitygs
In the directory of my choosing.
At this point, in an effort to make life easier I've also attempted to use offerings like Scout (http://mhs.github.io/scout-app/) and/or Compass.app (http://compass.handlino.com/) so I can take advantage of a more user-friendly GUI.
I'm running into problems using either of these apps however, so I'm assuming it has something to do either with my Ruby gem install of singularitygs or with the creation of a new project.
Specifically, once I have a target directory and folder structure in place, I'll attempt to "watch" the sass folder and get an error that looks like:
(Compass)
no such file to load -- singularitygs
org/jruby/RubyKernel.java:1062:in `require'
file:/Applications/compass.app/Contents/Resources/Java/compass-app.jar!/require_patch.rb:6:in `require'
or
(Scout)
LoadError on line 1038 of org/jruby/RubyKernel.java: no such file to load -- singularitygs
/Applications/Scout.app/Contents/Resources/vendor/gems/gems/compass
0.12.2/lib/compass/configuration/data.rb:161:in `require'
Strangely enough, I also get a very similar error message in Scout if I try to watch a Sass folder inside of a project that's using Foundation (having also installed the zurb-foundation ruby gem previously)
I am SUPER new to getting Sass / Compass set up so I'm definitely feeling a bit out of my element. I know this is probably not the easiest thing to diagnose from my description, but I'm not sure what I'm doing wrong. Hopefully I've managed to describe my issue clearly enough. Bear with me if any of this appears vague or incomplete, definitely not my intention.
Thanks so much.
Apps like Scout and Compass.app come bundled with their own versions of Ruby so even though you installed the gems on your computer they are not installed when compiling from those apps.
Here is how to make Compass.app use the version of Ruby on your computer. Open preferences and check “Custom”. Note your path may be different:

Ruby rspec command not working could it be because Ubuntu 12 is 64 bit?

I've had lots of headaches on this issue. I'm currently working on an assignment that requires me to use rspec on ruby. Whenever I run the rspec command I keep getting errors like
home/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/core/configuration.rb:780:in 'load': cannot load such file
fro, home/.rvm/gems/ruby-1.9.3-p286/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in 'map'....
They're just endless and confusing. I figure I wasn't doing something right in my .rb files no matter how I tweak according to the test rules same issue. I figured I'd start from scratch with a basic rspec tutorial example, still getting the same errors. I felt it might be my ruby installation so I uninstalled and this time I installed using RVM - still the same errors I get. No matter what I try - simple test codes (assuming maybe my assignment one is buggy), I've tried rspec, rspec spec, rake spec, still the same results.
I'm really confused. I'm new to ruby and my assignment is due in a few days. I have an idea how to write the code I need to get the required results but I have been restricted to use rspec which is really annoying. Then I remembered once when I tried to install LAMPP with my 64 bit Ubunutu and I was told I need to get 32 bit libraries or something, which I did and LAMPP now works (I can't use myphp admin though). So I'm thinking, could it be that I need to get a 32 bit version of Ubuntu 12 instead? Does it have anything to do with my rspec problem or I'm just doing something else wrong?
Oh and yes, I have ruby gems installed. Your answers would be really appreciated guys.
1.) delete your Gemfile.lock file
2.) run bundle install if you want to exclude anything use the --without flag ex: bundle install --without production
3.) run bundle exec rspec spec/
This should make it work now. Let me know.

Getting started with gems and jeweler

With Jeweler I created a gem folder structure with ease.
However, I still have some questions:
Why are params like --gemcutter and --rubyforge still available for Jeweler. Aren't these replaced by RubyGems? Do I have to specify anything to create a gem for RubyGems?
In the Rakefile I have information about the gem, and when I run "rake install" it created a gemspec. Why is the same information in two places?
What is a manifest? Just read about it, haven't seen such file.
How do I make my gem callable from the shell once I have installed it, like rails. Cause right now it's just accessible through a Ruby script using require.
Should I use "jeweler release" or "gem push" to push my gem to RubyGems.org?
I have to specify "handle" when signing up in RubyGems. What is that?
Thanks.
jeweler was created before RubyGems became what it is, so it still reflects the split. I'm not sure when jeweler was last updated, either. (I think it also still recognizes building gems on Github, which is now disabled.)
I'm not sure I follow what you're saying. The specification in the Rakefile details what the spec that gets written should look like. The spec that gets written details what should be installed and how, I believe.
A manifest is a list of all the files that your gem should ship with. Not everyone uses one. See the hoe documentation for some pro-manifest discussion.
Many Ruby gems are only libraries. If you want yours to also have a program like jeweler or rake or rails that you can call, you have to write the callable program, put it in bin in your gem's layout and specify (in your gemspec) that it should be packaged and installed. See the Gem::Specification reference under files and executable.
Not sure. Consult both jeweler's docs and the docs for RubyGems.
You can give an email address or use a name (a 'handle', like I use Telemachus here), which is all they mean by 'handle'.
For the record, if you are just learning how to write gems, you do not need to upload your first attempts using RubyGems or anything like it. You can simply install the gem on your machine only.

Resources