lib/thesilverspoon.rb~ in thesilverspoon-0.0.18 vs lib/thesilverspoon.rb~ in thesilverspoon-0.0.19

- old
+ new

@@ -68,11 +68,11 @@ resource = namespaces.pop route namespaces.reverse.inject("resources :#{resource}") { |acc, namespace| "namespace(:#{namespace}){ #{acc} }" } - s=%{match "#{resource}_integrated_view"=>"#{resource}#integrated_view"\n} + s=%{match "#{resource}_integrated_view"=>"#{resource}#integrated_view"\n} inject_into_file "config/routes.rb", s, :after=>"resources :#{resource}\n" end @@ -226,19 +226,31 @@ Rails::Generators.invoke('gritter:locale') Rails::Generators.invoke('devise:install') Rails::Generators.invoke('devise', ["user"]) Rails::Generators.invoke('devise:views') Rails::Generators.invoke('cancan:ability') - Rails::Generators.invoke('rails_admin:install') - Rails::Generators.invoke('migration',["add_role_to_user",["admin:boolean"]]) + Rails::Generators.invoke('migration', ["add_role_to_user", ["admin:boolean"]]) + Rails::Generators.invoke('controller',["welcome",["index"]]) end -def create_new_user + + def create_new_user s="\nUser.create!(:email=>'admin@tss.com',:password=>'secret',:password_confirmation=>'secret',:admin=>true)" - append_to_file "db/seeds.rb",s + append_to_file "db/seeds.rb", s end + def create_root_route + + s="root" + s=s+":to=>" + s=s+"'welcome#index'\n" + + # append_to_file "config/routes.rb",s + inject_into_file "config/routes.rb",s,:after=>"GemTest3::Application.routes.draw do\n" + + end + def create_appplication_helper remove_file "app/helpers/application_helper.rb" template 'application_helper.rb', "app/helpers/application_helper.rb" end @@ -312,20 +324,40 @@ template "#{Install.source_root}/layouts/welcome.html.erb", "app/views/layouts/welcome.html.erb" end def insert_devise_code - inject_into_file "config/application.rb", 'require "devise"', :after=>"require File.expand_path('../boot', __FILE__)\n" + inject_into_file "config/application.rb", 'require "devise"', :after=>"require File.expand_path('../boot', __FILE__)\n" inject_into_file "config/application.rb", "require 'bootstrap-sass'\n", :after=>"require File.expand_path('../boot', __FILE__)\n" - + inject_into_file "config/application.rb", "require 'bootstrapped'\n", :after=>"require 'rails/all'\n" inject_into_file "config/application.rb", "require 'gritter'\n", :after=>"require 'rails/all'\n" -inject_into_file "config/application.rb", "require 'bootstrapped'\n", :after=>"require 'rails/all'\n" - inject_into_file "app/assets/stylesheets/application.css", '*=require_directory', :before=>"*/" + + + inject_into_file "app/assets/stylesheets/application.css", '*=require_directory', :before=>"*/" + append_to_file "app/assets/javascripts/application.js", '//= require bootstrap' inject_into_file "app/controllers/application_controller.rb", "before_filter :authenticate_user!\n", :after=>" protect_from_forgery\n" + end + + end +end +module Revert +# If you use the NamedBase inheritance, a 'name' parameter has to follow the 'rails g integratedscaffold'. Won't work otherwise. If you don't want this, use ::Base + class Layout < Rails::Generators::Base + + def self.source_root + File.expand_path("../templates", __FILE__) + end + def initialize(*args, &block) + super + remove_file "app/views/layouts/application.html.erb" + template "#{Layout.source_root}/layouts/general_layout.html.erb",'app/views/layouts/application.html.erb' + + end + end end -end +