builder/gemfile_mergator.rb
# return merge Gemfile content
# gemfiles_contents : arrawy of content
return merge Gemfile content
gemfiles_contents : arrawy of content
return merge Gemfile content gemfiles_contents : arrawy of content
def merge_gem_file(master_gem_file, gemfiles_contents)
  master = []
  master << "# GENERATED GEMFILE. DON'T EDIT THIS FILE, YOUR CHANGES WILL BE LOST\n\n"
  master_gem_file.each_line do |line|
    master << line
  end
  gemfiles_contents.each do |content|
    content << "\n"
    content.each_line do |line|
      gem_name = get_gem_name(line)
      if gem_name != nil && !(is_gem_exist(master, gem_name))
        master << line
      end
    end
  end
  master.join("")
end
def merge_gem_file ( master_gem_file , gemfiles_contents ) master = [ ] master << "# GENERATED GEMFILE. DON'T EDIT THIS FILE, YOUR CHANGES WILL BE LOST\n\n" master_gem_file . each_line do | line | master << line end gemfiles_contents . each do | content | content << "\n" content . each_line do | line | gem_name = get_gem_name ( line ) if gem_name != nil && ! ( is_gem_exist ( master , gem_name ) ) master << line end end end master . join ( "" ) end
return merge Gemfile content
gemfiles_contents : arrawy of content
return merge Gemfile content gemfiles_contents : arrawy of content
master_gem_file
<not_specific>
gemfiles_contents
<not_specific>