geordi 3.0.3 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +46 -8
- data/Gemfile.lock +1 -1
- data/README.md +138 -118
- data/Rakefile +18 -8
- data/exe/dumple +10 -0
- data/geordi.gemspec +1 -0
- data/lib/geordi/COMMAND_TEMPLATE +3 -1
- data/lib/geordi/commands/chromedriver_update.rb +2 -2
- data/lib/geordi/commands/commit.rb +1 -6
- data/lib/geordi/commands/console.rb +9 -4
- data/lib/geordi/commands/create_databases.rb +2 -1
- data/lib/geordi/commands/cucumber.rb +15 -10
- data/lib/geordi/commands/delete_dumps.rb +0 -1
- data/lib/geordi/commands/deploy.rb +11 -11
- data/lib/geordi/commands/drop_databases.rb +0 -6
- data/lib/geordi/commands/dump.rb +9 -18
- data/lib/geordi/commands/firefox.rb +2 -5
- data/lib/geordi/commands/migrate.rb +1 -1
- data/lib/geordi/commands/rake.rb +3 -1
- data/lib/geordi/commands/rspec.rb +5 -9
- data/lib/geordi/commands/security_update.rb +65 -9
- data/lib/geordi/commands/server.rb +1 -1
- data/lib/geordi/commands/setup.rb +2 -11
- data/lib/geordi/commands/shell.rb +7 -4
- data/lib/geordi/commands/unit.rb +1 -1
- data/lib/geordi/commands/update.rb +0 -11
- data/lib/geordi/commands/vnc.rb +1 -3
- data/lib/geordi/commands/with_rake.rb +1 -1
- data/lib/geordi/cucumber.rb +6 -4
- data/lib/geordi/gitpt.rb +9 -51
- data/lib/geordi/remote.rb +14 -2
- data/lib/geordi/settings.rb +155 -0
- data/lib/geordi/util.rb +12 -4
- data/lib/geordi/version.rb +1 -1
- metadata +7 -33
- data/exe/cap-all +0 -4
- data/exe/console-for +0 -4
- data/exe/cuc +0 -4
- data/exe/cuc-show +0 -4
- data/exe/cuc-vnc-setup +0 -4
- data/exe/deploy-to-production +0 -4
- data/exe/dump-for +0 -8
- data/exe/gitpt +0 -4
- data/exe/load-dump +0 -4
- data/exe/migrate-all +0 -4
- data/exe/rs +0 -4
- data/exe/run_tests +0 -4
- data/exe/shell-for +0 -4
- data/exe/tests +0 -4
- data/lib/geordi/commands/eurest.rb +0 -4
data/Rakefile
CHANGED
@@ -32,21 +32,31 @@ You may abbreviate commands by typing only their first letters, e.g. `geordi
|
|
32
32
|
con` will boot a development console, `geordi set -t` will setup a project and
|
33
33
|
run tests afterwards.
|
34
34
|
|
35
|
-
|
36
|
-
`geordi help <command>`.
|
37
|
-
|
35
|
+
You can always run `geordi help <command>` to quickly look up command help.
|
38
36
|
TEXT
|
39
37
|
|
40
38
|
Geordi::CLI.all_commands.sort.each do |_, command|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
next if command.hidden?
|
40
|
+
|
41
|
+
geordi_section << "\n### `geordi #{command.usage}`\n"
|
42
|
+
geordi_section << "#{command.description.sub /(\.)?$/, '.'}\n\n"
|
43
|
+
geordi_section << "#{command.long_description.strip}\n\n" if command.long_description
|
44
|
+
|
45
|
+
if command.options.any?
|
46
|
+
geordi_section << "**Options**\n"
|
47
|
+
# Taken from thor-1.0.1/lib/thor/base.rb:557
|
48
|
+
command.options.values.each do |option|
|
49
|
+
next if option.hide
|
50
|
+
|
51
|
+
geordi_section << "- `#{option.usage}`"
|
52
|
+
geordi_section << ": #{option.description}" if option.description
|
53
|
+
geordi_section << "\n"
|
54
|
+
end
|
45
55
|
geordi_section << "\n"
|
46
56
|
end
|
47
57
|
end
|
48
58
|
|
49
59
|
updated_readme = readme.sub(geordi_section_regex, geordi_section)
|
50
60
|
File.open('README.md', 'w') { |f| f.puts updated_readme.strip }
|
51
|
-
puts 'README.
|
61
|
+
puts 'README.md updated.'
|
52
62
|
end
|
data/exe/dumple
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'erb'
|
4
4
|
|
5
5
|
fail_gently = ARGV.include?("--fail-gently")
|
6
|
+
compress = ARGV.include?("--compress")
|
6
7
|
|
7
8
|
if ARGV.include?("-i")
|
8
9
|
puts "*******************************************************"
|
@@ -96,6 +97,15 @@ begin
|
|
96
97
|
|
97
98
|
system "chmod 600 #{dump_path}"
|
98
99
|
|
100
|
+
if compress
|
101
|
+
puts "> Compressing the dump ..."
|
102
|
+
|
103
|
+
# gzip compresses in place
|
104
|
+
compress_success = system("gzip #{dump_path}")
|
105
|
+
compress_success or raise "Compressing the dump failed"
|
106
|
+
dump_path << ".gz"
|
107
|
+
end
|
108
|
+
|
99
109
|
dump_size_kb = (File.size(dump_path) / 1024).round
|
100
110
|
|
101
111
|
puts "> Dumped to #{dump_path} (#{dump_size_kb} KB)"
|
data/geordi.gemspec
CHANGED
@@ -27,5 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.post_install_message = <<-ATTENTION
|
29
29
|
* Binary `geordi` installed
|
30
|
+
* Geordi 4.0.0 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
|
30
31
|
ATTENTION
|
31
32
|
end
|
data/lib/geordi/COMMAND_TEMPLATE
CHANGED
@@ -12,7 +12,9 @@ Detailed description with anything the user needs to know.
|
|
12
12
|
|
13
13
|
Short and long description are printed on the console AND included in the README
|
14
14
|
by `rake update_readme`. Thus, please format descriptions in a way that's reader
|
15
|
-
friendly both in Markdown and the console.
|
15
|
+
friendly both in Markdown and the console. In particular, note that simple line
|
16
|
+
breaks (\n) will be squished. Only paragraphs (\n\n) will work both on the bash
|
17
|
+
and in Markdown.
|
16
18
|
LONGDESC
|
17
19
|
|
18
20
|
option :opt, type: :boolean, aliases: '-o', banner: 'VALUE_NAME', desc: 'If set, VALUE_NAME will be used for something'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
desc 'chromedriver-update', 'Update the chromedriver'
|
2
|
-
|
3
2
|
long_desc <<-LONGDESC
|
4
3
|
Example: `geordi chromedriver_update`
|
5
4
|
|
6
|
-
This command will find and install the matching chromedriver for the currently
|
5
|
+
This command will find and install the matching chromedriver for the currently
|
6
|
+
installed Chrome.
|
7
7
|
LONGDESC
|
8
8
|
|
9
9
|
def chromedriver_update
|
@@ -1,15 +1,11 @@
|
|
1
1
|
desc 'commit', 'Commit using a story title from Pivotal Tracker'
|
2
|
-
|
3
2
|
long_desc <<-LONGDESC
|
4
3
|
Example: `geordi commit`
|
5
4
|
|
6
5
|
Any extra arguments are forwarded to `git commit -m <message>`.
|
7
6
|
|
8
|
-
If there are no staged changes, prints a warning but will continue to create
|
9
|
-
an empty commit.
|
10
|
-
|
11
7
|
On the first execution we ask for your Pivotal Tracker API token. It will be
|
12
|
-
stored in `~/.
|
8
|
+
stored in `~/.config/geordi/global.yml`.
|
13
9
|
LONGDESC
|
14
10
|
|
15
11
|
def commit(*git_args)
|
@@ -18,6 +14,5 @@ Unsupported Ruby Version #{RUBY_VERSION}. `geordi commit` requires Ruby 2.1+.
|
|
18
14
|
TEXT
|
19
15
|
|
20
16
|
require 'geordi/gitpt'
|
21
|
-
|
22
17
|
Gitpt.new.run(git_args)
|
23
18
|
end
|
@@ -1,15 +1,20 @@
|
|
1
1
|
desc 'console [TARGET]', 'Open a Rails console locally or on a Capistrano deploy target'
|
2
2
|
long_desc <<-LONGDESC
|
3
|
-
|
3
|
+
Local (development): `geordi console`
|
4
4
|
|
5
|
-
|
6
|
-
LONGDESC
|
5
|
+
Remote: `geordi console staging`
|
7
6
|
|
7
|
+
Selecting the server: `geordi console staging -s` shows a menu with all available
|
8
|
+
servers. When passed a number, directly connects to the selected server.
|
9
|
+
LONGDESC
|
8
10
|
|
9
|
-
|
11
|
+
# This option is duplicated in shelll.rb
|
12
|
+
option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
|
13
|
+
desc: 'Select a server to connect to'
|
10
14
|
|
11
15
|
def console(target = 'development', *_args)
|
12
16
|
require 'geordi/remote'
|
17
|
+
invoke_cmd 'bundle_install'
|
13
18
|
|
14
19
|
if target == 'development'
|
15
20
|
invoke_cmd 'yarn_install'
|
@@ -6,7 +6,8 @@ def create_databases
|
|
6
6
|
Interaction.announce 'Creating databases'
|
7
7
|
|
8
8
|
if File.exist?('config/database.yml')
|
9
|
-
command = '
|
9
|
+
command = Util.binstub 'rake'
|
10
|
+
command << ' db:create:all'
|
10
11
|
command << ' parallel:create' if Util.file_containing?('Gemfile', /parallel_tests/)
|
11
12
|
|
12
13
|
Util.system! command
|
@@ -2,19 +2,24 @@ desc 'cucumber [FILES and OPTIONS]', 'Run Cucumber features'
|
|
2
2
|
long_desc <<-LONGDESC
|
3
3
|
Example: `geordi cucumber features/authentication_feature:3`
|
4
4
|
|
5
|
-
Runs Cucumber
|
6
|
-
|
7
|
-
|
5
|
+
Runs Cucumber with `bundle exec`, using parallel tests, with a VNC session
|
6
|
+
holding Selenium test browsers, support for using a dedicated testing browser
|
7
|
+
and beta support for re-running failed scenarios.
|
8
8
|
|
9
9
|
- *@solo:* Generally, features are run in parallel. However, scenarios tagged
|
10
|
-
with @solo are excluded
|
10
|
+
with @solo are excluded from the parallel run and executed sequentially instead.
|
11
11
|
|
12
|
-
- *Debugging:*
|
13
|
-
errors. In case a feature fails without
|
14
|
-
or `-d`.
|
12
|
+
- *Debugging:* In some cases, the dot-printing Cucumber formatter swallows
|
13
|
+
errors. In case a feature fails without an error message, try running it with
|
14
|
+
`--debug` or `-d`.
|
15
15
|
|
16
16
|
- *Options:* Any unknown option will be passed through to Cucumber,
|
17
|
-
e.g. `--format
|
17
|
+
e.g. `--format=pretty`. Make sure to connect option and value with an equals
|
18
|
+
sign, i.e. have each option a contiguous string.
|
19
|
+
|
20
|
+
- *VNC:* By default, test browsers will run in a VNC session. When using a
|
21
|
+
headless test browser anyway, you can disable VNC by setting `use_vnc: false`
|
22
|
+
in `.geordi.yml` in the project root.
|
18
23
|
LONGDESC
|
19
24
|
|
20
25
|
option :modified, aliases: '-m', type: :boolean,
|
@@ -22,9 +27,9 @@ option :modified, aliases: '-m', type: :boolean,
|
|
22
27
|
option :containing, aliases: '-c', banner: 'STRING',
|
23
28
|
desc: 'Run all features that contain STRING'
|
24
29
|
option :verbose, aliases: '-v', type: :boolean,
|
25
|
-
desc: '
|
30
|
+
desc: 'Show the test run command'
|
26
31
|
option :debug, aliases: '-d', type: :boolean,
|
27
|
-
desc: 'Run with `-f pretty -b
|
32
|
+
desc: 'Run Cucumber with `-f pretty -b`, which helps hunting down bugs'
|
28
33
|
option :rerun, aliases: '-r', type: :numeric, default: 0,
|
29
34
|
desc: 'Rerun features up to N times while failing'
|
30
35
|
|
@@ -7,7 +7,6 @@ no argument is given, two default directories are searched for dump files: the
|
|
7
7
|
current working directory and `~/dumps` (for dumps created with geordi).
|
8
8
|
|
9
9
|
Geordi will ask for confirmation before actually deleting files.
|
10
|
-
|
11
10
|
LONGDESC
|
12
11
|
|
13
12
|
def delete_dumps(dump_directory = nil)
|
@@ -5,18 +5,18 @@ Example: `geordi deploy` or `geordi deploy p[roduction]` or `geordi deploy --cur
|
|
5
5
|
Merge, push and deploy with a single command! **It always tells what it will do
|
6
6
|
before it does it.** There are different scenarios where this command is handy:
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
- *Production deploy:* From the master branch, run `geordi deploy production`.
|
9
|
+
This will merge `master` to `production`, push and deploy to production.
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
- *Feature branch deploy:* From a feature branch, run `geordi deploy staging`.
|
12
|
+
This will merge the feature branch to `master`, push and deploy to staging.
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
To deploy a feature branch directly without merging, run
|
15
|
+
`geordi deploy --current-branch`. This feature depends on the environment
|
16
|
+
variable `DEPLOY_BRANCH` to be picked up in the respective deploy file.
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
- *Simple deploy:* If the source branch matches the target branch, merging will
|
19
|
+
be skipped.
|
20
20
|
|
21
21
|
Calling the command without arguments will infer the target stage from the
|
22
22
|
current branch and fall back to master/staging.
|
@@ -94,6 +94,8 @@ 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
|
+
invoke_cmd 'bundle_install'
|
98
|
+
|
97
99
|
capistrano_call = "cap #{target_stage} deploy"
|
98
100
|
capistrano_call << ':migrations' unless Util.gem_major_version('capistrano') == 3 || options.no_migrations
|
99
101
|
capistrano_call = "bundle exec #{capistrano_call}" if Util.file_containing?('Gemfile', /capistrano/)
|
@@ -103,8 +105,6 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
103
105
|
Util.system! git_call.join(' && '), show_cmd: true
|
104
106
|
end
|
105
107
|
|
106
|
-
invoke_cmd 'bundle_install'
|
107
|
-
|
108
108
|
Util.system! capistrano_call, show_cmd: true
|
109
109
|
|
110
110
|
Interaction.success 'Deployment complete.'
|
@@ -7,12 +7,6 @@ and offer to delete them. Excluded are databases that are whitelisted. This come
|
|
7
7
|
in handy when you're keeping your currently active projects in the whitelist files
|
8
8
|
and perform regular housekeeping with Geordi.
|
9
9
|
|
10
|
-
When called with `-P` or `-M` options, only handles Postgres resp. MySQL/MariaDB.
|
11
|
-
|
12
|
-
When called with `--postgres <port or local socket>` or `--mysql <port or local socket>`,
|
13
|
-
will instruct the underlying management commands to use those connection methods
|
14
|
-
instead of the defaults. This is useful when running multiple installations.
|
15
|
-
|
16
10
|
Geordi will ask for confirmation before actually dropping databases and will
|
17
11
|
offer to edit the whitelist instead.
|
18
12
|
LONGDESC
|
data/lib/geordi/commands/dump.rb
CHANGED
@@ -1,27 +1,18 @@
|
|
1
|
-
desc 'dump [TARGET]', 'Handle
|
1
|
+
desc 'dump [TARGET]', 'Handle (remote) database dumps'
|
2
2
|
long_desc <<-DESC
|
3
|
-
|
3
|
+
`geordi dump` (without arguments) dumps the development database with `dumple`.
|
4
4
|
|
5
|
-
|
5
|
+
`geordi dump -l tmp/staging.dump` (with the `--load` option) sources the
|
6
|
+
specified dump file into the development database.
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
`geordi dump staging` (with a Capistrano deploy target) remotely dumps the
|
9
|
+
specified target's database and downloads it to `tmp/`.
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
When called with a capistrano deploy target (e.g. `staging`), remotely dumps
|
13
|
-
the specified target's database and downloads it to `tmp/`.
|
14
|
-
|
15
|
-
geordi dump staging
|
16
|
-
|
17
|
-
When called with a capistrano deploy target and the `--load` option, sources the
|
18
|
-
dump into the development database after downloading it.
|
19
|
-
|
20
|
-
geordi dump staging -l
|
11
|
+
`geordi dump staging -l` (with a Capistrano deploy target and the `--load`
|
12
|
+
option) sources the dump into the development database after downloading it.
|
21
13
|
DESC
|
22
14
|
|
23
|
-
option :load, aliases:
|
24
|
-
option :select_server, default: false, type: :boolean, aliases: '-s'
|
15
|
+
option :load, aliases: '-l', type: :string, desc: 'Load a dump', banner: '[DUMP_FILE]'
|
25
16
|
|
26
17
|
def dump(target = nil, *_args)
|
27
18
|
require 'geordi/dump_loader'
|
@@ -3,11 +3,8 @@ long_desc <<-LONGDESC
|
|
3
3
|
Example: `geordi firefox b cucumber` or `geordi firefox --setup 24.0`
|
4
4
|
|
5
5
|
Useful when you need Firefox for Selenium or the VNC set up, but can't use the
|
6
|
-
`geordi cucumber` command.
|
7
|
-
|
8
|
-
*Install* a special Firefox by calling with `--setup <version>`.
|
9
|
-
|
10
|
-
This command is aliased `chrome` for users running Selenium in Chrome.
|
6
|
+
`geordi cucumber` command. This command is aliased `chrome` for users running
|
7
|
+
Selenium in Chrome.
|
11
8
|
LONGDESC
|
12
9
|
|
13
10
|
option :setup, banner: 'FIREFOX_VERSION',
|
@@ -17,7 +17,7 @@ def migrate
|
|
17
17
|
Interaction.note 'Development and parallel test databases'
|
18
18
|
puts
|
19
19
|
|
20
|
-
Util.system! '
|
20
|
+
Util.system! Util.binstub('rake'), 'db:migrate', 'parallel:prepare'
|
21
21
|
else
|
22
22
|
invoke_cmd 'rake', 'db:migrate'
|
23
23
|
end
|
data/lib/geordi/commands/rake.rb
CHANGED
@@ -10,9 +10,11 @@ Example: `geordi rake db:migrate`
|
|
10
10
|
LONGDESC
|
11
11
|
|
12
12
|
def rake(*args)
|
13
|
+
invoke_cmd 'bundle_install'
|
14
|
+
|
13
15
|
%w[development test cucumber].each do |env| # update long_desc when changing this
|
14
16
|
if File.exist? "config/environments/#{env}.rb"
|
15
|
-
call =
|
17
|
+
call = [Util.binstub('rake')] + args + ["RAILS_ENV=#{env}"]
|
16
18
|
Interaction.note_cmd call.join(' ')
|
17
19
|
|
18
20
|
Util.system! *call
|
@@ -2,8 +2,7 @@ desc 'rspec [FILES]', 'Run RSpec'
|
|
2
2
|
long_desc <<-LONGDESC
|
3
3
|
Example: `geordi rspec spec/models/user_spec.rb:13`
|
4
4
|
|
5
|
-
Runs RSpec
|
6
|
-
detection, etc.
|
5
|
+
Runs RSpec with RSpec 1/2 support, parallel_tests detection and `bundle exec`.
|
7
6
|
LONGDESC
|
8
7
|
|
9
8
|
def rspec(*files)
|
@@ -15,7 +14,7 @@ def rspec(*files)
|
|
15
14
|
|
16
15
|
if Util.file_containing?('Gemfile', /parallel_tests/) && files.empty?
|
17
16
|
Interaction.note 'All specs at once (using parallel_tests)'
|
18
|
-
Util.system! '
|
17
|
+
Util.system! Util.binstub('rake'), 'parallel:spec', fail_message: 'Specs failed.'
|
19
18
|
|
20
19
|
else
|
21
20
|
# tell which specs will be run
|
@@ -26,13 +25,10 @@ def rspec(*files)
|
|
26
25
|
Interaction.note 'Only: ' + files.join(', ')
|
27
26
|
end
|
28
27
|
|
29
|
-
command =
|
30
|
-
|
31
|
-
'spec -c' # RSpec 1
|
32
|
-
elsif File.exist?('bin/rspec')
|
33
|
-
'bin/rspec'
|
28
|
+
command = if File.exist?('script/spec')
|
29
|
+
['bundle exec spec -c'] # RSpec 1
|
34
30
|
else
|
35
|
-
'rspec'
|
31
|
+
[Util.binstub('rspec')]
|
36
32
|
end
|
37
33
|
command << '-r rspec_spinner -f RspecSpinner::Bar' if Util.file_containing?('Gemfile', /rspec_spinner/)
|
38
34
|
command << files.join(' ')
|
@@ -1,11 +1,30 @@
|
|
1
1
|
desc 'security-update [STEP]', 'Support for performing security updates'
|
2
2
|
long_desc <<-LONGDESC
|
3
|
-
Preparation for security update: `geordi security-update
|
3
|
+
Preparation for security update: `geordi security-update`. Checks out production
|
4
|
+
and pulls.
|
4
5
|
|
5
|
-
After performing the update: `geordi security-update finish
|
6
|
+
After performing the update: `geordi security-update finish`. Switches branches,
|
7
|
+
pulls, pushes and deploys as required by our workflow.
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
This command tells what it will do before it does it. In detail:
|
10
|
+
|
11
|
+
1. Ask user if tests are green
|
12
|
+
|
13
|
+
2. Push production
|
14
|
+
|
15
|
+
3. Check out master and pull
|
16
|
+
|
17
|
+
4. Merge production and push in master
|
18
|
+
|
19
|
+
5. Deploy staging, if there is a staging environment
|
20
|
+
|
21
|
+
6. Ask user if deployment log is okay and staging application is still running
|
22
|
+
|
23
|
+
7. Deploy other stages
|
24
|
+
|
25
|
+
8. Ask user if deployment log is okay and application is still running on all stages
|
26
|
+
|
27
|
+
9. Inform user about the next (manual) steps
|
9
28
|
LONGDESC
|
10
29
|
|
11
30
|
def security_update(step = 'prepare')
|
@@ -13,7 +32,7 @@ def security_update(step = 'prepare')
|
|
13
32
|
when 'prepare'
|
14
33
|
Interaction.announce 'Preparing for security update'
|
15
34
|
Interaction.warn 'Please read https://makandracards.com/makandra/1587 before applying security updates!'
|
16
|
-
Interaction.note 'About to checkout production and pull'
|
35
|
+
Interaction.note 'About to checkout production and pull.'
|
17
36
|
Interaction.prompt('Continue?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
18
37
|
|
19
38
|
Util.system! 'git checkout production', show_cmd: true
|
@@ -27,13 +46,17 @@ def security_update(step = 'prepare')
|
|
27
46
|
|
28
47
|
when 'f', 'finish'
|
29
48
|
# ensure everything is committed
|
30
|
-
|
49
|
+
if Util.testing?
|
50
|
+
puts 'Util.system! git status --porcelain'
|
51
|
+
else
|
52
|
+
`git status --porcelain`.empty? || Interaction.fail('Please commit your changes before finishing the update.')
|
53
|
+
end
|
31
54
|
|
32
55
|
Interaction.announce 'Finishing security update'
|
33
56
|
Interaction.note 'Working directory clean.'
|
34
57
|
Interaction.prompt('Have you successfully run all tests?', 'n', /y|yes/) || Interaction.fail('Please run tests first.')
|
35
58
|
|
36
|
-
Interaction.note 'About to: push production, checkout & pull master, merge production, push master'
|
59
|
+
Interaction.note 'About to: push production, checkout & pull master, merge production, push master.'
|
37
60
|
Interaction.prompt('Continue?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
|
38
61
|
|
39
62
|
Util.system! 'git push', show_cmd: true
|
@@ -42,9 +65,42 @@ def security_update(step = 'prepare')
|
|
42
65
|
Util.system! 'git merge production', show_cmd: true
|
43
66
|
Util.system! 'git push', show_cmd: true
|
44
67
|
|
45
|
-
Interaction.announce '
|
68
|
+
Interaction.announce 'Deployment'
|
46
69
|
deploy = (Util.gem_major_version('capistrano') == 3) ? 'deploy' : 'deploy:migrations'
|
47
|
-
|
70
|
+
|
71
|
+
all_deploy_targets = Util.deploy_targets
|
72
|
+
Interaction.fail 'There are no deploy targets!' if all_deploy_targets.empty?
|
73
|
+
|
74
|
+
if all_deploy_targets.include?('staging')
|
75
|
+
Interaction.note 'There is a staging environment.'
|
76
|
+
Interaction.prompt('Deploy staging now?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
77
|
+
|
78
|
+
Interaction.announce 'Deploy staging'
|
79
|
+
Util.system! "bundle exec cap staging #{deploy}", show_cmd: true
|
80
|
+
|
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
|
+
else
|
83
|
+
Interaction.note 'There is no staging environment.'
|
84
|
+
end
|
85
|
+
|
86
|
+
deploy_targets_without_staging = all_deploy_targets.select { |target| target != 'staging' }
|
87
|
+
|
88
|
+
if deploy_targets_without_staging.empty?
|
89
|
+
Interaction.note 'There are no other stages.'
|
90
|
+
else
|
91
|
+
puts
|
92
|
+
Interaction.note 'Found the following other stages:'
|
93
|
+
puts deploy_targets_without_staging
|
94
|
+
puts
|
95
|
+
Interaction.prompt('Deploy other stages now?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
96
|
+
|
97
|
+
deploy_targets_without_staging.each do |target|
|
98
|
+
Interaction.announce "Deploy #{target}"
|
99
|
+
Util.system! "bundle exec cap #{target} #{deploy}", show_cmd: true
|
100
|
+
end
|
101
|
+
|
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!')
|
103
|
+
end
|
48
104
|
|
49
105
|
Interaction.success 'Successfully pushed and deployed security update'
|
50
106
|
puts
|