geordi 2.11.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +8 -2
- data/CHANGELOG.md +40 -0
- data/Gemfile +2 -5
- data/Gemfile.lock +50 -3
- data/README.md +34 -7
- data/Rakefile +6 -10
- data/{bin → exe}/b +0 -0
- data/{bin → exe}/cap-all +0 -0
- data/{bin → exe}/console-for +0 -0
- data/{bin → exe}/cuc +0 -0
- data/{bin → exe}/cuc-show +0 -0
- data/{bin → exe}/cuc-vnc-setup +0 -0
- data/{bin → exe}/deploy-to-production +0 -0
- data/{bin → exe}/dump-for +0 -0
- data/{bin → exe}/dumple +0 -0
- data/{bin → exe}/geordi +0 -0
- data/{bin → exe}/gitpt +0 -0
- data/{bin → exe}/launchy_browser +0 -0
- data/{bin → exe}/load-dump +0 -0
- data/{bin → exe}/migrate-all +0 -0
- data/{bin → exe}/rs +0 -0
- data/{bin → exe}/run_tests +0 -0
- data/{bin → exe}/shell-for +0 -0
- data/{bin → exe}/tests +0 -0
- data/geordi.gemspec +23 -20
- data/lib/geordi/COMMAND_TEMPLATE +4 -6
- data/lib/geordi/capistrano_config.rb +7 -7
- data/lib/geordi/chromedriver_updater.rb +9 -10
- data/lib/geordi/cli.rb +1 -7
- data/lib/geordi/commands/_setup_vnc.rb +23 -23
- data/lib/geordi/commands/apache_site.rb +3 -3
- data/lib/geordi/commands/bundle_install.rb +3 -3
- data/lib/geordi/commands/capistrano.rb +5 -6
- data/lib/geordi/commands/chromedriver_update.rb +0 -9
- data/lib/geordi/commands/clean.rb +5 -6
- data/lib/geordi/commands/commit.rb +0 -1
- data/lib/geordi/commands/console.rb +4 -4
- data/lib/geordi/commands/create_database_yml.rb +4 -4
- data/lib/geordi/commands/create_databases.rb +3 -3
- data/lib/geordi/commands/cucumber.rb +25 -25
- data/lib/geordi/commands/delete_dumps.rb +12 -12
- data/lib/geordi/commands/deploy.rb +27 -28
- data/lib/geordi/commands/drop_databases.rb +13 -15
- data/lib/geordi/commands/dump.rb +12 -13
- data/lib/geordi/commands/eurest.rb +2 -2
- data/lib/geordi/commands/firefox.rb +4 -4
- data/lib/geordi/commands/migrate.rb +3 -3
- data/lib/geordi/commands/png_optimize.rb +15 -14
- data/lib/geordi/commands/rake.rb +3 -3
- data/lib/geordi/commands/remove_executable_flags.rb +3 -3
- data/lib/geordi/commands/rspec.rb +11 -11
- data/lib/geordi/commands/security_update.rb +84 -27
- data/lib/geordi/commands/server.rb +6 -6
- data/lib/geordi/commands/setup.rb +8 -8
- data/lib/geordi/commands/shell.rb +3 -3
- data/lib/geordi/commands/tests.rb +1 -1
- data/lib/geordi/commands/unit.rb +3 -3
- data/lib/geordi/commands/update.rb +7 -7
- data/lib/geordi/commands/vnc.rb +1 -1
- data/lib/geordi/commands/with_rake.rb +3 -3
- data/lib/geordi/commands/yarn_install.rb +3 -3
- data/lib/geordi/cucumber.rb +35 -36
- data/lib/geordi/db_cleaner.rb +40 -41
- data/lib/geordi/dump_loader.rb +6 -5
- data/lib/geordi/firefox_for_selenium.rb +26 -29
- data/lib/geordi/gitpt.rb +14 -15
- data/lib/geordi/interaction.rb +2 -6
- data/lib/geordi/remote.rb +9 -10
- data/lib/geordi/util.rb +26 -27
- data/lib/geordi/version.rb +1 -1
- metadata +25 -37
- data/features/commit.feature +0 -17
- data/features/console.feature +0 -7
- data/features/cucumber.feature +0 -261
- data/features/deploy.feature +0 -66
- data/features/dump.feature +0 -34
- data/features/firefox.feature +0 -44
- data/features/server.feature +0 -31
- data/features/setup.feature +0 -11
- data/features/shell.feature +0 -78
- data/features/support/env.rb +0 -8
- data/features/support/step_definitions/aruba_backport_steps.rb +0 -5
- data/features/support/step_definitions/miscellaneous_steps.rb +0 -11
@@ -2,53 +2,110 @@ desc 'security-update [STEP]', 'Support for performing security updates'
|
|
2
2
|
long_desc <<-LONGDESC
|
3
3
|
Preparation for security update: `geordi security-update`
|
4
4
|
|
5
|
+
Checks out production and pulls.
|
6
|
+
|
5
7
|
After performing the update: `geordi security-update finish`
|
6
8
|
|
7
9
|
Switches branches, pulls, pushes and deploys as required by our workflow. Tells
|
8
|
-
what it will do before it does it.
|
10
|
+
what it will do before it does it. In detail:
|
11
|
+
|
12
|
+
1. Asks user, if tests are green
|
13
|
+
|
14
|
+
2. Pushes production
|
15
|
+
|
16
|
+
3. Checks out master and pulls
|
17
|
+
|
18
|
+
4. Merges production and pushes in master
|
19
|
+
|
20
|
+
5. Deploys staging first, if there is a staging environment
|
21
|
+
|
22
|
+
6. Asks user, if deployment log is okay and application is still running on staging
|
23
|
+
|
24
|
+
7. Deploys other stages
|
25
|
+
|
26
|
+
8. Asks user, if deployment log is okay and application is still running on all other stages
|
27
|
+
|
28
|
+
9. Informs user about the next steps
|
9
29
|
LONGDESC
|
10
30
|
|
11
|
-
def security_update(step='prepare')
|
31
|
+
def security_update(step = 'prepare')
|
12
32
|
case step
|
13
33
|
when 'prepare'
|
14
|
-
announce 'Preparing for security update'
|
15
|
-
warn 'Please read https://makandracards.com/makandra/1587 before applying security updates!'
|
16
|
-
note 'About to checkout production and pull'
|
17
|
-
prompt('Continue?', 'y', /y|yes/)
|
34
|
+
Interaction.announce 'Preparing for security update'
|
35
|
+
Interaction.warn 'Please read https://makandracards.com/makandra/1587 before applying security updates!'
|
36
|
+
Interaction.note 'About to checkout production and pull.'
|
37
|
+
Interaction.prompt('Continue?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
18
38
|
|
19
|
-
Util.system! 'git checkout production', :
|
20
|
-
Util.system! 'git pull', :
|
39
|
+
Util.system! 'git checkout production', show_cmd: true
|
40
|
+
Util.system! 'git pull', show_cmd: true
|
21
41
|
|
22
|
-
success 'Successfully prepared for security update'
|
42
|
+
Interaction.success 'Successfully prepared for security update'
|
23
43
|
puts
|
24
|
-
note 'Please apply the security update now and commit your changes.'
|
25
|
-
note 'When you are done, run `geordi security-update finish`.'
|
44
|
+
Interaction.note 'Please apply the security update now and commit your changes.'
|
45
|
+
Interaction.note 'When you are done, run `geordi security-update finish`.'
|
26
46
|
|
27
47
|
|
28
48
|
when 'f', 'finish'
|
29
49
|
# ensure everything is committed
|
30
|
-
|
50
|
+
if Util.testing?
|
51
|
+
puts 'Util.system! git status --porcelain'
|
52
|
+
else
|
53
|
+
`git status --porcelain`.empty? || Interaction.fail('Please commit your changes before finishing the update.')
|
54
|
+
end
|
31
55
|
|
32
|
-
announce 'Finishing security update'
|
33
|
-
note 'Working directory clean.'
|
34
|
-
prompt('Have you successfully run all tests?', 'n', /y|yes/)
|
56
|
+
Interaction.announce 'Finishing security update'
|
57
|
+
Interaction.note 'Working directory clean.'
|
58
|
+
Interaction.prompt('Have you successfully run all tests?', 'n', /y|yes/) || Interaction.fail('Please run tests first.')
|
35
59
|
|
36
|
-
note 'About to: push production, checkout & pull master, merge production, push master'
|
37
|
-
prompt('Continue?', 'n', /y|yes/)
|
60
|
+
Interaction.note 'About to: push production, checkout & pull master, merge production, push master.'
|
61
|
+
Interaction.prompt('Continue?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
|
38
62
|
|
39
|
-
Util.system! 'git push', :
|
40
|
-
Util.system! 'git checkout master', :
|
41
|
-
Util.system! 'git pull', :
|
42
|
-
Util.system! 'git merge production', :
|
43
|
-
Util.system! 'git push', :
|
63
|
+
Util.system! 'git push', show_cmd: true
|
64
|
+
Util.system! 'git checkout master', show_cmd: true
|
65
|
+
Util.system! 'git pull', show_cmd: true
|
66
|
+
Util.system! 'git merge production', show_cmd: true
|
67
|
+
Util.system! 'git push', show_cmd: true
|
44
68
|
|
45
|
-
announce '
|
69
|
+
Interaction.announce 'Deployment'
|
46
70
|
deploy = (Util.gem_major_version('capistrano') == 3) ? 'deploy' : 'deploy:migrations'
|
47
|
-
invoke_cmd 'capistrano', deploy
|
48
71
|
|
49
|
-
|
72
|
+
all_deploy_targets = Util.deploy_targets
|
73
|
+
Interaction.fail 'There are no deploy targets!' if all_deploy_targets.empty?
|
74
|
+
|
75
|
+
if all_deploy_targets.include?('staging')
|
76
|
+
Interaction.note 'There is a staging environment.'
|
77
|
+
Interaction.prompt('Deploy staging now?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
78
|
+
|
79
|
+
Interaction.announce 'Deploy staging'
|
80
|
+
Util.system! "bundle exec cap staging #{deploy}", show_cmd: true
|
81
|
+
|
82
|
+
Interaction.prompt('Is the deployment log okay and the application is still running on staging?', 'y', /y|yes/) || Interaction.fail('Please fix the deployment issues on staging before you continue.')
|
83
|
+
else
|
84
|
+
Interaction.note 'There is no staging environment.'
|
85
|
+
end
|
86
|
+
|
87
|
+
deploy_targets_without_staging = all_deploy_targets.select { |target| target != 'staging' }
|
88
|
+
|
89
|
+
if deploy_targets_without_staging.empty?
|
90
|
+
Interaction.note 'There are no other stages.'
|
91
|
+
else
|
92
|
+
puts
|
93
|
+
Interaction.note 'Found the following other stages:'
|
94
|
+
puts deploy_targets_without_staging
|
95
|
+
puts
|
96
|
+
Interaction.prompt('Deploy other stages now?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
97
|
+
|
98
|
+
deploy_targets_without_staging.each do |target|
|
99
|
+
Interaction.announce "Deploy #{target}"
|
100
|
+
Util.system! "bundle exec cap #{target} #{deploy}", show_cmd: true
|
101
|
+
end
|
102
|
+
|
103
|
+
Interaction.prompt('Is the application still running on all other stages and the logs are okay?', 'y', /y|yes/) || Interaction.fail('Please fix the application immediately!')
|
104
|
+
end
|
105
|
+
|
106
|
+
Interaction.success 'Successfully pushed and deployed security update'
|
50
107
|
puts
|
51
|
-
note 'Now send an email to customer and project lead, informing them about the update.'
|
52
|
-
note 'Do not forget to make a joblog on a security budget, if available.'
|
108
|
+
Interaction.note 'Now send an email to customer and project lead, informing them about the update.'
|
109
|
+
Interaction.note 'Do not forget to make a joblog on a security budget, if available.'
|
53
110
|
end
|
54
111
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
desc 'server [PORT]', 'Start a development server'
|
2
2
|
|
3
|
-
option :port, :
|
4
|
-
:
|
5
|
-
option :public, :
|
6
|
-
:
|
3
|
+
option :port, aliases: '-p', default: '3000',
|
4
|
+
desc: 'Choose a port'
|
5
|
+
option :public, aliases: '-P', type: :boolean,
|
6
|
+
desc: 'Make the server accessible in the local network'
|
7
7
|
|
8
8
|
def server(port = nil)
|
9
9
|
invoke_cmd 'bundle_install'
|
10
10
|
invoke_cmd 'yarn_install'
|
11
11
|
require 'geordi/util'
|
12
12
|
|
13
|
-
announce 'Booting a development server'
|
13
|
+
Interaction.announce 'Booting a development server'
|
14
14
|
port ||= options.port
|
15
|
-
note "URL: http://#{
|
15
|
+
Interaction.note "URL: http://#{File.basename(Dir.pwd)}.vcap.me:#{port}"
|
16
16
|
puts
|
17
17
|
|
18
18
|
command = Util.server_command
|
@@ -19,14 +19,14 @@ After setting up, runs all tests when called with the `--test` option:
|
|
19
19
|
geordi setup -t
|
20
20
|
LONGDESC
|
21
21
|
|
22
|
-
option :dump, :
|
23
|
-
:
|
24
|
-
option :test, :
|
22
|
+
option :dump, type: :string, aliases: '-d', banner: 'TARGET',
|
23
|
+
desc: 'After setup, dump the TARGET db and source it into the development db'
|
24
|
+
option :test, type: :boolean, aliases: '-t', desc: 'After setup, run tests'
|
25
25
|
|
26
26
|
def setup
|
27
|
-
if File.
|
28
|
-
announce 'Running bin/setup'
|
29
|
-
note "Geordi's own setup routine is skipped"
|
27
|
+
if File.exist? 'bin/setup'
|
28
|
+
Interaction.announce 'Running bin/setup'
|
29
|
+
Interaction.note "Geordi's own setup routine is skipped"
|
30
30
|
|
31
31
|
Util.system! 'bin/setup'
|
32
32
|
else
|
@@ -34,8 +34,8 @@ def setup
|
|
34
34
|
invoke_cmd 'migrate'
|
35
35
|
end
|
36
36
|
|
37
|
-
success 'Successfully set up the project.'
|
37
|
+
Interaction.success 'Successfully set up the project.'
|
38
38
|
|
39
|
-
invoke_cmd 'dump', options.dump, :
|
39
|
+
invoke_cmd 'dump', options.dump, load: true if options.dump
|
40
40
|
invoke_cmd 'tests' if options.test
|
41
41
|
end
|
@@ -7,13 +7,13 @@ Lets you select the server to connect to when called with `--select-server`:
|
|
7
7
|
geordi shell production -s
|
8
8
|
LONGDESC
|
9
9
|
|
10
|
-
option :select_server, :
|
10
|
+
option :select_server, default: false, type: :boolean, aliases: '-s'
|
11
11
|
|
12
12
|
# This method has a triple 'l' because :shell is a Thor reserved word. However,
|
13
13
|
# it can still be called with `geordi shell` :)
|
14
|
-
def shelll(target, *
|
14
|
+
def shelll(target, *_args)
|
15
15
|
require 'geordi/remote'
|
16
16
|
|
17
|
-
announce 'Opening a shell on ' + target
|
17
|
+
Interaction.announce 'Opening a shell on ' + target
|
18
18
|
Geordi::Remote.new(target).shell(options)
|
19
19
|
end
|
data/lib/geordi/commands/unit.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
desc 'unit', 'Run Test::Unit'
|
2
2
|
def unit
|
3
|
-
if File.
|
3
|
+
if File.exist?('test/test_helper.rb')
|
4
4
|
invoke_cmd 'bundle_install'
|
5
5
|
invoke_cmd 'yarn_install'
|
6
6
|
|
7
|
-
announce 'Running Test::Unit'
|
7
|
+
Interaction.announce 'Running Test::Unit'
|
8
8
|
Util.system! 'bundle exec rake test'
|
9
9
|
else
|
10
|
-
note 'Test::Unit not employed.'
|
10
|
+
Interaction.note 'Test::Unit not employed.'
|
11
11
|
end
|
12
12
|
end
|
@@ -16,18 +16,18 @@ After updating, runs all tests when called with the `--test` option:
|
|
16
16
|
See `geordi help update` for details.
|
17
17
|
LONGDESC
|
18
18
|
|
19
|
-
option :dump, :
|
20
|
-
:
|
21
|
-
option :test, :
|
19
|
+
option :dump, type: :string, aliases: '-d', banner: 'TARGET',
|
20
|
+
desc: 'After updating, dump the TARGET db and source it into the development db'
|
21
|
+
option :test, type: :boolean, aliases: '-t', desc: 'After updating, run tests'
|
22
22
|
|
23
23
|
def update
|
24
|
-
announce 'Updating repository'
|
25
|
-
Util.system! 'git pull', :
|
24
|
+
Interaction.announce 'Updating repository'
|
25
|
+
Util.system! 'git pull', show_cmd: true
|
26
26
|
|
27
27
|
invoke_cmd 'migrate'
|
28
28
|
|
29
|
-
success 'Successfully updated the project.'
|
29
|
+
Interaction.success 'Successfully updated the project.'
|
30
30
|
|
31
|
-
invoke_cmd 'dump', options.dump, :
|
31
|
+
invoke_cmd 'dump', options.dump, load: true if options.dump
|
32
32
|
invoke_cmd 'tests' if options.test
|
33
33
|
end
|
data/lib/geordi/commands/vnc.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
desc 'with-rake', 'Run tests with `rake`', :
|
1
|
+
desc 'with-rake', 'Run tests with `rake`', hide: true
|
2
2
|
def with_rake
|
3
3
|
if Util.file_containing?('Rakefile', /^task.+default.+(spec|test|feature)/)
|
4
4
|
invoke_cmd 'bundle_install'
|
5
5
|
invoke_cmd 'yarn_install'
|
6
6
|
|
7
|
-
announce 'Running tests with `rake`'
|
7
|
+
Interaction.announce 'Running tests with `rake`'
|
8
8
|
Util.system! 'rake'
|
9
9
|
else
|
10
|
-
note '`rake` does not run tests.'
|
10
|
+
Interaction.note '`rake` does not run tests.'
|
11
11
|
:did_not_perform
|
12
12
|
end
|
13
13
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
desc 'yarn-install', 'Runs yarn install if required', :
|
1
|
+
desc 'yarn-install', 'Runs yarn install if required', hide: true
|
2
2
|
|
3
3
|
def yarn_install
|
4
|
-
if File.
|
5
|
-
announce 'Yarn install'
|
4
|
+
if File.exist?('package.json') && !system('yarn check --integrity > /dev/null 2>&1')
|
5
|
+
Interaction.announce 'Yarn install'
|
6
6
|
Util.system! 'yarn install'
|
7
7
|
end
|
8
8
|
end
|
data/lib/geordi/cucumber.rb
CHANGED
@@ -3,17 +3,16 @@ require 'tempfile'
|
|
3
3
|
|
4
4
|
# This require-style is to prevent Ruby from loading files of a different
|
5
5
|
# version of Geordi.
|
6
|
-
require File.expand_path('
|
7
|
-
require File.expand_path('
|
6
|
+
require File.expand_path('interaction', __dir__)
|
7
|
+
require File.expand_path('firefox_for_selenium', __dir__)
|
8
8
|
|
9
9
|
module Geordi
|
10
10
|
class Cucumber
|
11
|
-
include Geordi::Interaction
|
12
11
|
|
13
|
-
VNC_DISPLAY = ':17'
|
14
|
-
VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} -localhost -nolisten tcp -SecurityTypes None -geometry 1280x1024"
|
15
|
-
VNC_VIEWER_COMMAND = "vncviewer #{VNC_DISPLAY}"
|
16
|
-
VNC_ENV_VARIABLES = %w[DISPLAY BROWSER LAUNCHY_BROWSER]
|
12
|
+
VNC_DISPLAY = ':17'.freeze
|
13
|
+
VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} -localhost -nolisten tcp -SecurityTypes None -geometry 1280x1024".freeze
|
14
|
+
VNC_VIEWER_COMMAND = "vncviewer #{VNC_DISPLAY}".freeze
|
15
|
+
VNC_ENV_VARIABLES = %w[DISPLAY BROWSER LAUNCHY_BROWSER].freeze
|
17
16
|
|
18
17
|
def run(files, cucumber_options, options = {})
|
19
18
|
self.argv = files + cucumber_options.map { |option| option.split('=') }.flatten
|
@@ -23,27 +22,27 @@ module Geordi
|
|
23
22
|
setup_vnc
|
24
23
|
|
25
24
|
command = use_parallel_tests?(options) ? parallel_execution_command : serial_execution_command
|
26
|
-
note_cmd(command) if options[:verbose]
|
25
|
+
Interaction.note_cmd(command) if options[:verbose]
|
27
26
|
|
28
27
|
puts # Make newline
|
29
28
|
system command # Util.system! would reset the Firefox PATH
|
30
29
|
end
|
31
30
|
|
32
31
|
def launch_vnc_viewer
|
33
|
-
fork
|
32
|
+
fork do
|
34
33
|
error = capture_stderr do
|
35
34
|
system(VNC_VIEWER_COMMAND)
|
36
35
|
end
|
37
36
|
unless $?.success?
|
38
37
|
if $?.exitstatus == 127
|
39
|
-
fail 'VNC viewer not found. Install it with `geordi vnc --setup`.'
|
38
|
+
Interaction.fail 'VNC viewer not found. Install it with `geordi vnc --setup`.'
|
40
39
|
else
|
41
|
-
note 'VNC viewer could not be opened:'
|
40
|
+
Interaction.note 'VNC viewer could not be opened:'
|
42
41
|
puts error
|
43
42
|
puts
|
44
43
|
end
|
45
44
|
end
|
46
|
-
|
45
|
+
end
|
47
46
|
end
|
48
47
|
|
49
48
|
def restore_env
|
@@ -57,10 +56,10 @@ module Geordi
|
|
57
56
|
VNC_ENV_VARIABLES.each do |variable|
|
58
57
|
ENV["OUTER_#{variable}"] = ENV[variable] if ENV[variable]
|
59
58
|
end
|
60
|
-
ENV[
|
61
|
-
ENV[
|
59
|
+
ENV['BROWSER'] = ENV['LAUNCHY_BROWSER'] = File.expand_path('../../bin/launchy_browser', __dir__)
|
60
|
+
ENV['DISPLAY'] = VNC_DISPLAY
|
62
61
|
|
63
|
-
note 'Run `geordi vnc` to view the Selenium test browsers'
|
62
|
+
Interaction.note 'Run `geordi vnc` to view the Selenium test browsers'
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
@@ -73,11 +72,11 @@ module Geordi
|
|
73
72
|
unless argv.include?('--format') || argv.include?('-f')
|
74
73
|
format_args = spinner_available? ? ['--format', 'CucumberSpinner::CuriousProgressBarFormatter'] : ['--format', 'progress']
|
75
74
|
end
|
76
|
-
[use_firefox_for_selenium,
|
75
|
+
[use_firefox_for_selenium, 'b', 'cucumber', format_args, escape_shell_args(argv)].flatten.compact.join(' ')
|
77
76
|
end
|
78
77
|
|
79
78
|
def parallel_execution_command
|
80
|
-
note 'Using parallel_tests'
|
79
|
+
Interaction.note 'Using parallel_tests'
|
81
80
|
self.argv = argv - command_line_features
|
82
81
|
|
83
82
|
type_arg = Util.gem_version('parallel_tests') > Gem::Version.new('0.7.0') ? 'cucumber' : 'features'
|
@@ -87,8 +86,8 @@ module Geordi
|
|
87
86
|
[
|
88
87
|
use_firefox_for_selenium,
|
89
88
|
'b parallel_test -t ' + type_arg,
|
90
|
-
%(-o '#{
|
91
|
-
"-- #{
|
89
|
+
%(-o '#{command_line_options.join(' ')} --tags "#{not_tag('@solo')}"'),
|
90
|
+
"-- #{features.join(' ')}",
|
92
91
|
].compact.join(' ')
|
93
92
|
end
|
94
93
|
|
@@ -109,21 +108,21 @@ module Geordi
|
|
109
108
|
|
110
109
|
def escape_shell_args(*args)
|
111
110
|
args.flatten.collect do |arg|
|
112
|
-
arg.gsub(/([\\ "])/) { |
|
111
|
+
arg.gsub(/([\\ "])/) { |_match| "\\#{Regexp.last_match(1)}" }
|
113
112
|
end
|
114
113
|
end
|
115
114
|
|
116
115
|
def show_features_to_run
|
117
116
|
if command_line_options.include? '@solo'
|
118
|
-
note 'All features tagged with @solo'
|
117
|
+
Interaction.note 'All features tagged with @solo'
|
119
118
|
elsif command_line_options.include? 'rerun'
|
120
|
-
note 'Rerunning failed scenarios'
|
119
|
+
Interaction.note 'Rerunning failed scenarios'
|
121
120
|
elsif features_to_run.empty?
|
122
|
-
note 'All features in features/'
|
121
|
+
Interaction.note 'All features in features/'
|
123
122
|
else
|
124
123
|
notification = 'Only: ' + features_to_run.join(', ')
|
125
124
|
notification << ' (from rerun.txt)' if (features_to_run == rerun_txt_features) && (features_to_run != command_line_features)
|
126
|
-
note notification
|
125
|
+
Interaction.note notification
|
127
126
|
end
|
128
127
|
end
|
129
128
|
|
@@ -137,8 +136,8 @@ module Geordi
|
|
137
136
|
|
138
137
|
def rerun_txt_features
|
139
138
|
@rerun_txt_features ||= begin
|
140
|
-
if File.
|
141
|
-
IO.read(
|
139
|
+
if File.exist?('rerun.txt')
|
140
|
+
IO.read('rerun.txt').to_s.strip.split(/\s+/)
|
142
141
|
else
|
143
142
|
[]
|
144
143
|
end
|
@@ -150,7 +149,7 @@ module Geordi
|
|
150
149
|
end
|
151
150
|
|
152
151
|
def command_line_options
|
153
|
-
@command_line_options ||=
|
152
|
+
@command_line_options ||= [].tap do |args|
|
154
153
|
# Sorry for this mess. Option parsing doesn't get much prettier.
|
155
154
|
argv.each_cons(2) do |a, b|
|
156
155
|
break if a == '--' # This is the common no-options-beyond marker
|
@@ -171,9 +170,9 @@ module Geordi
|
|
171
170
|
end
|
172
171
|
|
173
172
|
def consolidate_rerun_txt_files
|
174
|
-
parallel_rerun_files = Dir.glob(
|
173
|
+
parallel_rerun_files = Dir.glob('parallel_rerun*.txt')
|
175
174
|
unless parallel_rerun_files.empty?
|
176
|
-
note 'Consolidating parallel_rerun.txt files ...'
|
175
|
+
Interaction.note 'Consolidating parallel_rerun.txt files ...'
|
177
176
|
|
178
177
|
rerun_content = []
|
179
178
|
parallel_rerun_files.each do |filename|
|
@@ -181,8 +180,8 @@ module Geordi
|
|
181
180
|
File.unlink(filename)
|
182
181
|
end
|
183
182
|
|
184
|
-
File.open(
|
185
|
-
f.puts(rerun_content.join(
|
183
|
+
File.open('rerun.txt', 'w') do |f|
|
184
|
+
f.puts(rerun_content.join(' '))
|
186
185
|
end
|
187
186
|
end
|
188
187
|
end
|
@@ -190,14 +189,14 @@ module Geordi
|
|
190
189
|
def find_all_features_recursively(files_or_dirs)
|
191
190
|
Array(files_or_dirs).map do |file_or_dir|
|
192
191
|
if File.directory?(file_or_dir)
|
193
|
-
file_or_dir = Dir.glob(File.join(file_or_dir,
|
192
|
+
file_or_dir = Dir.glob(File.join(file_or_dir, '**', '*.feature'))
|
194
193
|
end
|
195
194
|
file_or_dir
|
196
195
|
end.flatten.uniq.compact
|
197
196
|
end
|
198
197
|
|
199
198
|
def spinner_available?
|
200
|
-
@spinner_available ||= File.
|
199
|
+
@spinner_available ||= File.exist?('Gemfile') && File.open('Gemfile').read.scan(/cucumber_spinner/).any?
|
201
200
|
end
|
202
201
|
|
203
202
|
def use_parallel_tests?(options)
|
@@ -209,7 +208,7 @@ module Geordi
|
|
209
208
|
|
210
209
|
def try_and_start_vnc
|
211
210
|
# check if vnc is already running
|
212
|
-
#return true if vnc_server_running?
|
211
|
+
# return true if vnc_server_running?
|
213
212
|
error = capture_stderr do
|
214
213
|
system(VNC_SERVER_COMMAND)
|
215
214
|
end
|
@@ -218,10 +217,10 @@ module Geordi
|
|
218
217
|
98 # was already running after all
|
219
218
|
true
|
220
219
|
when 127 # not installed
|
221
|
-
warn 'Could not launch VNC server. Install it with `geordi vnc --setup`.'
|
220
|
+
Interaction.warn 'Could not launch VNC server. Install it with `geordi vnc --setup`.'
|
222
221
|
false
|
223
222
|
else
|
224
|
-
warn 'Starting VNC failed:'
|
223
|
+
Interaction.warn 'Starting VNC failed:'
|
225
224
|
puts error
|
226
225
|
puts
|
227
226
|
false
|