Module: Cream::GeneratorHelper::Gemfile

Defined in:
lib/generators/cream/helpers/gemfile_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_gem(name, version = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/cream/helpers/gemfile_helper.rb', line 13

def add_gem name, version = nil
  if version
    add_gem_version name, version 
    return 
  end

  if !has_gem? name
    debug! "Adding gem: #{name}"
    gem name
  else
    debug! "gem: #{name} already in Gemfile"          
  end
end

#add_gem_version(name, version) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/generators/cream/helpers/gemfile_helper.rb', line 4

def add_gem_version name, version
  if !has_gem? name
    debug! "Adding gem: #{name}, #{version}"
    gem name, :version => version
  else
    debug! "gem: #{name}, #{version} already in Gemfile"
  end        
end