Class: Connector::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Connector::Generators::InstallGenerator
- Defined in:
- lib/generators/connector/install_generator.rb
Instance Method Summary collapse
- #copy_controllers_and_views ⇒ Object
- #copy_entity ⇒ Object
- #copy_example_entity ⇒ Object
- #copy_external ⇒ Object
- #copy_oauth_controller ⇒ Object
- #copy_stylesheets ⇒ Object
- #include_helpers ⇒ Object
- #maestrano_generator ⇒ Object
Instance Method Details
#copy_controllers_and_views ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/generators/connector/install_generator.rb', line 36 def copy_controllers_and_views copy_file 'home_controller.rb', 'app/controllers/home_controller.rb' copy_file 'home_controller_spec.rb', 'spec/controllers/home_controller_spec.rb' copy_file 'home_index.haml', 'app/views/home/index.html.haml' copy_file 'synchronizations_controller.rb', 'app/controllers/synchronizations_controller.rb' copy_file 'synchronizations_controller_spec.rb', 'spec/controllers/synchronizations_controller_spec.rb' copy_file 'synchronizations_index.haml', 'app/views/synchronizations/index.html.haml' copy_file 'shared_entities_controller.rb', 'app/controllers/shared_entities_controller.rb' copy_file 'shared_entities_controller_spec.rb', 'spec/controllers/shared_entities_controller_spec.rb' copy_file 'shared_entities_index.haml', 'app/views/shared_entities/index.html.haml' copy_file 'layouts.haml', 'app/views/layouts/application.html.haml' end |
#copy_entity ⇒ Object
24 25 26 |
# File 'lib/generators/connector/install_generator.rb', line 24 def copy_entity copy_file 'entity.rb', 'app/models/maestrano/connector/rails/entity.rb' end |
#copy_example_entity ⇒ Object
32 33 34 |
# File 'lib/generators/connector/install_generator.rb', line 32 def copy_example_entity copy_file 'example_entity.rb', 'app/models/entities/example_entitiy.rb' end |
#copy_external ⇒ Object
28 29 30 |
# File 'lib/generators/connector/install_generator.rb', line 28 def copy_external copy_file 'external.rb', 'app/models/maestrano/connector/rails/external.rb' end |
#copy_oauth_controller ⇒ Object
60 61 62 |
# File 'lib/generators/connector/install_generator.rb', line 60 def copy_oauth_controller copy_file 'oauth_controller.rb', 'app/controllers/oauth_controller.rb' end |
#copy_stylesheets ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/generators/connector/install_generator.rb', line 52 def copy_stylesheets copy_file 'stylesheets/application.sass', 'app/assets/stylesheets/application.sass' copy_file 'stylesheets/home.sass', 'app/assets/stylesheets/home.sass' copy_file 'stylesheets/layout.sass', 'app/assets/stylesheets/layout.sass' copy_file 'stylesheets/spacers.sass', 'app/assets/stylesheets/spacers.sass' copy_file 'stylesheets/variables.sass', 'app/assets/stylesheets/variables.sass' end |
#include_helpers ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/connector/install_generator.rb', line 10 def include_helpers sentinel = 'class ApplicationController < ActionController::Base' code_lines = [ "helper Maestrano::Connector::Rails::Engine.helpers", "include Maestrano::Connector::Rails::SessionHelper" ] in_root do gsub_file 'app/controllers/application_controller.rb', /(#{Regexp.escape(sentinel)})/mi do |match| "#{match}\n #{code_lines.join("\n ")}\n" end end end |
#maestrano_generator ⇒ Object
6 7 8 |
# File 'lib/generators/connector/install_generator.rb', line 6 def maestrano_generator generate 'maestrano:initializer' end |