geordi 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6987f48d4bce3bf0e72d2395052b1147cd0b1f1dc4e3beea5d928e2a187a84e2
4
- data.tar.gz: b72fa01a11225dc875a4c124f1d39d111a2bc5d4e4ef6f5a882adc34504335cf
3
+ metadata.gz: 8209de927d9f973919406bcc485f908774db958aa66301baed5f7680ba6b0c42
4
+ data.tar.gz: 19450383000e1ac02325f071a18e47b5e2c9dc59f10f2bc14cdde7283ffafa8e
5
5
  SHA512:
6
- metadata.gz: f04fd539fe8c3d286c28bfdfad3297cf9dcda5edf93eb4719a8bc25a383a04873c4fd2f3a716e65e806546685d8e6af3771d060926a2144fc60c1b68f912a34f
7
- data.tar.gz: e3791d7d0d41c610a3b7a6c95a002e354235835948e3b55974dba99254594378f47114f9ffe8c4065ac575f91d6b0acc440c2579dcab0632efc3132037c4c585
6
+ metadata.gz: 6c57254616496d86a8b6930ef56a985e209311ce42e9152bc25e37e96df89161dd04801f95310a2c565116307fe18b6e5dd5623bd35aa1cbbb26ae4415513d3f
7
+ data.tar.gz: e6f62e4853962f109eba4e60758577fe7517ab4e04d1ee271f08e9a5f2e8666762770e5481de20b463377744dec9067e39886eeb2858b3ddb74f3e3a32a6ef40
data/CHANGELOG.md CHANGED
@@ -10,17 +10,34 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
10
10
 
11
11
  ### Breaking changes
12
12
 
