Unable to load gems in cloud 9 - ruby-on-rails

I cannot load many ruby gems in Cloud 9's ruby on rails.
For example I run
$ gem install signer
and get:
Successfully installed signer-1.4.2
1 gem installed
but then when I try to call it with:
require "signer"
I get the following error upon running:
cannot load such file -- signer
I am getting desperate, any help would be immensely appreciated!

Adding the following line to the Gemfile within your Rails folder:
gem 'signer', '~> 1.4.2'
and then running bundle install should remove the error.

Related

Jekyll theme could not be found

Following the jekyll documentation found here: https://jekyllrb.com/docs/themes/ I was trying to install and change a gem based theme so I have chosen the jekyll-theme-primer for this and I've run the following command and instructed under the https://jekyllrb.com/docs/themes/#installing-a-theme section:
gem "jekyll-theme-primer"
and got this error:
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command jekyll-theme-awesome
After doing some research I've found that I should have added install to my query as described here: While executing gem, unknown command
After running this:
gem install "jekyll-theme-primer"
I successfully installed the primer gem based theme and got the following confirmation:
Successfully installed jekyll-theme-primer-0.5.2
Parsing documentation for jekyll-theme-primer-0.5.2
Done installing documentation for jekyll-theme-primer after 0 seconds
1 gem installed
First question: Was the official documentation incorrect or am I missing something?
I proceeded to run the bundle install command:
bundle install
and replaced my current minima theme from the _config.yml with the jekyll-theme-primer by adding/replacing this line:
theme: jekyll-theme-primer
Now when I tried to run either the:
jekyll serve
or the:
bundle exec jekyll serve
commands, I get the following error:
jekyll 3.5.2 | Error: The jekyll-theme-primer theme could not be found.
So why it can't find the gem theme if the installation was successful?
From what I gather, it looks like you did not add jekyll-theme-primer to your Gemfile, but instead simply executed gem "jekyll-theme-primer" in the terminal and later installed the gem correctly after encountering the Gem::CommandLineError
So, in short, simply follow the steps below:
Add the theme-gem to your Gemfile
add the theme to your _config.yml (correctly done already..)
Run: bundle install (just to make sure Bundler is able to use it)
Run: bundle exec jekyll serve
Adding a theme-gem to a Gemfile:
Open your current Gemfile in a text-editor, and replace entire line gem "minima", "~> 2.0" with your theme gem. i.e. gem "jekyll-theme-primer", "~> 0.4"

Sketchfab api data with Ruby

I am new to ruby. I am trying to upload a .STL file to Sketchfab using the code that they have provided on Sketchfab website.
https://gist.github.com/sbouafif/3736968#file-sketchfab-api-rb
I have installed the required gems including - gem install ruby-multipart-post
When I run:
bundle install
rake db:migrate
I get an error saying:
rake aborted!
cannot load such a file -- ruby-multipart-post
I have never had this issue when installing gems.
Any help would be great.
I am using Ruby 1.9.3.
Thanks
You don't install ruby-multipart-post gem as recommended in this line of script. Open terminal and install it use command:
gem install ruby-multipart-post

`require': cannot load such file -- mime/message

I am trying to run a program to import mails from gmail. When I run the ruby fine it returns an error
/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require': cannot load such file -- mime/message (LoadError)
Can someone guide me to resolve this?
Thank you
when you run gem install gmail
installed not worked gem
I fix this issue installed last gmail gem from github
git clone git://github.com/nu7hatch/gmail.git
cd gmail
bundle install
rake install
Or if you're using bundler, change your Gemfile entry to:
gem 'gmail', :git => 'git://github.com/nu7hatch/gmail.git'
removing require 'mime' in my ruby file resolved the issue.
Thanks!

Installing/Running Spork-Rails on Rails 4

After installing spork-rails I get this error when running 'spork':
Andrews-Mac-Pro-4:lb_final chapmanf16$ spork
/Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/spork:23:in load': cannot load such file - - /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/gems/spork-1.0.0rc3/bin/spork (LoadError)
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/spork:23:in'
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in eval'
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in'
If I run 'sudo spork' none of my gems are being located. I will get the following errors:
Using RSpec, Rails
Preloading Rails environment
Could not find actionpack-4.0.0 in any of the sources
It literally can't find any gems because if I list the versions of the gem being mentioned and install only the version it is asking for, it will tell me the next gem is not install. I'm just trying to figure out why the path to my gemfile is not being recognized by spark. I have only started learning ruby/rails for the past 3 days so I'm completely out of my element, but I am really not sure what to do. Any help would be appreciated.
I also posted this question I have on spark-rails github -https://github.com/sporkrb/spork-rails/issues/20
spork-rails from RubyGems doesn't support Rails 4. Try to update you Gemfile with a github reference for the spork:
gem 'spork-rails', github: 'sporkrb/spork-rails'
and run bundle update

ZenTest Error in Rails

I am following the tutorial on railstutoiral.org and encounter the following error: "ZenTest is not part of the bundle. Add it to Gemfile. (Gem::LoadError)." I have ZenTest (4.4.2) installed according to gemlist so what's wrong? Thanks!
Open 'Gemfile' in the root of your rails application, and add a section like this to the bottom:
group :development, :test do
gem 'ZenTest'
end
Then at the command line, type:
bundle install
This command will install the gem and associate it with your application. It might take a few minutes :)
The cause of your problem is that under rails 3, rubygems are managed by a tool called bundler, which manages all the dependencies between your gems and ensures that your application is always started with the right versions of the right gems, even when you move it between servers.
One more thing to note is that if you want to run a command from a gem you've installed using bundler, you need to type 'bundle exec <command>' to ensure the right environment is established to run the command.
Even if you have it installed it isn't getting loaded because it says it isn't in the Gemfile. The Gemfile exists at the root of your project directory.

Resources