lib/purecss-rails/generators/install_generator.rb in purecss-rails-0.0.5 vs lib/purecss-rails/generators/install_generator.rb in purecss-rails-0.0.6

- old
+ new

@@ -2,18 +2,30 @@ module Purecss module Generators class InstallGenerator < ::Rails::Generators::Base source_root File.expand_path("../templates/", __FILE__) + argument :stylesheets_type, :type => :string, :default => 'responsive', :banner => '*responsive or nonresponsive' + def add_purecss + copy_file layout_type(stylesheets_type), "app/assets/stylesheets/purecss.css" + css_manifest = 'app/assets/stylesheets/application.css' if File.exist?(css_manifest) - copy_file "purecss.css", "app/assets/stylesheets/purecss.css" style_require_block = " *= require purecss\n" insert_into_file css_manifest, style_require_block, :after => "require_self\n" else copy_file "application.css", "app/assets/stylesheets/application.css" + end + end + + private + def layout_type(type) + if type == 'responsive' or type == 'nonresponsive' + "#{stylesheets_type}.css" + else + raise "'#{stylesheets_type}'' is not recognized, use either 'responsive' or 'nonresponsive'" end end end end end