Skip to content

uu59/grill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

69a758c · Jul 15, 2016

History

38 Commits
Jun 23, 2013
Jul 10, 2013
Aug 14, 2014
Aug 31, 2012
Feb 25, 2014
Aug 31, 2012
Aug 31, 2012
Jul 15, 2016
Aug 31, 2012
Aug 14, 2014

Repository files navigation

Use bundler/inline instead

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"
  gem "rack"
end

p defined?(Rack) # => "constant"

Grill

Build Status Code Climate Gem Version

http://en.wikipedia.org/wiki/Grill_(jewelry)

Implant Gemfile into your script.

Installation

$ gem install grill

If you want to uninstall gems installed by Grill, delete $HOME/.grill directory.

Usage

#!ruby

require "grill"

p defined?(Rack) # => nil

Grill.implant <<-GEMFILE
  source :rubygems
  gem "rack"
GEMFILE

p defined?(Rack) # => "constant"

Or, more handy way to use as below (since v0.2.1):

$ cat $HOME/.grill/commontools
source :rubygems
gem "typhoeus"
gem "nokogiri"
gem "slop"

$ cat scraper.rb
require "grill"

Grill.implant :commontools

opts = Slop.parse do
  # ...
end

You can multiple implant as below (since v0.3.0):

# these args will be combined one file.
# so if first arg define "source" and second is not, 
# second arg's `gem` is affected by that

Grill.implant <<-FOO, <<-BAR, :commontools
  source :rubygems
  gem "typhoeus"
  gem "nokogiri"
FOO
  gem "rack"
BAR

# You got typhoeus, nokogiri, rack, and :commontools

Compatibility of Gemfile

It is completely compatible (you installed version) Bundler's Gemfile so you can use full spec of it for version fixation, :require, :path, etc.

When use this?

Grill is useful for your disposable scripts. Do you want to do that create directory and put Gemfile into it and bundle install; bundle exec foo.rb for disposable scripts?