geordi 3.2.0 → 4.2.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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +5 -0
  4. data/CHANGELOG.md +69 -1
  5. data/Gemfile +2 -1
  6. data/Gemfile.lock +46 -28
  7. data/README.md +132 -140
  8. data/Rakefile +19 -9
  9. data/exe/dumple +19 -4
  10. data/geordi.gemspec +3 -2
  11. data/lib/geordi/COMMAND_TEMPLATE +4 -2
  12. data/lib/geordi/chromedriver_updater.rb +2 -2
  13. data/lib/geordi/cli.rb +1 -1
  14. data/lib/geordi/commands/bundle_install.rb +1 -1
  15. data/lib/geordi/commands/capistrano.rb +1 -1
  16. data/lib/geordi/commands/chromedriver_update.rb +10 -3
  17. data/lib/geordi/commands/commit.rb +0 -5
  18. data/lib/geordi/commands/console.rb +11 -13
  19. data/lib/geordi/commands/create_databases.rb +7 -5
  20. data/lib/geordi/commands/cucumber.rb +22 -19
  21. data/lib/geordi/commands/delete_dumps.rb +0 -1
  22. data/lib/geordi/commands/deploy.rb +17 -17
  23. data/lib/geordi/commands/drop_databases.rb +0 -6
  24. data/lib/geordi/commands/dump.rb +20 -18
  25. data/lib/geordi/commands/firefox.rb +3 -6
  26. data/lib/geordi/commands/migrate.rb +4 -4
  27. data/lib/geordi/commands/rake.rb +7 -3
  28. data/lib/geordi/commands/rspec.rb +8 -12
  29. data/lib/geordi/commands/security_update.rb +24 -25
  30. data/lib/geordi/commands/server.rb +4 -4
  31. data/lib/geordi/commands/setup.rb +7 -16
  32. data/lib/geordi/commands/shell.rb +7 -8
  33. data/lib/geordi/commands/tests.rb +4 -4
  34. data/lib/geordi/commands/unit.rb +3 -3
  35. data/lib/geordi/commands/update.rb +4 -15
  36. data/lib/geordi/commands/vnc.rb +2 -4
  37. data/lib/geordi/commands/with_rake.rb +3 -3
  38. data/lib/geordi/commands/yarn_install.rb +1 -1
  39. data/lib/geordi/cucumber.rb +3 -3
  40. data/lib/geordi/dump_loader.rb +1 -1
  41. data/lib/geordi/gitpt.rb +1 -1
  42. data/lib/geordi/interaction.rb +1 -1
  43. data/lib/geordi/remote.rb +5 -4
  44. data/lib/geordi/settings.rb +11 -2
  45. data/lib/geordi/util.rb +35 -17
  46. data/lib/geordi/version.rb +1 -1
  47. metadata +7 -34
  48. data/exe/cap-all +0 -4
  49. data/exe/console-for +0 -4
  50. data/exe/cuc +0 -4
  51. data/exe/cuc-show +0 -4
  52. data/exe/cuc-vnc-setup +0 -4
  53. data/exe/deploy-to-production +0 -4
  54. data/exe/dump-for +0 -8
  55. data/exe/gitpt +0 -4
  56. data/exe/load-dump +0 -4
  57. data/exe/migrate-all +0 -4
  58. data/exe/rs +0 -4
  59. data/exe/run_tests +0 -4
  60. data/exe/shell-for +0 -4
  61. data/exe/tests +0 -4
  62. data/lib/geordi/commands/eurest.rb +0 -4
@@ -4,15 +4,13 @@ Example: `geordi vnc` or `geordi vnc --setup`
4
4
 
5
5
  Launch a VNC session to the hidden screen where `geordi cucumber` runs Selenium
6
6
  tests.
7
-
8
- When called with `--setup`, will guide through the setup of VNC.
9
7
  LONGDESC
10
8
 
11
- option :setup, type: :boolean
9
+ option :setup, type: :boolean, desc: 'Guide through the setup of VNC'
12
10
 
13
11
  def vnc
14
12
  if options.setup
