lib/generators/dust/scaffold/scaffold_generator.rb in dust-generators-0.2.8 vs lib/generators/dust/scaffold/scaffold_generator.rb in dust-generators-0.3.1

- old
+ new

@@ -67,18 +67,18 @@ gem "mocha", :group => :test unless File.read(destination_path("Gemfile")).include? "mocha" end def create_model unless @skip_model - template 'model.rb', "app/models/#{singular_name}.rb" - if test_framework == :rspec - template "tests/rspec/model.rb", "spec/models/#{singular_name}_spec.rb" - template 'fixtures.yml', "spec/fixtures/#{plural_name}.yml" - else - template "tests/#{test_framework}/model.rb", "test/unit/#{singular_name}_test.rb" - template 'fixtures.yml', "test/fixtures/#{plural_name}.yml" - end + template 'model.rb', "app/models/app/#{singular_name}.rb" + #if test_framework == :rspec + #template "tests/rspec/model.rb", "spec/models/#{singular_name}_spec.rb" + #template 'fixtures.yml', "spec/fixtures/#{plural_name}.yml" + #else + #template "tests/#{test_framework}/model.rb", "test/unit/#{singular_name}_test.rb" + #template 'fixtures.yml', "test/fixtures/#{plural_name}.yml" + #end end end def create_migration unless @skip_model || options.skip_migration? @@ -86,42 +86,42 @@ end end def create_controller unless options.skip_controller? - template 'controller.rb', "app/controllers/#{plural_name}_controller.rb" + template 'controller.rb', "app/controllers/app/#{plural_name}_controller.rb" - template 'helper.rb', "app/helpers/#{plural_name}_helper.rb" + #template 'helper.rb', "app/helpers/#{plural_name}_helper.rb" controller_actions.each do |action| if %w[index show new edit].include?(action) # Actions with templates - template "views/#{view_language}/#{action}.html.#{view_language}", "app/views/#{plural_name}/#{action}.html.#{view_language}" + template "views/#{view_language}/#{action}.html.#{view_language}", "app/views/app/#{plural_name}/#{action}.html.#{view_language}" end end - template "views/#{view_language}/_search.html.#{view_language}", "app/views/#{plural_name}/_search.html.#{view_language}" + template "views/#{view_language}/_search.html.#{view_language}", "app/views/app/#{plural_name}/_search.html.#{view_language}" if form_partial? - template "views/#{view_language}/_form.html.#{view_language}", "app/views/#{plural_name}/_form.html.#{view_language}" + template "views/#{view_language}/_form.html.#{view_language}", "app/views/app/#{plural_name}/_form.html.#{view_language}" end unless options[:skip_frontend] - template "view_controller.rb", "app/controllers/view_#{plural_name}_controller.rb" + template "view_controller.rb", "app/controllers/front_end/app/#{plural_name}_controller.rb" - route("match \"all-#{plural_name}\" => \"view_#{plural_name}#index\", :as => :view_#{plural_name}") - route("match \"#{singular_name}/:filename\" => \"view_#{plural_name}#show\", :as => :view_#{singular_name}") + route("match \"all-#{plural_name}\" => \"front_end/app/#{plural_name}#index\", :as => :front_end_app_#{plural_name}") + route("match \"#{singular_name}/:filename\" => \"front_end/app/#{plural_name}#show\", :as => :front_end_app_#{singular_name}") - template "views/front_end/#{view_language}/index.html.#{view_language}", "app/views/view_#{plural_name}/index.html.#{view_language}" - template "views/front_end/#{view_language}/show.html.#{view_language}", "app/views/view_#{plural_name}/show.html.#{view_language}" + template "views/front_end/#{view_language}/index.html.#{view_language}", "app/views/front_end/app/#{plural_name}/index.html.#{view_language}" + template "views/front_end/#{view_language}/show.html.#{view_language}", "app/views/front_end/app/#{plural_name}/show.html.#{view_language}" end - route "resources #{plural_name.to_sym.inspect}" + route "namespace :app do resources #{plural_name.to_sym.inspect} end" - if test_framework == :rspec - template "tests/#{test_framework}/controller.rb", "spec/controllers/#{plural_name}_controller_spec.rb" - else - template "tests/#{test_framework}/controller.rb", "test/functional/#{plural_name}_controller_test.rb" - end + #if test_framework == :rspec + #template "tests/#{test_framework}/controller.rb", "spec/controllers/#{plural_name}_controller_spec.rb" + #else + #template "tests/#{test_framework}/controller.rb", "test/functional/#{plural_name}_controller_test.rb" + #end end end private