geordi 5.4.0 → 6.0.0.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87cda39f50721b8821dc5042de4a4ead24b4f8a27d5601bcb1742aa5f1a7cd00
4
- data.tar.gz: baf33c3c575963062318374024cfae1071dd1002aaebbdd1c353cc7dc8c4c0c0
3
+ metadata.gz: eee4c378b0fe08b20405c74876813d2e23eda1e09c92dae4a19146af9f414a2d
4
+ data.tar.gz: 48bfb8c877fedf002b46aa1f09ea7dde284c9b1358f1c8f1f9c39a0bc3381c03
5
5
  SHA512:
6
- metadata.gz: 0a66597a85f305bf90bf01ec56f0141ad4c3a7fcbd4d21032e8a7f64b2b5fece841e37084c8f783d7f8b9269e484d4cd7d6b35523435b032d67e472125c14043
7
- data.tar.gz: 74954d6cf80dc9dea5b3f8d233fa2f2c2cb0c65fb229c385b96cb202f667dfdab14a1fd32212f3a168658cbeacbe4a279300a6a6fbcb9eee44f91a85b5da241f
6
+ metadata.gz: e24c228acd4170e540b76accc1708bf7df44f3650052c200abfdb2f297770e7660f017a176bd0edbc74202d08c1c4df9d3c05289d91c06501ebcb7f32d28839f
7
+ data.tar.gz: e817b989c4254f3482a888418fef3ca57f493901cce611ab970faaaf8db6ff259ea67f7417ffb6b964bb6f1063e926afe0503ace94c1ce497e9c92c494c41ec0
@@ -25,6 +25,8 @@ jobs:
25
25
  gemfile: Gemfile
26
26
  - ruby: 2.7.2
27
27
  gemfile: Gemfile
28
+ - ruby: 3.0.0
29
+ gemfile: Gemfile
28
30
  env:
29
31
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
30
32
  steps:
@@ -33,16 +35,14 @@ jobs:
33
35
  uses: ruby/setup-ruby@v1
34
36
  with:
35
37
  ruby-version: "${{ matrix.ruby }}"
36
- - name: Install vncserver
37
- run: |
38
- sudo apt-get update
39
- sudo apt-get install -y tightvncserver
40
- # Fake required password for vncserver
41
- mkdir ~/.vnc && touch ~/.vnc/passwd && chmod 700 ~/.vnc/passwd
42
38
  - name: Bundle
43
39
  run: |
44
40
  gem install bundler:1.17.3
45
41
  bundle install --no-deployment
42
+ - name: Install VNC viewer
43
+ run: |
44
+ sudo apt-get update
45
+ sudo apt-get install -y xtightvncviewer
46
46
  - name: Run tests
47
47
  run: bundle exec rake
48
48
 
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/CHANGELOG.md CHANGED
@@ -3,13 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
5
5
 
6
-
7
6
  ## Unreleased
8
7
 
9
8
  ### Compatible changes
9
+ * Removed support for serial execution of scenarios tagged with @solo.
10
10
 
11
11
  ### Breaking changes
12
12
 
13
+ ## 6.0.0 2021-04-06
14
+
15
+ ### Compatible changes
16
+ * `geordi commit` will continue even if one of the given projects is inaccessible. It will only fail if no stories could be found at all.
17
+
18
+ ### Breaking changes
19
+ * Removed VNC test browser support for integration tests.
20
+ * Please use a headless Chrome setup <https://makandracards.com/makandra/492109-capybara-running-tests-with-headless-chrome>.
21
+ * You might also want to get rid of your local VNC server `sudo apt remove tightvncserver`.
13
22
 
14
23
  ## 5.4.0 2021-02-01
15
24
 
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gemspec
5
5
 
6
6
  gem 'aruba', '< 1' # Drops support for Ruby 2.2-
7
7
  gem 'rake', '< 13' # Drops support for Ruby 2.1
8
- gem 'rspec-mocks'
8
+ gem 'rspec'
9
9
  gem 'highline'
10
10
  gem 'parallel_tests'
11
11
  gem 'launchy'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (5.3.0)
4
+ geordi (6.0.0)
5
5
  thor (~> 1)
6
6
 
7
7
  GEM
@@ -62,10 +62,15 @@ GEM
62
62
  launchy (2.4.3)
