Class: Bolt::ProjectMigrate

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt/project_migrate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, outputter, configured_inventory = nil) ⇒ ProjectMigrate

This init mostly makes testing easier



8
9
10
11
12
13
14
15
# File 'lib/bolt/project_migrate.rb', line 8

def initialize(path, outputter, configured_inventory = nil)
  @path = Pathname.new(path).expand_path
  @project_file = @path + 'bolt-project.yaml'
  @config_file = @path + 'bolt.yaml'
  @backup_dir = @path + '.bolt-bak'
  @inventory_file = configured_inventory || @path + 'inventory.yaml'
  @outputter = outputter
end

Instance Attribute Details

#backup_dirObject (readonly)

Returns the value of attribute backup_dir.



5
6
7
# File 'lib/bolt/project_migrate.rb', line 5

def backup_dir
  @backup_dir
end

#config_fileObject (readonly)

Returns the value of attribute config_file.



5
6
7
# File 'lib/bolt/project_migrate.rb', line 5

def config_file
  @config_file
end

#inventory_fileObject (readonly)

Returns the value of attribute inventory_file.



5
6
7
# File 'lib/bolt/project_migrate.rb', line 5

def inventory_file
  @inventory_file
end

#outputterObject (readonly)

Returns the value of attribute outputter.



5
6
7
# File 'lib/bolt/project_migrate.rb', line 5

def outputter
  @outputter
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/bolt/project_migrate.rb', line 5

def path
  @path
end

#project_fileObject (readonly)

Returns the value of attribute project_file.



5
6
7
# File 'lib/bolt/project_migrate.rb', line 5

def project_file
  @project_file
end

Instance Method Details

#migrate_projectObject



17
18
19
20
21
# File 'lib/bolt/project_migrate.rb', line 17

def migrate_project
  inv_ok = inventory_1_to_2(inventory_file, outputter) if inventory_file.file?
  config_ok = bolt_yaml_to_bolt_project(inventory_file, outputter)
  inv_ok && config_ok ? 0 : 1
end