class Rails::Generators::PluginGenerator

def wrap_in_modules(unwrapped_code)

def wrap_in_modules(unwrapped_code)
  unwrapped_code = "#{unwrapped_code}".strip.gsub(/\s$\n/, "")
  modules.reverse.inject(unwrapped_code) do |content, mod|
    str = +"module #{mod}\n"
    str << content.lines.map { |line| "  #{line}" }.join
    str << (content.present? ? "\nend" : "end")
  end
end