If I run the following command from the terminal I am able to run the rspec test cases successfully.
bundle exec rspec spec/requests/api/contacts/v3_get_tags_spec.rb
However if I am in the Rubymine IDE and do:
1- Right click on the file
2- Select "Run"
Then i get the following error message.
"in `require': cannot load such file -- spec_helper (LoadError)"
Also i am seeing a lot of errors related to gems not found, i feel link Rubymine is not configured correctly. What am i missing?
Note: Both the terminal and the IDE are running in the same root directory. I am pretty sure there is a problem with the configuration of the IDE. I checked the preference setting and it is using the same version of ruby as the one I am running in the termina.
Any help on the issue would be greatly appreciated.
pdfkit-www is a great library. It enable you to output a pdf directly from the browser.
To see the demo : http://ef4.github.com/pdfkit-www/demo.html
From the demo, I took the pdfkit.min.js file ; and it works good. Except for the font ; the only embed font is Arial and font embeding from a directory is not yet supported. If you want to have more font, you have to build the pdfkit.min.js and add the font metrics you want to use in the directory ; as explained here : https://github.com/ef4/pdfkit-www#building
The point is that I have no idea about how to do this. This is ruby and coffee script powered. But here, I feel like a baby monkey in front of a big equation.
Where do I type stuff ? (I'm on windows 7) I tried to type that stuff in the basic windows command line, in the ruby.exe command line and in the command line that open when you click on "open a shell here" when you cloned the repository on the github client.
/* ----- Edit ----- */
Ok, it looks like I should do it with the "Git Shell" (did not see the icon on my desktop first). The first two line seems to work, but the "bundle install" throw an error. (no recognized).
And the "rake" line abort because it "cannot load such file -- bundler".
/* ----- Edit 2 after Duck Boyle answer ----- */ (ok, this is better with an edit)
Ok, thanks a lots, this solved the first problem.
Now the "bundle install" command threw :
Your Gemfile has no remote source. If you need gems that are not already on your machine, add a line like this to your Gemfile : source 'https://rubygems.org'
Could not find rake-0.9.2 in any of the sources
And the "rake" command threw :
cannot load such file -- uglifier
So I tried "gem install uglifier" wich seemed to solve the error for the "rake" command by installing uglifier of course ; then i went in a few gem install for different version of json and execjs and other stuff, according to what the errors told me to do ; untill the "bundle install" command threw :
Using lib..
...
Your bundle is complete !
YOOHOO !
But now, the "rake" command throw :
rake aborted!
Type Error : This objet cannot manage this property or method
I did run the command with --trace ; but I have absolutely no idea about what I have to watch here :
/* ----- Edit 3 ----- */
Yes, I did put the source 'https://rubygems.org' in my gem file, this is what gave me the clues to install all the gems I should install.
(please don't moke me too much I'm only a designer that don't understand everything when it is question about more than the basic html / css stuff)
You should install bundler, used for dependency management in many Ruby projects. Try this:
gem install bundler
I wouldn’t be surprised if you run into more problems after that, let me know.
I am trying to get RubyTest to work in Sublime Text 2. I followed the Instruction on the Github Readme and get the following error. Does anyone know how I could fix this?
/bin/sh: rspec: command not found
To get this to work you only need to change one setting in the RubyTest package in sb2.
If you are using rvm, your rspec gem is installed through rvm and is not found in /bin/sh
So you need to set the RubyTest package for Sublime Text 2 to automatically check for your rvm environment variables.
What to change:
1) In Sublime Text 2, go to Preferences|Browse Packages. This will open up your packages directory.
2) Open the 'RubyTest' directory and look for the file 'RubyTest.sublime-settings'.
3) find the line that says:
"check_for_rvm": false,
and change it to:
"check_for_rvm": true,
save the change.
4) That's it. It should now work.
Good Luck
This worked for me:
If you're using RVM, open a project with command line from the project's folder:
subl .
Then, it'll hook the ruby version and gems.
This is most likely due to using RVM. What is the output of
which rspec
on your command line?
Also of note, just because you've included rspec-rails in a Gemfile, does not mean that 'rspec' is an executable program that your system knows about.
You can edit the RubyTest.sublime.settings to refer to your particular path to the rspec executable and it should work.
Unfortunately, this has the nasty side effect of being tied to one particular version of Ruby. If you're using RVM to switch between versions, you'll have to update your sublime.settings.
One work around, is to run Sublime from the command line.
Running Sublime Text 2(2165) with RubyTest plugin. Ruby and Gems managed with rbenv (0.3.0).
First attempt to use RubyTest gave the following error:
/bin/sh: rspec: command not found
From the command line I ran
which rspec
and it returned no results.
After some digging, I read that bundle install does not put the executables in your $PATH.
Alternative executable paths not picked up by shims sometimes
In order to use the executible outside the app, I had to delete the gem installed by bundler and then install it manually.
gem uninstall rspec
gem install rspec
followed by
rbenv rehash (Note you will need to run bundle inside your app so it updates the location of the gem)
This had to be performed for each version of ruby I have under rbenv control.
Now when I run
which rspec
it is found in the path and RubyTest is able to grab it without any problems.
fwiw, I had to repeat the steps for cucumber as well. To use all of RubyTests' features, ruby, cucumber and rspec executables need to be in your $PATH (for rbenv it is ~/.rbenv/shims/).
Try change the path to usr/local/bin/
I wrote a post on Sublime Text Build Scripts which should show you how to do this.
http://wesbos.com/sublime-text-build-scripts/
Same issue for me. With rspec 1.3.2 what I just did to fix it is to edit the RubyTest.sublime.settings file in the plugin folder, changing the "ruby_rspec_exec" key from:
"ruby_rspec_exec": "rspec"
to
"ruby_rspec_exec": "spec"
It really depends on the location where you have your rspec executable file...
I had the same problem after installing RubyTest by cloning from the repo. I simply uninstalled and reinstalled the package inside Sublime using Package Control, then everything worked fine.
You can see a summary of this issue here: https://github.com/maltize/sublime-text-2-ruby-tests/issues/36
Essentially, what Jim said was correct, you're running RVM or some other ruby vm manager that similarly monkeys with your PATH. Following the directions from this issue I did the following:
Install the binaries in my project
bundle install --binstubs
Add the path to my .bashrc and source it
echo 'export PATH="./bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Open the sublime project from the command line (so that PATH is available in Sublime Text 2)
subl .
The following steps worked for me (I encountered the same error as OP):
Install the RubyTest plugin through the package control manager.
Note* If you don't have the package manager installed - I highly recommend it for managing sublime plugins - more info here.
Be sure to add the code here to your RubyTest.sublime-settings file.
This file can be found at (from the menu): Preferences -> Package settings -> RubyTest -> Settings User
Save file, close Sublime and restart Sublime from the terminal in your project's folder using (so PATH is available in Sublime): subl .
No, you don't need to change paths, run sublime from command line etc.
If you are using RVM, you only have to do this:
Go to Sublime Text 2, go to
preferances-> package settings -> RubyTests
and pick settings-user or settings-default (depending what you are using) and change line:
"run_rspec_command": "rspec {relative_path}"
to
"run_rspec_command": "bundle exec rspec {relative_path}"
And so forth - add bundle exec to all commands
I spent many hours struggling with this same problem! I could not get rspec to run within Sublime Text 2, using the Michael Hartl "Ruby on Rails Tutorial." It kept saying:
/bin/sh: rspec: command not found
I finally realized that the RubyTest package (https://github.com/maltize/sublime-text-2-ruby-tests) was looking in the WRONG PLACE for my RVM!
On my Mac, the path for RubyTest is /Library/Application Support/Sublime Text 2/Packages/Ruby Test
First, to make RubyTest seek the RVM, I changed the parameter in RubyTest.sublime-settings from
"check_for_rvm": false, to "check_for_rvm": true,
Then I dug into the Python code of run_ruby_test.py: https://github.com/maltize/sublime-text-2-ruby-tests/blob/master/run_ruby_test.py
At line 151, inside class BaseRubyTask, it had the wrong path for my RVM:
rvm_cmd = os.path.expanduser('~/.rvm/bin/rvm-auto-ruby')
I changed it to the full correct path: rvm_cmd = os.path.expanduser('/usr/local/rvm/bin/rvm-auto-ruby')
If this is not your path, find the correct path by typing
$ which rvm-auto-ruby and substitute that instead.
After saving run_ruby_test.py, I went to Terminal, cd to my Rails application directory, and ran spork
Finally, I opened static_pages_spec.rb in Sublime Text 2. Now all the tests work from it!
I'm using rbenv and found that adding the following to my .bashrc did the trick
/Users/user/.rbenv/shims/rspec
This question is probably pretty stupid/n00bish/inappropriate/localised/sparkly cake, so downvote all you like as long as I get the answer, as I wish very much to be able to go through the koans. :)
I am trying to get this to work. (GitHub is here) I've downloaded and extracted it, and the folder is in my Documents directory (I renamed it ruby_koans from the default name). I've been messing around with this all day and can't get it to run in Konsole. :/
I use
cd /home/sophia/Documents
to move to the directory Documents, which contains the ruby_koans file.
I have no idea what to do after that, as Rake seems to be broken, and I probably installed Autotest incorrectly :S
And, before posting here, I already asked #ruby and #kubuntu on freenode. ._.
Try to install the koans from http://rubykoans.com/
They have detailed installation instructions and a troubleshooting section.
If for some reason things still don't work properly, then you should seek help from a real-life programmer friend who has done this before :)
old answer:
Please, try to run the "path_to_enlightenment.rb" file inside the "koans" directory.
cd koans
ruby path_to_enlightenment.rb
That doesn't use rake. If that doesn't work, then your ruby installation may be broken.
The first line of the "path_to_enlightenment" is:
LOAD_PATH << File.dirname(__FILE__).
This makes "require" look for files in the current directory.
Perhaps File.dirname(__FILE__) does not return the proper value(for some reason).
Try and replace File.dirname(__FILE__) with the absolute path of the directory in which the koans are. I.e. "/home/MYUSERNAME/ruby_koans/koans/".
If I had to guess, I'd say the problem is that the "Documents" folder has an uppercase D in it. You can also try and move the project somewhere else.
git clone https://github.com/renemendoza/ruby_koans.git
cd ruby_koans/koans
autotest
If autotest is not already installed, you'll need to do gem install autotest.
Open each script and fill in the correct answers as prompted. When you save changes autotest should rerun and show you the next failing one.
For those that got here after downloading the Koans from the renmendoza or neall versions of the koans, you'll want to get them from https://github.com/edgecase/ruby_koans now. Be sure to run rake gen before starting.
I'm running though the webby tutorial and I get to the part where you run the webby command for the first time to generate the website in the /output directory.
I do that, and next I'm told to open output/index.html. I do so, and the only thing that displays is:
true
I view the source...and all that is displayed is
true
This isn't a Budweiser commercial from years past! This is webby!
I wrote down the commands I used to install webby here, but it still doesn't seem to work.
According to the webby -v command... I was doing it correctly. What did I do wrong?
Just to confirm - did you open output/index.html in a browser? And the "true" that you describe is what you see in your browser...?
Before you ran the webby command, did you edit any of the files, especially content/index.txt? Can you paste the contents of content/index.txt here...?
Did you install RedCloth as well as Webby or did it install automatically as a dependency? If you run the following command, you can see whether RedCloth is installed.
gem list RedCloth