Class: MenuGenerator
- Inherits:
-
Object
- Object
- MenuGenerator
- Includes:
- InvokeGenerators
- Defined in:
- lib/generators/menu_generator.rb
Overview
:reek:FeatureEnvy { enabled: false } :reek:UtilityFunction { enabled: false }
Defined Under Namespace
Classes: FrameworkOptions
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
Instance Method Summary collapse
- #choose_mobile_platform ⇒ Object
- #choose_test_framework(automation) ⇒ Object
- #choose_visual_automation ⇒ Object
- #generate_choice_menu ⇒ Object
-
#initialize(project_name) ⇒ MenuGenerator
constructor
A new instance of MenuGenerator.
- #set_up_framework(options) ⇒ Object
Methods included from InvokeGenerators
#add_examples, #add_generator, #generate_framework, #invoke_generator
Constructor Details
#initialize(project_name) ⇒ MenuGenerator
13 14 15 16 |
# File 'lib/generators/menu_generator.rb', line 13 def initialize(project_name) @prompt = TTY::Prompt.new @name = project_name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/generators/menu_generator.rb', line 9 def name @name end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
9 10 11 |
# File 'lib/generators/menu_generator.rb', line 9 def prompt @prompt end |
Instance Method Details
#choose_mobile_platform ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/generators/menu_generator.rb', line 49 def choose_mobile_platform prompt.select('Please select your mobile platform') do || .choice :iOS, -> { choose_test_framework 'ios' } .choice :Android, -> { choose_test_framework 'android' } .choice :Cross_Platform, -> { choose_test_framework 'cross_platform' } .choice :Quit, -> { exit } end end |
#choose_test_framework(automation) ⇒ Object
31 32 33 34 35 |
# File 'lib/generators/menu_generator.rb', line 31 def choose_test_framework(automation) return choose_mobile_platform if automation == 'appium' select_test_framework(automation) end |
#choose_visual_automation ⇒ Object
27 28 29 |
# File 'lib/generators/menu_generator.rb', line 27 def choose_visual_automation prompt.select('Do you want to add visual automation with applitools?', ) end |
#generate_choice_menu ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/generators/menu_generator.rb', line 18 def prompt.select('Please select your automation framework') do || .choice :Appium, -> { choose_test_framework('appium') } .choice :Selenium, -> { choose_test_framework('selenium') } .choice :Watir, -> { choose_test_framework('watir') } .choice :Quit, -> { exit } end end |
#set_up_framework(options) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/generators/menu_generator.rb', line 37 def set_up_framework() structure = { automation: [:automation], framework: [:framework], name: @name, visual: [:visual_automation], examples: [:with_examples] } generate_framework(structure) system "cd #{name} && gem install bundler && bundle install" end |