geordi 3.0.0 → 3.0.1

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile.lock +1 -1
  4. data/lib/geordi/COMMAND_TEMPLATE +2 -3
  5. data/lib/geordi/chromedriver_updater.rb +7 -8
  6. data/lib/geordi/cli.rb +0 -1
  7. data/lib/geordi/commands/_setup_vnc.rb +22 -22
  8. data/lib/geordi/commands/bundle_install.rb +1 -1
  9. data/lib/geordi/commands/capistrano.rb +4 -4
  10. data/lib/geordi/commands/clean.rb +6 -5
  11. data/lib/geordi/commands/console.rb +2 -2
  12. data/lib/geordi/commands/create_database_yml.rb +2 -2
  13. data/lib/geordi/commands/create_databases.rb +1 -1
  14. data/lib/geordi/commands/cucumber.rb +8 -8
  15. data/lib/geordi/commands/delete_dumps.rb +5 -5
  16. data/lib/geordi/commands/deploy.rb +18 -18
  17. data/lib/geordi/commands/drop_databases.rb +3 -3
  18. data/lib/geordi/commands/dump.rb +8 -8
  19. data/lib/geordi/commands/firefox.rb +2 -2
  20. data/lib/geordi/commands/migrate.rb +3 -3
  21. data/lib/geordi/commands/png_optimize.rb +5 -5
  22. data/lib/geordi/commands/rake.rb +1 -1
  23. data/lib/geordi/commands/remove_executable_flags.rb +2 -2
  24. data/lib/geordi/commands/rspec.rb +5 -5
  25. data/lib/geordi/commands/security_update.rb +17 -17
  26. data/lib/geordi/commands/server.rb +2 -2
  27. data/lib/geordi/commands/setup.rb +3 -3
  28. data/lib/geordi/commands/shell.rb +1 -1
  29. data/lib/geordi/commands/tests.rb +1 -1
  30. data/lib/geordi/commands/unit.rb +2 -2
  31. data/lib/geordi/commands/update.rb +2 -2
  32. data/lib/geordi/commands/with_rake.rb +2 -2
  33. data/lib/geordi/commands/yarn_install.rb +1 -1
  34. data/lib/geordi/cucumber.rb +14 -15
  35. data/lib/geordi/db_cleaner.rb +21 -22
  36. data/lib/geordi/dump_loader.rb +2 -3
  37. data/lib/geordi/firefox_for_selenium.rb +17 -19
  38. data/lib/geordi/gitpt.rb +2 -3
  39. data/lib/geordi/interaction.rb +2 -6
  40. data/lib/geordi/remote.rb +3 -4
  41. data/lib/geordi/util.rb +13 -8
  42. data/lib/geordi/version.rb +1 -1
  43. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcd8074a50a0c81d4e0b7e2beaef07e8508018a494ae9b3cc288bb29c0b9e796
4
- data.tar.gz: a8091353e0d315e6e37f93227688a89d74b7b01abcf4d4a4339271aaaf65e50a
3
+ metadata.gz: 6526d69319548d39cfe259c4c62788ae997bffec2d305f5bd8ee63bef9a5e12e
4
+ data.tar.gz: e19060563af6fad488e1521aa3574c36499ff74dfca2e782283a35ca34f7301f
5
5
  SHA512:
6
- metadata.gz: b6147e0cbddbcba812f1ea87f03544c0cefd6f40f766b6971275ec5c8efb25f307d47623508bb2990b7cdbd88ed540c51de51920faa59236e5a2034b2cfa9d68
7
- data.tar.gz: '078962b0bac78764315e54f2f104354966cc775f18bd9a6d514069c8972bcf3dd4c96cb8b58e0ddf42b233032c12c7d00eb3af24b67970548bb297915d7394b7'
6
+ metadata.gz: 429dc10291a955e101c6ba802475d2daef6a05eaad3c5e6737853194bc4565797d86820c2b20bc97ad387b5eeebeb4bfdec4651c99f12bc325c75a9ed6eece54
7
+ data.tar.gz: 2196c5fb48bbc1365fbf2731441d0fac73a57944414a99a97b61f4cbff6c95ab551346ebb418c844f89ea21c96182e66110d9b842405ceaf6e1119c8c10e928a
data/CHANGELOG.md CHANGED
@@ -11,6 +11,13 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
11
11
  ### Breaking changes
