lib/rails/generators/joosy/preloader_generator.rb in joosy-0.1.0.RC3 vs lib/rails/generators/joosy/preloader_generator.rb in joosy-0.1.0.alpha
- old
+ new
@@ -2,31 +2,24 @@
module Joosy
module Generators
class PreloaderGenerator < ::Rails::Generators::NamedBase
class_option :template_engine, :type => :string,
- :desc => "Generate templates for specified engine."
+ :desc => "Generate templates for specified engine."
source_root File.join(File.dirname(__FILE__), 'templates')
def create_preloader_files
- unless class_path.empty?
- puts <<HELP
-Usage: rails generate joosy:preloader joosy_app_name
-HELP
- exit 1
- end
+ template "app_preloader.js.coffee.erb", "app/assets/javascripts/#{file_path}_preloader.js.coffee.erb"
- template "app_preloader.js.coffee.erb", "app/assets/javascripts/#{file_name}_preloader.js.coffee.erb"
+ empty_directory "app/controllers/#{File.join class_path}"
+ template "app_controller.rb", "app/controllers/#{file_path}_controller.rb"
- empty_directory "app/controllers"
- template "app_controller.rb", "app/controllers/#{file_name}_controller.rb"
-
- empty_directory "app/views/layouts"
+ empty_directory "app/views/layouts/#{File.join class_path}"
template "preload.html.#{options[:template_engine]}",
- "app/views/layouts/#{file_name}.html.#{options[:template_engine]}"
+ "app/views/layouts/#{file_path}.html.#{options[:template_engine]}"
- route "match '#{file_name}' => '#{file_name}#index'"
+ route "match '#{file_path}' => '#{file_path}#index'"
end
end
end
end
\ No newline at end of file