Source code of the project for anyone interested: https://github.com/clockworkpc/verbalyser
Ruby version: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
From the root directory of this project ("verbalyser") I am trying to run the simple command:
bundle exec exe/verbalyser
But I keep on getting this error message:
bundler: failed to load command: exe/verbalyser (exe/verbalyser)
LoadError: cannot load such file -- verbalyser
exe/verbalyser:2:in `require'
exe/verbalyser:2:in `<top (required)>'
Here are the contents of the file verbalyser/exe/verbalyser, which has been made executable (chmod +x):
#!/usr/bin/env ruby
require "verbalyser"
Here are the contents of the Ruby file that this executable is trying to load:
require "verbalyser/version"
require "verbalyser/conjugation_scraper"
require "verbalyser/cooljugator_scraper"
require "verbalyser/endings_grouper"
require "verbalyser/lemma_matcher"
require "verbalyser/verb_shortlister"
Here is my directory structure:
I had a problem like this. I found the answer to my specific problem somewhere on stack overflow but I can't find the link so I'll repeat what I remember of it.
Basically, the file was recently created and did not exist in bundler's own internal git repository, so I had to add it, and once I did that it worked. I didn't even have to commit the file - just stage it.
Related
I'm building an enigma machine simulator in ruby using aptana studio 3 on ubuntu 16.04 LTS.
When I run the application the following error occurs:
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- enigma/rotor.rb (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/xxxx/Downloads/enigma-ruby-master/lib/enigma.rb:1:in `<main>'
Please.
It would be helpful if you added the require code from your ruby file, but I suspect the following
rotor.rb is a file you have created in your enigma project, and is contained in the enigma folder
your require should be
require './enigma/rotor'
or
require './enigma/rotor.rb'
if the enigma directory is a sub-directory of the one you are currently operating in
require './rotor'
or
require './rotor'
This will say to source the file locally and not to look through the general libraries or gem's you may have added
I'd like to use gems specified from Gemfile that I uploaded. However, I keep getting
/usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- capybara (LoadError) from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' from app.rb:3:in `<main>'
Seems like the code cannot find the required gems. This is my .worker file:
runtime "ruby"
stack "ruby-2.1"
exec "app.rb"
gemfile "Gemfile"
full_remote_build true
My Gemfile:
source "https://rubygems.org"
gem "capybara"
gem "capybara-webkit"
I uploaded my work using this command:
zip -r my_work.zip . ; iron worker upload --zip my_work.zip --name my_work iron/ruby ruby app.rb ; iron worker queue --wait my_work
Thanks in advance.
There's a couple things here:
1) you are using full_remote_build with a .worker file, but then uploading the zip. Those two things don't go together, it's one or the other.
2) Be sure you are vendoring the gems so they are included when you zip them. To vendor: docker run --rm -v "$PWD":/worker -w /worker iron/ruby:dev bundle install --standalone --clean. Then at the top of your script, add: require_relative 'bundle/bundler/setup'.
See the documentation here for more details: https://github.com/iron-io/dockerworker/tree/master/ruby
I have some chef unit tests that I can run via the command : chef exec rspec
However, I am trying to run these from TeamCity and I am using a rakefile. When I try to execute the rakefile the require 'chefspec' line in the test file causes an error "cannot load such file -- chefspec (LoadError)"
I know chefspec is installed. I am new to Ruby, chefspec, rspec. I know there is mention of a gemspec file and I have tried to create one in the directory where I can run the command chef exec rspec to execute the test. However, when I try to run bundle install I get the error Could not locate Gemfile or .bundle/ directory. Is there a default location of a gemfile when you install ruby? I am pretty lost at this point.
C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire': cannot load such file -- chefspec (LoadErr
or)
from C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'
from D:/../spec/octopus_tentacle_spec.rb:1:in'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in load'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:inblock in load_
spec_files'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in each'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:inload_spec_file
s'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:102:in setup'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:88:inrun'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in run'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:ininvoke'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/exe/rspec:4:in <top (required)>'
from C:/Ruby22/bin/rspec:23:inload'
from C:/Ruby22/bin/rspec:23:in <main>'
The gemspec files are normally used when you are creating a Ruby gem, and contains the metadata about the Gem you are creating.
when you use bundle install it requires a Gemfile in the directory. The Gemfile works as a manifest file for the gems required for the project in the directory. It is possible that chef exec is looking for this file and will only work with gems specified here.
Try creating a Gemfile with the content
source 'https://rubygems.org'
gem 'rspec'
gem 'chefspec'
you should list other gems you are using in the file.
and then run bundle install
I am attempting to run a test against a hello method contained within the hello file:
ruby hello_spec.rb
which returns:
/usr/local/Cellar/ruby/2.1.2_2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- hello (LoadError)
from /usr/local/Cellar/ruby/2.1.2_2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from hello_spec.rb:116:in `<main>'
The files are contained within the same directory. I've installed RSpec and (I believe) the necessary gems. Other people seem to have similar problems but none of the solutions have worked for me.
I am running Ruby 2.1.2
I am new to Ruby and am struggling (obviously) to get the environment properly configured. Any help is much appreciated.
Note: I didn't write any of the test code. I've literally only made the hello.rb file.
Change require 'hello' to require_relative 'hello' in your hello_spec.rb. Current directory is not included in default ruby load path by default.
Or, alternatively, add the current directory to ruby load path:
$:.unshift File.dirname(__FILE__)
Hope it helps.
I am attempting to make a custom test runner using test/unit in ruby
and have followed a tutorial outlined here
http://endofline.wordpress.com/2008/02/11/a-custom-testrunner-to-scratch-an-itch/
however when i try to run on it using the
ruby -rfast_fail_runner example_test.rb --runner fastfail
however i get the error
C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- fast_fail_runner (LoadError)
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
You have a file in the current directory named fast_fail_runner.rb, right? Ruby is not finding it. You are following a very old tutorial and I suspect that old versions of Ruby had the current directory (.) on the load path or something like that.
Try replacing -rfast_fail_runner with -r./fast_fail_runner.