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

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.

Related

Jekyll and Redcarpet (plus dependencies)

Up until a few hours ago, I had my jekyll install working as normal. Having created 26 different posts using my current setup, I'm not expecting something to suddenly not work at all. Ran jekyll build to see the results of a new post I created for my blog. I got an error saying it could not find redcarpet; weird since I have never touched my config or anything since I created it. I ran bundle install no new gems added. For sanity's sake I ran bundle show redcarpet, it could not be found. Okay that's weird. So I run gem install redcarpet v 3.1.0 which was the version I was using pretty much the entire time. I then run bundle install again, checking to see if redcarpet was added...and nope.
I decided to go into my config and switch markdown parser and add kramdown, then run jekyll serve...and now I get that I'm missing kramdown and like redcarpet even if I install via gem install jekyll refuses to acknowledge it's existence.
I tried deleting my gemfile and rebuilding it unfortunately that does nothing. If I run bundle exec jekyll serve it works however redcarpet isn't activated and thus the markdown isn't parsed correctly (And new entries aren't added to the index page).
I'm probably missing something obvious, any direction or advice would be much appreciated.

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.

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:

Fixing "custom_require.rb:36:in `require': no such file to load" errors

I understand that after Ruby 1.9.2, '.' is no longer in your path for security reasons. This seems to be a problem when using certain gems (ones not updated to 1.9 I imagine?), a problem that throws errors like
$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 'require': cannot load such file -- rubylog (LoadError)
I've seen and fixed this problem once, by (perhaps naively) changing some requires into require_relatives: https://github.com/mathpunk/MongoDB_Koans/commit/e2f7898347d328450ec121d22f701508f389cc53
Now I'd like to use rubylog, and I'm getting the custom_require error, so I tried the same trick:
https://github.com/mathpunk/rubylog/commit/995e13dccc6a197d280d0783f3fb7fe50deabd02
but this time, I'm just getting the same error. What else can I try?
ETA: All this time, I've been using sudo gem install blah to install gems, and for some reason, for rubylog it's gem install rubylog that does it. (Something to do with RVM?) So now everything works. Thank you.
Your code fails at require 'rubylog' - so it can't find rubylog.rb itself. So just add dir containing rubylog.rb to load path - something like $: << 'rubylog' might help.
Just add the library directory to your LOAD_PATH:
$LOAD_PATH.unshift(File.dirname(__FILE__))
See Understanding Ruby's load paths\
Edit: I assumed you had a rubylog directory wherever your script was running from. If your script can't find rubylog then you need to add that location to your load path:
$LOAD_PATH.unshift('/path/to/rubylog')
Are you sure you have the rubylog libraries? gem install rubylog

Generating RDOCs for locally installed gems

I am trying to contribute to a gem I recently took interest in - Nesta. The developer has done a great job in creating one of the lightest, thinest CMSs you can find and I want to document it. I have read through the code and commented on a few methods to the best of my knowledge.
However, I seek to test this out locally by calling gem server and seeing the changes on my machine before pushing it online.
Things I have tried:
Manual edit.
Documented the file.
Fired up gem server.
Using the gem tool.
Documented the file.
Ran gem rdoc nesta --rdoc
Restarted gem server
All to no avail. Please help.
Thank you.
You can preview generated html pages without installing a modified version of the gem on your machine. Add this to nesta's Rakefile:
require 'rake/rdoctask'
Rake::RDocTask.new('doc') do |i|
i.rdoc_files = FileList['lib/**/*']
end
and type rake doc. Then view generated html/index.html file.
Are you sure you've installed the version that you've modified, not the original version?
If you've installed the modified version, but have forgotten to install the rdoc, see Can you install documentation for existing gems?

Resources