gem-release 2.0.0.dev.1 → 2.0.0.dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de3c02037630d812e94714ef4d9bd64d0cb05b1c
4
- data.tar.gz: ac73a1c14c2cac5899f1e6589d5082ec20b50bb6
3
+ metadata.gz: 2eae2d6d553dc7f227a2d77d312478f9b350fc70
4
+ data.tar.gz: a9eb400332f183359a9607452f1988870a971765
5
5
  SHA512:
6
- metadata.gz: 43770ee60ea5a82409423671417c88498a0abd6fddabe4a75297552447eb1e12e3ad63acbf3ed7586c1f6af69de9c4c656efd3f39847602aa793f11e9bcb4195
7
- data.tar.gz: 643a26ffc6a0bb321a02b26481a7b8ced8689b1d9e3939f49dc333fb9137576404d52a73b00075f84c9b8ab7d493dee18379d32c5de72289a0b713538ceffa52
6
+ metadata.gz: 7f044bdc3f1e96aeb2e106efffbeb8f30e304f5d7d87ee26255c9e2d3a18c263ce219e2c6046c8bb3e155ecd708f50f56b209cd844e62ec3bed84a43e5c8d14e
7
+ data.tar.gz: a9411129a69515026f8a9fc51b0a64b216f1224f729ce61ff9345ea4c9075d84f0044cfa1a8cf1fd488c629138ea750659337ed9920496ce860710dc92fb6499
data/TODO.txt CHANGED
@@ -1,23 +1,25 @@
1
1
  # Todo
2
2
 
3
- * Make it so that if no arg is given, we fallback to the first gemspec file
4
- first. only if there's no gemspec file we use the dirname?
3
+ - Add defaults to options help output [5]
4
+ - Add specs for all error conditions [6]
5
+ - Add a changelog [7]
5
6
 
6
- * Add a changelog
7
+ - Make sure we don't double tag the same repo when several args are given [9]
7
8
 
8
- * Release and tag should fail if there are uncommitted changes
9
+ x Release and tag should fail if there are uncommitted changes done:2017-05-01 [8]
9
10
  https://github.com/svenfuchs/gem-release/issues/34
10
11
 
11
- * Make sure we don't double tag the same repo when several args are given
12
-
13
- # Fix
12
+ # Double check
14
13
 
15
- * Misleading success message
14
+ x Misleading success message done:2017-05-01 [4]
16
15
  https://github.com/svenfuchs/gem-release/issues/60
16
+ Pushing foo-0.0.5.gem
17
+ Pushing gem to http://localhost:9292...
18
+ ...
19
+ ERROR: While executing gem ... (Errno::ECONNREFUSED)
20
+ Failed to open TCP connection to localhost:9292 (Connection refused - connect(2) for "localhost" port 9292)
17
21
 
18
- # Double check
19
-
20
- - Issues with in-repo gems [1]
22
+ x Issues with in-repo gems done:2017-05-01 [1]
21
23
  https://github.com/svenfuchs/gem-release/issues/58
22
24
 
23
25
  x bump fails when there is a space in the path to project done:2017-05-01 [2]
@@ -29,166 +31,9 @@ x bump fails when there is a space in the path to project done:2017-05-01 [2]
29
31
  gem bootstrap foo
30
32
  gem bump --no-push
31
33
 
32
- - gem bump --tag --release pushes the wrong version [3]
34
+ x gem bump --tag --release pushes the wrong version done:2017-05-01 [3]
33
35
  https://github.com/svenfuchs/gem-release/issues/36