12
12
 
13
13
 
14
+ ## 3.0.1 2020-05-13
15
+
16
+ ### Compatible changes
17
+ - Fix #93: Using `$CHILDSTATUS` instead of `$?` did not work properly. This affected commands like `geordi drop-databases` to fail.
18
+ - Fix #92: Geordi fail messages were converted to exceptions by accident. Now they are printed as red error message without the backtrace again.
19
+
20
+
14
21
  ## 3.0.0 2020-05-04
15
22
 
16
23
  ### Compatible changes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (3.0.0)
4
+ geordi (3.0.1)
5
5
  thor (~> 1)
6
6
 
7
7
  GEM
@@ -21,10 +21,9 @@ def example
21
21
  # Invoke other commands like this:
22
22
  invoke_cmd 'other_command', 'argument', an: 'option'
23
23
 
24
- fail 'Option missing' unless options.opt?
24
+ Interaction.fail 'Option missing' unless options.opt?
25
25
 
26
- # For formatted output, see geordi/interaction.rb
27
- success 'Done.'
26
+ Interaction.success 'Done.'
28
27
  end
29
28
 
30
29
  # Command mappings, usually not needed
@@ -4,14 +4,13 @@ require 'tempfile'
4
4
 
5
5
  module Geordi
6
6
  class ChromedriverUpdater
7
- include Geordi::Interaction
8
7
 
9
8
  def run
10
9
  chrome_version = determine_chrome_version
11
10
  chromedriver_version = determine_chromedriver_version
12
11
 
13
12
  if skip_update?(chrome_version, chromedriver_version)
14
- warn("No update required, you are using for both executables the same version #{chrome_version}!")
13
+ Interaction.warn("No update required, you are using for both executables the same version #{chrome_version}!")
15
14
  else
16
15
  chromedriver_zip = download_chromedriver(chrome_version)
17
16
  unzip(chromedriver_zip, File.expand_path('~/bin'))
@@ -19,7 +18,7 @@ module Geordi
19
18
  chromedriver_zip.unlink
20
19
 
21
20
  # We need to determine the version again, as it could be nil in case no chromedriver was installed before
22
- note "Chromedriver updated to version #{determine_chromedriver_version}"
21
+ Interaction.note "Chromedriver updated to version #{determine_chromedriver_version}"
23
22
  end
24
23
  end
25
24
 
@@ -32,7 +31,7 @@ module Geordi
32
31
  end
33
32
 
34
33
  if !status.success? || chrome_version.nil?
35
- raise('Could not determine the current Google Chrome version')
34
+ Interaction.fail('Could not determine the current Google Chrome version')
36
35
  else
37
36
  chrome_version.to_i
38
37
  end
@@ -47,7 +46,7 @@ module Geordi
47
46
  end
48
47
 
49
48
  if !status.success? || chromedriver_version.nil?
50
- raise('Could not determine the current chromedriver version')
49
+ Interaction.fail('Could not determine the current chromedriver version')
51
50
  else
52
51
  chromedriver_version.to_i
53
52
  end
@@ -69,7 +68,7 @@ module Geordi
69
68
 
70
69
  file
71
70
  else
72
- raise("Could not download chromedriver version #{latest_version}")
71
+ Interaction.fail("Could not download chromedriver version #{latest_version}")
73
72
  end
74
73
  end
75
74
 
@@ -80,7 +79,7 @@ module Geordi
80
79
  if response.is_a?(Net::HTTPSuccess)
81
80
  response.body.to_s
82
81
  else
83
- raise("Could not find the latest version for Google Chrome version #{chrome_version}")
82
+ Interaction.fail("Could not find the latest version for Google Chrome version #{chrome_version}")
84
83
  end
85
84
  end
86
85
 
@@ -88,7 +87,7 @@ module Geordi
88
87
  _stdout_str, _error_str, status = Open3.capture3('unzip', '-d', output_dir, '-o', zip.path)
89
88
 
90
89
  unless status.success?
