geordi 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
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
data/lib/geordi/remote.rb CHANGED
@@ -6,7 +6,6 @@ require 'pathname'
6
6
 
7
7
  module Geordi
8
8
  class Remote
9
- include Geordi::Interaction
10
9
 
11
10
  REMOTE_DUMP_PATH = '~/dumps/dump_for_download.dump'.freeze
12
11
 
@@ -43,11 +42,11 @@ module Geordi
43
42
  destination_path = File.join(destination_directory, "#{@stage}.dump")
44
43
  relative_destination = Pathname.new(destination_path).relative_path_from Pathname.new(@config.root)
45
44
 
46
- note "Downloading remote dump to #{relative_destination} ..."
45
+ Interaction.note "Downloading remote dump to #{relative_destination} ..."
47
46
  server = @config.primary_server
48
47
  Util.system! "scp -C #{@config.user(server)}@#{server}:#{REMOTE_DUMP_PATH} #{destination_path}"
49
48
 
50
- success "Dumped the #{@stage} database to #{relative_destination}."
49
+ Interaction.success "Dumped the #{@stage} database to #{relative_destination}."
51
50
 
52
51
  destination_path
53
52
  end
@@ -62,7 +61,7 @@ module Geordi
62
61
  remote_command = "cd #{@config.remote_root} && #{@config.shell}"
63
62
  remote_command << " -c '#{options[:remote_command]}'" if options[:remote_command]
64
63
 
65
- note 'Connecting to ' + server.to_s
64
+ Interaction.note 'Connecting to ' + server.to_s
66
65
  Util.system! 'ssh', "#{@config.user(server)}@#{server}", '-t', remote_command
67
66
  end
68
67
 
data/lib/geordi/util.rb CHANGED
@@ -4,7 +4,6 @@ require 'socket'
4
4
  module Geordi
5
5
  class Util
6
6
  class << self
7
- include Geordi::Interaction
8
7
 
9
8
  # Geordi commands sometimes require external gems. However, we don't want
10
9
  # all employed gems as runtime dependencies because that would
@@ -20,13 +19,13 @@ module Geordi
20
19
  install_command = 'gem install ' + gem_name
21
20
 
22
21
  # install missing gem
23
- warn 'Probably missing gem: ' + gem_name
24
- prompt('Install it now?', 'y', /y|yes/) || raise('Missing Gems.')
22
+ Interaction.warn 'Probably missing gem: ' + gem_name
23
+ Interaction.prompt('Install it now?', 'y', /y|yes/) || Interaction.fail('Missing Gems.')
25
24
  system! install_command, show_cmd: true
26
25
 
27
26
  # retry
28
27
  Gem.clear_paths
29
- note 'Retrying ...'
28
+ Interaction.note 'Retrying ...'
30
29
  require gem_name
31
30
  retry
32
31
  end
@@ -39,10 +38,10 @@ module Geordi
39
38
  # @option fail_message: The text to print on command failure
40
39
  def system!(*commands)
41
40
  options = commands.last.is_a?(Hash) ? commands.pop : {}
42
- note_cmd commands.join(' ') if options[:show_cmd]
41
+ Interaction.note_cmd commands.join(' ') if options[:show_cmd]
43
42
 
44
43
  if options[:confirm]
45
- prompt('Run this now?', 'n', /y|yes/) || raise('Cancelled.')
44
+ Interaction.prompt('Run this now?', 'n', /y|yes/) or Interaction.fail('Cancelled.')
46
45
  end
47
46
 
48
47
  if testing?
@@ -59,7 +58,7 @@ module Geordi
59
58
  Bundler.clean_system(*commands)
60
59
  end
61
60
 
62
- success || raise(options[:fail_message] || 'Something went wrong.')
61
+ success || Interaction.fail(options[:fail_message] || 'Something went wrong.')
63
62
  end
64
63
  end
65
64
 
@@ -118,7 +117,7 @@ module Geordi
118
117
  # check if given cmd is executable. Absolute path or command in $PATH allowed.
119
118
  def cmd_exists?(cmd)
120
119
  system("which #{cmd} > /dev/null")
121
- $CHILD_STATUS.exitstatus.zero?
120
+ $?.exitstatus.zero?
122
121
  end
123
122
 
124
123
  def is_port_open?(port)
@@ -167,6 +166,12 @@ module Geordi
167
166
  !!ENV['GEORDI_TESTING']
168
167
  end
169
168
 
169
+ def strip_heredoc(string)
170
+ leading_whitespace = (string.match(/\A( +)[^ ]+/) || [])[1]
171
+ string.gsub! /^#{leading_whitespace}/, '' if leading_whitespace
172
+ string
173
+ end
174
+
170
175
  private
171
176
 
172
177
  def bundle_list
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-04 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubygems_version: 3.0.8
147
+ rubygems_version: 3.1.3
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Collection of command line tools we use in our daily work with Ruby, Rails