jumpup 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: ff68a671a142a27009322cfb38911217cf84f588
4
- data.tar.gz: 691e3f44c7dcfbf8f6c30145b7605bb54a973722
3
+ metadata.gz: 7769036c4d2de1cc20f9746aa4959172d1ebb9e5
4
+ data.tar.gz: 8aff067d48d1cfc08fa3412a7433ec4bd0523e9c
5
5
  SHA512:
6
- metadata.gz: 47dd5dd1d4dfd1f973e10143b65a5c5b0aed496a4b5166c205a09d6ef3340e6f5bd6d30ebbf10f97499b8eea2e7d22801905f7016524afc7e919b7020678b7d9
7
- data.tar.gz: 33ba51c18acbe2b644e35c704333f17fb1610ea8c705e48e7376b3a1286a8fc9e8168e7a3b61aa965823f425397f8a3d0233d2e5042215f4e268e3e726d8e2b9
6
+ metadata.gz: 662e5d2a05e59552bab8745f9c9ded9447280893bb02e83f89c3daa02664977db7d928e0e0ed7373519196bc4a45d4ecbb870cd31169b55db5918f8079041f37
7
+ data.tar.gz: 84ba7ea29f818342ecbf007a9c7889078ca2f94282371465102628e1efaa96f9aa94d0a4dd9a3dba780166a38129ef3a0cea036f70468977ae1939f54ee97199
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.8 (November 28, 2014)
4
+
5
+ ### features
6
+ - Abort integration if a new commit appears between spec and push tasks. You can use it running `git:store_last_commit_hash` on the beginning of integration (already on `jumpup:start`) and `git:check_last_commit_change` before pushing.
7
+
8
+ ### improvements
9
+
10
+ ### bug fixes
11
+
3
12
  ## 0.0.7 (September 15, 2014)
4
13
 
5
14
  ### features
@@ -28,6 +28,7 @@ INTEGRATION_TASKS = %w(
28
28
  jumpup:bundle_install
29
29
  db:migrate
30
30
  spec
31
+ jumpup:git:check_last_commit_change
31
32
  jumpup:finish
32
33
  )
33
34
  ```
@@ -44,6 +45,7 @@ For more information, please have a look at the "[Integration Steps](#integratio
44
45
 
45
46
  * [jumpup-heroku][jumpup-heroku]
46
47
  * [jumpup-hipchat][jumpup-hipchat]
48
+ * [jumpup-deis][jumpup-deis]
47
49
 
48
50
  ## Dependencies
49
51
 
@@ -70,19 +72,21 @@ The integration process is composed of several Rake tasks that are explained bel
70
72
 
71
73
  | Rake Task | Description |
72
74
  | --------- | ----------- |
73
- | `jumpup:integration:check` | Check if other user is already integrating, to avoid reject message from git after runing all tests. |
74
- | `jumpup:integration:lock` | Lock the integration to current user. |
75
- | `git:status_check` | Check if all local files have been commited to the local git repository. |
76
- | `log:clear` | Remove log files. |
77
- | `tmp:clear` | Remove temporary files. |
78
- | `git:pull` | Update local files from the remote git repository. |
79
- | `jumpup:start` | Run all the previous tasks on this order |
80
- | `jumpup:bundle_install` | Run `bundle install` on quiet mode |
81
- | `db:migrate` | Execute any new database migration created by other team members since the last integration. |
82
- | `test` or `spec` | Set the rake task your test/spec suite needs to run. Use a command that generate the coverage files. |
83
- | `git:push` | Push your changes. If any of the previous tasks break, because one test failed, for instance, the script won't push. Actually this task runs only if every checking done before work well. |
84
- | `jumpup:integration:unlock` | Unlock the integration to current user. |
85
- | `jumpup:finish` | Run tasks: `git:push` and `jumpup:integration:unlock` |
75
+ | `jumpup:integration:check` | Check if other user is already integrating, to avoid reject message from git after runing all tests. |
76
+ | `jumpup:integration:lock` | Lock the integration to current user. |
77
+ | `git:status_check` | Check if all local files have been commited to the local git repository. |
78
+ | `log:clear` | Remove log files. |
79
+ | `tmp:clear` | Remove temporary files. |
80
+ | `git:pull` | Update local files from the remote git repository. |
81
+ | `git:store_last_commit_hash` | Store last commit hash to be checked before git push. |
82
+ | `jumpup:start` | Run all the previous tasks on this order. |
83
+ | `jumpup:bundle_install` | Run `bundle install` on quiet mode. |
84
+ | `db:migrate` | Execute any new database migration created by other team members since the last integration. |
85
+ | `test` or `spec` | Set the rake task your test/spec suite needs to run. Use a command that generate the coverage files. |
86
+ | `git:check_last_commit_change` | Stop integration if a new commit is created since `git:store_last_commit_hash`. |
87
+ | `git:push` | Push your changes. If any of the previous tasks break, because one test failed, for instance, the script won't push. Actually this task runs only if every checking done before work well. |
88
+ | `jumpup:integration:unlock` | Unlock the integration to current user. |
89
+ | `jumpup:finish` | Run tasks: `git:push` and `jumpup:integration:unlock`. |
86
90
 
87
91
  Using this almost paranoid sequence of steps it will be hard to check in bad code in your repository, which is good, very good. The idea is that you should treat your repository as a sacred place, where only good code should ever enter.
88
92
 
@@ -97,6 +101,7 @@ INTEGRATION_TASKS = %w(
97
101
  jumpup:start
98
102
  jumpup:bundle_install
99
103
  db:migrate
104
+ jumpup:git:check_last_commit_change
100
105
  jumpup:finish
101
106
  )
102
107
  ```
