Class can't be found

Tomás Juárez

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

Expanded version

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Class can't be found

From Dev

Jboss 7.1.1: NamingException class can't be found

From Dev

LWJGL Display class can't be found

From Dev

Class 'ServiceProvider' not found, can't autload serviceprovider

From Dev

Phalcon module loaded but still class can't be found

From Dev

Can’t run PHPUnit with Composer on Travis-CI, class not found

From Dev

Tomcat server can't found DigestUtils apache class

From Dev

mdVirtualRepeatContainer can't be found

From Dev

Variable can't be found

From Dev

Where can be ECDsaCryptoServiceProvider class found

From Dev

php Memcache class can not be found

From Dev

Class type required but T found

From Dev

Class path contains multiple SLF4J bindings (can't found it)

From Dev

Audio Card can't be found

From Dev

MySQL column can't be found

From Dev

sudo not found and can't be installed

From Dev

Image for QPixmap can't be found

From Dev

Api - Page can't be found

From Dev

Can't remove class

From Dev

Scala: class type required but T found

From Dev

Scala: class type required but T found

From Dev

Stored procedure found on localhost but can't be found when published

From Dev

StackOverFlow - Exception? I can't found the reason :-(

From Java

Why can't IntHolder be found in JDK 14?

From Dev

GWT can't be found in intellij 12

From Java

Controller 'ngModel', required by directive '...', can't be found

From Dev

Controller 'ngModel', required by directive '…', can't be found

From Dev

Flavored Activity can't be found on launch

From Java

Can't check signature: public key not found