Class: Rails::Generators::Hyperdrive::SyncGenerator
- Inherits:
-
Base
- Object
- Base
- Rails::Generators::Hyperdrive::SyncGenerator
- Includes:
- ContentSyncSupport
- Defined in:
- lib/generators/hyperdrive/sync/sync_generator.rb
Overview
Content-only by contract: no step may write a bootstrap artifact (.mcp.json, the engine mount, the initializer, the .gitignore rule).
Instance Method Summary collapse
- #discover_artifacts ⇒ Object
- #print_summary ⇒ Object
- #sync_content ⇒ Object
- #verify_environment ⇒ Object
- #verify_options ⇒ Object
Methods included from ContentSyncSupport
Instance Method Details
#discover_artifacts ⇒ Object
33 34 35 |
# File 'lib/generators/hyperdrive/sync/sync_generator.rb', line 33 def discover_artifacts runner.discover_artifacts end |
#print_summary ⇒ Object
47 48 49 50 51 |
# File 'lib/generators/hyperdrive/sync/sync_generator.rb', line 47 def print_summary say "" say_status :done, "hyperdrive synced", :green runner.summary_lines.each { |line| say line } end |
#sync_content ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/generators/hyperdrive/sync/sync_generator.rb', line 37 def sync_content mode = if [:overwrite] then :overwrite elsif [:merge] then :merge elsif [:sidecar] then :sidecar else :preserve end runner.install(mode: mode) end |
#verify_environment ⇒ Object
29 30 31 |
# File 'lib/generators/hyperdrive/sync/sync_generator.rb', line 29 def verify_environment runner.verify_environment! end |
#verify_options ⇒ Object
22 23 24 25 26 27 |
# File 'lib/generators/hyperdrive/sync/sync_generator.rb', line 22 def chosen = %i[overwrite merge sidecar].select { |flag| [flag] } return if chosen.size <= 1 raise Thor::Error, "hyperdrive: #{chosen.map { |flag| "--#{flag}" }.join(" and ")} are mutually exclusive; pick one" end |