Class: MenuGenerator
Instance Attribute Summary collapse
Instance Method Summary
collapse
#add_examples, #add_generator, #generate_framework, #invoke_generator
Constructor Details
#initialize(project_name) ⇒ MenuGenerator
Returns a new instance of MenuGenerator.
11
12
13
14
|
# File 'lib/generators/menu_generator.rb', line 11
def initialize(project_name)
@prompt = TTY::Prompt.new
@name = project_name
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7
8
9
|
# File 'lib/generators/menu_generator.rb', line 7
def name
@name
end
|
#prompt ⇒ Object
Returns the value of attribute prompt.
7
8
9
|
# File 'lib/generators/menu_generator.rb', line 7
def prompt
@prompt
end
|
Instance Method Details
51
52
53
54
55
56
57
58
|
# File 'lib/generators/menu_generator.rb', line 51
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
33
34
35
36
37
|
# File 'lib/generators/menu_generator.rb', line 33
def choose_test_framework(automation)
return choose_mobile_platform if automation == 'appium'
select_test_framework(automation)
end
|
#choose_visual_automation ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/generators/menu_generator.rb', line 25
def choose_visual_automation
prompt.select('Do you want to add visual automation with applitools?') do ||
.choice :Yes, -> { true }
.choice :No, -> { false }
.choice :Quit, -> { exit }
end
end
|
16
17
18
19
20
21
22
23
|
# File 'lib/generators/menu_generator.rb', line 16
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(automation, framework, visual_automation, with_examples) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/generators/menu_generator.rb', line 39
def set_up_framework(automation, framework, visual_automation, with_examples)
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
|