Class: Bolt::ProjectMigrator
- Inherits:
-
Object
- Object
- Bolt::ProjectMigrator
- Defined in:
- lib/bolt/project_migrator.rb,
lib/bolt/project_migrator/base.rb,
lib/bolt/project_migrator/config.rb,
lib/bolt/project_migrator/modules.rb,
lib/bolt/project_migrator/inventory.rb
Defined Under Namespace
Classes: Base, Config, Inventory, Modules
Instance Method Summary collapse
-
#initialize(config, outputter) ⇒ ProjectMigrator
constructor
A new instance of ProjectMigrator.
- #migrate ⇒ Object
Constructor Details
#initialize(config, outputter) ⇒ ProjectMigrator
Returns a new instance of ProjectMigrator.
9 10 11 12 |
# File 'lib/bolt/project_migrator.rb', line 9 def initialize(config, outputter) @config = config @outputter = outputter end |
Instance Method Details
#migrate ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bolt/project_migrator.rb', line 14 def migrate unless $stdin.tty? raise Bolt::Error.new( "stdin is not a tty, unable to migrate project", 'bolt/stdin-not-a-tty-error' ) end @outputter.("Migrating project #{@config.project.path}\n\n") @outputter.print_action_step( "Migrating a Bolt project may make irreversible changes to the project's "\ "configuration and inventory files. Before continuing, make sure the "\ "project has a backup or uses a version control system." ) return 0 unless Bolt::Util.prompt_yes_no("Continue with project migration?", @outputter) @outputter.('') ok = migrate_inventory && migrate_config && migrate_modules if ok @outputter.("Project successfully migrated") else @outputter.print_error("Project could not be migrated completely") end ok ? 0 : 1 end |