91
- raise("Could not unzip #{zip.path}")
90
+ Interaction.fail("Could not unzip #{zip.path}")
92
91
  end
93
92
  end
94
93
  end
data/lib/geordi/cli.rb CHANGED
@@ -5,7 +5,6 @@ require 'geordi/util'
5
5
 
6
6
  module Geordi
7
7
  class CLI < Thor
8
- include Geordi::Interaction
9
8
 
10
9
  def self.exit_on_failure?
11
10
  true
@@ -2,33 +2,33 @@ desc '-setup-vnc', 'Setup VNC for running Selenium tests there', hide: true
2
2
  def _setup_vnc
3
3
  `clear`
4
4
 
5
- note 'This script will help you install a VNC server and a VNC viewer.'
5
+ Interaction.note 'This script will help you install a VNC server and a VNC viewer.'
6
6
  puts
7
- puts strip_heredoc <<-TEXT
7
+ puts Util.strip_heredoc <<-TEXT
8
8
  With those you will be able to use our cucumber script without being
9
9
  disturbed by focus-stealing Selenium windows. Instead, they will open
10
10
  inside a VNC session.
11
11
 
12
12
  You can still inspect everything with:
13
13
  TEXT
14
- note_cmd 'geordi vnc'
14
+ Interaction.note_cmd 'geordi vnc'
15
15
  puts
16
- note 'Please open a second shell to execute instructions.'
17
- prompt 'Continue ...'
16
+ Interaction.note 'Please open a second shell to execute instructions.'
17
+ Interaction.prompt 'Continue ...'
18
18
 
19
- announce 'Setup VNC server'
19
+ Interaction.announce 'Setup VNC server'
20
20
 
21
21
  vnc_server_installed = system('which vncserver > /dev/null 2>&1')
22
22
  if vnc_server_installed
23
- success 'It appears you already have a VNC server installed. Good job!'
23
+ Interaction.success 'It appears you already have a VNC server installed. Good job!'
24
24
  else
25
25
  puts 'Please run:'
26
- note_cmd 'sudo apt-get install vnc4server'
27
- prompt 'Continue ...'
26
+ Interaction.note_cmd 'sudo apt-get install vnc4server'
27
+ Interaction.prompt 'Continue ...'
28
28
 
29
29
  puts
30
- note 'We will now set a password for your VNC server.'
31
- puts strip_heredoc <<-TEXT
30
+ Interaction.note 'We will now set a password for your VNC server.'
31
+ puts Util.strip_heredoc <<-TEXT
32
32
  When running our cucumber script, you will not actually need this
33
33
  password, and there is no security risk. However, if you start a vncserver
34
34
  without our cucumber script, a user with your password can connect to
@@ -36,31 +36,31 @@ def _setup_vnc
36
36
 
37
37
  TEXT
38
38
  puts 'Please run:'
39
- note_cmd 'vncserver :20'
40
- warn 'Enter a secure password!'
41
- prompt 'Continue ...'
39
+ Interaction.note_cmd 'vncserver :20'
40
+ Interaction.warn 'Enter a secure password!'
41
+ Interaction.prompt 'Continue ...'
42
42
 
43
43
  puts 'Now stop the server again. Please run:'
44
- note_cmd 'vncserver -kill :20'
45
- prompt 'Continue ...'
44
+ Interaction.note_cmd 'vncserver -kill :20'
45
+ Interaction.prompt 'Continue ...'
46
46
  end
47
47
 
48
- announce 'Setup VNC viewer'
48
+ Interaction.announce 'Setup VNC viewer'
49
49
 
50
50
  vnc_viewer_installed = system('which vncviewer > /dev/null 2>&1')
51
51
  if vnc_viewer_installed
52
- success 'It appears you already have a VNC viewer installed. Good job!'
52
+ Interaction.success 'It appears you already have a VNC viewer installed. Good job!'
53
53
  else
54
54
  puts 'Please run:'
55
- note_cmd 'sudo apt-get install xtightvncviewer'
56
- prompt 'Continue ...'
55
+ Interaction.note_cmd 'sudo apt-get install xtightvncviewer'
56
+ Interaction.prompt 'Continue ...'
57
57
  end