15
- invoke_cmd :_setup_vnc
13
+ invoke_geordi :_setup_vnc
16
14
  else
17
15
  require 'geordi/cucumber'
18
16
  Geordi::Cucumber.new.launch_vnc_viewer
@@ -1,11 +1,11 @@
1
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
- invoke_cmd 'bundle_install'
5
- invoke_cmd 'yarn_install'
4
+ invoke_geordi 'bundle_install'
5
+ invoke_geordi 'yarn_install'
6
6
 
7
7
  Interaction.announce 'Running tests with `rake`'
8
- Util.system! 'rake'
8
+ Util.run!(Util.binstub_or_fallback('rake'))
9
9
  else
10
10
  Interaction.note '`rake` does not run tests.'
11
11
  :did_not_perform
@@ -3,6 +3,6 @@ desc 'yarn-install', 'Runs yarn install if required', hide: true
3
3
  def yarn_install
4
4
  if File.exist?('package.json') && !system('yarn check --integrity > /dev/null 2>&1')
5
5
  Interaction.announce 'Yarn install'
6
- Util.system! 'yarn install'
6
+ Util.run!('yarn install')
7
7
  end
8
8
  end
@@ -27,7 +27,7 @@ module Geordi
27
27
  Interaction.note_cmd(command) if options[:verbose]
28
28
 
29
29
  puts # Make newline
30
- system command # Util.system! would reset the Firefox PATH
30
+ system command # Util.run! would reset the Firefox PATH
31
31
  end
32
32
 
33
33
  def launch_vnc_viewer
@@ -74,7 +74,7 @@ module Geordi
74
74
  unless argv.include?('--format') || argv.include?('-f')
75
75
  format_args = spinner_available? ? ['--format', 'CucumberSpinner::CuriousProgressBarFormatter'] : ['--format', 'progress']
76
76
  end
77
- [use_firefox_for_selenium, 'b', 'cucumber', format_args, escape_shell_args(argv)].flatten.compact.join(' ')
77
+ [use_firefox_for_selenium, Util.binstub_or_fallback('cucumber'), format_args, escape_shell_args(argv)].flatten.compact.join(' ')
78
78
  end
79
79
 
80
80
  def parallel_execution_command
@@ -87,7 +87,7 @@ module Geordi
87
87
 
88
88
  [
89
89
  use_firefox_for_selenium,
90
- 'b parallel_test -t ' + type_arg,
90
+ 'bundle exec parallel_test -t ' + type_arg,
91
91
  %(-o '#{command_line_options.join(' ')} --tags "#{not_tag('@solo')}"'),
92
92
  "-- #{features.join(' ')}",
93
93
  ].compact.join(' ')
@@ -57,7 +57,7 @@ module Geordi
57
57
  Interaction.note 'Source file: ' + dump_file
58
58
 
59
59
  source_command = send("#{config['adapter']}_command")
60
- Util.system! source_command, fail_message: "An error occured loading #{File.basename(dump_file)}"
60
+ Util.run! source_command, fail_message: "An error occured loading #{File.basename(dump_file)}"
61
61
  end
62
62
 
63
63
  end
@@ -89,7 +89,7 @@ No staged changes. Will create an empty commit.
89
89
  extra = highline.ask("\nAdd an optional message").strip
90
90
  message << ' - ' << extra if extra != ''
91
91
 
92
- Geordi::Util.system! 'git', 'commit', '--allow-empty', '-m', message, *git_args
92
+ Geordi::Util.run!(['git', 'commit', '--allow-empty', '-m', message, *git_args])
93
93
  end
94
94
 
95
95
  def bold(string)
@@ -24,7 +24,7 @@ module Geordi
24
24
  end
25
25
 
26
26
  # Like `note`, but pink. Use to print (bash) commands.
27
- # Also see Util.system!
27
+ # Also see Util.run!
28
28
  def note_cmd(text)
29
29
  message = "> #{text}"
30
30
  puts "\e[35m#{message}\e[0m" # pink
@@ -31,9 +31,10 @@ module Geordi
31
31
  end
32
32
 
33
33
  def dump(options = {})