34
-
35
- # Refactor
36
-
37
- should create the directory foo, and cd into it
38
-
39
- cd tmp
40
- gem bootstrap foo
41
-
42
-
43
- should bootstrap a gem foo
44
-
45
- cd foo
46
- gem bootstrap
47
-
48
- should fail, as there's no foo.gemspec
49
-
50
- cd tmp
51
- gem bump foo
52
-
53
- should bump the first gemspec's gem, no matter the dir name
54
-
55
- cd foo
56
- gem bump
57
-
58
- # Scenario: Nested gem with conventional directory name
59
-
60
- ### Setup
61
-
62
- ```
63
- export GEM_RELEASE_PUSH=false
64
- cd /tmp
65
- rm -rf sinja
66
- gem bootstrap sinja
67
- cd sinja
68
- mkdir extensions
69
- cd extensions
70
- gem bootstrap sinja-sequel
71
- cd /tmp/sinja
72
- tree
73
- ```
74
-
75
- ### Directory structure
76
-
77
- ```
78
- .
79
- ├── Gemfile
80
- ├── LICENSE.md
81
- ├── extensions
82
- │   └── sinja-sequel
83
- │   ├── Gemfile
84
- │   ├── LICENSE.md
85
- │   ├── lib
86
- │   │   └── sinja
87
- │   │   ├── sequel
88
- │   │   │   └── version.rb
89
- │   │   └── sequel.rb
90
- │   └── sinja-sequel.gemspec
91
- ├── lib
92
- │   ├── sinja
93
- │   │   └── version.rb
94
- │   └── sinja.rb
95
- └── sinja.gemspec
96
- ```
97
-
98
- ### Behaviour
99
-
100
- ```
101
- # this bumps both sinja and sinja-sequel
102
- cd /tmp/sinja
103
- gem bump --recurse
104
-
105
- # this bumps sinja
106
- cd /tmp/sinja
107
- gem bump
108
-
109
- # this also bumps sinja
110
- cd /tmp/sinja
111
- gem bump sinja
112
-
113
- # this bumps sinja-sequel only
114
- cd /tmp/sinja
115
- gem bump sinja-sequel
116
-
117
- # this also bumps sinja-sequel only
118
- cd /tmp/sinja/extensions/sinja-sequel
119
- gem bump
120
-
121
- # this also bumps sinja-sequel only
122
- cd /tmp/sinja/extensions/sinja-sequel
123
- gem bump sinja-sequel
124
- ```
125
-
126
- ## Nested gem with irregular directory name
127
-
128
- ### Setup
129
-
130
- ```
131
- export GEM_RELEASE_PUSH=false
132
- cd /tmp
133
- rm -rf sinja
134
- gem bootstrap sinja
135
- cd sinja
136
- mkdir -p extensions
137
- cd extensions
138
- gem bootstrap sinja-sequel
139
- mv sinja-sequel sequel
140
- cd /tmp/sinja
141
- tree
142
- ```
143
-
144
- ### Directory structure
145
-
146
- ```
147
- .
148
- ├── Gemfile
149
- ├── LICENSE.md
150
- ├── extensions
151
- │   └── sequel
152
- │   ├── Gemfile
153
- │   ├── LICENSE.md
154
- │   ├── lib
155
- │   │   └── sinja
156
- │   │   ├── sequel
157
- │   │   │   └── version.rb
158
- │   │   └── sequel.rb
159
- │   └── sinja-sequel.gemspec
160
- ├── lib
161
- │   ├── sinja
162
- │   │   └── version.rb
163
- │   └── sinja.rb
164
- └── sinja.gemspec
165
- ```
166
-
167
- ### Behaviour
168
-
169
- ```
170
- # this bumps both sinja and sinja-sequel
171
- cd /tmp/sinja
172
- gem bump --recurse
173
-
174
- # this bumps sinja
175
- cd /tmp/sinja
176
- gem bump
177
-
178
- # this also bumps sinja
179
- cd /tmp/sinja
180
- gem bump sinja
181
-
182
- # this bumps sinja-sequel only
183
- cd /tmp/sinja
184
- gem bump sinja-sequel
185
-
186
- # this also bumps sinja-sequel only
187
- cd /tmp/sinja/extensions/sinja-sequel
188
- gem bump
189
-
190
- # this also bumps sinja-sequel only
191
- cd /tmp/sinja/extensions/sinja-sequel
192
- gem bump sinja-sequel
193
- ```
194
-
36
+ $ gem bump --tag --release
37
+ Bumping foo from version 0.0.3 to 0.0.4
38
+ ...
39
+ Pushing foo-0.0.4.gem
@@ -53,7 +53,7 @@ module Gem
53
53
 
54
54
  DEFAULTS = {
55
55
  commit: true,
56
- push: true,
56
+ push: false,
57
57
  remote: 'origin'
58
58
  }
59
59
 
@@ -86,13 +86,14 @@ module Gem
86
86
  end
87
87
 
