lib/generators/batman/view_generator.rb in batman-rails-0.15.1 vs lib/generators/batman/view_generator.rb in batman-rails-0.15.2
- old
+ new
@@ -6,13 +6,30 @@
requires_app_name
desc "This generator creates a Batman.View"
argument :actions, :type => :array, :default => [], :banner => "action action"
- def create_batman_view
+ def create_directory
+ return if actions.length == 0
+
with_app_name do
- template "batman/view.coffee", "#{app_path}/views/#{file_name.downcase}_view.js.coffee"
+ empty_directory "#{app_path}/views/#{plural_name.downcase}"
end
end
+
+ def create_files
+ with_app_name do
+ if actions.length == 0
+ @file = "#{file_name}_view".downcase
+ template "batman/view.coffee", "#{app_path}/views/#{@file}.js.coffee"
+ else
+ actions.each do |file|
+ @file = "#{plural_name}_#{file}_view".downcase
+ template "batman/view.coffee", "#{app_path}/views/#{plural_name.downcase}/#{@file}.js.coffee"
+ end
+ end
+ end
+ end
+
end
end
end