Class: MenuGenerator
- Inherits:
-
Object
- Object
- MenuGenerator
- Defined in:
- lib/generators/menu_generator.rb
Class Method Summary collapse
- .choose_mobile_platform ⇒ Object
- .choose_test_framework(automation, project_name) ⇒ Object
- .generate_choice_menu(project_name) ⇒ Object
- .set_framework(automation, framework, project_name) ⇒ Object
Class Method Details
.choose_mobile_platform ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/generators/menu_generator.rb', line 55 def choose_mobile_platform @cli.choose do || .prompt = 'Please select your mobile platform' .choice('iOS') { 'appium_ios' } .choice('Android') do pp 'Android appium is coming soon. Thank you for the interest' exit end .choice('Cross Platform') do pp 'Cross platform appium is coming soon. Thank you for the interest' exit end .choice('Quit') { exit } end end |
.choose_test_framework(automation, project_name) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/generators/menu_generator.rb', line 23 def choose_test_framework(automation, project_name) system('clear') || system('cls') sleep 0.3 automation = automation == 'appium' ? choose_mobile_platform : automation framework = '' @cli.choose do || .prompt = 'Please select your test framework' .choice('Rspec') do framework = 'rspec' set_framework(automation, framework, project_name) end .choice('Cucumber') do framework = 'cucumber' set_framework(automation, framework, project_name) end .choice('Quit') { exit } end @cli.say("You have chosen to use #{framework} with #{automation}") end |
.generate_choice_menu(project_name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/generators/menu_generator.rb', line 12 def (project_name) @cli = HighLine.new @cli.choose do || .prompt = 'Please select your automation framework' .choice('Selenium') { choose_test_framework('selenium', project_name) } .choice('Watir') { choose_test_framework('watir', project_name) } .choice('Appium') { choose_test_framework('appium', project_name) } .choice('Quit') { exit } end end |
.set_framework(automation, framework, project_name) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/generators/menu_generator.rb', line 43 def set_framework(automation, framework, project_name) if framework == 'rspec' RspecGenerator.new([automation, framework, project_name]).invoke_all else CucumberGenerator.new([automation, framework, project_name]).invoke_all end AutomationGenerator.new([automation, framework, project_name]).invoke_all CommonGenerator.new([automation, framework, project_name]).invoke_all HelpersGenerator.new([automation, framework, project_name]).invoke_all system "cd #{project_name} && gem install bundler && bundle install" end |