63
63
  addressable (~> 2.3)
64
64
  method_source (1.0.0)
65
- mimemagic (0.3.5)
65
+ mimemagic (0.3.9)
66
+ nokogiri (~> 1)
67
+ rake
68
+ mini_portile2 (2.4.0)
66
69
  multi_json (1.15.0)
67
70
  multi_test (0.1.2)
68
71
  multipart-post (2.1.1)
72
+ nokogiri (1.9.1)
73
+ mini_portile2 (~> 2.4.0)
69
74
  parallel (1.19.2)
70
75
  parallel_tests (2.32.0)
71
76
  parallel
@@ -78,10 +83,16 @@ GEM
78
83
  declarative (< 0.1.0)
79
84
  declarative-option (< 0.2.0)
80
85
  uber (< 0.2.0)
86
+ rspec (3.10.0)
87
+ rspec-core (~> 3.10.0)
88
+ rspec-expectations (~> 3.10.0)
89
+ rspec-mocks (~> 3.10.0)
90
+ rspec-core (3.10.1)
91
+ rspec-support (~> 3.10.0)
81
92
  rspec-expectations (3.10.0)
82
93
  diff-lcs (>= 1.2.0, < 2.0)
83
94
  rspec-support (~> 3.10.0)
84
- rspec-mocks (3.10.0)
95
+ rspec-mocks (3.10.2)
85
96
  diff-lcs (>= 1.2.0, < 2.0)
86
97
  rspec-support (~> 3.10.0)
87
98
  rspec-support (3.10.0)
@@ -115,7 +126,7 @@ DEPENDENCIES
115
126
  parallel_tests
116
127
  pry
117
128
  rake (< 13)
118
- rspec-mocks
129
+ rspec
119
130
  tracker_api
120
131
 
121
132
  BUNDLED WITH
data/README.md CHANGED
@@ -90,12 +90,8 @@ Run Cucumber features.
90
90
 
91
91
  Example: `geordi cucumber features/authentication_feature:3`
92
92
 
93
- Runs Cucumber with `bundle exec`, using parallel tests, with a VNC session
94
- holding Selenium test browsers, support for using a dedicated testing browser
95
- and beta support for re-running failed scenarios.
96
-
97
- - *@solo:* Generally, features are run in parallel. However, scenarios tagged
98
- with @solo are excluded from the parallel run and executed sequentially instead.
93
+ Runs Cucumber with `bundle exec`, using parallel tests and with support for re-running
94
+ failed scenarios.
99
95
 
100
96
  - *Debugging:* In some cases, the dot-printing Cucumber formatter swallows
101
97
  errors. In case a feature fails without an error message, try running it with
@@ -105,10 +101,6 @@ errors. In case a feature fails without an error message, try running it with
105
101
  e.g. `--format=pretty`. Make sure to connect option and value with an equals
106
102
  sign, i.e. have each option a contiguous string.
107
103
 
108
- - *VNC:* By default, test browsers will run in a VNC session. When using a
109
- headless test browser anyway, you can disable VNC by setting `use_vnc: false`
110
- in `.geordi.yml` in the project root.
111
-
112
104
  - In order to limit processes in a parallel run, you can set an environment
113
105
  variable like this: `PARALLEL_TEST_PROCESSORS=6 geordi cucumber`
114
106
 
@@ -188,6 +180,7 @@ There are three subcommands:
188
180
 
189
181
  - `geordi docker vnc`
190
182
  Opens a VNC viewer to connect to the VNC server in the container.
183
+ Append `--setup` to be guided through the setup of VNC viewer.
191
184
 
192
185
 
193
186
  ### `geordi drop-databases`
@@ -235,19 +228,6 @@ Loading a dump into one of multiple local databases is not supported yet.
235
228
  - `-d, [--database=NAME]`: Database name, if there are multiple databases
236
229
 
237
230
 
238
- ### `geordi firefox COMMAND`
239
- Run a command with VNC and test browser set up (alias: chrome).
240
-
241
- Example: `geordi firefox b cucumber` or `geordi firefox --setup 24.0`
242
-
243
- Useful when you need Firefox for Selenium or the VNC set up, but can't use the
244
- `geordi cucumber` command. This command is aliased `chrome` for users running
245
- Selenium in Chrome.
246
-
247
- **Options**
248
- - `[--setup=FIREFOX_VERSION]`: Install a special test runner Firefox with the given version
249
-
250
-
251
231
  ### `geordi help [COMMAND]`
