geordi 4.1.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +48 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +49 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +46 -28
- data/README.md +21 -4
- data/Rakefile +1 -1
- data/exe/dumple +9 -4
- data/geordi.gemspec +4 -4
- data/lib/geordi/COMMAND_TEMPLATE +1 -1
- data/lib/geordi/chromedriver_updater.rb +2 -2
- data/lib/geordi/cli.rb +1 -1
- data/lib/geordi/commands/_setup_vnc.rb +8 -10
- data/lib/geordi/commands/bundle_install.rb +1 -1
- data/lib/geordi/commands/capistrano.rb +1 -1
- data/lib/geordi/commands/chromedriver_update.rb +8 -1
- data/lib/geordi/commands/commit.rb +0 -4
- data/lib/geordi/commands/console.rb +4 -3
- data/lib/geordi/commands/create_database_yml.rb +1 -1
- data/lib/geordi/commands/create_databases.rb +7 -6
- data/lib/geordi/commands/cucumber.rb +9 -4
- data/lib/geordi/commands/deploy.rb +7 -7
- data/lib/geordi/commands/dump.rb +14 -4
- data/lib/geordi/commands/firefox.rb +1 -1
- data/lib/geordi/commands/migrate.rb +4 -4
- data/lib/geordi/commands/rake.rb +6 -4
- data/lib/geordi/commands/rspec.rb +5 -5
- data/lib/geordi/commands/security_update.rb +10 -10
- data/lib/geordi/commands/server.rb +3 -3
- data/lib/geordi/commands/setup.rb +5 -5
- data/lib/geordi/commands/shell.rb +1 -1
- data/lib/geordi/commands/tests.rb +4 -4
- data/lib/geordi/commands/unit.rb +3 -3
- data/lib/geordi/commands/update.rb +4 -4
- data/lib/geordi/commands/vnc.rb +1 -1
- data/lib/geordi/commands/with_rake.rb +3 -3
- data/lib/geordi/commands/yarn_install.rb +1 -1
- data/lib/geordi/cucumber.rb +5 -4
- data/lib/geordi/dump_loader.rb +1 -1
- data/lib/geordi/gitpt.rb +1 -1
- data/lib/geordi/interaction.rb +1 -1
- data/lib/geordi/remote.rb +5 -4
- data/lib/geordi/settings.rb +11 -2
- data/lib/geordi/util.rb +33 -21
- data/lib/geordi/version.rb +1 -1
- metadata +6 -6
- data/.travis.yml +0 -23
data/lib/geordi/commands/unit.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
desc 'unit', 'Run Test::Unit'
|
2
2
|
def unit
|
3
3
|
if File.exist?('test/test_helper.rb')
|
4
|
-
|
5
|
-
|
4
|
+
invoke_geordi 'bundle_install'
|
5
|
+
invoke_geordi 'yarn_install'
|
6
6
|
|
7
7
|
Interaction.announce 'Running Test::Unit'
|
8
|
-
Util.
|
8
|
+
Util.run!([Util.binstub_or_fallback('rake'), 'test'])
|
9
9
|
else
|
10
10
|
Interaction.note 'Test::Unit not employed.'
|
11
11
|
end
|
@@ -11,12 +11,12 @@ option :test, type: :boolean, aliases: '-t', desc: 'After updating, run tests'
|
|
11
11
|
|
12
12
|
def update
|
13
13
|
Interaction.announce 'Updating repository'
|
14
|
-
Util.
|
14
|
+
Util.run!('git pull', show_cmd: true)
|
15
15
|
|
16
|
-
|
16
|
+
invoke_geordi 'migrate'
|
17
17
|
|
18
18
|
Interaction.success 'Successfully updated the project.'
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
invoke_geordi 'dump', options.dump, load: true if options.dump
|
21
|
+
invoke_geordi 'tests' if options.test
|
22
22
|
end
|
data/lib/geordi/commands/vnc.rb
CHANGED
@@ -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
|
-
|
5
|
-
|
4
|
+
invoke_geordi 'bundle_install'
|
5
|
+
invoke_geordi 'yarn_install'
|
6
6
|
|
7
7
|
Interaction.announce 'Running tests with `rake`'
|
8
|
-
Util.
|
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.
|
6
|
+
Util.run!('yarn install')
|
7
7
|
end
|
8
8
|
end
|
data/lib/geordi/cucumber.rb
CHANGED
@@ -11,8 +11,9 @@ module Geordi
|
|
11
11
|
class Cucumber
|
12
12
|
|
13
13
|
VNC_DISPLAY = ':17'.freeze
|
14
|
-
|
15
|
-
|
14
|
+
VNC_PASSWORD_FILE = File.absolute_path('~/.vnc/passwd').freeze # default for "vncpasswd"
|
15
|
+
VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} -localhost -nolisten tcp -geometry 1280x1024 -rfbauth #{VNC_PASSWORD_FILE}".freeze
|
16
|
+
VNC_VIEWER_COMMAND = "vncviewer #{VNC_DISPLAY} -passwd #{VNC_PASSWORD_FILE}".freeze
|
16
17
|
VNC_ENV_VARIABLES = %w[DISPLAY BROWSER LAUNCHY_BROWSER].freeze
|
17
18
|
|
18
19
|
def run(files, cucumber_options, options = {})
|
@@ -27,7 +28,7 @@ module Geordi
|
|
27
28
|
Interaction.note_cmd(command) if options[:verbose]
|
28
29
|
|
29
30
|
puts # Make newline
|
30
|
-
system command # Util.
|
31
|
+
system command # Util.run! would reset the Firefox PATH
|
31
32
|
end
|
32
33
|
|
33
34
|
def launch_vnc_viewer
|
@@ -74,7 +75,7 @@ module Geordi
|
|
74
75
|
unless argv.include?('--format') || argv.include?('-f')
|
75
76
|
format_args = spinner_available? ? ['--format', 'CucumberSpinner::CuriousProgressBarFormatter'] : ['--format', 'progress']
|
76
77
|
end
|
77
|
-
[use_firefox_for_selenium, Util.
|
78
|
+
[use_firefox_for_selenium, Util.binstub_or_fallback('cucumber'), format_args, escape_shell_args(argv)].flatten.compact.join(' ')
|
78
79
|
end
|
79
80
|
|
80
81
|
def parallel_execution_command
|
data/lib/geordi/dump_loader.rb
CHANGED
@@ -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.
|
60
|
+
Util.run! source_command, fail_message: "An error occured loading #{File.basename(dump_file)}"
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
data/lib/geordi/gitpt.rb
CHANGED
@@ -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.
|
92
|
+
Geordi::Util.run!(['git', 'commit', '--allow-empty', '-m', message, *git_args])
|
93
93
|
end
|
94
94
|
|
95
95
|
def bold(string)
|
data/lib/geordi/interaction.rb
CHANGED
data/lib/geordi/remote.rb
CHANGED
@@ -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.
|
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.
|
78
|
+
Util.run!(['ssh', "#{@config.user(server)}@#{server}", '-t', remote_command])
|
78
79
|
end
|
79
80
|
|
80
81
|
end
|
data/lib/geordi/settings.rb
CHANGED
@@ -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
|
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
|
|
data/lib/geordi/util.rb
CHANGED
@@ -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
|
-
|
24
|
+
Util.run!(install_command, show_cmd: true)
|
25
25
|
|
26
26
|
# retry
|
27
27
|
Gem.clear_paths
|
@@ -33,50 +33,62 @@ 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
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
if
|
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
|
+
show_command = command
|
47
|
+
else
|
48
|
+
show_command = [command]
|
49
|
+
end
|
50
|
+
|
51
|
+
if show_cmd
|
52
|
+
# Join with spaces for better readability and copy-pasting
|
53
|
+
Interaction.note_cmd show_command.join(' ')
|
54
|
+
end
|
55
|
+
|
56
|
+
if confirm
|
44
57
|
Interaction.prompt('Run this now?', 'n', /y|yes/) or Interaction.fail('Cancelled.')
|
45
58
|
end
|
46
59
|
|
47
60
|
if testing?
|
48
|
-
|
61
|
+
# Join with commas for precise argument distinction
|
62
|
+
puts "Util.run! #{show_command.join(', ')}"
|
49
63
|
else
|
50
64
|
# Remove Geordi's Bundler environment when running commands.
|
51
65
|
success = if !defined?(Bundler)
|
52
|
-
system(*
|
66
|
+
system(*command)
|
53
67
|
elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.1.2')
|
54
68
|
Bundler.with_original_env do
|
55
|
-
system(*
|
69
|
+
system(*command)
|
56
70
|
end
|
57
71
|
else
|
58
|
-
Bundler.clean_system(*
|
72
|
+
Bundler.clean_system(*command)
|
59
73
|
end
|
60
74
|
|
61
|
-
success || Interaction.fail(
|
75
|
+
success || Interaction.fail(fail_message)
|
62
76
|
end
|
63
77
|
end
|
64
78
|
|
65
|
-
def
|
79
|
+
def binstub_or_fallback(executable)
|
66
80
|
binstub_file = "bin/#{executable}"
|
67
81
|
|
68
|
-
|
69
|
-
command.push(*arguments)
|
70
|
-
command.join(' ')
|
82
|
+
File.exists?(binstub_file) ? binstub_file : "bundle exec #{executable}"
|
71
83
|
end
|
72
84
|
|
73
85
|
def console_command(environment)
|
74
86
|
if gem_major_version('rails') == 2
|
75
87
|
'script/console ' + environment
|
76
88
|
elsif gem_major_version('rails') == 3
|
77
|
-
|
89
|
+
"#{binstub_or_fallback('rails')} console #{environment}"
|
78
90
|
else
|
79
|
-
|
91
|
+
"#{binstub_or_fallback('rails')} console -e #{environment}"
|
80
92
|
end
|
81
93
|
end
|
82
94
|
|
@@ -84,7 +96,7 @@ module Geordi
|
|
84
96
|
if gem_major_version('rails') == 2
|
85
97
|
'script/server ""'
|
86
98
|
else
|
87
|
-
|
99
|
+
"#{binstub_or_fallback('rails')} server"
|
88
100
|
end
|
89
101
|
end
|
90
102
|
|
data/lib/geordi/version.rb
CHANGED
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:
|
4
|
+
version: 5.1.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-
|
11
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -36,9 +36,9 @@ executables:
|
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
+
- ".github/workflows/test.yml"
|
39
40
|
- ".gitignore"
|
40
41
|
- ".ruby-version"
|
41
|
-
- ".travis.yml"
|
42
42
|
- CHANGELOG.md
|
43
43
|
- Gemfile
|
44
44
|
- Gemfile.lock
|
@@ -97,13 +97,13 @@ files:
|
|
97
97
|
- lib/geordi/settings.rb
|
98
98
|
- lib/geordi/util.rb
|
99
99
|
- lib/geordi/version.rb
|
100
|
-
homepage:
|
100
|
+
homepage: https://makandra.com
|
101
101
|
licenses:
|
102
102
|
- MIT
|
103
103
|
metadata: {}
|
104
104
|
post_install_message: |
|
105
105
|
* Binary `geordi` installed
|
106
|
-
* Geordi 4
|
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
|
107
107
|
rdoc_options: []
|
108
108
|
require_paths:
|
109
109
|
- lib
|
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
111
|
requirements:
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: 2.
|
114
|
+
version: 2.2.0
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- '2.0.0'
|
5
|
-
- '2.1.10'
|
6
|
-
- '2.2.10'
|
7
|
-
- '2.3.8'
|
8
|
-
- '2.4.10'
|
9
|
-
- '2.5.8'
|
10
|
-
- '2.6.6'
|
11
|
-
|
12
|
-
gemfile:
|
13
|
-
- 'Gemfile'
|
14
|
-
|
15
|
-
dist: trusty
|
16
|
-
|
17
|
-
install:
|
18
|
-
- gem install bundler:1.17.3
|
19
|
-
# Replace default Travis CI bundler script with a version that doesn't
|
20
|
-
# explode when lockfile doesn't match recently bumped version
|
21
|
-
- bundle install --no-deployment --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
22
|
-
|
23
|
-
script: bundle exec rake
|