58
58
 
59
59
  puts
60
- puts strip_heredoc <<-TEXT
60
+ puts Util.strip_heredoc <<-TEXT
61
61
  All done. Our cucumber script will now automatically run Selenium features
62
62
  in VNC.
63
63
  TEXT
64
64
 
65
- success 'Happy cuking!'
65
+ Interaction.success 'Happy cuking!'
66
66
  end
@@ -1,7 +1,7 @@
1
1
  desc 'bundle-install', 'Run bundle install if required', hide: true
2
2
  def bundle_install
3
3
  if File.exist?('Gemfile') && !system('bundle check > /dev/null 2>&1')
4
- announce 'Bundling'
4
+ Interaction.announce 'Bundling'
5
5
  Util.system! 'bundle install'
6
6
  end
7
7
  end
@@ -6,16 +6,16 @@ LONGDESC
6
6
  def capistrano(*args)
7
7
  targets = Dir['config/deploy/*.rb'].map { |file| File.basename(file, '.rb') }.sort
8
8
 
9
- note 'Found the following deploy targets:'
9
+ Interaction.note 'Found the following deploy targets:'
10
10
  puts targets
11
- prompt('Continue?', 'n', /y|yes/) || raise('Cancelled.')
11
+ Interaction.prompt('Continue?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
12
12
 
13
13
  targets << nil if targets.empty? # default target
14
14
  targets.each do |stage|
15
- announce 'Target: ' + (stage || '(default)')
15
+ Interaction.announce 'Target: ' + (stage || '(default)')
16
16
 
17
17
  command = "bundle exec cap #{stage} " + args.join(' ')
18
- note_cmd command
18
+ Interaction.note_cmd command
19
19
 
20
20
  Util.system!(command, fail_message: 'Capistrano failed. Have a look!')
21
21
  end
@@ -1,14 +1,15 @@
1
1
  desc 'clean', 'Remove unneeded files from the current directory'
2
2
  def clean
3
- announce 'Removing tempfiles'
4
- %w[webrat-* capybara-* tmp/webrat-* tmp/capybara-* tmp/rtex/* log/*.log].each do |pattern|
5
- note pattern
3
+
4
+ Interaction.announce 'Removing tempfiles'
5
+ for pattern in %w[ webrat-* capybara-* tmp/webrat-* tmp/capybara-* tmp/rtex/* log/*.log ]
6
+ Interaction.note pattern
6
7
  puts `rm -vfR #{pattern}`
7
8
  end
8
9
 
9
- announce 'Finding recursively and removing backup files'
10
+ Interaction.announce 'Finding recursively and removing backup files'
10
11
  %w[*~].each do |pattern|
11
- note pattern
12
+ Interaction.note pattern
12
13
  `find . -name #{pattern} -exec rm {} ';'`
13
14
  end
14
15
  end
@@ -14,11 +14,11 @@ def console(target = 'development', *_args)
14
14
  if target == 'development'
15
15
  invoke_cmd 'yarn_install'
16
16
 
17
- announce 'Opening a local Rails console'
17
+ Interaction.announce 'Opening a local Rails console'
18
18
 
19
19
  Util.system! Util.console_command(target)
20
20
  else
21
- announce 'Opening a Rails console on ' + target
21
+ Interaction.announce 'Opening a Rails console on ' + target
22
22
 
23
23
  Geordi::Remote.new(target).console(options)
24
24
  end
@@ -4,7 +4,7 @@ def create_database_yml
4
4
  sample_yml = 'config/database.sample.yml'
5
5
 
6
6
  if File.exist?(sample_yml) && !File.exist?(real_yml)
7
- announce 'Creating ' + real_yml
7
+ Interaction.announce 'Creating ' + real_yml
8
8
 
9
9
  sample = File.read(sample_yml)
10
10
  adapter = sample.match(/adapter: (\w+)\n/).captures.first
@@ -15,6 +15,6 @@ def create_database_yml
15
15
  real = sample.gsub(/password:.*$/, "password: #{db_password}")
16
16
  File.open(real_yml, 'w') { |f| f.write(real) }
17
17
 
18
- note "Created #{real_yml}."
18
+ Interaction.note "Created #{real_yml}."
19
19
  end
20
20
  end
@@ -3,7 +3,7 @@ def create_databases
3
3
  invoke_cmd 'create_database_yml'
4
4
  invoke_cmd 'bundle_install'
5
5
 
6
- announce 'Creating databases'
6
+ Interaction.announce 'Creating databases'
7
7
 
8
8
  if File.exist?('config/database.yml')
9
9
  command = 'bundle exec rake db:create:all'
@@ -56,7 +56,7 @@ def cucumber(*args)
56
56
 
57
57
  # Serial run of @solo scenarios ############################################
58
58
  if files.any? { |f| f.include? ':' }
59
- note '@solo run skipped when called with line numbers' if options.verbose
59
+ Interaction.note '@solo run skipped when called with line numbers' if options.verbose
60
60
  else
61
61
  solo_files = if files.empty?
62
62
  'features' # Proper grepping
@@ -70,14 +70,14 @@ def cucumber(*args)
70
70
  solo_cmd_opts = cmd_opts.dup
71
71
  solo_cmd_opts << '--tags' << '@solo'
72
72
 
73
- announce 'Running @solo features'
73
+ Interaction.announce 'Running @solo features'
74
74
  solo_success = Geordi::Cucumber.new.run files, solo_cmd_opts, verbose: options.verbose, parallel: false
75
- solo_success || raise('Features failed.')
75
+ solo_success || Interaction.fail('Features failed.')
76
76
  end
77
77
  end
78
78
 
79
79
  # Parallel run of all given features + reruns ##############################
80
- announce 'Running features'
80
+ Interaction.announce 'Running features'
81
81
  normal_run_successful = Geordi::Cucumber.new.run(files, cmd_opts, verbose: options.verbose)
82
82
 
83
83
  unless normal_run_successful
@@ -85,16 +85,16 @@ def cucumber(*args)
85
85
 
86
86
  # Reruns
87
87
  (options.rerun + 1).times do |i|
88
- raise 'Features failed.' if i == options.rerun # All reruns done?
88
+ Interaction.fail 'Features failed.' if i == options.rerun # All reruns done?
89
89
 
90
- announce "Rerun ##{i + 1} of #{options.rerun}"
90
+ Interaction.announce "Rerun ##{i + 1} of #{options.rerun}"
91
91
  break if Geordi::Cucumber.new.run([], cmd_opts, verbose: options.verbose, parallel: false)
92
92
  end
93
93
  end
94
94
 
95
- success 'Features green.'
95
+ Interaction.success 'Features green.'
96
96
 
97
97
  else
98
- note 'Cucumber not employed.'
98
+ Interaction.note 'Cucumber not employed.'
99
99
  end
100
100
  end
@@ -20,24 +20,24 @@ def delete_dumps(dump_directory = nil)
20
20
  else
21
21
  [dump_directory]
22
22
  end
23
- announce 'Looking for *.dump in ' << dump_directories.join(',')
23
+ Interaction.announce 'Looking for *.dump in ' << dump_directories.join(',')
24
24
  dump_directories.each do |d|
25
25
  d_2 = File.expand_path(d)
26
26
  unless File.directory? File.realdirpath(d_2)
27
- warn "Directory #{d_2} does not exist"
27
+ Interaction.warn "Directory #{d_2} does not exist"
28
28
  next
29
29
  end
30
30
  deletable_dumps.concat(Dir.glob("#{d_2}/**/*.dump"))
31
31
  end
32
32
  if deletable_dumps.empty?
33
- success 'No dumps to delete' if deletable_dumps.empty?
33
+ Interaction.success 'No dumps to delete' if deletable_dumps.empty?
34
34
  exit 0
35
35
  end
36
36
  deletable_dumps.uniq!.sort!
37
- note 'The following dumps can be deleted:'
37
+ Interaction.note 'The following dumps can be deleted:'
38
38
  puts
39
39
  puts deletable_dumps
40
- prompt('Delete those dumps', 'n', /y|yes/) || raise('Cancelled.')
40
+ Interaction.prompt('Delete those dumps', 'n', /y|yes/) || raise('Cancelled.')
41
41
  deletable_dumps.each do |dump|
42
42
  File.delete dump unless File.directory? dump
43
43
  end
@@ -41,14 +41,14 @@ def deploy(target_stage = nil)
41
41
  if target_stage && (Util.deploy_targets.exclude? target_stage)
42
42
  # Target stage autocompletion from available stages
43
43
  target_stage = Util.deploy_targets.find { |t| t.start_with? target_stage }
44
- target_stage || warn('Given deployment stage not found')
44
+ target_stage || Interaction.warn('Given deployment stage not found')
45
45
  end
46
46
 
47
47
  # Ask for required information
48
- target_stage ||= prompt 'Deployment stage:', branch_stage_map.fetch(Util.current_branch, 'staging')
48
+ target_stage ||= Interaction.prompt 'Deployment stage:', branch_stage_map.fetch(Util.current_branch, 'staging')
49
49
  if options.current_branch
50
50
  stage_file = "config/deploy/#{target_stage}.rb"
51
- Util.file_containing?(stage_file, 'DEPLOY_BRANCH') || raise(<<-ERROR)
51
+ Util.file_containing?(stage_file, 'DEPLOY_BRANCH') || Interaction.fail(<<-ERROR)
52
52
  To deploy from the current branch, configure #{stage_file} to respect the
53
53
  environment variable DEPLOY_BRANCH. Example:
54
54
 
@@ -57,38 +57,38 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
57
57
 
58
58
  source_branch = target_branch = Util.current_branch
59
59
  else
60
- source_branch = prompt 'Source branch:', Util.current_branch
61
- target_branch = prompt 'Deploy branch:', branch_stage_map.invert.fetch(target_stage, 'master')
60
+ source_branch = Interaction.prompt 'Source branch:', Util.current_branch
61
+ target_branch = Interaction.prompt 'Deploy branch:', branch_stage_map.invert.fetch(target_stage, 'master')
62
62
  end
63
63
 
64
64
  merge_needed = (source_branch != target_branch)
65
65
  push_needed = merge_needed || `git cherry -v | wc -l`.strip.to_i > 0
66
66
  push_needed = false if Util.testing? # Hard to test
67
67
 
68
- announce "Checking whether your #{source_branch} branch is ready" ############
68
+ Interaction.announce "Checking whether your #{source_branch} branch is ready" ############
69
69
  Util.system! "git checkout #{source_branch}"
70
70
  if (`git status -s | wc -l`.strip != '0') && !Util.testing?
71
- warn "Your #{source_branch} branch holds uncommitted changes."
72
- prompt('Continue anyway?', 'n', /y|yes/) || raise('Cancelled.')
71
+ Interaction.warn "Your #{source_branch} branch holds uncommitted changes."
72
+ Interaction.prompt('Continue anyway?', 'n', /y|yes/) || raise('Cancelled.')
73
73
  else
74
- note 'All good.'
74
+ Interaction.note 'All good.'
75
75
  end
76
76
 
77
77
  if merge_needed
78
- announce "Checking what's in your #{target_branch} branch right now" #######
78
+ Interaction.announce "Checking what's in your #{target_branch} branch right now" #######
79
79
  Util.system! "git checkout #{target_branch} && git pull"
80
80
  end
81
81
 
82
- announce 'You are about to:' #################################################
83
- note "Merge branch #{source_branch} into #{target_branch}" if merge_needed
82
+ Interaction.announce 'You are about to:' #################################################
83
+ Interaction.note "Merge branch #{source_branch} into #{target_branch}" if merge_needed
84
84
  if push_needed
85
- note 'Push these commits:' if push_needed
85
+ Interaction.note 'Push these commits:' if push_needed
86
86
  Util.system! "git --no-pager log origin/#{target_branch}..#{source_branch} --oneline"
87
87
  end
88
- note "Deploy to #{target_stage}"
89
- note "From current branch #{source_branch}" if options.current_branch
88
+ Interaction.note "Deploy to #{target_stage}"
89
+ Interaction.note "From current branch #{source_branch}" if options.current_branch
90
90
 
91
- if prompt('Go ahead with the deployment?', 'n', /y|yes/)
91
+ if Interaction.prompt('Go ahead with the deployment?', 'n', /y|yes/)
92
92
  puts
93
93
  git_call = []
94
94
  git_call << "git merge #{source_branch}" if merge_needed
@@ -107,9 +107,9 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
107
107
 
108
108
  Util.system! capistrano_call, show_cmd: true
109
109
 
110
- success 'Deployment complete.'
110
+ Interaction.success 'Deployment complete.'
111
111
  else
112
112
  Util.system! "git checkout #{source_branch}"
113
- raise 'Deployment cancelled.'
113
+ Interaction.fail 'Deployment cancelled.'
114
114
  end
115
115
  end
@@ -28,7 +28,7 @@ option :mysql, banner: 'PORT_OR_SOCKET',
28
28
 
29
29
  def drop_databases
30
30
  require 'geordi/db_cleaner'
31
- raise '-P and -M are mutually exclusive' if options.postgres_only && options.mysql_only
31
+ Interaction.fail '-P and -M are mutually exclusive' if options.postgres_only && options.mysql_only
32
32
  mysql_flags = nil
33
33
  postgres_flags = nil
34
34
 
@@ -38,7 +38,7 @@ def drop_databases
38
38
  mysql_flags = "--port=#{mysql_port} --protocol=TCP"
39
39
  rescue AttributeError
40
40
  unless File.exist? options.mysql
41
- raise "Path #{options.mysql} is not a valid MySQL socket"
41
+ Interaction.fail "Path #{options.mysql} is not a valid MySQL socket"
42
42
  end
43
43
  mysql_flags = "--socket=#{options.mysql}"
44
44
  end
@@ -54,5 +54,5 @@ def drop_databases
54
54
  cleaner.clean_mysql unless options.postgres_only
55
55
  cleaner.clean_postgres unless options.mysql_only
56
56
 
57
- success 'Done.'
57
+ Interaction.success 'Done.'
58
58
  end
@@ -30,33 +30,33 @@ def dump(target = nil, *_args)
30
30
  if target.nil?
31
31
  if options.load
32
32
  # validate load option
33
- raise 'Missing a dump file.' if options.load == 'load'
33
+ Interaction.fail 'Missing a dump file.' if options.load == 'load'
34
34
  File.exist?(options.load) || raise('Could not find the given dump file: ' + options.load)
35
35
 
36
36
  loader = DumpLoader.new(options.load)
37
37
 
38
- announce "Sourcing dump into the #{loader.config['database']} db"
38
+ Interaction.announce "Sourcing dump into the #{loader.config['database']} db"
39
39
  loader.load
40
40
 
41
- success "Your #{loader.config['database']} database has now the data of #{options.load}."
41
+ Interaction.success "Your #{loader.config['database']} database has now the data of #{options.load}."
42
42
 
43
43
  else
44
- announce 'Dumping the development database'
44
+ Interaction.announce 'Dumping the development database'
45
45
  Util.system! 'dumple development'
46
- success 'Successfully dumped the development database.'
46
+ Interaction.success 'Successfully dumped the development database.'
47
47
  end
48
48
 
49
49
  else
50
- announce 'Dumping the database of ' + target
50
+ Interaction.announce 'Dumping the database of ' + target
51
51
  dump_path = Geordi::Remote.new(target).dump(options)
52
52
 
53
53
  if options.load
54
54
  loader = DumpLoader.new(dump_path)
55
55
 
56
- announce "Sourcing dump into the #{loader.config['database']} db"
56
+ Interaction.announce "Sourcing dump into the #{loader.config['database']} db"
57
57
  loader.load
58
58
 
59
- success "Your #{loader.config['database']} database has now the data of #{target}."
59
+ Interaction.success "Your #{loader.config['database']} database has now the data of #{target}."
60
60
  end
61
61
  end
62
62
  end
@@ -15,7 +15,7 @@ option :setup, banner: 'FIREFOX_VERSION',
15
15
 
16
16
  def firefox(*command)
17
17
  if options.setup
18
- raise 'Firefox version required (e.g. --setup 24.0)' if options.setup == 'setup'
18
+ Interaction.fail 'Firefox version required (e.g. --setup 24.0)' if options.setup == 'setup'
19
19
 
20
20
  require 'geordi/firefox_for_selenium'
21
21
  Geordi::FirefoxForSelenium.install(options.setup)
@@ -27,7 +27,7 @@ def firefox(*command)
27
27
  FirefoxForSelenium.setup_firefox
28
28
 
29
29
  puts
30
- note_cmd command.join(' ')
30
+ Interaction.note_cmd command.join(' ')
31
31
  system *command # Util.system! would reset the Firefox PATH
32
32
  end
33
33
  end
@@ -10,11 +10,11 @@ LONGDESC
10
10
  def migrate
11
11
  invoke_cmd 'bundle_install'
12
12
  invoke_cmd 'yarn_install'
13
- announce 'Migrating'
13
+ Interaction.announce 'Migrating'
14
14
 
15
15
  if File.directory?('db/migrate')
16
16
  if Util.file_containing?('Gemfile', /parallel_tests/)
17
- note 'Development and parallel test databases'
17
+ Interaction.note 'Development and parallel test databases'
18
18
  puts
19
19
 
20
20
  Util.system! 'bundle exec rake db:migrate parallel:prepare'
@@ -22,6 +22,6 @@ def migrate
22
22
  invoke_cmd 'rake', 'db:migrate'
23
23
  end
24
24
  else
25
- note 'No migrations directory found.'
25
+ Interaction.note 'No migrations directory found.'
26
26
  end
27
27
  end
@@ -10,10 +10,10 @@ LONGDESC
10
10
  def png_optimize(path)
11
11
  require 'fileutils'
12
12
 
13
- announce 'Optimizing .png files'
13
+ Interaction.announce 'Optimizing .png files'
14
14
 
15
15
  if `which pngcrush`.strip.empty?
16
- raise 'Please install pngcrush first (sudo apt-get install pngcrush)'
16
+ Interaction.fail 'Please install pngcrush first (sudo apt-get install pngcrush)'
17
17
  end
18
18
 
19
19
  po = PngOptimizer.new
@@ -22,10 +22,10 @@ def png_optimize(path)
22
22
  elsif File.file?(path)
23
23
  po.optimize_inplace(path)
24
24
  else
25
- raise 'Neither directory nor file: ' + path
25
+ Interaction.fail 'Neither directory nor file: ' + path
26
26
  end
27
27
 
28
- success 'PNG optimization completed.'
28
+ Interaction.success 'PNG optimization completed.'
29
29
  end
30
30
 
31
31
  class PngOptimizer
@@ -64,7 +64,7 @@ class PngOptimizer
64
64
  FileUtils.rm(input_file)
65
65
  FileUtils.mv(temp_file.to_s, input_file.to_s)
66
66
  else
67
- raise 'Error:' + $CHILD_STATUS
67
+ Interaction.fail 'Error:' + $?
68
68
  end
69
69
  end
70
70
 
@@ -13,7 +13,7 @@ def rake(*args)
13
13
  %w[development test cucumber].each do |env| # update long_desc when changing this
14
14
  if File.exist? "config/environments/#{env}.rb"
15
15
  call = %w[bundle exec rake] + args + ["RAILS_ENV=#{env}"]
16
- note_cmd call.join(' ')
16
+ Interaction.note_cmd call.join(' ')
17
17
 
18
18
  Util.system! *call
19
19
  end
@@ -1,13 +1,13 @@
1
1
  desc 'remove-executable-flags', 'Remove executable-flags from files that should not be executable'
2
2
  def remove_executable_flags
3
- announce 'Removing executable-flags'
3
+ Interaction.announce 'Removing executable-flags'
4
4
 
5
5
  patterns = %w[
6
6
  *.rb *.html *.erb *.haml *.yml *.css *.sass *.rake *.png *.jpg
7
7
  *.gif *.pdf *.txt *.rdoc *.feature Rakefile VERSION README Capfile
8
8
  ]
9
9
  patterns.each do |pattern|
10
- note pattern
10
+ Interaction.note pattern
11
11
  `find . -name "#{pattern}" -exec chmod -x {} ';'`
12
12
  end
13
13
  puts 'Done.'