Jekyll theme could not be found - ruby-on-rails

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"

Related

Geokit issue - "could not find generator"

I am trying to get started with Geokit, and I ran the install command and was greeted with the following:
rails g geokit_rails:install
Could not find generator geokit_rails:install.
Any idea what's going on? I am so confused. bundle install works just fine. I run bundle exec rake db:migrate. but when I go into the console, when I try require 'geokit', I get false. I assume it's because the config file is missing? But how do I generate a sample config file to modify if the install script is failing??
The problem is that your version of the geokit-rails gem does not contain the generator. It was added with https://github.com/geokit/geokit-rails/commit/bb4261acef62a26de823c4b7306634ffb7c3381f. The latest version of the gem is 2.1.0, and as you can see here, the generators were not part of that release.
If you want to use the head version of the gem, then you can change your Gemfile to match gem 'geokit-rails', github: 'geokit/geokit-rails'.

Unable to load gems in cloud 9

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.

Update ruby gem version with new changings

I have developed a gem for learning purposes and push it to https://rubygems.org/gems/combination-pairs. Now I want to do some changes in the code of the gem. Means I want to update my same gem but with different version. How can we do the same??
Follow these steps to update your ruby gem with changes:
Keep testing your code and make the required changes in your gem code (locally)
Once you are done with Step 1, update the version of your gem in lib/combination/pairs/ version.rb file by following the Semantic Versioning Guidelines. Let's say you change the version of your gem to 0.0.2
Next, run bundle install command in your gem's working directory to install all the gem dependencies.
And finally, run the task rake release which will create tag v0.1.2 and build and push combination-pairs-0.0.2.gem to Rubygems. This task is available to you as I see that you have the following line in the Rakefile
require "bundler/gem_tasks"
You can double check the list of available rake tasks by executing the command
rake -T
NOTE:
Just for your reference, check out this awesome Railscasts by Ryan Bates: New Gem with Bundler

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.

spree install issue - using RVM

I am trying to install the spree gem using the following instructions
http://spreecommerce.com/resources/quick-start
The install worked fine, but trying to create an application doesn't resolve
bash: spree: command not found
PATH is
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/bin:/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0#global/bin:/Users/sandbox1/.rvm/rubies/ruby-1.9.2-p0/bin:/Users/sandbox1/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/usr/X11/bin
bash-3.2$
Should I add something from the below output to my PATH?
bash-3.2$ find $HOME -name spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/doc/spree-0.30.0/rdoc/lib/generators/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/doc/spree_auth-0.30.0/rdoc/lib/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/doc/spree_core-0.30.0/rdoc/lib/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/gems/spree-0.30.0/lib/generators/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/gems/spree_auth-0.30.0/app/controllers/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/gems/spree_auth-0.30.0/lib/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/gems/spree_core-0.30.0/app/controllers/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/gems/spree_core-0.30.0/app/helpers/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/gems/spree_core-0.30.0/lib/spree
/Users/sandbox1/.rvm/gems/ruby-1.9.2-p0/gems/spree_core-0.30.0/public/images/spree
bash-3.2$
What Chris said: You can create a rails 3.0 app and add the spree gem to the app, as documented in http://spreecommerce.com/documentation/getting_started.html#creatinga-new-spree-project.
Create you project with e.g., rails new spreetest
Add gem 'spree' to the Gemfile
Perform bundle install to install missing gems
Initialize the spree site with rails g spree:site and rake spree:install
Optionally, install sample data rake spree_sample:install
Populate the database with rake db:bootstrap
Run the server with rails server
From what I read on Spree homepage, they recommend you to perform the Gem installation using sudo. However, RVM says you should not use sudo. Try installing the Gem again, this time without sudo.

Resources