I'm building a project in Ruby using Sinatra in Windows 7.
My project structure is:
/project
|_ one.rb
|_ sin.rb
So, my code in one.rb
:
require 'sinatra'
require 'sin'
But when I run it, the console puts:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:
36:in `require': cannot load such file -- sin (LoadError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custo
m_require.rb:36:in `require'
from one.rb:1:in `<main>'
How can I fix it?
Also you can put the sin.rb into the lib/ folder, then just run:
bundle install
and then:
bundle exec project/one.rb
Make sure that you properly made the Gemfile, and .gemspec. The templates for the files can be automatically generated by bundler as follows:
bundle gem your_gem_name
Then you shell create the folders bin/, and lib/, put sin.rb into lib/, and one.rb into bin/. And fill all TODOs in the .gemspec the with proper values:
spec.summary = %q{short summary}
spec.description = %q{longer description}
Then run bundle install, and exec as it was specified above. And in case if you will generate the gem, and then install it with gem install
, you'll not need to change anything.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments