Module: Grill
- Defined in:
- lib/grill.rb,
lib/grill/version.rb
Constant Summary collapse
- VERSION =
"0.4.0"
Class Method Summary collapse
Class Method Details
.gemfile_path(gems) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/grill.rb', line 16 def gemfile_path(gems) fullpath = File.($0) filename = "#{Digest::MD5.hexdigest(fullpath)}-#{Digest::MD5.hexdigest(gems)}" path = File.join(home, ruby, filename) dir = File.dirname(path) FileUtils.mkdir_p(dir) unless File.directory?(dir) path end |
.home ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/grill.rb', line 8 def home home = "#{ENV["GRILL_HOME"] || ENV["HOME"] || "."}/.grill" unless File.directory?(home) FileUtils.mkdir_p(home) end home end |
.implant(*args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/grill.rb', line 25 def implant(*args) gems = "" args.each do |arg| if arg.class == Symbol gems << File.read(File.join(home, arg.to_s)) else gems << arg end gems << "\n" end gemfile = gemfile_path(gems) tmp = File.open(gemfile, "w") tmp.puts gems tmp.close ENV["BUNDLE_GEMFILE"] = tmp.path gemdir = File.join(home, ruby) unless system(%Q!bundle check --gemfile "#{gemfile}" --path "#{gemdir}" > #{devnull}!) puts "missing gems found. will install them" system(%Q!bundle install --gemfile "#{gemfile}" --path "#{gemdir}"!) puts "gems are installed." end require "bundler/setup" Bundler.require end |