geordi 3.2.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +5 -0
- data/CHANGELOG.md +69 -1
- data/Gemfile +2 -1
- data/Gemfile.lock +46 -28
- data/README.md +132 -140
- data/Rakefile +19 -9
- data/exe/dumple +19 -4
- data/geordi.gemspec +3 -2
- data/lib/geordi/COMMAND_TEMPLATE +4 -2
- data/lib/geordi/chromedriver_updater.rb +2 -2
- 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/chromedriver_update.rb +10 -3
- data/lib/geordi/commands/commit.rb +0 -5
- data/lib/geordi/commands/console.rb +11 -13
- data/lib/geordi/commands/create_databases.rb +7 -5
- data/lib/geordi/commands/cucumber.rb +22 -19
- data/lib/geordi/commands/delete_dumps.rb +0 -1
- data/lib/geordi/commands/deploy.rb +17 -17
- data/lib/geordi/commands/drop_databases.rb +0 -6
- data/lib/geordi/commands/dump.rb +20 -18
- data/lib/geordi/commands/firefox.rb +3 -6
- data/lib/geordi/commands/migrate.rb +4 -4
- data/lib/geordi/commands/rake.rb +7 -3
- data/lib/geordi/commands/rspec.rb +8 -12
- data/lib/geordi/commands/security_update.rb +24 -25
- data/lib/geordi/commands/server.rb +4 -4
- data/lib/geordi/commands/setup.rb +7 -16
- data/lib/geordi/commands/shell.rb +7 -8
- data/lib/geordi/commands/tests.rb +4 -4
- data/lib/geordi/commands/unit.rb +3 -3
- data/lib/geordi/commands/update.rb +4 -15
- data/lib/geordi/commands/vnc.rb +2 -4
- data/lib/geordi/commands/with_rake.rb +3 -3
- data/lib/geordi/commands/yarn_install.rb +1 -1
- data/lib/geordi/cucumber.rb +3 -3
- 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 +35 -17
- data/lib/geordi/version.rb +1 -1
- metadata +7 -34
- 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
@@ -5,7 +5,7 @@ desc 'Default: Run all tests'
|
|
5
5
|
task default: :features
|
6
6
|
|
7
7
|
task :features do
|
8
|
-
|
8
|
+
exec 'bundle exec cucumber'
|
9
9
|
end
|
10
10
|
|
11
11
|
task :readme do
|
@@ -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 "*******************************************************"
|
@@ -44,9 +45,13 @@ begin
|
|
44
45
|
end
|
45
46
|
|
46
47
|
config = YAML::load(ERB.new(File.read(config_path)).result)
|
48
|
+
environment, database = ARGV.reject{ |arg| arg[0].chr == '-' }
|
49
|
+
environment ||= 'production'
|
50
|
+
config = config[environment] or raise "No #{environment} database found.\nUsage: dumple ENVIRONMENT [DATABASE]"
|
47
51
|
|
48
|
-
|
49
|
-
|
52
|
+
if database
|
53
|
+
config = config[database] or raise %(Unknown #{environment} database "#{database}")
|
54
|
+
end
|
50
55
|
|
51
56
|
dump_dir = "#{ENV['HOME']}/dumps"
|
52
57
|
unless File.directory?(dump_dir)
|
@@ -60,7 +65,8 @@ begin
|
|
60
65
|
dump_path = "#{dump_dir}/#{config['database']}_#{Time.now.strftime("%Y%m%d_%H%M%S")}.dump"
|
61
66
|
end
|
62
67
|
|
63
|
-
|
68
|
+
given_database = database ? %(#{database} ) : ""
|
69
|
+
puts "> Dumping #{given_database}database for \"#{environment}\" environment ..."
|
64
70
|
|
65
71
|
host = config['host']
|
66
72
|
port = config['port']
|
@@ -89,13 +95,22 @@ begin
|
|
89
95
|
command << " --port=#{port}" if port
|
90
96
|
command
|
91
97
|
else
|
92
|
-
raise "Adapter \"#{config['adapter']} is not supported"
|
98
|
+
raise "Adapter \"#{config['adapter']}\" is not supported"
|
93
99
|
end
|
94
100
|
success = system(dump_command)
|
95
101
|
success or raise "Creating the dump failed"
|
96
102
|
|
97
103
|
system "chmod 600 #{dump_path}"
|
98
104
|
|
105
|
+
if compress
|
106
|
+
puts "> Compressing the dump ..."
|
107
|
+
|
108
|
+
# gzip compresses in place
|
109
|
+
compress_success = system("gzip #{dump_path}")
|
110
|
+
compress_success or raise "Compressing the dump failed"
|
111
|
+
dump_path << ".gz"
|
112
|
+
end
|
113
|
+
|
99
114
|
dump_size_kb = (File.size(dump_path) / 1024).round
|
100
115
|
|
101
116
|
puts "> Dumped to #{dump_path} (#{dump_size_kb} KB)"
|
data/geordi.gemspec
CHANGED
@@ -11,13 +11,13 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = 'Collection of command line tools we use in our daily work with Ruby, Rails and Linux at makandra.'
|
13
13
|
spec.description = 'Collection of command line tools we use in our daily work with Ruby, Rails and Linux at makandra.'
|
14
|
-
spec.homepage = '
|
14
|
+
spec.homepage = 'https://makandra.com'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
# Specify which files should be added to the gem when it is released.
|
18
18
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
19
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features)/}) }
|
21
21
|
end
|
22
22
|
spec.bindir = 'exe'
|
23
23
|
spec.executables = spec.files.grep(%r(^exe/)) { |f| File.basename(f) }
|
@@ -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 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,14 +12,16 @@ 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'
|
19
21
|
|
20
22
|
def example
|
21
23
|
# Invoke other commands like this:
|
22
|
-
|
24
|
+
invoke_geordi 'other_command', 'argument', an: 'option'
|
23
25
|
|
24
26
|
Interaction.fail 'Option missing' unless options.opt?
|
25
27
|
|
@@ -5,12 +5,12 @@ require 'tempfile'
|
|
5
5
|
module Geordi
|
6
6
|
class ChromedriverUpdater
|
7
7
|
|
8
|
-
def run
|
8
|
+
def run(options)
|
9
9
|
chrome_version = determine_chrome_version
|
10
10
|
chromedriver_version = determine_chromedriver_version
|
11
11
|
|
12
12
|
if skip_update?(chrome_version, chromedriver_version)
|
13
|
-
Interaction.
|
13
|
+
Interaction.note("No update required, you are using for both executables the same version #{chrome_version}!") unless options[:quiet_if_matching]
|
14
14
|
else
|
15
15
|
chromedriver_zip = download_chromedriver(chrome_version)
|
16
16
|
unzip(chromedriver_zip, File.expand_path('~/bin'))
|
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
|
@@ -1,13 +1,20 @@
|
|
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
|
+
|
8
|
+
Setting `auto_update_chromedriver` to `true` in your global Geordi config file
|
9
|
+
(`~/.config/geordi/global.yml`), will automatically update chromedriver before
|
10
|
+
cucumber tests, in case Chrome and chromedriver versions don't match
|
7
11
|
LONGDESC
|
8
12
|
|
13
|
+
option :quiet_if_matching, type: :boolean, default: false,
|
14
|
+
desc: 'Suppress notification if chromedriver and chrome versions match'
|
15
|
+
|
9
16
|
def chromedriver_update
|
10
17
|
require 'geordi/chromedriver_updater'
|
11
18
|
|
12
|
-
ChromedriverUpdater.new.run
|
19
|
+
ChromedriverUpdater.new.run(options)
|
13
20
|
end
|
@@ -1,13 +1,9 @@
|
|
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
8
|
stored in `~/.config/geordi/global.yml`.
|
13
9
|
LONGDESC
|
@@ -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,30 +1,28 @@
|
|
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
|
-
|
5
|
+
Remote: `geordi console staging`
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
geordi console staging -s
|
10
|
-
|
11
|
-
If you already know the number of the server you want to connect to, just pass it along:
|
12
|
-
|
13
|
-
geordi console staging -s2
|
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.
|
14
9
|
LONGDESC
|
15
10
|
|
16
|
-
|
17
|
-
option :select_server, type: :string, aliases: '-s'
|
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'
|
18
14
|
|
19
15
|
def console(target = 'development', *_args)
|
20
16
|
require 'geordi/remote'
|
17
|
+
invoke_geordi 'bundle_install'
|
21
18
|
|
22
19
|
if target == 'development'
|
23
|
-
|
20
|
+
invoke_geordi 'yarn_install'
|
24
21
|
|
25
22
|
Interaction.announce 'Opening a local Rails console'
|
26
23
|
|
27
|
-
|
24
|
+
command = Util.console_command(target)
|
25
|
+
Util.run!(command)
|
28
26
|
else
|
29
27
|
Interaction.announce 'Opening a Rails console on ' + target
|
30
28
|
|
@@ -1,15 +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 <<
|
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/)
|
11
13
|
|
12
|
-
Util.
|
14
|
+
Util.run!(command)
|
13
15
|
else
|
14
16
|
puts 'config/database.yml does not exist. Nothing to do.'
|
15
17
|
end
|
@@ -2,26 +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.
|
18
19
|
|
19
20
|
- *VNC:* By default, test browsers will run in a VNC session. When using a
|
20
|
-
headless test browser anyway, you can disable VNC by
|
21
|
-
|
22
|
-
|
23
|
-
use_vnc: false
|
24
|
-
|
21
|
+
headless test browser anyway, you can disable VNC by setting `use_vnc: false`
|
22
|
+
in `.geordi.yml` in the project root.
|
25
23
|
LONGDESC
|
26
24
|
|
27
25
|
option :modified, aliases: '-m', type: :boolean,
|
@@ -29,9 +27,9 @@ option :modified, aliases: '-m', type: :boolean,
|
|
29
27
|
option :containing, aliases: '-c', banner: 'STRING',
|
30
28
|
desc: 'Run all features that contain STRING'
|
31
29
|
option :verbose, aliases: '-v', type: :boolean,
|
32
|
-
desc: '
|
30
|
+
desc: 'Show the test run command'
|
33
31
|
option :debug, aliases: '-d', type: :boolean,
|
34
|
-
desc: 'Run with `-f pretty -b
|
32
|
+
desc: 'Run Cucumber with `-f pretty -b`, which helps hunting down bugs'
|
35
33
|
option :rerun, aliases: '-r', type: :numeric, default: 0,
|
36
34
|
desc: 'Rerun features up to N times while failing'
|
37
35
|
|
@@ -39,7 +37,7 @@ def cucumber(*args)
|
|
39
37
|
if args.empty?
|
40
38
|
# This is not testable as there is no way to stub `git` :(
|
41
39
|
if options.modified?
|
42
|
-
modified_features = `git status --short`.split(
|
40
|
+
modified_features = `git status --short`.split("\n").map do |line|
|
43
41
|
indicators = line.slice!(0..2) # Remove leading indicators
|
44
42
|
line if line.include?('.feature') && !indicators.include?('D')
|
45
43
|
end.compact
|
@@ -47,7 +45,7 @@ def cucumber(*args)
|
|
47
45
|
end
|
48
46
|
|
49
47
|
if options.containing
|
50
|
-
matching_features = `grep -lri '#{options.containing}' --include=*.feature features/`.split(
|
48
|
+
matching_features = `grep -lri '#{options.containing}' --include=*.feature features/`.split("\n")
|
51
49
|
args = matching_features.uniq
|
52
50
|
end
|
53
51
|
end
|
@@ -55,8 +53,13 @@ def cucumber(*args)
|
|
55
53
|
if File.directory?('features')
|
56
54
|
require 'geordi/cucumber'
|
57
55
|
|
58
|
-
|
59
|
-
|
56
|
+
settings = Geordi::Settings.new
|
57
|
+
|
58
|
+
invoke_geordi 'bundle_install'
|
59
|
+
invoke_geordi 'yarn_install'
|
60
|
+
if settings.auto_update_chromedriver
|
61
|
+
invoke_geordi 'chromedriver_update', quiet_if_matching: true
|
62
|
+
end
|
60
63
|
|
61
64
|
cmd_opts, files = args.partition { |f| f.start_with? '-' }
|
62
65
|
cmd_opts << '--format' << 'pretty' << '--backtrace' if options.debug
|
@@ -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.
|
@@ -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,22 +94,22 @@ 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_geordi '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/)
|
100
102
|
capistrano_call = "DEPLOY_BRANCH=#{source_branch} #{capistrano_call}" if options.current_branch
|
101
103
|
|
102
104
|
if git_call.any?
|
103
|
-
Util.
|
105
|
+
Util.run!(git_call.join(' && '), show_cmd: true)
|
104
106
|
end
|
105
107
|
|
106
|
-
|
107
|
-
|
108
|
-
Util.system! capistrano_call, show_cmd: true
|
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
|