34
+ database = options[:database] ? " #{options[:database]}" : ''
34
35
  # Generate dump on the server
35
36
  shell options.merge({
36
- remote_command: "dumple #{@config.env} --for_download",
37
+ remote_command: "dumple #{@config.env}#{database} --for_download",
37
38
  })
38
39
 
39
40
  destination_directory = File.join(@config.root, 'tmp')
@@ -43,9 +44,9 @@ module Geordi
43
44
 
44
45
  Interaction.note "Downloading remote dump to #{relative_destination} ..."
45
46
  server = @config.primary_server
46
- Util.system! "scp -C #{@config.user(server)}@#{server}:#{REMOTE_DUMP_PATH} #{destination_path}"
47
+ Util.run!("scp -C #{@config.user(server)}@#{server}:#{REMOTE_DUMP_PATH} #{destination_path}")
47
48
 
48
- Interaction.success "Dumped the #{@stage} database to #{relative_destination}."
49
+ Interaction.success "Dumped the#{database} #{@stage} database to #{relative_destination}."
49
50
 
50
51
  destination_path
51
52
  end
@@ -74,7 +75,7 @@ module Geordi
74
75
  remote_command << " -c '#{options[:remote_command]}'" if options[:remote_command]
75
76
 
76
77
  Interaction.note 'Connecting to ' + server.to_s
77
- Util.system! 'ssh', "#{@config.user(server)}@#{server}", '-t', remote_command
78
+ Util.run!(['ssh', "#{@config.user(server)}@#{server}", '-t', remote_command])
78
79
  end
79
80
 
80
81
  end
@@ -8,7 +8,7 @@ module Geordi
8
8
  GLOBAL_SETTINGS_FILE_NAME = Util.testing? ? './tmp/global_settings.yml'.freeze : File.join(ENV['HOME'], '.config/geordi/global.yml').freeze
9
9
  LOCAL_SETTINGS_FILE_NAME = Util.testing? ? './tmp/local_settings.yml'.freeze : './.geordi.yml'.freeze
10
10
 
11
- ALLOWED_GLOBAL_SETTINGS = %w[ pivotal_tracker_api_key ].freeze
11
+ ALLOWED_GLOBAL_SETTINGS = %w[ pivotal_tracker_api_key auto_update_chromedriver ].freeze
12
12
  ALLOWED_LOCAL_SETTINGS = %w[ use_vnc pivotal_tracker_project_ids ].freeze
13
13
 
14
14
  def initialize
@@ -25,6 +25,15 @@ module Geordi
25
25
  save_global_settings
26
26
  end
27
27
 
28
+ def auto_update_chromedriver
29
+ @global_settings["auto_update_chromedriver"] || false
30
+ end
31
+
32
+ def auto_update_chromedriver=(value)
33
+ @global_settings['auto_update_chromedriver'] = value
34
+ save_global_settings
35
+ end
36
+
28
37
  # Local settings
29
38
  # They should not be changed by geordi to avoid unexpected diffs, therefore
30
39
  # there are no setters for these settings
@@ -129,7 +138,7 @@ module Geordi
129
138
  def inquire_pt_api_key
130
139
  Geordi::Interaction.warn 'Your settings are missing or invalid.'
131
140
  Geordi::Interaction.warn "Please configure your Pivotal Tracker access."
132
- token = Geordi::Interaction.prompt 'Your API key:'
141
+ token = Geordi::Interaction.prompt('Your API key:').to_s # Just be sure
133
142
  self.pivotal_tracker_api_key = token
134
143
  puts
135
144
 
@@ -21,7 +21,7 @@ module Geordi
21
21
  # install missing gem
22
22
  Interaction.warn 'Probably missing gem: ' + gem_name
23
23
  Interaction.prompt('Install it now?', 'y', /y|yes/) || Interaction.fail('Missing Gems.')
24
- system! install_command, show_cmd: true
24
+ Util.run!(install_command, show_cmd: true)
25
25
 
26
26
  # retry
27
27
  Gem.clear_paths
@@ -33,42 +33,60 @@ module Geordi
33
33
  # Run a command with a clean environment.
