lib/padrino-gen/generators/controller.rb in padrino-gen-0.2.9 vs lib/padrino-gen/generators/controller.rb in padrino-gen-0.4.5

- old
+ new

@@ -20,15 +20,17 @@ desc "Description:\n\n\tpadrino-gen controller generates a new Padrino controller" argument :name, :desc => "The name of your padrino controller" argument :fields, :desc => "The fields for the controller", :type => :array, :default => [] class_option :root, :aliases => '-r', :default => nil, :type => :string + class_option :destroy, :aliases => '-d', :default => false, :type => :boolean # Copies over the base sinatra starting project def create_controller if in_app_root?(options[:root]) @app_name = fetch_app_name(options[:root]) @actions = controller_actions(fields) + self.behavior = :revoke if options[:destroy] inject_into_file app_root_path("config/urls.rb"), controller_routes(name,fields), :after => "urls do\n" template "templates/controller.rb.tt", app_root_path("app/controllers", "#{name}.rb") template "templates/helper.rb.tt", app_root_path("app/helpers", "#{name}_helper.rb") empty_directory app_root_path("app/views/#{name}") include_component_module_for(:test, options[:root])