lib/rocktumbler/group.rb in rocktumbler-0.1.2 vs lib/rocktumbler/group.rb in rocktumbler-0.1.3

- old
+ new

@@ -1,20 +1,23 @@ module Rocktumbler + # The Group is a class responsible for outputting a gem group class Group - attr_accessor :name - def initialize(name,gem_dependencies) + def initialize(name, gem_dependencies, opts) @name = name - @gems = gem_dependencies.map{|g| Rocktumbler::Gem.new(g)} + @opts = opts + @gems = gem_dependencies.map { |g| Rocktumbler::Gem.new(g, @opts) } end def print - str = '' + str = "\n" prepend_spacing = (@name == :default) ? '' : ' ' - str += "\n\ngroup #{@name.to_s.gsub(/[\[\]]/,'')} do\n" if @name != :default - str += @gems.map{|g|g.print(prepend_spacing)}.join - str += "end\n" if @name != :default - return str + if @name != :default + str += "\ngroup #{@name.to_s.gsub(/[\[\]]/, '')} do\n" + end + str += @gems.map { |g| g.print(prepend_spacing) }.join("\n") + str += "\nend\n" if @name != :default + str end end end