Multiple versions of a gem - ruby

I'm currently using the gems scss-lint and compass; however scss-lint uses sass#3.3.0.rc.1 and this version isn't compatible with compass.
I have sass (3.3.0.rc.1, 3.2.12) installed, so is there a way I can essentially separate the two sass versions so that I can use compass and scss-lint side by side?

Due to the way the SASS dependency is set on both of those projects you cannot run both gems within the same gem set. If you are using scss-lint to do command line linting though, you could just have each of these under separate gem sets and switch between the two as needed. This does not preclude automation.

So the way I got around this was by installing the latest alpha version of compass. This meant that I can now use the two gems together :)

Related

What does it mean when there are two versions of the same gem listed in parentheses in a gem list?

When I execute gem list, I see that there are some gems that have two (or even three) versions listed. For example:
faraday (0.15.2, 0.11.0)
From what I've read, one cannot use two versions of the same gem. If that's the case, what does this mean? How can I tell which version is actually being used?
It shows all the versions that are installed locally. By default the newest one will be used unless bundler (via Gemfile) is configured to use another one.
If you'd like to remove the old unused versions of the gem:
gem cleanup faraday
Leave out the faraday if you'd like to clean up all old versions of all gems, and add --dryrun if you'd like to see which versions are to be deleted, without deleting them.

Where to get versions suitability sheet of neat and bourbon?

I want so use libsass for compiling my scss (considering positive testimonials about it's speed against ruby native compiler). The compiling ends with an error, and my searching have driven me here: (my bourbon was 4.x): https://github.com/sass/libsass/issues/365. the current version of libsass cannot compile bourbon 4.x. and the issue is closed. Okay, lets install bourbon 3.x.
gem install bourbon -v 3
and then
gem install neat
and the damn thing installs the latest neat (1.7.x) and bourbon 4.x as a dependency for it (along with already installed bourbon 3.x). I cannot make it install neat precisely for bourbon 3.x, and I couldn't ever find any info about which neat version is compatible with bourbon 3.x. Not on bourbon.io, not on github.com, not on stackoverflow.com, not anywhere... Maybe it's just a matter of SASS version, but why gem installs the latest bourbon then? If there is already one in the system? Or maybe there is any gem option exists which tells gem to lower the version of requested package, if dependent packages versions indicate so?
The compatibility issues that Bourbon had with Libsass got sorted out quite some time ago, and that thread is from last year.
Do you mind posting your compiling error?
If you try to install a gem without a version, it will grab the newest one, so you would want to install a version of Neat that required a 3.x version of Bourbon. I don't think that should be necessary though if we can solve your compiling problem. Those commands also install the gems to your local system, rather than in your project directory, so you will want to use a Gemfile (for Ruby projects) or something like package.json (for npm projects).

How to use Susy2 with Compass / SASS?

I'm trying to figure out how to get Susy2 working alongside compass on my local system, and I've been all over trying to find the answer.
error sass/screen.scss (Line 4 of sass/_base.scss: File to import not found or unreadable: susy.
Load paths:
/Users/jem/Desktop/base/sass
/usr/local/lib/ruby/gems/2.1.0/gems/compass-core-1.0.0.alpha.21/stylesheets
/Users/jem/.compass/extensions/compass-normalize/stylesheets
/Users/jem/.compass/extensions/compass-recipes-master/stylesheets
/Users/jem/.compass/extensions/toolkit/stylesheets
/usr/local/lib/ruby/gems/2.1.0/gems/sassy-maps-0.4.0/sass
/usr/local/lib/ruby/gems/2.1.0/gems/breakpoint-2.4.2/stylesheets
Compass::SpriteImporter
Sass::Globbing::Importer)
ArgumentError on line ["161"] of /usr/local/lib/ruby/gems/2.1.0/gems/sass-3.3.3/lib/sass/error.rb: wrong number of arguments (1 for 2)
Run with --trace to see the full backtrace
I hit this error continually (although occasionally for other gems as well). I feel like I've tried every combination of installing and uninstalling gems, ruby, bundler, etc.
Instructions continually point me toward:
Using Bundler to manage the gems (I am).
Make sure require "susy" is in my config.rb (Yup.)
Make sure I'm on the new alpha version of compass (using 1.0.0.alpha.20)
I'm not having any luck, and I can only assume it's something going on with my local system (OS 10.9, using Ruby 2.1.2 with RVM to stay separate from the system ruby). I had susy working once on a separate linux box, but when I brought the code here I keep running into these susy issues.
If you are using Bundler, your Gemfile should include:
gem "susy", "~>2.1.0"
gem "sass", "~>3.3.0"
gem "breakpoint", "~>2.4.0"
Bundler should set up all the other dependencies you need.
Since you are using RVM for your Ruby installation, are you sure that you are using the default Ruby (as per RVM) or the system Ruby which might be only Ruby 1.8.7 (rather than Ruby 2.0)?

How do I specify which gem to use when using rbenv. Multiple versions same gem installed

I've been using Sass 3.2.13.
I want to try out the sourcemap generation in 3.3, so I installed 3.3.
'gem list | grep sass' returns
sass (3.3.0.rc.5, 3.2.14)
I would like to invoke sass 3.3 from the commandline. I'm not using sass from a within a ruby project.
I discovered that format should work:
gem_name __versionNum__ --opts
So, I've tried this:
sass _3.3.0.rc.5_ --watch --sourcemap sass/site.sass: css/site2.css
The resulting stack trace returns
"Could not find sass (= 3.3.0.rc.5)..."
I've tried variations, like 3.3.0, 3.3, but these return stack traces with the same message about not being able to find the specified version.
Turns out that I was calling the wrong 'sass' binary.
Instead of using my rbenv gem, I was using 'sass' from '/usr/local/bin'.
I've deleted system sass. Now when I call 'sass' I get the version offered by the gem I installed via rbenv.
Yes, I know I shouldn't be deleting system binaries. It's a dirty, dirty thing to do. In the desperate case of removing system ruby from ubuntu, I think the measure is justifiable.

Manually adding a Ruby Gem

I am trying to install the mechanize gem that is supposed to work with 1.9 from here: http://github.com/kemiller/mechanize but I do not know how to add it manually.
I am using Windows, I could just copy the folder to the gems directory, but how do I initialize it?
I'm not sure I understand the problem. gem install mechanize doesn't work? It produces version 0.9.3 for me, which matches the gemspec of the library you linked to.
EDIT: you're on 1.9. I knew that. Disregard my hasty post, not familiar enough with Windows to offer any help on building the extensions.
I would use the bundler gem using the command gem install bundler. This will create a file called Gemfile in your project directory where you can put your dependencies for the specific project that you are working on. In the Gemfile, you will need to specify gem mechanize. If you want a specific version include ~> VERSION after. After, run the command bundle install. This will install the gem you want and use it in your project.

Resources