geordi 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/Gemfile.lock +1 -1
- data/lib/geordi/COMMAND_TEMPLATE +1 -1
- data/lib/geordi/cli.rb +1 -1
- data/lib/geordi/commands/bundle_install.rb +1 -1
- data/lib/geordi/commands/capistrano.rb +1 -1
- data/lib/geordi/commands/console.rb +4 -3
- data/lib/geordi/commands/create_databases.rb +7 -6
- data/lib/geordi/commands/cucumber.rb +2 -2
- data/lib/geordi/commands/deploy.rb +7 -7
- data/lib/geordi/commands/dump.rb +1 -1
- 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 +2 -2
- 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 +2 -2
- data/lib/geordi/util.rb +31 -21
- data/lib/geordi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2af11b387f28e87fc2cb89172b1ea8fdcd87dc4bc62697c18ba4a7cc8ddada28
|
4
|
+
data.tar.gz: c0612fe6e8f266a3b5e5a467018b5f6e484224944057ddd323c9162a0b64d858
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e96089335890efaf9e8ea9a0cabea1c4a6447e363513f61fa2e2fe55f43637ca24906fd3732fd3eb0b5adb752bd2a752a263a0be772bedba1b7115e69425b5d2
|
7
|
+
data.tar.gz: bad860e3b8a14d06970351213fda638e2b853dfbf107ea6b6f4e018cd2ecdbb767848a2ebdec34757f3c5a9d47e8a2a3181ac40c729b1b3a9cbb26e62aaf1613
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,32 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
9
9
|
### Breaking changes
|
10
10
|
|
11
11
|
|
12
|
+
## 4.1.1 2020-08-28
|
13
|
+
### Compatible changes
|
14
|
+
|
15
|
+
* Fixed: System calls are not executed properly if no bin stub is present. This resulted in errors like:
|
16
|
+
|
17
|
+
```
|
18
|
+
% geordi rspec
|
19
|
+
|
20
|
+
# Running specs
|
21
|
+
> All specs at once (using parallel_tests)
|
22
|
+
|
23
|
+
x Specs failed.
|
24
|
+
```
|
25
|
+
|
26
|
+
or
|
27
|
+
|
28
|
+
```
|
29
|
+
% geordi migrate
|
30
|
+
|
31
|
+
# Migrating
|
32
|
+
> Development and parallel test databases
|
33
|
+
|
34
|
+
x Something went wrong.
|
35
|
+
```
|
36
|
+
|
37
|
+
|
12
38
|
## 4.1.0 2020-08-18
|
13
39
|
|
14
40
|
### Compatible changes
|
data/Gemfile.lock
CHANGED
data/lib/geordi/COMMAND_TEMPLATE
CHANGED
@@ -21,7 +21,7 @@ option :opt, type: :boolean, aliases: '-o', banner: 'VALUE_NAME', desc: 'If set,
|
|
21
21
|
|
22
22
|
def example
|
23
23
|
# Invoke other commands like this:
|
24
|
-
|
24
|
+
invoke_geordi 'other_command', 'argument', an: 'option'
|
25
25
|
|
26
26
|
Interaction.fail 'Option missing' unless options.opt?
|
27
27
|
|
data/lib/geordi/cli.rb
CHANGED
@@ -17,6 +17,6 @@ def capistrano(*args)
|
|
17
17
|
command = "bundle exec cap #{stage} " + args.join(' ')
|
18
18
|
Interaction.note_cmd command
|
19
19
|
|
20
|
-
Util.
|
20
|
+
Util.run!(command, fail_message: 'Capistrano failed. Have a look!')
|
21
21
|
end
|
22
22
|
end
|
@@ -14,14 +14,15 @@ option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
|
|
14
14
|
|
15
15
|
def console(target = 'development', *_args)
|
16
16
|
require 'geordi/remote'
|
17
|
-
|
17
|
+
invoke_geordi 'bundle_install'
|
18
18
|
|
19
19
|
if target == 'development'
|
20
|
-
|
20
|
+
invoke_geordi 'yarn_install'
|
21
21
|
|
22
22
|
Interaction.announce 'Opening a local Rails console'
|
23
23
|
|
24
|
-
|
24
|
+
command = Util.console_command(target)
|
25
|
+
Util.run!(command)
|
25
26
|
else
|
26
27
|
Interaction.announce 'Opening a Rails console on ' + target
|
27
28
|
|
@@ -1,16 +1,17 @@
|
|
1
1
|
desc 'create-databases', 'Create all databases', hide: true
|
2
2
|
def create_databases
|
3
|
-
|
4
|
-
|
3
|
+
invoke_geordi 'create_database_yml'
|
4
|
+
invoke_geordi 'bundle_install'
|
5
5
|
|
6
6
|
Interaction.announce 'Creating databases'
|
7
7
|
|
8
8
|
if File.exist?('config/database.yml')
|
9
|
-
command =
|
10
|
-
command << '
|
11
|
-
command << '
|
9
|
+
command = []
|
10
|
+
command << Util.binstub_or_fallback('rake')
|
11
|
+
command << 'db:create:all'
|
12
|
+
command << 'parallel:create' if Util.file_containing?('Gemfile', /parallel_tests/)
|
12
13
|
|
13
|
-
Util.
|
14
|
+
Util.run!(command)
|
14
15
|
else
|
15
16
|
puts 'config/database.yml does not exist. Nothing to do.'
|
16
17
|
end
|
@@ -53,8 +53,8 @@ def cucumber(*args)
|
|
53
53
|
if File.directory?('features')
|
54
54
|
require 'geordi/cucumber'
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
invoke_geordi 'bundle_install'
|
57
|
+
invoke_geordi 'yarn_install'
|
58
58
|
|
59
59
|
cmd_opts, files = args.partition { |f| f.start_with? '-' }
|
60
60
|
cmd_opts << '--format' << 'pretty' << '--backtrace' if options.debug
|
@@ -66,7 +66,7 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
66
66
|
push_needed = false if Util.testing? # Hard to test
|
67
67
|
|
68
68
|
Interaction.announce "Checking whether your #{source_branch} branch is ready" ############
|
69
|
-
Util.
|
69
|
+
Util.run!("git checkout #{source_branch}")
|
70
70
|
if (`git status -s | wc -l`.strip != '0') && !Util.testing?
|
71
71
|
Interaction.warn "Your #{source_branch} branch holds uncommitted changes."
|
72
72
|
Interaction.prompt('Continue anyway?', 'n', /y|yes/) || raise('Cancelled.')
|
@@ -76,14 +76,14 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
76
76
|
|
77
77
|
if merge_needed
|
78
78
|
Interaction.announce "Checking what's in your #{target_branch} branch right now" #######
|
79
|
-
Util.
|
79
|
+
Util.run!("git checkout #{target_branch} && git pull")
|
80
80
|
end
|
81
81
|
|
82
82
|
Interaction.announce 'You are about to:' #################################################
|
83
83
|
Interaction.note "Merge branch #{source_branch} into #{target_branch}" if merge_needed
|
84
84
|
if push_needed
|
85
85
|
Interaction.note 'Push these commits:' if push_needed
|
86
|
-
Util.
|
86
|
+
Util.run!("git --no-pager log origin/#{target_branch}..#{source_branch} --oneline")
|
87
87
|
end
|
88
88
|
Interaction.note "Deploy to #{target_stage}"
|
89
89
|
Interaction.note "From current branch #{source_branch}" if options.current_branch
|
@@ -94,7 +94,7 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
94
94
|
git_call << "git merge #{source_branch}" if merge_needed
|
95
95
|
git_call << 'git push' if push_needed
|
96
96
|
|
97
|
-
|
97
|
+
invoke_geordi 'bundle_install'
|
98
98
|
|
99
99
|
capistrano_call = "cap #{target_stage} deploy"
|
100
100
|
capistrano_call << ':migrations' unless Util.gem_major_version('capistrano') == 3 || options.no_migrations
|
@@ -102,14 +102,14 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
102
102
|
capistrano_call = "DEPLOY_BRANCH=#{source_branch} #{capistrano_call}" if options.current_branch
|
103
103
|
|
104
104
|
if git_call.any?
|
105
|
-
Util.
|
105
|
+
Util.run!(git_call.join(' && '), show_cmd: true)
|
106
106
|
end
|
107
107
|
|
108
|
-
Util.
|
108
|
+
Util.run!(capistrano_call, show_cmd: true)
|
109
109
|
|
110
110
|
Interaction.success 'Deployment complete.'
|
111
111
|
else
|
112
|
-
Util.
|
112
|
+
Util.run!("git checkout #{source_branch}")
|
113
113
|
Interaction.fail 'Deployment cancelled.'
|
114
114
|
end
|
115
115
|
end
|
data/lib/geordi/commands/dump.rb
CHANGED
@@ -8,8 +8,8 @@ with `db:migrate`.
|
|
8
8
|
LONGDESC
|
9
9
|
|
10
10
|
def migrate
|
11
|
-
|
12
|
-
|
11
|
+
invoke_geordi 'bundle_install'
|
12
|
+
invoke_geordi 'yarn_install'
|
13
13
|
Interaction.announce 'Migrating'
|
14
14
|
|
15
15
|
if File.directory?('db/migrate')
|
@@ -17,9 +17,9 @@ def migrate
|
|
17
17
|
Interaction.note 'Development and parallel test databases'
|
18
18
|
puts
|
19
19
|
|
20
|
-
Util.
|
20
|
+
Util.run!([Util.binstub_or_fallback('rake'), 'db:migrate', 'parallel:prepare'])
|
21
21
|
else
|
22
|
-
|
22
|
+
invoke_geordi 'rake', 'db:migrate'
|
23
23
|
end
|
24
24
|
else
|
25
25
|
Interaction.note 'No migrations directory found.'
|
data/lib/geordi/commands/rake.rb
CHANGED
@@ -10,14 +10,16 @@ Example: `geordi rake db:migrate`
|
|
10
10
|
LONGDESC
|
11
11
|
|
12
12
|
def rake(*args)
|
13
|
-
|
13
|
+
invoke_geordi 'bundle_install'
|
14
14
|
|
15
15
|
%w[development test cucumber].each do |env| # update long_desc when changing this
|
16
16
|
if File.exist? "config/environments/#{env}.rb"
|
17
|
-
|
18
|
-
|
17
|
+
command = []
|
18
|
+
command << Util.binstub_or_fallback('rake')
|
19
|
+
command += args
|
20
|
+
command << "RAILS_ENV=#{env}"
|
19
21
|
|
20
|
-
Util.
|
22
|
+
Util.run!(command, show_cmd: true)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -7,14 +7,14 @@ LONGDESC
|
|
7
7
|
|
8
8
|
def rspec(*files)
|
9
9
|
if File.exist?('spec/spec_helper.rb')
|
10
|
-
|
11
|
-
|
10
|
+
invoke_geordi 'bundle_install'
|
11
|
+
invoke_geordi 'yarn_install'
|
12
12
|
|
13
13
|
Interaction.announce 'Running specs'
|
14
14
|
|
15
15
|
if Util.file_containing?('Gemfile', /parallel_tests/) && files.empty?
|
16
16
|
Interaction.note 'All specs at once (using parallel_tests)'
|
17
|
-
Util.
|
17
|
+
Util.run!([Util.binstub_or_fallback('rake'), 'parallel:spec'], fail_message: 'Specs failed.')
|
18
18
|
|
19
19
|
else
|
20
20
|
# tell which specs will be run
|
@@ -28,13 +28,13 @@ def rspec(*files)
|
|
28
28
|
command = if File.exist?('script/spec')
|
29
29
|
['bundle exec spec -c'] # RSpec 1
|
30
30
|
else
|
31
|
-
[Util.
|
31
|
+
[Util.binstub_or_fallback('rspec')]
|
32
32
|
end
|
33
33
|
command << '-r rspec_spinner -f RspecSpinner::Bar' if Util.file_containing?('Gemfile', /rspec_spinner/)
|
34
34
|
command << files.join(' ')
|
35
35
|
|
36
36
|
puts
|
37
|
-
Util.
|
37
|
+
Util.run!(command.join(' '), fail_message: 'Specs failed.')
|
38
38
|
end
|
39
39
|
else
|
40
40
|
Interaction.note 'RSpec not employed.'
|
@@ -35,8 +35,8 @@ def security_update(step = 'prepare')
|
|
35
35
|
Interaction.note 'About to checkout production and pull.'
|
36
36
|
Interaction.prompt('Continue?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
37
37
|
|
38
|
-
Util.
|
39
|
-
Util.
|
38
|
+
Util.run!('git checkout production', show_cmd: true)
|
39
|
+
Util.run!('git pull', show_cmd: true)
|
40
40
|
|
41
41
|
Interaction.success 'Successfully prepared for security update'
|
42
42
|
puts
|
@@ -47,7 +47,7 @@ def security_update(step = 'prepare')
|
|
47
47
|
when 'f', 'finish'
|
48
48
|
# ensure everything is committed
|
49
49
|
if Util.testing?
|
50
|
-
puts 'Util.
|
50
|
+
puts 'Util.run! git status --porcelain'
|
51
51
|
else
|
52
52
|
`git status --porcelain`.empty? || Interaction.fail('Please commit your changes before finishing the update.')
|
53
53
|
end
|
@@ -59,11 +59,11 @@ def security_update(step = 'prepare')
|
|
59
59
|
Interaction.note 'About to: push production, checkout & pull master, merge production, push master.'
|
60
60
|
Interaction.prompt('Continue?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
|
61
61
|
|
62
|
-
Util.
|
63
|
-
Util.
|
64
|
-
Util.
|
65
|
-
Util.
|
66
|
-
Util.
|
62
|
+
Util.run!('git push', show_cmd: true)
|
63
|
+
Util.run!('git checkout master', show_cmd: true)
|
64
|
+
Util.run!('git pull', show_cmd: true)
|
65
|
+
Util.run!('git merge production', show_cmd: true)
|
66
|
+
Util.run!('git push', show_cmd: true)
|
67
67
|
|
68
68
|
Interaction.announce 'Deployment'
|
69
69
|
deploy = (Util.gem_major_version('capistrano') == 3) ? 'deploy' : 'deploy:migrations'
|
@@ -76,7 +76,7 @@ def security_update(step = 'prepare')
|
|
76
76
|
Interaction.prompt('Deploy staging now?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
77
77
|
|
78
78
|
Interaction.announce 'Deploy staging'
|
79
|
-
Util.
|
79
|
+
Util.run! "bundle exec cap staging #{deploy}", show_cmd: true
|
80
80
|
|
81
81
|
Interaction.prompt('Is the deployment log okay and the application is still running on staging?', 'y', /y|yes/) || Interaction.fail('Please fix the deployment issues on staging before you continue.')
|
82
82
|
else
|
@@ -96,7 +96,7 @@ def security_update(step = 'prepare')
|
|
96
96
|
|
97
97
|
deploy_targets_without_staging.each do |target|
|
98
98
|
Interaction.announce "Deploy #{target}"
|
99
|
-
Util.
|
99
|
+
Util.run!("bundle exec cap #{target} #{deploy}", show_cmd: true)
|
100
100
|
end
|
101
101
|
|
102
102
|
Interaction.prompt('Is the application still running on all other stages and the logs are okay?', 'y', /y|yes/) || Interaction.fail('Please fix the application immediately!')
|
@@ -6,8 +6,8 @@ option :public, aliases: '-P', type: :boolean,
|
|
6
6
|
desc: 'Make the server accessible from the local network'
|
7
7
|
|
8
8
|
def server(port = nil)
|
9
|
-
|
10
|
-
|
9
|
+
invoke_geordi 'bundle_install'
|
10
|
+
invoke_geordi 'yarn_install'
|
11
11
|
require 'geordi/util'
|
12
12
|
|
13
13
|
Interaction.announce 'Booting a development server'
|
@@ -18,7 +18,7 @@ def server(port = nil)
|
|
18
18
|
command = Util.server_command
|
19
19
|
command << ' -b 0.0.0.0' if options.public
|
20
20
|
command << ' -p ' << port
|
21
|
-
Util.
|
21
|
+
Util.run!(command)
|
22
22
|
end
|
23
23
|
|
24
24
|
map 'devserver' => 'server'
|
@@ -19,14 +19,14 @@ def setup
|
|
19
19
|
Interaction.announce 'Running bin/setup'
|
20
20
|
Interaction.note "Geordi's own setup routine is skipped"
|
21
21
|
|
22
|
-
Util.
|
22
|
+
Util.run!('bin/setup')
|
23
23
|
else
|
24
|
-
|
25
|
-
|
24
|
+
invoke_geordi 'create_databases'
|
25
|
+
invoke_geordi 'migrate'
|
26
26
|
end
|
27
27
|
|
28
28
|
Interaction.success 'Successfully set up the project.'
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
invoke_geordi 'dump', options.dump, load: true if options.dump
|
31
|
+
invoke_geordi 'tests' if options.test
|
32
32
|
end
|
@@ -15,7 +15,7 @@ option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
|
|
15
15
|
def shelll(target, *_args)
|
16
16
|
require 'geordi/remote'
|
17
17
|
|
18
|
-
|
18
|
+
invoke_geordi 'bundle_install'
|
19
19
|
|
20
20
|
Interaction.announce 'Opening a shell on ' + target
|
21
21
|
Geordi::Remote.new(target).shell(options)
|
@@ -1,13 +1,13 @@
|
|
1
1
|
desc 'tests', 'Run all employed tests'
|
2
2
|
def tests
|
3
|
-
rake_result =
|
3
|
+
rake_result = invoke_geordi 'with_rake'
|
4
4
|
|
5
5
|
# Since `rake` usually is configured to run all tests, only run them if `rake`
|
6
6
|
# did not perform
|
7
7
|
if rake_result == :did_not_perform
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
invoke_geordi 'unit'
|
9
|
+
invoke_geordi 'rspec'
|
10
|
+
invoke_geordi 'cucumber'
|
11
11
|
end
|
12
12
|
|
13
13
|
Interaction.success 'Successfully ran tests.'
|
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
@@ -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.
|
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, Util.
|
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
|
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
@@ -43,7 +43,7 @@ module Geordi
|
|
43
43
|
|
44
44
|
Interaction.note "Downloading remote dump to #{relative_destination} ..."
|
45
45
|
server = @config.primary_server
|
46
|
-
Util.
|
46
|
+
Util.run!("scp -C #{@config.user(server)}@#{server}:#{REMOTE_DUMP_PATH} #{destination_path}")
|
47
47
|
|
48
48
|
Interaction.success "Dumped the #{@stage} database to #{relative_destination}."
|
49
49
|
|
@@ -74,7 +74,7 @@ module Geordi
|
|
74
74
|
remote_command << " -c '#{options[:remote_command]}'" if options[:remote_command]
|
75
75
|
|
76
76
|
Interaction.note 'Connecting to ' + server.to_s
|
77
|
-
Util.
|
77
|
+
Util.run!(['ssh', "#{@config.user(server)}@#{server}", '-t', remote_command])
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
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,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
|
-
#
|
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
|
+
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.
|
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(*
|
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(*
|
67
|
+
system(*command)
|
56
68
|
end
|
57
69
|
else
|
58
|
-
Bundler.clean_system(*
|
70
|
+
Bundler.clean_system(*command)
|
59
71
|
end
|
60
72
|
|
61
|
-
success || Interaction.fail(
|
73
|
+
success || Interaction.fail(fail_message)
|
62
74
|
end
|
63
75
|
end
|
64
76
|
|
65
|
-
def
|
77
|
+
def binstub_or_fallback(executable)
|
66
78
|
binstub_file = "bin/#{executable}"
|
67
79
|
|
68
|
-
|
69
|
-
command.push(*arguments)
|
70
|
-
command.join(' ')
|
80
|
+
File.exists?(binstub_file) ? binstub_file : "bundle exec #{executable}"
|
71
81
|
end
|
72
82
|
|
73
83
|
def console_command(environment)
|
74
84
|
if gem_major_version('rails') == 2
|
75
85
|
'script/console ' + environment
|
76
86
|
elsif gem_major_version('rails') == 3
|
77
|
-
|
87
|
+
"#{binstub_or_fallback('rails')} console #{environment}"
|
78
88
|
else
|
79
|
-
|
89
|
+
"#{binstub_or_fallback('rails')} console -e #{environment}"
|
80
90
|
end
|
81
91
|
end
|
82
92
|
|
@@ -84,7 +94,7 @@ module Geordi
|
|
84
94
|
if gem_major_version('rails') == 2
|
85
95
|
'script/server ""'
|
86
96
|
else
|
87
|
-
|
97
|
+
"#{binstub_or_fallback('rails')} server"
|
88
98
|
end
|
89
99
|
end
|
90
100
|
|
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.1.
|
4
|
+
version: 4.1.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-08-
|
11
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.
|
121
|
+
rubygems_version: 3.0.8
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Collection of command line tools we use in our daily work with Ruby, Rails
|