I'm trying to install jekyll based on instructions here (via rbenv): https://gist.github.com/r-brown/a0b50d56cfb3596e0d17
Before the "bundle install" step, it states:
go to the project folder
However, I'm new and simply truly confused as to what this refers to? I don't actually have a project folder right now, because I am merely in the process of installing jekyll?
Or is that referring to a specific location based on the earlier installation steps?
I attempted to skip this step and directly input bundle install, but that yielded this error
"Could not locate Gemfile".
Referring to this post: Could not locate Gemfile was unfortunately not useful as no one explicitly stated what "project folder" entails...
Why do you want to use jekyll? Usually you would use it as part of a project - which probably entails writing the line:
gem 'jekyll'
...inside the Gemfile of your project. And then, to install the library (along with all other dependencies, you can run bundle install.
This is why the next line of the guide talks about running the command: bundle exec jekyll serve ... -- because the author is assuming that you have a project set up.
However, if you just want to install the gem globally (i.e. not within the context of a project), then you don't need to do anything with bundle. Just run:
gem install jekyll
Related
According to Bundler (http://bundler.io/v1.3/rationale.html)
The --deployment flags adds the following defaults:
...
If you have run bundle pack, checked in the vendor/cache directory,
and do not have any git gems, Bundler will not contact the internet
while installing your bundle.
Questions:
is bundle pack the same as bundle package? If not then, as bundle -h doesn't show any details about bundle pack, how do you find out more about bundle pack (other than trawling through Google results!)
does "checked in the vendor/cache" mean checked into git? And, if so, how does bundler know you've checked it in?
is bundle pack the same as bundle package? If not then, as bundle -h doesn't show any details about bundle pack, how do you find out more about bundle pack (other than trawling through Google results!)
Yes. Both bundle package and bundle pack accomplish the same. Refer to this line in lib/bundler/cli.rb. The map command inside a Thor::CLI aliases the command(s) given to it as an argument. In this case, it converts "pack" to :package which is a recognized task.
does "checked in the vendor/cache" mean checked into git? And, if so, how does bundler know you've checked it in?
Bundler doesn't check if the vendor/cache is checked into git repo or not. It only checks if the directory exists and sets the --local flag appropriately when bundle install is run. The last paragraph in bundle package man page gives a subtle reason why there is a need to check-in the vendor/cache directory into source control. Other than that, I couldn't find any code that necessitates checking in the vendor/cache directory into source control for the purposes of the bundle command.
I have some gems that are only used for the asset pipeline. One example is:
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
Unfortunately, I can not find exactly where this gem is installed. "gem list --local" does not even show it.
I need to fix it, because I am trying to use Bootstrap styling in datatables, which is allowed in the latest version. But the version of datatables included with the gem is old.
Does anybody know where these gems go? I am very, very confused by the asset pipeline.
I such cases, I fork the project on github and make my changes, and adjust my Gemfiles accordingly. This also makes it reuseable in different projects.
The asset pipeline and Bundler grouping has nothing to do with where gems are installed on your system. You can always run bundle open gemname to open the source of a Gem in your $EDITOR and make quick changes (i.e. for debugging). If you want to actually include changes in a release, though, you are going to want to fork the Gem and make your changes there, then specify the git path in your Gemfile.
As a side note, make sure you run bundle install (or really, just bundle) after making changes to your Gemfile to ensure the Gems all get installed.
[Ruby Noob]
I have a small (command line) utility written in Ruby, which requires a few gems. Is there a way to create a self contained bundle of my program such that I can run it on another machine that has Ruby installed (but not necessarily the gems)?
FWIW, the target machine runs Linux/Ubuntu.
You can use the gem bundle http://gembundler.com/
With bundle you create a Gemfile in your project root - a text that contains all your dependencies, very similar to Maven concept
In order to fetch all your dependencies simply tun
bundle install
The only issue is that you need to have the bundle gem itself installed, so you are back with the chicken-or-Egg problem :-)
I've used:
http://www.erikveen.dds.nl/rubyscript2exe/
before, but it was a while ago. Seemed to work okay for simple programs.
You can download it here:
http://rubyforge.org/projects/rubyscript2exe/
I ran:
bundle install --path vendor as the first Bundler install. I then ran:
bundle package, which creates a vendor/cache directory and puts in the gems. But, there is also a vendor/ruby/1.9.1/cache/ directory too. It has the same contents (I md5'ed them).
So, what's the point of bundle package then?
Any insight is much appreciated.
bundle package stores the .gem source files in vendor/cache, which guarantees smooth deploys and allows reviving old projects easily. This is especially useful when using a fork of a gem because the author can close their repo at any time, leaving your app incomplete.
The vendor/ruby directory contains the installed gems, which in some cases will be the same. But some gems build with native extensions so these can't be used in deployment due to different architecture. You should add vendor/ruby to your .gitignore file.
Hi cloned a simple app ( https://github.com/cfx/twix) on github that allows me to send Twitter messages from the console, but I'm not sure how to run it.
I now have a folder in my users/name director called Twix. Inside twix, I have these folders created by the app.
README Rakefile bin lib test
The readme doesn't provide a lot of instruction to get things started. It just tells you what to do after the program's running (see below).
Questions: What command do I use to get this started? What folder do I need to be in?
The README
Twix 0.0.1
Simple twitter client for console
Keys:
q - quit
t - write new message
If you want to post your twit, finish you message with !SEND
If you want abort and back to your feed, finish your message with !EXIT
new features soon
This program is packaged as a gem. The following command will install the gem (run it in the Twix directory):
rake package && gem install pkg/twix-0.0.1.gem
You can now run the program from anywhere with the twix command.
Edit
The first thing I saw in the repository was the Rakefile, meaning there were some rake tasks defined. When you find yourself in this case, running rake -T is your best bet as it will show you the rake tasks available. Its output was the following:
(in /home/benoit/code/clones/twix)
rake clobber_package # Remove package products
rake gem # Build the gem file twix-0.0.1.gem
rake package # Build all the packages
rake repackage # Force a rebuild of the package files
I picked the command that would be the most likely to build the gem: the package one. I guess the gem task would have worked as well.
Running rake package gave me the following output:
(in /home/benoit/code/clones/twix)
mkdir -p pkg
WARNING: no homepage specified
Successfully built RubyGem
Name: twix
Version: 0.0.1
File: twix-0.0.1.gem
mv twix-0.0.1.gem pkg/twix-0.0.1.gem
All that was left was to install the pkg/twix-0.0.1.gem created by the previous command:
gem install pkg/twix-0.0.1.gem
There's another case you could have encountered: the presence of a twix.gemspec in the root directory of the application. In this case, running:
gem build twix.gemspec
would have built the gem, the installation step remains the same.
ruby ./bin/twix
or
ruby -I lib ./bin/twix