13
+
14
+ ## 2.5.0 2019-10-25
15
+
16
+ ### Compatible changes
17
+ - Added [#69](https://github.com/makandra/geordi/issues/69): If bin/setup exists, prefer it over Geordi's standard setup routine.
18
+ - Fixed [#48](https://github.com/makandra/geordi/issues/48): Bundle right before deploying
19
+ - Improved [#56](https://github.com/makandra/geordi/issues/56): Print instructions how to set up `DEPLOY_BRANCH` when deploying the current branch.
20
+
21
+
22
+ ## 2.4.0 2019-10-21
23
+
24
+ ### Compatible changes
25
+ - [#56](https://github.com/makandra/geordi/issues/56): Add current branch option to "deploy" command. This actually sets the `DEPLOY_BRANCH` variable to the current branch during deployment. The deployed application needs to pick up this variable in the respective Capistrano stage file. Example: `set :branch, ENV['DEPLOY_BRANCH'] || 'master'`
26
+
27
+
13
28
  ## 2.3.0 2019-08-27
14
29
 
15
30
  ### Compatible changes
16
31
  - Fixes [#70]: Make "console" and "server" commands ready for Rails 6
17
32
  - Added: CI testing with Travis
18
33
 
34
+
19
35
  ## 2.2.0 2019-02-28
20
36
 
21
37
  ### Compatible changes
22
38
  - Fixes [#67]: Don't run yarn install unless needed
23
39
 
40
+
24
41
  ## 2.1.0 2019-02-25
25
42
 
26
43
  ### Compatible changes
data/Gemfile CHANGED
@@ -8,4 +8,4 @@ gem 'rspec-mocks'
8
8
  gem 'highline'
9
9
  gem 'parallel_tests'
10
10
  gem 'launchy'
11
- gem 'pry'
11
+ # gem 'pry' # Not supported for 1.8.7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (2.3.0)
4
+ geordi (2.5.0)
5
5
  thor (>= 0.18.0)
6
6
 
7
7
  GEM
@@ -15,7 +15,6 @@ GEM
15
15
  builder (3.2.3)
16
16
  childprocess (1.0.1)
17
17
  rake (< 13.0)
18
- coderay (1.1.2)
19
18
  cucumber (1.3.20)
20
19
  builder (>= 2.1.2)
21
20
  diff-lcs (>= 1.1.3)
@@ -28,15 +27,11 @@ GEM
28
27
  highline (1.6.21)
29
28
  launchy (2.4.3)
30
29
  addressable (~> 2.3)
31
- method_source (0.9.2)
32
30
  multi_json (1.13.1)
33
31
  multi_test (0.1.2)
34
32
  parallel (0.5.16)
35
33
  parallel_tests (0.6.18)
36
34
  parallel
37
- pry (0.12.2)
38
- coderay (~> 1.1.0)
39
- method_source (~> 0.9.0)
40
35
  rake (10.5.0)
41
36
  rspec-expectations (3.4.0)
42
37
  diff-lcs (>= 1.2.0, < 2.0)
@@ -45,7 +40,7 @@ GEM
45
40
  diff-lcs (>= 1.2.0, < 2.0)
46
41
  rspec-support (~> 3.4.0)
47
42
  rspec-support (3.4.1)
48
- thor (0.19.1)
43
+ thor (0.20.3)
49
44
 
50
45
  PLATFORMS
51
46
  ruby
@@ -56,7 +51,6 @@ DEPENDENCIES
56
51
  highline
57
52
  launchy
58
53
  parallel_tests
59
- pry
60
54
  rspec-mocks
61
55
 
62
56
  BUNDLED WITH
data/README.md CHANGED
@@ -96,10 +96,10 @@ Geordi will ask for confirmation before actually deleting files.
96
96
 
97
97
  Guided deployment across branches.
98
98
 
99
- Example: `geordi deploy` or `geordi deploy p[roduction]`
99
+ Example: `geordi deploy` or `geordi deploy p[roduction]` or `geordi deploy --current-branch`
100
100
 
101
- Merge, push and deploy with a single command! There are several scenarios where
102
- this command comes in handy:
101
+ Merge, push and deploy with a single command! **It always tells what it will do
102
+ before it does it.** There are different scenarios where this command is handy:
103
103
 
104
104
  1) *Production deploy:* From the master branch, run `geordi deploy production`.
105
105
  This will merge `master` to `production`, push and deploy to production.
@@ -107,6 +107,10 @@ this command comes in handy:
107
107
  2) *Feature branch deploy:* From a feature branch, run `geordi deploy staging`.
108
108
  This will merge the feature branch to `master`, push and deploy to staging.
109
109
 
110
+ To deploy a feature branch directly without merging, run
111
+ `geordi deploy --current-branch`. This feature depends on the environment
112
+ variable `DEPLOY_BRANCH` to be picked up in the respective deploy file.
113
+
110
114
  3) *Simple deploy:* If the source branch matches the target branch, merging will
111
115
  be skipped.
112
116
 
@@ -259,12 +263,15 @@ Setup a project for the first time.
259
263
 
260
264
  Example: `geordi setup`
261
265
 
262
- Check out a repository, cd into its directory. Now let `setup` do the tiring
266
+ Check out a repository and cd into its directory. Then let `setup` do the tiring
263
267
  work: run `bundle install`, create `database.yml`, create databases, migrate
264
268
  (all if applicable).
265
269
 
266
- After setting up, loads a dump into the development db when called with the
267
- `--dump` option:
270
+ If a local bin/setup file is found, Geordi skips these steps runs bin/setup
271
+ for setup instead.
272
+
273
+ After setting up, loads a remote database dump into the development db when
274
+ called with the `--dump` option:
268
275
 
269
276
  geordi setup -d staging
270
277
 
@@ -272,8 +279,6 @@ After setting up, runs all tests when called with the `--test` option:
272
279
 
273
280
  geordi setup -t
274
281
 
275
- See `geordi help setup` for details.
276
-
277
282
 
278
283
  ### `geordi shell TARGET`
279
284
 
@@ -15,6 +15,7 @@ Feature: The deploy command
15
15
  Then the output should contain:
16
16
  """
17
17
  # Checking whether your master branch is ready
18
+ Util.system! git checkout master
18
19
  > All good.
19
20
 
20
21
  # You are about to:
@@ -35,9 +36,31 @@ Feature: The deploy command
35
36
  Deploying the current branch requires support by the deployed application:
36
37
  its deploy config needs to pick up the DEPLOY_BRANCH environment variable.
37
38
 
39
+ When I run `geordi deploy --current-branch` interactively
40
+ # Answer deployment stage prompt
41
+ And I type "staging"
42
+ Then the output should contain "configure config/deploy/staging.rb"
43
+ And the output should contain "ENV['DEPLOY_BRANCH']"
44
+
45
+ Given a file named "config/deploy/staging.rb" with:
46
+ """
47
+ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
48
+ """
38
49
  When I run `geordi deploy --current-branch` interactively
39
50
  # Answer deployment stage prompt
40
51
  And I type "staging"
41
52
  # Confirm deployment
42
53
  And I type "yes"
43
- Then the output should contain "DEPLOY_BRANCH=master cap staging deploy:migrations"
54
+ # Current branch is always "master" during tests
55
+ Then the output should contain "From current branch master"
56
+ And the output should contain "DEPLOY_BRANCH=master cap staging deploy:migrations"
57
+
58
+
59
+ Scenario: Deploying with a given stage
60
+ Given a file named "config/deploy/staging.rb" with "staging.rb exists"
61
+
62
+ When I run `geordi deploy staging` interactively
63
+ And I type "master"
64
+ And I type ""
65
+ And I type "no"
66
+ Then the output should not contain "Deployment stage: [staging]"
@@ -0,0 +1,11 @@
1
+ Feature: Project setup
2
+
3
+ Scenario: A local bin/setup is preferred
4
+ Given a file named "bin/setup" with "custom project setup"
5
+
6
+ When I run `geordi setup`
7
+ Then the output should contain "Running bin/setup"
8
+ And the output should contain "Geordi's own setup routine is skipped"
9
+ And the output should contain "Util.system! bin/setup"
10
+ And the output should not contain "Creating databases"
11
+ But the output should contain "Successfully set up the project"
@@ -1,5 +1,5 @@
1
1
  require 'aruba/cucumber'
2
- require 'pry'
2
+ # require 'pry'
3
3
 
4
4
  # Disables execution of Util.system! calls
5
5
  ENV['GEORDI_TESTING'] = 'true'
@@ -1,9 +1,9 @@
1
1
  desc 'deploy [STAGE]', 'Guided deployment across branches'
2
2
  long_desc <<-LONGDESC
3
- Example: `geordi deploy` or `geordi deploy p[roduction]`
3
+ Example: `geordi deploy` or `geordi deploy p[roduction]` or `geordi deploy --current-branch`
4
4
 
5
- Merge, push and deploy with a single command! There are several scenarios where
6
- this command comes in handy:
5
+ Merge, push and deploy with a single command! **It always tells what it will do
6
+ before it does it.** There are different scenarios where this command is handy:
7
7
 
8
8
  1) *Production deploy:* From the master branch, run `geordi deploy production`.
9
9
  This will merge `master` to `production`, push and deploy to production.
@@ -11,6 +11,10 @@ this command comes in handy:
11
11
  2) *Feature branch deploy:* From a feature branch, run `geordi deploy staging`.
12
12
  This will merge the feature branch to `master`, push and deploy to staging.
13
13
 
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
+
14
18
  3) *Simple deploy:* If the source branch matches the target branch, merging will
15
19
  be skipped.
16
20
 
@@ -28,7 +32,7 @@ LONGDESC
28
32
 
29
33
  option :no_migrations, :aliases => '-M', :type => :boolean,
30
34
  :desc => 'Run cap deploy instead of cap deploy:migrations'
31
- option :current_branch, :aliases => '-b', :type => :boolean,
35
+ option :current_branch, :aliases => '-c', :type => :boolean,
32
36
  :desc => 'Set DEPLOY_BRANCH to the current branch during deploy'
33
37
 
34
38
  def deploy(target_stage = nil)
@@ -37,12 +41,20 @@ def deploy(target_stage = nil)
37
41
  if target_stage and not Util.deploy_targets.include? target_stage
38
42
  # Target stage autocompletion from available stages
39
43
  target_stage = Util.deploy_targets.find { |t| t.start_with? target_stage }
44
+ target_stage || warn('Given deployment stage not found')
40
45
  end
41
- proposed_stage = target_stage || branch_stage_map.fetch(Util.current_branch, 'staging')
42
46
 
43
47
  # Ask for required information
44
- target_stage = prompt 'Deployment stage:', proposed_stage
48
+ target_stage ||= prompt 'Deployment stage:', branch_stage_map.fetch(Util.current_branch, 'staging')
45
49
  if options.current_branch
50
+ stage_file = "config/deploy/#{target_stage}.rb"
51
+ Util.file_containing? stage_file, 'DEPLOY_BRANCH' or fail <<-ERROR
52
+ To deploy from the current branch, configure #{stage_file} to respect the
53
+ environment variable DEPLOY_BRANCH. Example:
54
+
55
+ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
56
+ ERROR
57
+
46
58
  source_branch = target_branch = Util.current_branch
47
59
  else
48
60
  source_branch = prompt 'Source branch:', Util.current_branch
@@ -53,7 +65,8 @@ def deploy(target_stage = nil)
53
65
  push_needed = merge_needed || `git cherry -v | wc -l`.strip.to_i > 0
54
66
  push_needed = false if Util.testing? # Hard to test
55
67
 
56
- announce "Checking whether your #{source_branch} branch is ready"
68
+ announce "Checking whether your #{source_branch} branch is ready" ############
69
+ Util.system! "git checkout #{source_branch}"
57
70
  if `git status -s | wc -l`.strip != '0' and not Util.testing?
58
71
  warn "Your #{source_branch} branch holds uncommitted changes."
59
72
  prompt('Continue anyway?', 'n', /y|yes/) or fail 'Cancelled.'
@@ -73,25 +86,30 @@ def deploy(target_stage = nil)
73
86
  Util.system! "git --no-pager log origin/#{target_branch}..#{source_branch} --oneline"
74
87
  end
75
88
  note "Deploy to #{target_stage}"
89
+ note "From current branch #{source_branch}" if options.current_branch
76
90
 
77
91
  if prompt('Go ahead with the deployment?', 'n', /y|yes/)
92
+ puts
93
+ git_call = []
94
+ git_call << "git merge #{source_branch}" if merge_needed
95
+ git_call << 'git push' if push_needed
96
+
78
97
  capistrano_call = "cap #{target_stage} deploy"
79
98
  capistrano_call << ':migrations' unless Util.gem_major_version('capistrano') == 3 || options.no_migrations
80
99
  capistrano_call = "bundle exec #{capistrano_call}" if Util.file_containing?('Gemfile', /capistrano/)
81
100
  capistrano_call = "DEPLOY_BRANCH=#{source_branch} #{capistrano_call}" if options.current_branch
82
101
 
102
+ if git_call.any?
103
+ Util.system! git_call.join(' && '), :show_cmd => true
104
+ end
105
+
83
106
  invoke_cmd 'bundle_install'
84
- invoke_cmd 'yarn_install'
85
107
 
86
- puts
87
- commands = []
88
- commands << "git merge #{source_branch}" if merge_needed
89
- commands << 'git push' if push_needed
90
- commands << capistrano_call
91
- Util.system! commands.join(' && '), :show_cmd => true
108
+ Util.system! capistrano_call, :show_cmd => true
92
109
 
93
110
  success 'Deployment complete.'
94
111
  else
112
+ Util.system! "git checkout #{source_branch}"
95
113
  fail 'Deployment cancelled.'
96
114
  end
97
115
 
@@ -2,20 +2,21 @@ desc 'setup', 'Setup a project for the first time'
2
2
  long_desc <<-LONGDESC
3
3
  Example: `geordi setup`
4
4
 
5
- Check out a repository, cd into its directory. Now let `setup` do the tiring
5
+ Check out a repository and cd into its directory. Then let `setup` do the tiring
6
6
  work: run `bundle install`, create `database.yml`, create databases, migrate
7
7
  (all if applicable).
8
8
 
9
- After setting up, loads a dump into the development db when called with the
10
- `--dump` option:
9
+ If a local bin/setup file is found, Geordi skips these steps runs bin/setup
10
+ for setup instead.
11
+
12
+ After setting up, loads a remote database dump into the development db when
13
+ called with the `--dump` option:
11
14
 
12
15
  geordi setup -d staging
13
16
 
14
17
  After setting up, runs all tests when called with the `--test` option:
15
18
 
16
19
  geordi setup -t
17
-
18
- See `geordi help setup` for details.
19
20
  LONGDESC
20
21
 
21
22
  option :dump, :type => :string, :aliases => '-d', :banner => 'TARGET',
@@ -23,8 +24,15 @@ option :dump, :type => :string, :aliases => '-d', :banner => 'TARGET',
23
24
  option :test, :type => :boolean, :aliases => '-t', :desc => 'After setup, run tests'
24
25
 
25
26
  def setup
26
- invoke_cmd 'create_databases'
27
- invoke_cmd 'migrate'
27
+ if File.exists? 'bin/setup'
28
+ announce 'Running bin/setup'
29
+ note "Geordi's own setup routine is skipped"
30
+
31
+ Util.system! 'bin/setup'
32
+ else
33
+ invoke_cmd 'create_databases'
34
+ invoke_cmd 'migrate'
35
+ end
28
36
 
29
37
  success 'Successfully set up the project.'
30
38
 
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '2.4.0'
2
+ VERSION = '2.5.0'
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: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-21 00:00:00.000000000 Z
11
+ date: 2019-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -83,6 +83,7 @@ files:
83
83
  - features/dump.feature
84
84
  - features/firefox.feature
85
85
  - features/server.feature
86
+ - features/setup.feature
86
87
  - features/shell.feature
87
88
  - features/support/env.rb
88
89
  - features/support/step_definitions/aruba_backport_steps.rb