"no such file to load" 960gs gem (a.k.a.) ninesixty - ruby

I'm trying to use the 960 grid system in my compass project.
So I installed the gem with:
gem install compass-960-plugin
Then in my compass project I add the folowing rule to my "config.rb" file:
# Require any additional compass plugins here.
require 'ninesixty'
But when I try to import in my screen.scss with:
#import 960/grid
It's not working. The error I get is as follows:
Compass was unable to compile one or more files in the project:
Compass was unable to compile one or more files in the project:
LoadError on line 161 of /Applications/CodeKit.app/Contents/Resources/engines/compass/bin/../lib/compass/configuration/data.rb:
no such file to load -- ninesixty Run with --trace to see the full
backtrace

It looks like the gem isn't in your LOAD_PATH. Did you require 'rubygems' before requiring the 960 gem? Are you using something like Bundler?

Related

Issues in loading gems from env.rb file

I have 2 env.rb file(for desktop browser and mobile browsers) which has all the required environment related setups done.
The below line is present in both env.rb files but it does not work when included in one of the file(mobile browser). These are the standard gems used.
require 'time_diff'
require 'rubyXL'
require 'Prawn'
All though the files are exactly the same except including few more external libraries, we get the below error when running the Appium script.
cannot load such file -- time-diff (LoadError)
Any idea where to look for the problem?
EDIT:
The difference in both the files are below. Apart from these lines, other lines are related to normal variable assignment and config file handling.
File 1:
$LOAD_PATH<< File.expand_path('../features/DesktopWeb/pages', 'common.rb')
File 2:
$LOAD_PATH<< File.expand_path('../features/MobileWeb/pages', 'common.rb')
I faced same issue and i tried the below steps that resolved my issue.
Add all gems in Gemfile.
require 'time_diff',
require 'rubyXL',
require 'Prawn',
run "gem install bundler" this will install the bundler.
run "bundle install" from the project directory where the Gemfile is placed.
This will install all the gems and there dependency gems.
Then try to run your code...
Hope this will resolve your issue.

Ruby script cannot load a gem installed via bundler

