Class: Gemboree::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Gemboree::Generators::InstallGenerator
- Defined in:
- lib/generators/gemboree/install_generator.rb
Instance Method Summary collapse
- #setup_asssets ⇒ Object
- #setup_cancan ⇒ Object
- #setup_devise ⇒ Object
- #setup_home_page ⇒ Object
- #setup_roles ⇒ Object
Instance Method Details
#setup_asssets ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/generators/gemboree/install_generator.rb', line 16 def setup_asssets insert_into_file "app/assets/javascripts/application.js", :after => "jquery_ujs\n" do "//= require gemboree\n" end insert_into_file "app/assets/stylesheets/application.css", :after => "require_self\n" do " *= require gemboree\n" end end |
#setup_cancan ⇒ Object
30 31 32 |
# File 'lib/generators/gemboree/install_generator.rb', line 30 def setup_cancan copy_file "ability.rb", "app/models/ability.rb" end |
#setup_devise ⇒ Object
25 26 27 28 |
# File 'lib/generators/gemboree/install_generator.rb', line 25 def setup_devise generate "devise:install" generate "devise", "User" end |
#setup_home_page ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/gemboree/install_generator.rb', line 5 def setup_home_page remove_file "public/index.html" remove_file "app/assets/images/rails.png" remove_file "app/views/layouts/application.html.erb" copy_file "home_controller.rb", "app/controllers/home_controller.rb" copy_file "index.html.erb", "app/views/home/index.html.erb" copy_file "nav.html.erb", "app/views/layouts/_nav.html.erb" copy_file "application.html.erb", "app/views/layouts/application.html.erb" route "root :to => 'home#index'" end |
#setup_roles ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/generators/gemboree/install_generator.rb', line 34 def setup_roles generate "gemboree:migration" insert_into_file "app/models/user.rb", :after => "ActiveRecord::Base\n" do %{ acts_as_actor has_many :user_roles, :dependent => :destroy has_many :roles, :through => :user_roles } end end |