252
232
  Describe available commands or one specific command.
253
233
 
@@ -389,18 +369,6 @@ Performs: `git pull`, `bundle install` (if necessary) and migrates (if applicabl
389
369
  ### `geordi version`
390
370
  Print the current version of geordi.
391
371
 
392
-
393
- ### `geordi vnc`
394
- Show the hidden VNC window.
395
-
396
- Example: `geordi vnc` or `geordi vnc --setup`
397
-
398
- Launch a VNC session to the hidden screen where `geordi cucumber` runs Selenium
399
- tests.
400
-
401
- **Options**
402
- - `[--setup], [--no-setup]`: Guide through the setup of VNC
403
-
404
372
  b
405
373
  ---
406
374
 
@@ -424,13 +392,6 @@ Stores a timestamped database dump for the given Rails environment in `~/dumps`:
424
392
  - `--compress`: After dumping, run gzip to compress the dump in place
425
393
 
426
394
 
427
- launchy_browser
428
- ---------------
429
-
430
- Used by the `geordi cucumber` command. Makes launchy open pages in the user's
431
- browser, as opposed to opening it within the VNC window.
432
-
433
-
434
395
  Contributing
435
396
  ============
436
397
 
data/geordi.gemspec CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_runtime_dependency 'thor', '~> 1'
27
27
 
28
- #spec.post_install_message = <<-ATTENTION
29
- #ATTENTION
28
+ spec.post_install_message = <<-ATTENTION
29
+ Support for sequential running of integration tests tagged with @solo has been dropped.
30
+ ATTENTION
30
31
  end
@@ -10,7 +10,7 @@ module Geordi
10
10
  chromedriver_version = determine_chromedriver_version
11
11
 
12
12
  if skip_update?(chrome_version, chromedriver_version)
13
- Interaction.note("No update required, you are using for both executables the same version #{chrome_version}!") unless options[:quiet_if_matching]
13
+ Interaction.success "No update required: both Chrome and chromedriver are on v#{chrome_version}!" unless options[:quiet_if_matching]
14
14
  else
15
15
  chromedriver_zip = download_chromedriver(chrome_version)
16
16
  unzip(chromedriver_zip, File.expand_path('~/bin'))
@@ -18,7 +18,7 @@ module Geordi
18
18
  chromedriver_zip.unlink
19
19
 
20
20
  # We need to determine the version again, as it could be nil in case no chromedriver was installed before
21
- Interaction.note "Chromedriver updated to version #{determine_chromedriver_version}"
21
+ Interaction.success "Chromedriver updated to v#{determine_chromedriver_version}."
22
22
  end
23
23
  end
24
24
 
@@ -31,7 +31,7 @@ module Geordi
31
31
  end
32
32
 
33
33
  if !status.success? || chrome_version.nil?
34
- Interaction.fail('Could not determine the current Google Chrome version')
34
+ Interaction.fail('Could not determine the version of Google Chrome.')
35
35
  else
36
36
  chrome_version.to_i
37
37
  end
@@ -46,7 +46,7 @@ module Geordi
46
46
  end
47
47
 
48
48
  if !status.success? || chromedriver_version.nil?
49
- Interaction.fail('Could not determine the current chromedriver version')
49
+ Interaction.fail('Could not determine the version of chromedriver.')
50
50
  else
51
51
  chromedriver_version.to_i
52
52
  end
@@ -68,7 +68,7 @@ module Geordi
68
68
 
69
69
  file
70
70
  else
71
- Interaction.fail("Could not download chromedriver version #{latest_version}")
71
+ Interaction.fail("Could not download chromedriver v#{latest_version}.")
72
72
  end
73
73
  end
74
74
 
@@ -79,7 +79,7 @@ module Geordi
79
79
  if response.is_a?(Net::HTTPSuccess)
80
80
  response.body.to_s
81
81
  else
82
- Interaction.fail("Could not find the latest version for Google Chrome version #{chrome_version}")
82
+ Interaction.fail("Could not download the chromedriver v#{chrome_version}.")
83
83
  end
84
84
  end
85
85
 
@@ -87,7 +87,7 @@ module Geordi
87
87
  _stdout_str, _error_str, status = Open3.capture3('unzip', '-d', output_dir, '-o', zip.path)
88
88
 
89
89
  unless status.success?
90
- Interaction.fail("Could not unzip #{zip.path}")
90
+ Interaction.fail("Could not unzip #{zip.path}.")
91
91
  end
92
92
  end
93
93
  end
data/lib/geordi/cli.rb CHANGED
@@ -15,12 +15,12 @@ module Geordi
15
15
  class_eval File.read(file), file
16
16
  end
17
17
 
18
- private
19
-
20
- # fix weird implementation of #invoke
21
- def invoke_geordi(name, *args)
22
- options = args.last.is_a?(Hash) ? args.pop : {}
23
- invoke(name, args, options)
18
+ no_commands do
19
+ # fix weird implementation of #invoke
20
+ def invoke_geordi(name, *args)
21
+ options = args.last.is_a?(Hash) ? args.pop : {}
22
+ invoke(name, args, options)
23
+ end
24
24
  end
25
25
 
26
26
  end
@@ -2,12 +2,8 @@ desc 'cucumber [FILES and OPTIONS]', 'Run Cucumber features'
2
2
  long_desc <<-LONGDESC
3
3
  Example: `geordi cucumber features/authentication_feature:3`
4
4
 
5
- Runs Cucumber with `bundle exec`, using parallel tests, with a VNC session
6
- holding Selenium test browsers, support for using a dedicated testing browser
7
- and beta support for re-running failed scenarios.
8
-
9
- - *@solo:* Generally, features are run in parallel. However, scenarios tagged
10
- with @solo are excluded from the parallel run and executed sequentially instead.
5
+ Runs Cucumber with `bundle exec`, using parallel tests and with support for re-running
6
+ failed scenarios.
11
7
 
12
8
  - *Debugging:* In some cases, the dot-printing Cucumber formatter swallows
13
9
  errors. In case a feature fails without an error message, try running it with
@@ -17,10 +13,6 @@ errors. In case a feature fails without an error message, try running it with
17
13
  e.g. `--format=pretty`. Make sure to connect option and value with an equals
18
14
  sign, i.e. have each option a contiguous string.
19
15
 
20
- - *VNC:* By default, test browsers will run in a VNC session. When using a
21
- headless test browser anyway, you can disable VNC by setting `use_vnc: false`
22
- in `.geordi.yml` in the project root.
23
-
24
16
  - In order to limit processes in a parallel run, you can set an environment
25
17
  variable like this: `PARALLEL_TEST_PROCESSORS=6 geordi cucumber`
26
18
  LONGDESC
@@ -67,28 +59,6 @@ def cucumber(*args)
67
59
  cmd_opts, files = args.partition { |f| f.start_with? '-' }
68
60
  cmd_opts << '--format' << 'pretty' << '--backtrace' if options.debug
69
61
 
70
- # Serial run of @solo scenarios ############################################
71
- if files.any? { |f| f.include? ':' }
72
- Interaction.note '@solo run skipped when called with line numbers' if options.verbose
73
- else
74
- solo_files = if files.empty?
75
- 'features' # Proper grepping
76
- else
77
- files.join(' ')
78
- end
79
-
80
- solo_tag_usages = `grep -r '@solo' #{solo_files}`.split("\n")
81
-
82
- if solo_tag_usages.any?
83
- solo_cmd_opts = cmd_opts.dup
84
- solo_cmd_opts << '--tags' << '@solo'
85
-
86
- Interaction.announce 'Running @solo features'
87
- solo_success = Geordi::Cucumber.new.run files, solo_cmd_opts, verbose: options.verbose, parallel: false
88
- solo_success || Interaction.fail('Features failed.')
89
- end
90
- end
91
-
92
62
  # Parallel run of all given features + reruns ##############################
93
63
  Interaction.announce 'Running features'
94
64
  normal_run_successful = Geordi::Cucumber.new.run(files, cmd_opts, verbose: options.verbose)
@@ -30,7 +30,7 @@ def delete_dumps(*locations)
30
30
  deletable_dumps = dump_files.flatten.uniq.sort.select &File.method(:file?)
31
31
 
32
32
  if deletable_dumps.empty?
33
- Interaction.note 'No dump files found'
33
+ Interaction.warn 'No dump files found.'
34
34
  else
35
35
  puts deletable_dumps
36
36
  Interaction.prompt('Delete these files?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
@@ -12,8 +12,13 @@ class DockerCLI < Thor
12
12
  end
13
13
 
14
14
  desc 'vnc', 'Open a vnc viewer connecting to the docker container'
15
+ option :setup, default: false, type: :boolean, desc: 'Guide through the setup of VNC'
15
16
  def vnc
16
- docker.vnc
17
+ if options.setup
18
+ docker.setup_vnc
19
+ else
20
+ docker.vnc
21
+ end
17
22
  end
18
23
 
19
24
  private
@@ -42,5 +47,6 @@ There are three subcommands:
42
47
 
43
48
  - `geordi docker vnc`
44
49
  Opens a VNC viewer to connect to the VNC server in the container.
50
+ Append `--setup` to be guided through the setup of VNC viewer.
45
51
  LONGDESC
46
52
  subcommand 'docker', DockerCLI
@@ -47,6 +47,4 @@ def drop_databases
47
47
  cleaner = DBCleaner.new(extra_flags)
48
48
  cleaner.clean_mysql unless options.postgres_only
49
49
  cleaner.clean_postgres unless options.mysql_only
50
-
51
- Interaction.success 'Done.'
52
50
  end
@@ -10,5 +10,6 @@ def remove_executable_flags
10
10
  Interaction.note pattern
11
11
  `find . -name "#{pattern}" -exec chmod -x {} ';'`
12
12
  end
13
- puts 'Done.'
13
+
14
+ Interaction.success 'Done.'
14
15
  end
@@ -4,67 +4,23 @@ require 'tempfile'
4
4
  # This require-style is to prevent Ruby from loading files of a different
5
5
  # version of Geordi.
6
6
  require File.expand_path('interaction', __dir__)
7
- require File.expand_path('firefox_for_selenium', __dir__)
8
7
  require File.expand_path('settings', __dir__)
9
8
 
10
9
  module Geordi
11
10
  class Cucumber
12
11
 
13
- VNC_DISPLAY = ':17'.freeze
14
- VNC_PASSWORD_FILE = File.expand_path('~/.vnc/passwd').freeze # default for "vncpasswd"
15
- VNC_SERVER_DEFAULT_OPTIONS = "-localhost -nolisten tcp -geometry 1280x1024 -rfbauth #{VNC_PASSWORD_FILE}".freeze
16
- VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} #{ENV.fetch('GEORDI_VNC_OPTIONS', VNC_SERVER_DEFAULT_OPTIONS)}".freeze
17
- VNC_VIEWER_COMMAND = "vncviewer -passwd #{VNC_PASSWORD_FILE}".freeze
18
- VNC_ENV_VARIABLES = %w[DISPLAY BROWSER LAUNCHY_BROWSER].freeze
19
-
20
12
  def run(files, cucumber_options, options = {})
21
13
  self.argv = files + cucumber_options.map { |option| option.split('=') }.flatten
22
14
  self.settings = Geordi::Settings.new
23
15
 
24
16
  consolidate_rerun_txt_files
25
17
  show_features_to_run
26
- setup_vnc if settings.use_vnc?
27
18
 
28
19
  command = use_parallel_tests?(options) ? parallel_execution_command : serial_execution_command
29
20
  Interaction.note_cmd(command) if options[:verbose]
30
21
 
31
22
  puts # Make newline
32
- system command # Util.run! would reset the Firefox PATH
33
- end
34
-
35
- def launch_vnc_viewer(source = VNC_DISPLAY)
36
- fork do
37
- error = capture_stderr do
38
- system("#{VNC_VIEWER_COMMAND} #{source}")
39
- end
40
- unless $?.success?
41
- if $?.exitstatus == 127
42
- Interaction.fail 'VNC viewer not found. Install it with `geordi vnc --setup`.'
43
- else
44
- Interaction.note 'VNC viewer could not be opened:'
45
- puts error
46
- puts
47
- end
48
- end
49
- end
50
- end
51
-
52
- def restore_env
53
- VNC_ENV_VARIABLES.each do |variable|
54
- ENV[variable] = ENV["OUTER_#{variable}"]
55
- end
56
- end
57
-
58
- def setup_vnc
59
- if try_and_start_vnc
60
- VNC_ENV_VARIABLES.each do |variable|
61
- ENV["OUTER_#{variable}"] = ENV[variable] if ENV[variable]
62
- end
63
- ENV['BROWSER'] = ENV['LAUNCHY_BROWSER'] = File.expand_path('../../exe/launchy_browser', __dir__)
64
- ENV['DISPLAY'] = VNC_DISPLAY
65
-
66
- Interaction.note 'Run `geordi vnc` to view the Selenium test browsers'
67
- end
23
+ system command
68
24
  end
69
25
 
70
26
  private
@@ -76,7 +32,7 @@ module Geordi
76
32
  unless argv.include?('--format') || argv.include?('-f')
77
33
  format_args = spinner_available? ? ['--format', 'CucumberSpinner::CuriousProgressBarFormatter'] : ['--format', 'progress']
78
34
  end
79
- [use_firefox_for_selenium, Util.binstub_or_fallback('cucumber'), format_args, escape_shell_args(argv)].flatten.compact.join(' ')
35
+ [ Util.binstub_or_fallback('cucumber'), format_args, escape_shell_args(argv)].flatten.compact.join(' ')
80
36
  end
81
37
 
82
38
  def parallel_execution_command
@@ -88,28 +44,12 @@ module Geordi
88
44
  features = find_all_features_recursively('features') if features.empty?
89
45
 
90
46
  [
91
- use_firefox_for_selenium,
92
47
  'bundle exec parallel_test -t ' + type_arg,
93
- %(-o '#{command_line_options.join(' ')} --tags "#{not_tag('@solo')}"'),
48
+ %(-o '#{command_line_options.join(' ')}'),
94
49
  "-- #{features.join(' ')}",
95
50
  ].compact.join(' ')
96
51
  end
97
52
 
98
- def not_tag(name)
99
- if Util.gem_major_version('cucumber') < 3
100
- "~#{name}"
101
- else
102
- "not #{name}"
103
- end
104
- end
105
-
106
- def use_firefox_for_selenium
107
- path = Geordi::FirefoxForSelenium.path_from_config
108
- if path
109
- "PATH=#{path}:$PATH"
110
- end
111
- end
112
-
113
53
  def escape_shell_args(*args)
114
54
  args.flatten.collect do |arg|
115
55
  arg.gsub(/([\\ "])/) { |_match| "\\#{Regexp.last_match(1)}" }
@@ -117,9 +57,7 @@ module Geordi
117
57
  end
118
58
 
119
59
  def show_features_to_run
120
- if command_line_options.include? '@solo'
121
- Interaction.note 'All features tagged with @solo'
122
- elsif command_line_options.include? 'rerun'
60
+ if command_line_options.include? 'rerun'
123
61
  Interaction.note 'Rerunning failed scenarios'
124
62
  elsif features_to_run.empty?
125
63
  Interaction.note 'All features in features/'
@@ -210,39 +148,5 @@ module Geordi
210
148
  features_to_run.none? { |f| f.include? ':' }
211
149
  end
212
150
 
213
- def try_and_start_vnc
214
- # check if vnc is already running
215
- # return true if vnc_server_running?
216
- error = capture_stderr do
217
- system(VNC_SERVER_COMMAND)
218
- end
219
- case $?.exitstatus
220
- when 0,
221
- 98 # was already running after all
222
- true
223
- when 127 # not installed
224
- Interaction.warn 'Could not launch VNC server. Install it with `geordi vnc --setup`.'
225
- false
226
- else
227
- Interaction.warn 'Starting VNC failed:'
228
- puts error
229
- puts
230
- false
231
- end
232
- end
233
-
234
- def capture_stderr
235
- old_stderr = $stderr.dup
236
- io = Tempfile.new('cuc')
237
- $stderr.reopen(io)
238
- yield
239
- io.rewind
240
- io.read
241
- ensure
242
- io.close
243
- io.unlink
244
- $stderr.reopen(old_stderr)
245
- end
246
-
247
151
  end
248
152
  end