34
34
  # Print an error message and exit if the command fails.
35
35
  #
36
- # @option show_cmd: Whether to print the command
37
- # @option confirm: Whether to ask for confirmation before running it
38
- # @option fail_message: The text to print on command failure
39
- def system!(*commands)
40
- options = commands.last.is_a?(Hash) ? commands.pop : {}
41
- Interaction.note_cmd commands.join(' ') if options[:show_cmd]
42
-
43
- if options[:confirm]
36
+ # show_cmd: Whether to print the command
37
+ # confirm: Whether to ask for confirmation before running it
38
+ # fail_message: The text to print on command failure
39
+ def run!(command, show_cmd: false, confirm: false, fail_message: 'Something went wrong.')
40
+ # Disable shell features for arrays https://stackoverflow.com/questions/13338147/ruby-system-method-arguments
41
+ # Conversion: ['ls *', 'some arg'] => ['ls', '*', 'some arg']
42
+ # If you need shell features, you need to pass in a String instead of an array.
43
+ if command.is_a?(Array)
44
+ real_command, *arguments = *command
45
+ command = [real_command.split(' '), arguments].flatten
46
+ printable_command = command.join(', ')
47
+ else
48
+ printable_command = command
49
+ end
50
+
51
+ if show_cmd
52
+ Interaction.note_cmd printable_command
53
+ end
54
+
55
+ if confirm
44
56
  Interaction.prompt('Run this now?', 'n', /y|yes/) or Interaction.fail('Cancelled.')
45
57
  end
46
58
 
47
59
  if testing?
48
- puts "Util.system! #{commands.join ', '}"
60
+ puts "Util.run! #{printable_command}"
49
61
  else
50
62
  # Remove Geordi's Bundler environment when running commands.
51
63
  success = if !defined?(Bundler)
52
- system(*commands)
64
+ system(*command)
53
65
  elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.1.2')
54
66
  Bundler.with_original_env do
55
- system(*commands)
67
+ system(*command)
56
68
  end
57
69
  else
58
- Bundler.clean_system(*commands)
70
+ Bundler.clean_system(*command)
59
71
  end
60
72
 
61
- success || Interaction.fail(options[:fail_message] || 'Something went wrong.')
73
+ success || Interaction.fail(fail_message)
62
74
  end
63
75
  end
64
76
 
77
+ def binstub_or_fallback(executable)
78
+ binstub_file = "bin/#{executable}"
79
+
80
+ File.exists?(binstub_file) ? binstub_file : "bundle exec #{executable}"
81
+ end
82
+
65
83
  def console_command(environment)
66
84
  if gem_major_version('rails') == 2
67
85
  'script/console ' + environment
68
86
  elsif gem_major_version('rails') == 3
69
- 'bundle exec rails console ' + environment
87
+ "#{binstub_or_fallback('rails')} console #{environment}"
70
88
  else
71
- "bundle exec rails console -e #{environment}"
89
+ "#{binstub_or_fallback('rails')} console -e #{environment}"
72
90
  end
73
91
  end
74
92
 
@@ -76,7 +94,7 @@ module Geordi
76
94
  if gem_major_version('rails') == 2
77
95
  'script/server ""'
78
96
  else
79
- 'bundle exec rails server'
97
+ "#{binstub_or_fallback('rails')} server"
80
98
  end
81
99
  end
82
100
 
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '3.2.0'.freeze
2
+ VERSION = '4.2.0'.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.2.0
4
+ version: 4.2.0
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-07-15 00:00:00.000000000 Z
11
+ date: 2020-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -30,23 +30,9 @@ email:
30
30
  - henning.koch@makandra.de
31
31
  executables:
32
32
  - b
33
- - cap-all
34
- - console-for
35
- - cuc
36
- - cuc-show
37
- - cuc-vnc-setup
38
- - deploy-to-production
39
- - dump-for
40
33
  - dumple
41
34
  - geordi
42
- - gitpt
43
35
  - launchy_browser
44
- - load-dump
45
- - migrate-all
46
- - rs
47
- - run_tests
48
- - shell-for
49
- - tests
50
36
  extensions: []