88
88
  MSGS = {
89
- not_found: 'Ignoring %s. Version file %s not found.',
90
- no_remote: 'Cannot push to missing git remote %s.',
91
- bump: 'Bumping %s from version %s to %s',
92
- version: 'Changing version in %s from %s to %s',
93
- git_add: 'Staging %s',
94
- git_commit: 'Creating commit',
95
- git_push: 'Pushing to the %s git repository'
89
+ bump: 'Bumping %s from version %s to %s',
90
+ version: 'Changing version in %s from %s to %s',
91
+ git_add: 'Staging %s',
92
+ git_commit: 'Creating commit',
93
+ git_push: 'Pushing to the %s git repository',
94
+ git_dirty: 'Uncommitted changes found. Please commit or stash.',
95
+ not_found: 'Ignoring %s. Version file %s not found.',
96
+ no_git_remote: 'Cannot push to missing git remote %s.'
96
97
  }
97
98
 
98
99
  CMDS = {
@@ -116,8 +117,9 @@ module Gem
116
117
  private
117
118
 
118
119
  def validate
119
- abort :not_found, gem.name, version.path unless version.exists?
120
- abort :no_remote, remote if push? && !git_remotes.include?(remote)
120
+ abort :git_dirty unless git_clean?
121
+ abort :not_found, gem.name, version.path || '?' unless version.exists?
122
+ abort :no_git_remote, remote if push? && !git_remotes.include?(remote.to_s)
121
123
  end
122
124
 
123
125
  def bump
@@ -46,10 +46,11 @@ module Gem
46
46
  end
47
47
 
48
48
  MSGS = {
49
- release: 'Releasing %s with version %s',
50
- build: 'Building %s',
51
- push: 'Pushing %s',
52
- cleanup: 'Deleting left over gem file %s'
49
+ release: 'Releasing %s with version %s',
50
+ build: 'Building %s',
51
+ push: 'Pushing %s',
52
+ cleanup: 'Deleting left over gem file %s',
53
+ git_dirty: 'Uncommitted changes found. Please commit or stash.',
53
54
  }
54
55
 
55
56
  CMDS = {
@@ -58,6 +59,7 @@ module Gem
58
59
 
59
60
  def run
60
61
  in_gem_dirs do
62
+ validate
61
63
  release
62
64
  end
63
65
  tag if opts[:tag]
@@ -65,6 +67,10 @@ module Gem
65
67
 
66
68
  private
67
69
 
70
+ def validate
71
+ abort :git_dirty unless git_clean?
72
+ end
73
+
68
74
  def release
69
75
  announce :release, gem.name, gem.version
70
76
  build
@@ -12,7 +12,7 @@ module Gem
12
12
  private
13
13
 
14
14
  def run_cmd
15
- const.new(context.class.new, args, opts).run
15
+ const.new(context, args, opts).run
16
16
  end
17
17
 
18
18
  def const
@@ -46,6 +46,7 @@ module Gem
46
46
  git_tag: 'Creating git tag %s',
47
47
  git_push: 'Pushing tags to the %s git repository',
48
48
  no_remote: 'Cannot push to missing git remote %s',
49
+ git_dirty: 'Uncommitted changes found. Please commit or stash.',
49
50
  }
50
51
 
51
52
  CMDS = {
@@ -65,6 +66,7 @@ module Gem
65
66
  private
66
67
 
67
68
  def validate
69
+ abort :git_dirty unless git_clean?
68
70
  abort :no_remote, remote if push? && !git_remotes.include?(remote)
69
71
  end
70
72
 
@@ -12,6 +12,10 @@ module Gem
12
12
  true
13
13
  end
14
14
 
15
+ def git_clean?
16
+ system 'git diff-index --quiet HEAD'
17
+ end
18
+
15
19
  def git_remotes
16
20
  `git remote`.split("\n")
17
21
  end
@@ -5,8 +5,8 @@ module Gem
5
5
  module Helper
6
6
  extend Forwardable
7
7
  def_delegators :context, :gem, :system
8
- def_delegators :system, :git_remotes, :git_user_name, :git_user_email,
9
- :github_user_name
8
+ def_delegators :system, :git_clean?, :git_remotes, :git_user_name,
9
+ :git_user_email, :github_user_name
10
10
 
11
11
  def run(cmd)
12
12
  return true if send(cmd)
@@ -1,5 +1,5 @@
1
1
  module Gem
2
2
  module Release
3
- VERSION = '2.0.0.dev.1'
3
+ VERSION = '2.0.0.dev.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.dev.1
4
+ version: 2.0.0.dev.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs