Class: Sbdevcore::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Sbdevcore::Generators::InstallGenerator
- Defined in:
- lib/generators/sbdevcore/install_generator.rb
Instance Method Summary collapse
- #database ⇒ Object
- #git ⇒ Object
- #migrations ⇒ Object
- #remove_bs ⇒ Object
- #seeds ⇒ Object
- #set_routes ⇒ Object
Instance Method Details
#database ⇒ Object
16 17 18 19 20 |
# File 'lib/generators/sbdevcore/install_generator.rb', line 16 def database template 'database.yml', 'config/database.yml', :force => true rake "db:drop:all" rake "db:create" end |
#git ⇒ Object
59 60 61 62 63 64 |
# File 'lib/generators/sbdevcore/install_generator.rb', line 59 def git run "git init ." copy_file ".gitignore", ".gitignore", :force => true run "git add ." run "git commit -m 'first commit'" end |
#migrations ⇒ Object
22 23 24 25 |
# File 'lib/generators/sbdevcore/install_generator.rb', line 22 def migrations rake "sbdevcore:install:migrations" rake "db:migrate" end |
#remove_bs ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/generators/sbdevcore/install_generator.rb', line 7 def remove_bs puts "foo\n\n\n" directory "config", "config", :force => true remove_file 'public/index.html' remove_file 'public/images/rails.png' remove_file 'app/views/layouts/application.html.erb' remove_file 'app/assets/stylesheets/application.css' end |
#seeds ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/generators/sbdevcore/install_generator.rb', line 36 def seeds copy_file "application.scss", "app/assets/stylesheets/application.scss", :force => true copy_file "sass.scss", "app/assets/stylesheets/sass.scss", :force => true directory "application", "app/views/application" directory "layouts", "app/views/layouts" inject_into_file "app/assets/javascripts/application.js", "//= require sbdevcore\n", :before => "//= require_tree ." dev_mailer = <<-OPTS ActionMailer::Base.perform_deliveries = false ActionMailer::Base.raise_delivery_errors = true OPTS inject_into_file "config/environments/development.rb", dev_mailer, :after => "Application.configure do" prod_mailer = <<-OPTS ActionMailer::Base.perform_deliveries = true ActionMailer::Base.raise_delivery_errors = false OPTS inject_into_file "config/environments/production.rb", prod_mailer, :after => "Application.configure do" gsub_file "config/environments/production.rb", /"X-Sendfile"/, "nil" end |
#set_routes ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/generators/sbdevcore/install_generator.rb', line 27 def set_routes route "Sbdevcore::Routes.draw(self)" statics = <<-STR root :to => "indices#show", :id => ('home') match "(:id)" => "indices#show" STR route statics end |