Class: Adopter::MigrationPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/adopter/migration_plan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ MigrationPlan

:reek:LongParameterList { enabled: false }



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/adopter/migration_plan.rb', line 11

def initialize(attrs = {})
  @source_path = attrs[:source_path]
  @output_path = attrs[:output_path]
  @target_automation = attrs[:target_automation]
  @target_framework = attrs[:target_framework]
  @ci_platform = attrs[:ci_platform]
  @skeleton_structure = attrs[:skeleton_structure] || {}
  @converted_pages = attrs[:converted_pages] || []
  @converted_tests = attrs[:converted_tests] || []
  @converted_features = attrs[:converted_features] || []
  @converted_steps = attrs[:converted_steps] || []
  @gemfile_additions = attrs[:gemfile_additions] || []
  @config_overrides = attrs[:config_overrides] || {}
  @warnings = attrs[:warnings] || []
  @manual_actions = attrs[:manual_actions] || []
end

Instance Attribute Details

#ci_platformObject (readonly)

Returns the value of attribute ci_platform.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def ci_platform
  @ci_platform
end

#config_overridesObject (readonly)

Returns the value of attribute config_overrides.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def config_overrides
  @config_overrides
end

#converted_featuresObject (readonly)

Returns the value of attribute converted_features.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def converted_features
  @converted_features
end

#converted_pagesObject (readonly)

Returns the value of attribute converted_pages.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def converted_pages
  @converted_pages
end

#converted_stepsObject (readonly)

Returns the value of attribute converted_steps.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def converted_steps
  @converted_steps
end

#converted_testsObject (readonly)

Returns the value of attribute converted_tests.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def converted_tests
  @converted_tests
end

#gemfile_additionsObject (readonly)

Returns the value of attribute gemfile_additions.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def gemfile_additions
  @gemfile_additions
end

#manual_actionsObject (readonly)

Returns the value of attribute manual_actions.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def manual_actions
  @manual_actions
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def output_path
  @output_path
end

#skeleton_structureObject (readonly)

Returns the value of attribute skeleton_structure.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def skeleton_structure
  @skeleton_structure
end

#source_pathObject (readonly)

Returns the value of attribute source_path.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def source_path
  @source_path
end

#target_automationObject (readonly)

Returns the value of attribute target_automation.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def target_automation
  @target_automation
end

#target_frameworkObject (readonly)

Returns the value of attribute target_framework.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def target_framework
  @target_framework
end

#warningsObject (readonly)

Returns the value of attribute warnings.



5
6
7
# File 'lib/adopter/migration_plan.rb', line 5

def warnings
  @warnings
end

Instance Method Details

#summaryObject



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/adopter/migration_plan.rb', line 52

def summary
  {
    pages: converted_pages.length,
    tests: converted_tests.length,
    features: converted_features.length,
    steps: converted_steps.length,
    custom_gems: gemfile_additions.length,
    warnings: warnings.length,
    manual_actions: manual_actions.length
  }
end

#to_hObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/adopter/migration_plan.rb', line 28

def to_h
  {
    source_path:,
    output_path:,
    target_automation:,
    target_framework:,
    ci_platform:,
    skeleton_structure:,
    converted_pages: converted_pages.map(&:to_h),
    converted_tests: converted_tests.map(&:to_h),
    converted_features: converted_features.map(&:to_h),
    converted_steps: converted_steps.map(&:to_h),
    gemfile_additions:,
    config_overrides:,
    warnings:,
    manual_actions:
  }
end

#to_json(*args) ⇒ Object



47
48
49
50
# File 'lib/adopter/migration_plan.rb', line 47

def to_json(*args)
  require 'json'
  to_h.to_json(*args)
end