How to use Susy2 with Compass / SASS? - ruby

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)?

Related

Rubymine debugging

I have Installed
2017.1.5 Version of Ruby
ruby-2.4.1-p111
I've made a new project and named it hello.rb. When I run it, everything works fine. However when I try to debug the project I get a prompt message
The gem debase required by the debugger is not currently installed. Would you like to install?
Error running hello. Following gems were not installed:
I've tried re-installing everything and restarting and I don't know what is the problem.
Well apparently debugger in RubyMine does require this gem. So You have multiple ways of doing this.
Assuming your File > Settings > Languages & Frameworks > Ruby SDK and Gems
contains only one ruby version and its the selected one (and the gem really isn't in the list). As halfelf said in your terminal/cmd/iterm you would simply write
gem install debase
Also you could create file called Gemfile that would have all the gems in
source 'http://rubygems.org'
gem 'debase'
and in the future any other gems you would need, Rubymine should be able to install those for you.
If you would have already installed the gem, there might be a gem installation conflict that would need to be resolved.

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.

sinatra app on localhost via unicorn: syntax error

I have a Sinatra app that I continually upgrade (local only, at the moment). Problem being that I know nothing at all about Ruby — my friend made me the app and it's worked beautifully for over almost a year.
To see the site on localhost, I do this:
bundle exec unicorn -l 9000
I don't understand this, haven't needed to. I know I'm using the unicorn gem to run the app directed at port 9000 (due to an old printer conflict).
Today, I get this error:
in `evaluate': compile error (SyntaxError)
syntax error, unexpected ':', expecting $end
which refers to line 16 of my gem file, the sinatra-contrib gem:
gem "sinatra-contrib", require: "sinatra/reloader"
I've never had this error before. Haven't ever touched the gem file, and it's been working for a year. The only thing I can think I've done recently that may have affected my environment is installing a gemset called Wordless:
rvm use 1.8.7#wordless --create --default && gem install therubyracer sprockets compass coffee-script thor yui-compressor && rvm wrapper 1.8.7#wordless wordless compass ruby
I'd appreciate insights, and hopefully I can start to learn a thing or two about managing ruby gems. Thanks.
You were using Ruby 1.9 before. The line you referenced is in 1.9 format, which Ruby 1.8 does not understand.
When you installed Wordless you said:
rvm use 1.8.7#wordless --create --default
This made Ruby 1.8.7 your default interpreter. To switch back to whatever you used before do:
rvm list rubies
And then:
rvm use [the 1.9.x you found in the list above] --default

Ruby: How to include/install .bundle?

I'm new to Ruby. I have a .bundle file. I put it in the source folder and did
require('my.bundle')
But when I call the methods in the bundle, the definition is not found. Do I have to install them or include them in some other way to access them?
I am on Ruby version 1.8.7 (latest version on Mac).
I highly recommend using RVM to manage your Ruby installation, including your gems, so if you don't already have that, get it and follow the instructions for installing it. Make sure you do the part about modifying your bash startup script or you'll see weird behavior, like the wrong Ruby being called. Also, use the steps in "RVM and RubyGems" to install your gems or you can run into weird behavior with gems being installed under the wrong or an unexpected Ruby.
Second, use the gem command to install gems:
gem install gem_to_install
replacing "gem_to_install" with the name of the gem you want, and it will be installed into the appropriate gem folder for your Ruby.
If you are on Ruby 1.92, and trying to require a gem to use as a module in your code, use:
require 'gemname'
if it is installed via the gem command. And, if it is a module you wrote or have in your program's directory or below it, use:
require_relative 'path/to/gem/gemname'
If you are on a Ruby < 1.9 you'll also need to add require 'rubygems' above your other require lines, then use require './path/to/gem/gemname'.
Thanks, but my .bundle is not in gems. How do I install/require a .bundle file I already have?
If you wrote it look into rubygems/gemcutter or bundler for info on bundling and managing gems.
You can install a gem without using the app by going into the directory containing the gem and running setup.rb. See http://i.loveruby.net/en/projects/setup/doc/usage.html for a decent writeup or the official docs at: http://docs.rubygems.org/read/chapter/3

Installing a gem from Github with Bundler

I am trying to use the instructions here to install a pre-released version of a gem with bundler.
The "bundle install" output lists the gem as getting installed, but "gem list" fails to find it.
My Gemfile:
source :gemcutter
gem 'sinatra', '1.1.0', :git => 'http://github.com/sinatra/sinatra.git'
gem 'RedCloth', '4.2.3'
Here is a gist with the rest of my sample code.
Has anyone gotten this scenario to work?
NOTE: I am also using RVM (on OS X). bundle show does list the gem (and dependencies) as existing, but I am not able to properly resolve them.
Thanks.
I would look at the load paths, and further debug from there, example:
...(master) $ irb
irb(main):001:0> $LOAD_PATH.count
=> 8
irb(main):004:0> require 'bundler/setup'
=> true
irb(main):005:0> $LOAD_PATH.count
=> 112
irb(main):006:0>
Bundler configures the load path for you, this means not all the gems are included on your load path by default.
Additionally, from the bundler git help:
Because Rubygems lacks the ability to handle gems from git, any gems installed from a git repository will not show up in gem list. They will, however, be available after running Bundler.setup.
Best regards, hope this helps
ED
Bundler might have installed it locally to your app. This could vary wildly, depending on OS and whether you are using RVM.
What is the output of bundle show sinatra?
In my case, sinatra was installed here:
/home/marshall/.rvm/gems/ruby-1.8.7-p302#3846859/bundler/gems/sinatra-9cfa74a7f352
Sinatra doesn't show in the gems list, but the server launches correctly if I execute rackup.
Gems installed via bundler on Engine Yard go to a different folder to isolate them.
it's usually /data/APP_NAME/shared/bundled_gems
To be sure, check your .bundle/config file on your APP folder at Engine Yard
It looks like there is an issue using Shotgun and Bundler (git repositories only).
If I use rackup to start up my app, all is well. I am going to investigate a little more and then file a bug with one (or both) of the projects.

Resources