@@ -113,6 +118,7 @@ INTEGRATION_TASKS = %w(
113
118
  jumpup:bundle_install
114
119
  db:migrate
115
120
  spec
121
+ jumpup:git:check_last_commit_change
116
122
  jumpup:finish
117
123
  )
118
124
  ```
@@ -128,6 +134,12 @@ SimpleCov.start 'rails' do
128
134
  end
129
135
  ```
130
136
 
137
+ #### Skip spec
138
+
139
+ Sometimes we have to change some configuration and deploy as fast as possible. It is possible setting the environment variable `SKIP_SPEC=1` to skip specs.
140
+
141
+ ```SKIP_SPEC=1 rake integrate```
142
+
131
143
  ## Versioning
132
144
 
133
145
  Jumpup follows the [Semantic Versioning](http://semver.org/).
@@ -198,5 +210,6 @@ This gem was created and is maintained by [HE:labs](https://github.com/Helabs).
198
210
  [helabs]: http://helabs.com.br/en/
199
211
  [jumpup-heroku]: https://github.com/Helabs/jumpup-heroku
200
212
  [jumpup-hipchat]: https://github.com/Helabs/jumpup-hipchat
213
+ [jumpup-deis]: https://github.com/Helabs/jumpup-deis
201
214
  [travis]: https://travis-ci.org/Helabs/jumpup
202
215
  [travis_badge]: https://travis-ci.org/Helabs/jumpup.svg?branch=master
@@ -35,11 +35,16 @@ module Jumpup
35
35
 
36
36
  def invoke_tasks
37
37
  INTEGRATION_TASKS.each do |subtask|
38
+ next if skip_spec?(subtask)
38
39
  Jumpup::UI.header("--> Executing #{subtask}...".white) do
39
40
  Rake::Task[subtask].invoke
40
41
  end
41
42
  end
42
43
  end
44
+
45
+ def skip_spec?(task)
46
+ task == 'spec' && ENV['SKIP_SPEC'] == '1'
47
+ end
43
48
  end
44
49
  end
45
50
 
@@ -20,6 +20,23 @@ module Jumpup
20
20
  sh 'git push --quiet'
21
21
  end
22
22
 
23
+ def store_last_commit_hash
24
+ Jumpup::UI.say ' --> Storing last commit hash...'.yellow
25
+ @@last_commit_hash = last_commit_hash
26
+ end
27
+
28
+ def check_last_commit_change
29
+ Jumpup::UI.say ' --> Checking if last commit changed since integration started...'.yellow
30
+ if last_commit_hash != stored_commit_hash
31
+ Jumpup::UI.say " --> Last commit changed since integration started. Halting!".red
32
+ exit
33
+ end
34
+ end
35
+
36
+ def reset_commit_hash!
37
+ @@last_commit_hash = ''
38
+ end
39
+
23
40
  def check_integration
24
41
  Jumpup::UI.say " --> Checking if there's someone integrating...".yellow
25
42
  Jumpup::UI.say `git tag -d integrating`
@@ -59,6 +76,14 @@ module Jumpup
59
76
  def user
60
77
  @user = `git config --get user.name`.strip
61
78
  end
79
+
80
+ def last_commit_hash
81
+ `git rev-parse HEAD`.strip
82
+ end
83
+
84
+ def stored_commit_hash
85
+ @@last_commit_hash ||= ''
86
+ end
62
87
  end
63
88
  end
64
89
  end
@@ -1,3 +1,3 @@
1
1
  module Jumpup
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -15,6 +15,16 @@ namespace :jumpup do
15
15
  task :push do
16
16
  Jumpup::GitCommand.push
17
17
  end
18
+
19
+ desc 'Stores last commit hash'
20
+ task :store_last_commit_hash do
21
+ Jumpup::GitCommand.store_last_commit_hash
22
+ end
23
+
24
+ desc 'Verifies if last commit changed'
25
+ task :check_last_commit_change do
26
+ Jumpup::GitCommand.check_last_commit_change
27
+ end
18
28
  end
19
29
 
20
30
  namespace :integration do
@@ -34,7 +44,7 @@ namespace :jumpup do
34
44
  end
35
45
  end
36
46
 
37
- task start: ['integration:check', 'integration:lock', 'git:status_check', 'log:clear', 'tmp:clear', 'git:pull'] do
47
+ task start: ['integration:check', 'integration:lock', 'git:status_check', 'log:clear', 'tmp:clear', 'git:pull', 'git:store_last_commit_hash'] do
38
48
  ENV['coverage'] = 'on'
39
49
  end
40
50
  task finish: ['git:push', 'integration:unlock']
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Jumpup::GitCommand do
4
+ include_examples 'capture stdout'
5
+
6
+ context '.store_last_commit_hash' do
7
+ it 'stores the last commit GitCommand.stored_commit_hash' do
8
+ subject.reset_commit_hash!
9
+
10
+ expect {
11
+ subject.store_last_commit_hash
12
+ }.to change(subject, :stored_commit_hash).from('')
13
+ end
14
+ end
15
+
16
+ context '.check_last_commit_change' do
17
+ it 'halts if last commit changes' do
18
+ subject.store_last_commit_hash
19
+ allow(subject).to receive(:last_commit_hash).and_return('new_hash')
20
+
21
+ expect {
22
+ subject.check_last_commit_change
23
+ }.to raise_exception(SystemExit)
24
+ end
25
+
26
+ it 'goes on if last commit is the same' do
27
+ subject.store_last_commit_hash
28
+
29
+ expect {
30
+ subject.check_last_commit_change
31
+ }.to_not raise_exception
32
+ end
33
+ end
34
+
35
+ context '.reset_commit_hash!' do
36
+ it 'change commit hash to empty string' do
37
+ subject.store_last_commit_hash
38
+ expect {
39
+ subject.reset_commit_hash!
40
+ }.to change(subject, :stored_commit_hash).to('')
41
+ end
42
+ end
43
+ end
44
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jumpup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - HE:labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-16 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,6 +128,7 @@ files:
128
128
  - lib/jumpup/version.rb
129
129
  - lib/tasks/integrate.rake
130
130
  - spec/fixtures/integration.rake
131
+ - spec/jumpup/commands/git_command_spec.rb
131
132
  - spec/jumpup/integration_spec.rb
132
133
  - spec/spec_helper.rb
133
134
  - spec/support/rake_helpers.rb
@@ -165,6 +166,7 @@ test_files:
165
166
  - features/step_definitions/setup_git_repo.rb
166
167
  - features/support/env.rb
167
168
  - spec/fixtures/integration.rake
169
+ - spec/jumpup/commands/git_command_spec.rb
168
170
  - spec/jumpup/integration_spec.rb
169
171
  - spec/spec_helper.rb
170
172
  - spec/support/rake_helpers.rb