-
Notifications
You must be signed in to change notification settings - Fork 0
/
load_gems.rb
40 lines (29 loc) · 865 Bytes
/
load_gems.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# load_gems.rb
# Uses bundle/inline to insure that gem libraries are available
# Its intended for small apps.
# Note that the bundler/inline sets the load path so that only
# the specified gems are available.
begin
require 'bundler/inline'
rescue
system "gem install bundler"
require 'bundler/inline'
end
# TODO: Might want to allow specific versions of the gems in addition to their names
def load_gems(an_array_of_strings)
print "Installing gems as necessary ... " if $debug
gemfile do
source 'https://rubygems.org'
Array(an_array_of_strings).each do |gem_name|
print gem_name + ' ' if $debug
gem gem_name
end
end
puts 'done' if $debug
end # def load_gems(an_array_of_strings)
__END__
Typical Usage:
require 'load_gems'
load_gems %w[
awesome_print cli_helper debug_me loofah mail progress_bar rethinkdb_helper
]