I am trying to include the ruby-mysql gem in my ruby script. I have installed the gem using bundler but when I run bundle exec ./mysql_connector, I receive the error ./mysql_connector:4:in ``require': cannot load such file -- ruby-mysql (LoadError). Can you please help me troubleshoot what the problem is?
What I did
Installed rails in my home directory.
I do not have root access to the server so I have installed rails in my local directory by following the instructions here:
http://www.r-bloggers.com/installing-ruby-on-linux-as-a-user-other-than-root/
Created a directory for my application.
My application resides in my home directory in a folder called connector. It has a Gemfile that looks like this:
source 'https://rubygems.org'
gem 'ruby-mysql'
Call bundle install.
Using ruby-mysql 2.9.14
Using bundler 1.11.2
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Bundled gems are installed into ./vendor/bundle.
Add dependencies to my script. My script is in connector/mysql_connector and it reads:
#!/home/dcox/bin/ruby
require 'rubygems'
require 'bundler/setup'
require 'ruby-mysql'
Make script executable. I saw that you need to run bundle exec using an executable file, so I followed the instructions here to make my script executable: http://commandercoriander.net/blog/2013/02/16/making-a-ruby-script-executable/
Run the script. I execute using bundle exec mysql_connector and see:
/home/dcox/bin/mysql_connector:4:in `require': cannot load such file -- ruby-mysql (LoadError)
from /home/dcox/bin/mysql_connector:4:in `<main>'
Is it the $LOAD_PATH? After searching around for answers, I discovered a lot of SO answers as well as a blog post (https://codedecoder.wordpress.com/2013/09/23/require-and-load-in-ruby-loaderror-cannot-load-such-file/) that seem to suggest the problem is that the gem is not installed in a directory on the $LOAD_PATH. Here is what I see when I run $LOAD_PATH from IRB:
irb(main):002:0> $LOAD_PATH
=> ["/home/dcox/lib/ruby/site_ruby/2.1.0",
"/home/dcox/lib/ruby/site_ruby/2.1.0/x86_64-linux",
"/home/dcox/lib/ruby/site_ruby", "/home/dcox/lib/ruby/vendor_ruby/2.1.0",
"/home/dcox/lib/ruby/vendor_ruby/2.1.0/x86_64-linux",
"/home/dcox/lib/ruby/vendor_ruby", "/home/dcox/lib/ruby/2.1.0",
"/home/dcox/lib/ruby/2.1.0/x86_64-linux"]
Next I checked to see the location of ruby-mysql:
dcox#analytics1:~/connector$ bundle show ruby-mysql
/data/home/dcox/connector/vendor/bundle/ruby/2.1.0/gems/ruby-mysql-2.9.14
Obviously my connector/vendor/bundle path is not on the $LOAD_PATH. I could add it, but I have a feeling I am missing something simple here because bundler is supposed to work as long as you follow the instructions, right?
Any advice or help is very much appreciated! Thanks!!
If you just want to require this specific gem, require 'mysql' should work (e.g., https://github.com/tmtm/ruby-mysql/blob/master/test/test_mysql.rb#L10).
Your file should call Bundler.setup http://bundler.io/bundler_setup.html
Better yet, if you instead call Bundler.require(:default) it will setup and require all the gems in your Gemfile for you.

Compass loads wrong paths for plugins like the gem compass-rgbapng

I tried to setup my project as normal. In the config.rb file i require rgbapng and before of corse I installed it with sudo gem install compass-rgbapng.
Now when I now run compass compile . I get the following Errors.
compass compile .
error sass/styles.sass (Line 5: File to import not found or unreadable: rgbapng.
Load paths:
Compass::SpriteImporter
/home/my_user/public_html/spinnwerk/my_project/public/sass
/var/lib/gems/1.9.1/gems/compass-core-1.0.1/stylesheets)
The gem compass-rgbapng is located under /var/lib/gems/1.9.1/gems/compass-rgbapng-0.2.1. So How do I tell compass to watch in the right directory?
I fixe it for me by copying the file to te compass-core folder.
sudo cp /var/lib/gems/1.9.1/gems/compass-rgbapng-0.2.1/lib/stylesheets/_rgbapng.scss /var/lib/gems/1.9.1/gems/compass-core-1.0.1/stylesheets
This is a bad fix in my opinion, so I am still looking for a better way. If you can find one, pleas let me know.

Import of "bourbon" doesn't work in Jekyll setup

I'm using Jekyll to create a static website and want to use the framework Bourbon to build my CSS from.
I've installed Jekyll and want to install Bourbon by adding it to my Gemfile using gem 'bourbon' and running bundle install.
Now when I add the rule #import 'bourbon'; to my SCSS file and start to run Jekyll by jekyll serve -w it starts, but when I modify my SCSS file the Jekyll watcher throws an error saying:
Regenerating: 1 files at 2014-07-03 10:00:11 `Conversion error: There was an error converting 'css/main.scss'.`
...error:
Error: File to import not found or unreadable: bourbon. Load path: /Users/mark/Code/markdejong.com/mistermark.github.com.jekyll/_sass
Error: Run jekyll build --trace for more information.
What can be the problem here? Shouldn't it be possible to import it like this or doesn't Jekyll support this?
Assuming you have a Gemfile:
source 'https://rubygems.org'
gem 'jekyll'
gem 'bourbon'
gem 'neat'
Add this line to _config.yml
gems: [bourbon, neat]
Jekyll will require these gems automatically.
Just do for import:
#import 'bourbon';
#import 'neat';
Check Jekyll docs for more information
http://jekyllrb.com/docs/plugins/
Did you do a
bourbon install
In order to create the bourbon folder ?
Bourbon's doc also says that for non rail app the import rule is :
#import 'bourbon/bourbon';
Did you import Bourbon at the Ruby level, with require 'bourbon?
Or in your Sass configuration?
With Sass, to use Bourbon installed with RubyGems, you have to tell the following command (note the argument -r bourbon):
sass -r bourbon -w css:sass
I do not know Jekyll, but it's perhaps a clue?

Ruby file locations and requiring them

I am trying to require:
PROJECT_DIR/lib/shrt.rb
from:
PROJECT_DIR/test/shrt_test.rb
I tried:
require File.expand_path('.././lib/shrt.rb')
# and
require './lib/shrt.rb'
# and
require_relative '../lib/shrt.rb'
However it gives me an error stating it cannot load a file that is required in the shrt.rb file in lib/. In PROJECT_DIR/, I ran via Rake a Ruby test file:
ruby 'test/shrt_test.rb'
Any idea what I'm doing incorrectly?
Does:
require './lib/shrt.rb'
Not work? I've always required files in projects that way.
I needed to require the files in the following way:
require './lib/shrt/version'
require './lib/shrt/client'
...in the file I was trying to require in the test file. I required that file using require_relative '../lib/shrt'.
EDIT However now, when I rake install the gem, I'm using Bundler, and run it, I get `require': cannot load such file -- ./lib/shrt/version (LoadError).
EDIT 2 Fixed the problem by require_relative instead of just require on the version file.

Resources