I am attempting to take an interactive Ruby test to no avail.
I downloaded the zip file with no problems and followed the directions for
the terminal command line where I continue to get the following error. I
am using "Ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin10.8.0]".
If anyone can offer any help or suggestions thank you in advance.
INSTRUCTIONS:
Install RSpec
gem install rspec
Enter the course directory. (That's the same directory that this
index.html file is in.)
cd learn_ruby
Enter the 00_hello lab.
cd 00_hello
Open a terminal in this directory
cd 00_hello
This directory is the starting point for this exercise. It contains a
spec file and you'll be adding a ruby file to (eventually) make the
specs pass.
Run the test
rake
Watch it fail
You should see an error. Don't get scared! Try to read it and figure out
what the computer wants to tell you. Somewhere on the first line it
should say something like
no such file to load -- test-first-teaching/hello/hello (LoadError)
I do not get this error message, I get the one below:
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb,
Rakefile.rb)
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in
`<main>'
(See full trace by running task with --trace)
When I run rake --trace I receive:
rake --trace
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb,
Rakefile.rb)
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:632:in
`raw_load_rakefile'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:94:in
`block in load_rakefile'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:165:in
`standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:93:in
`load_rakefile'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:77:in
`block in run'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:165:in
`standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/lib/rake/application.rb:75:in
`run'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.0/bin/rake:33:in
`<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/rake:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in
`<main>'
you have to cd into your project directory before you can run rake routes
Related
I have a capistrano task I am trying to make into a gem so I can use it in multiple projects. The repository for this gem is located here:
https://github.com/FoamFactory/capistrano-monorepo-assets/tree/jwir3/initial-commit
I essentially used https://github.com/sheharyarn/capistrano-rake as a basis for creating my gem.
I've tested the actual rake script, but I'm actually not importing it into the project right now. Instead, I'm trying to get it to actually import the gem successfully. When I add the gem to my Gemfile as such:
gem 'capistrano-monorepoassets','0.0.6', path: "~/Source/capistrano-monorepo-assets/pkg"
Run bundle install, then attempt to import it using the following in my Capfile:
require 'capistrano/monorepoassets'
I get an error when I run cap --tasks --trace:
cap aborted!
LoadError: cannot load such file -- capistrano/monorepoassets
/home/scottj/Source/foamfactory/designsystem/Capfile:37:in `require'
/home/scottj/Source/foamfactory/designsystem/Capfile:37:in `<top (required)>'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/rake_module.rb:29:in `load'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/rake_module.rb:29:in `load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:703:in `raw_load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:104:in `block in load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:103:in `load_rakefile'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:82:in `block in run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/capistrano-3.11.0/lib/capistrano/application.rb:14:in `run'
/home/scottj/.rvm/gems/ruby-2.6.1/gems/capistrano-3.11.0/bin/cap:3:in `<top (required)>'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/cap:23:in `load'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/cap:23:in `<main>'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
/home/scottj/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>
I can't seem to get it to load the module using require, which is where I'm stuck. Can someone tell me what I'm doing incorrectly?
So this actually was happening because I didn't understand that bundle install doesn't support installing local gems by specifying the path in the Gemfile. This question actually covers the problem, and, more specifically, the answer here solved it for me.
Very new to Travis CI. Build failed with The command "bundle exec rake" exited with 1.
The build was passing before my latest changes which involved using Fileutils to write to gem directory so I'm assuming this is the culprit.
I found this : https://stackoverflow.com/a/40643667/9526393 but still no luck
Any ideas?
Build: https://travis-ci.org/AlphaDaniel/ruby_doc/builds/356485701?utm_source=github_status&utm_medium=notification
Repo: https://github.com/AlphaDaniel/ruby_doc
rake aborted!
Errno::ENOENT: No such file or directory # rb_sysopen - /home/travis/build/AlphaDaniel/ruby_doc/vendor/bundle/ruby/2.2.0/gems/ruby_doc-2.2.0/favs.txt
/home/travis/build/AlphaDaniel/ruby_doc/config/environment.rb:23:in `<top (required)>'
/home/travis/build/AlphaDaniel/ruby_doc/Rakefile:5:in `require_relative'
/home/travis/build/AlphaDaniel/ruby_doc/Rakefile:5:in `<top (required)>'
/home/travis/.rvm/rubies/ruby-2.2.3/bin/bundle:30:in `block in <main>'
/home/travis/.rvm/rubies/ruby-2.2.3/bin/bundle:22:in `<main>'
Errno::ENOENT: No such file or directory # utime_internal - /home/travis/build/AlphaDaniel/ruby_doc/vendor/bundle/ruby/2.2.0/gems/ruby_doc-2.2.0/favs.txt
/home/travis/build/AlphaDaniel/ruby_doc/config/environment.rb:23:in `<top (required)>'
/home/travis/build/AlphaDaniel/ruby_doc/Rakefile:5:in `require_relative'
/home/travis/build/AlphaDaniel/ruby_doc/Rakefile:5:in `<top (required)>'
/home/travis/.rvm/rubies/ruby-2.2.3/bin/bundle:30:in `block in <main>'
/home/travis/.rvm/rubies/ruby-2.2.3/bin/bundle:22:in `<main>'
(See full trace by running task with --trace)
The problem here becomes more clear if you read the error message and the stack trace. Errno::ENOENT: No such file or directory basically means that Ruby can not find a specific file or directory, in your case it's /home/travis/build/AlphaDaniel/ruby_doc/vendor/bundle/ruby/2.2.0/gems/ruby_doc-2.2.0/favs.txt. The last line of code that ran is a call to FileUtils.touch (in config/environment.rb:23).
You may have asked yourself "But shouldn't that create this file if it does not yet exist?". The answer to that is: yes, however only when the parent directories exist as well. When you gem install your gem, those directories will be created for you. This is not the case when you clone your repository and run rake (which is also what Travis automatically does for you when it sees a Ruby project).
To solve that, I recommend you to change the fav_dir method's body to something like this:
File.expand_path("../favs.txt", __dir__)
Looks a bit magic at first glance, but it isn't really: __dir__ is a Ruby method which returns the absolute path of the directory of the file from which this method is called. In this case this would be e.g. /usr/home/foo/dev/ruby_doc/config. Finally, File.expand_path allows us to resolve relative paths, in this case the final result will be /usr/home/foo/dev/ruby_doc/favs.txt.
This way you don't need to specify any absolute paths or make assumptions about a directory layout, and also ensure that the path exists (as the source file's directory and its parent always exist).
I'm a noob, working through a tutorial which many here may know (testfirst.org). I'm getting the error below in terminal.app, when I try running 'rake':
fname-lnames-macbook-pro:00_hello macbookowner$ rake
(in /Users/macbookowner/Desktop/learn_ruby-master)
/Users/macbookowner/.rvm/gems/ruby-1.9.3-p448#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:216: warning: Insecure world writable dir /Users in PATH, mode 040777
/Users/macbookowner/Desktop/learn_ruby-master/00_hello/hello_spec.rb:116:in `require': cannot load such file -- hello (LoadError)
from /Users/macbookowner/Desktop/learn_ruby-master/00_hello/hello_spec.rb:116:in `<top (required)>'
from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `load'
from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `each'
from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/command_line.rb:22:in `run'
from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:80:in `run'
from /Users/macbookowner/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.5/lib/rspec/core/runner.rb:17:in `block in autorun'
/Users/macbookowner/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -S rspec /Users/macbookowner/Desktop/learn_ruby-master/00_hello/hello_spec.rb -I/Users/macbookowner/Desktop/learn_ruby-master/00_hello -I/Users/macbookowner/Desktop/learn_ruby-master/00_hello/solution -f documentation -r ./rspec_config failed
fname-lnames-macbook-pro:00_hello macbookowner$
My questions: What is going wrong? And how can I fix it?
Info:
I got the same/similar error running rvm 1.9.3 and rvm 2.0.0
I installed 'gem install rspec' on both rvm versions
My best guess is that the hello.rb file [which I created in Sublime Text 2, and saved on macbookowner ->Desktop] is not being found by rake. When I run ls on Desktop, it does show hello.rb.
Thanks in advance!
If you look at the error,
/Users/macbookowner/Desktop/learn_ruby-master/00_hello/hello_spec.rb:116:in 'require': cannot load such file -- hello (LoadError)
it shows that in hello_spec.rb, on line 116, there is a require 'hello' statement which is failing. Likely the file does not exist at the path specified.
I am trying to install Tarantula ( http://www.testiatarantula.com/ ) on Fedora (kernel 3.6.5-2.fc16.x86_64) using the documentation at (https://github.com/prove/tarantula) .
The issue I ran into is Ruby error (A) :
/opt/tarantula/config/initializers/session_store.rb:3: syntax error, unexpected ':',
expecting $end ...sion_store :cookie_store, key: '_tarantula_session'
^
Tasks: TOP => db:schema:load => environment
(See full trace by running task with --trace)
when executing the command :
sudo RAILS_ENV=test bundle exec rake tarantula:install
The
bundle exec
command is used to overcome another error (B):
sudo RAILS_ENV=production rake tarantula:install
[sudo] password for admin:
rake aborted!
You have already activated rake 10.0.2, but your Gemfile requires rake 0.9.2.2. Using
bundle exec may solve this.
/opt/tarantula/config/boot.rb:6
/opt/tarantula/config/application.rb:1
/opt/tarantula/Rakefile:5
(See full trace by running task with --trace)
Error (A) can be traced back to https://github.com/prove/tarantula/blob/master/config/initializers/session_store.rb .
Using
--trace
the outputs are:
sudo RAILS_ENV=production rake tarantula:install --trace
rake aborted!
You have already activated rake 10.0.2, but your Gemfile requires rake 0.9.2.2. Using bundle exec may solve this.
/usr/lib/ruby/gems/1.8/gems/bundler-1.2.2/lib/bundler/runtime.rb:31:in `setup'
/usr/lib/ruby/gems/1.8/gems/bundler-1.2.2/lib/bundler/runtime.rb:17:in `setup'
/usr/lib/ruby/gems/1.8/gems/bundler-1.2.2/lib/bundler.rb:116:in `setup'
/usr/lib/ruby/gems/1.8/gems/bundler-1.2.2/lib/bundler/setup.rb:7
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `require'
/opt/tarantula/config/boot.rb:6
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/opt/tarantula/config/application.rb:1
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/opt/tarantula/Rakefile:5
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in `load'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:581:in `raw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:87:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:86:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:70:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.2/bin/rake:37
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Try your session_store.rb with this line:
Tarantula::Application.config.session_store :cookie_store, :key => '_tarantula_session'
Whats the Ruby Version you are running? I'm doubting it's 1.8.7 ?
ruby -v for Ruby version.
EDIT
And wrap_parameters.rb with this on line 8:
wrap_parameters :format => [:json]
Specify the version of rake to use in your Gemfile:
gem 'rake', '=0.9.2.2'
and bundle update
every time i execute rspec, dosen't matter what I have done, if the code is wrong it tells:
nev3rkill#nev3rkill-virtual-machine ~/Documentos/ruby $ rspec
/home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load': no such file to load -- /home/nev3rkill/Documentos/ruby/spec (LoadError)
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
from /home/nev3rkill/.rvm/gems/ruby-1.9.2-p318/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
nev3rkill#nev3rkill-virtual-machine ~/Documentos/ruby $
I have tested with a lot of versions, with ruby 1.9.3,1.9.2 but i don't know. Is it normal?
Unless you're in a path with a spec directory (e.g. the root of your rails project), you also need to tell rspec which spec files to run, either by passing it a directory or file. e.g:
$ rspec path/to/specs/
Will run all the specs in the path/to/specs/ path (recursively), or:
$ rspec spec/your_specs.rb
will run the specs in the spec/your_specs.rb file.