51
37
  extra_rdoc_files: []
52
38
  files:
@@ -60,23 +46,9 @@ files:
60
46
  - README.md
61
47
  - Rakefile
62
48
  - exe/b
63
- - exe/cap-all
64
- - exe/console-for
65
- - exe/cuc
66
- - exe/cuc-show
67
- - exe/cuc-vnc-setup
68
- - exe/deploy-to-production
69
- - exe/dump-for
70
49
  - exe/dumple
71
50
  - exe/geordi
72
- - exe/gitpt
73
51
  - exe/launchy_browser
74
- - exe/load-dump
75
- - exe/migrate-all
76
- - exe/rs
77
- - exe/run_tests
78
- - exe/shell-for
79
- - exe/tests
80
52
  - geordi.gemspec
81
53
  - lib/geordi.rb
82
54
  - lib/geordi/COMMAND_TEMPLATE
@@ -98,7 +70,6 @@ files:
98
70
  - lib/geordi/commands/deploy.rb
99
71
  - lib/geordi/commands/drop_databases.rb
100
72
  - lib/geordi/commands/dump.rb
101
- - lib/geordi/commands/eurest.rb
102
73
  - lib/geordi/commands/firefox.rb
103
74
  - lib/geordi/commands/migrate.rb
104
75
  - lib/geordi/commands/png_optimize.rb
@@ -126,11 +97,13 @@ files:
126
97
  - lib/geordi/settings.rb
127
98
  - lib/geordi/util.rb
128
99
  - lib/geordi/version.rb
129
- homepage: http://makandra.com
100
+ homepage: https://makandra.com
130
101
  licenses:
131
102
  - MIT
132
103
  metadata: {}
133
- post_install_message: "* Binary `geordi` installed\n"
104
+ post_install_message: |
105
+ * Binary `geordi` installed
106
+ * Geordi 4 has removed its deprecated executables. If you want to invoke these commands like before, you may create aliases on your machine. For the alias mapping, please refer to https://github.com/makandra/geordi/commit/68fa92acb146ebde3acb92d7b9556bd4eaa2b4ff
134
107
  rdoc_options: []
135
108
  require_paths:
136
109
  - lib
@@ -145,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
118
  - !ruby/object:Gem::Version
146
119
  version: '0'
147
120
  requirements: []
148
- rubygems_version: 3.0.3
121
+ rubygems_version: 3.1.4
149
122
  signing_key:
150
123
  specification_version: 4
151
124
  summary: Collection of command line tools we use in our daily work with Ruby, Rails
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi ca[pistrano]` instead'
4
- exec 'geordi', 'capistrano', *ARGV
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi con[sole]` instead'
4
- exec 'geordi', 'console', *ARGV
data/exe/cuc DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi cu[cumber]` instead'
4
- exec 'geordi', 'cucumber', *ARGV
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi vn[c]` instead'
4
- exec 'geordi', 'vnc'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi vn[c] --setup` instead'
4
- exec 'geordi', 'vnc', '--setup'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi dep[loy]` instead'
4
- exec 'geordi', 'deploy'
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- if (i = ARGV.index '-s')
4
- ARGV[i] = '-l'
5
- end
6
-
7
- puts 'DEPRECATED: Use `geordi du[mp]` instead'
8
- exec 'geordi', 'dump', *ARGV
data/exe/gitpt DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi com[mit]` instead'
4
- exec 'geordi', 'commit'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi du[mp] -l` instead'
4
- exec 'geordi', 'dump', '-l', *ARGV
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi m[igrate]` instead'
4
- exec 'geordi', 'migrate'
data/exe/rs DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi rs[pec]` instead'
4
- exec 'geordi', 'rspec', *ARGV
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi f[irefox]` instead'
4
- exec 'geordi', 'firefox', *ARGV
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi sh[ell]` instead'
4
- exec 'geordi', 'shell', *ARGV
data/exe/tests DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts 'DEPRECATED: Use `geordi t[est]` instead'
4
- exec 'geordi', 'test'