Class: DatashiftJourney::InstallCollectorGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- DatashiftJourney::InstallCollectorGenerator
- Extended by:
- InitializerCommon
- Includes:
- InitializerCommon, Rails::Generators::Migration
- Defined in:
- lib/generators/datashift_journey/collector/install_collector_generator.rb
Instance Method Summary collapse
- #copy_collector_migration ⇒ Object
-
#install_common ⇒ Object
Hmm bit odd but to get thor to work appears we need to wrap calls to our common methods.
Instance Method Details
#copy_collector_migration ⇒ Object
14 15 16 17 |
# File 'lib/generators/datashift_journey/collector/install_collector_generator.rb', line 14 def copy_collector_migration migration_template "migration.rb", "db/migrate/add_foo_to_bar.rb" migration_template 'collector_migration.rb', 'db/migrate/datashift_journey_create_collector.rb', migration_version: migration_version end |
#install_common ⇒ Object
Hmm bit odd but to get thor to work appears we need to wrap calls to our common methods
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/datashift_journey/collector/install_collector_generator.rb', line 23 def install_common create_initializer_file(klass) notify_about_routes insert_into_file File.join('config', 'routes.rb'), before: "end\n" do %( # This line mounts Datashift Journey's Collector routes # scope :api, constraints: { format: 'json' } do scope :v1 do resources :page_states, only: [:create], controller: 'datashift_journey/page_states' end end ) end journey_plan_host_file(klass) model_journey_code(klass) end |