Class: Adopter::AdoptMenu
- Inherits:
-
Object
- Object
- Adopter::AdoptMenu
- Defined in:
- lib/adopter/adopt_menu.rb
Overview
:reek:TooManyMethods { enabled: false }
Constant Summary collapse
- WEB_AUTOMATIONS =
%w[selenium capybara watir].freeze
- TEST_FRAMEWORKS =
%w[rspec cucumber minitest].freeze
- CI_PLATFORMS =
%w[github gitlab].freeze
Class Method Summary collapse
-
.adopt(params) ⇒ Object
Programmatic entry point for raider_desktop and CLI –parameters :reek:LongParameterList { enabled: false }.
- .validate_params!(params) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ AdoptMenu
constructor
A new instance of AdoptMenu.
- #run ⇒ Object
Constructor Details
#initialize ⇒ AdoptMenu
Returns a new instance of AdoptMenu.
15 16 17 |
# File 'lib/adopter/adopt_menu.rb', line 15 def initialize @prompt = TTY::Prompt.new end |
Class Method Details
.adopt(params) ⇒ Object
Programmatic entry point for raider_desktop and CLI –parameters :reek:LongParameterList { enabled: false }
38 39 40 41 42 43 44 45 46 |
# File 'lib/adopter/adopt_menu.rb', line 38 def self.adopt(params) validate_params!(params) analysis = ProjectAnalyzer.new(params[:source_path]).analyze plan = PlanBuilder.new(analysis, params).build results = Migrator.new(plan).execute { plan: plan, results: results } end |
.validate_params!(params) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/adopter/adopt_menu.rb', line 48 def self.validate_params!(params) raise ArgumentError, 'source_path is required' unless params[:source_path] raise ArgumentError, 'output_path is required' unless params[:output_path] raise ArgumentError, 'target_automation is required' unless params[:target_automation] raise ArgumentError, 'target_framework is required' unless params[:target_framework] unless WEB_AUTOMATIONS.include?(params[:target_automation]) raise ArgumentError, "target_automation must be one of: #{WEB_AUTOMATIONS.join(', ')}" end return if TEST_FRAMEWORKS.include?(params[:target_framework]) raise ArgumentError, "target_framework must be one of: #{TEST_FRAMEWORKS.join(', ')}" end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/adopter/adopt_menu.rb', line 19 def run source_path = ask_source_path detection = preview_detection(source_path) target_automation = ask_target_automation(detection[:automation]) target_framework = ask_target_framework(detection[:framework]) output_path = ask_output_path ci_platform = ask_ci_platform(detection[:ci_platform]) execute_adoption( source_path: source_path, output_path: output_path, target_automation: target_automation, target_framework: target_framework, ci_platform: ci_platform ) end |