step-up 0.8.1 → 0.8.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.
- data/GEM_VERSION +1 -1
- data/lib/step-up/cli.rb +8 -10
- data/lib/step-up/driver/git.rb +24 -3
- metadata +4 -4
data/GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v0.8.
|
1
|
+
v0.8.2
|
data/lib/step-up/cli.rb
CHANGED
@@ -10,6 +10,7 @@ module StepUp
|
|
10
10
|
default_task :version
|
11
11
|
|
12
12
|
desc "version ACTION [base_object] [OPTIONS]", "manage versions of your project"
|
13
|
+
method_options %w[next-release -n] => :boolean # stepup version --next-release
|
13
14
|
method_options %w(levels -L) => :boolean # $ stepup version [--levels|-L]
|
14
15
|
method_options %w(level -l) => :string, %w(steps -s) => :boolean, %w(message -m) => :string, :'no-editor' => :boolean # $ stepup version create [--level|-l <level-name>] [--steps|-s] [--message|-m <comment-string>] [--no-editor]
|
15
16
|
method_options %w(mask -M) => :string # stepup version show --mask development_hudson_build_0
|
@@ -245,7 +246,12 @@ module StepUp
|
|
245
246
|
else
|
246
247
|
mask = options[:mask]
|
247
248
|
mask = nil if mask !~ /0/
|
248
|
-
|
249
|
+
if options[:"next-release"]
|
250
|
+
tag = driver.next_version_tag(commit_object, options[:level])
|
251
|
+
puts tag if tag
|
252
|
+
else
|
253
|
+
puts driver(mask).last_version_tag(commit_object || "HEAD", true)
|
254
|
+
end
|
249
255
|
end
|
250
256
|
end
|
251
257
|
|
@@ -257,15 +263,7 @@ module StepUp
|
|
257
263
|
level = options[:level] || "auto"
|
258
264
|
message = get_notes(true, get_custom_message)
|
259
265
|
|
260
|
-
if level == "auto"
|
261
|
-
detached_notes = driver.cached_detached_notes_as_hash(commit_object || "HEAD")
|
262
|
-
level = version_levels.last
|
263
|
-
version_levels.reverse.each do |name|
|
264
|
-
sections = CONFIG.versioning.auto_increment.sections_level[name]
|
265
|
-
next if sections.nil?
|
266
|
-
level = name if detached_notes.any?{ |section, notes| sections.include?(section) && notes.any? }
|
267
|
-
end
|
268
|
-
end
|
266
|
+
level = driver.next_release_level(commit_object) if level == "auto"
|
269
267
|
|
270
268
|
if version_levels.include? level
|
271
269
|
unless options[:'no-editor']
|
data/lib/step-up/driver/git.rb
CHANGED
@@ -107,10 +107,31 @@ check with the following bash command:
|
|
107
107
|
RangedNotes.new(self, tag, commit_base, :notes_sections => notes_sections).notes.as_hash
|
108
108
|
end
|
109
109
|
|
110
|
+
def next_release_level(commit_base)
|
111
|
+
level = CONFIG.versioning.version_levels.last
|
112
|
+
if CONFIG.versioning["auto_increment"].is_a?(Hash)
|
113
|
+
detached_notes = cached_detached_notes_as_hash(commit_base)
|
114
|
+
CONFIG.versioning.version_levels.reverse.each do |name|
|
115
|
+
sections = CONFIG.versioning.auto_increment.sections_level[name]
|
116
|
+
next if sections.nil?
|
117
|
+
level = name if detached_notes.any?{ |section, notes| sections.include?(section) && notes.any? }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
level
|
121
|
+
end
|
122
|
+
|
123
|
+
def next_version_tag(commit_base, level = nil)
|
124
|
+
level = next_release_level(commit_base) if level.nil?
|
125
|
+
if commit_base && mask.parse(commit_base)
|
126
|
+
mask.increase_version(commit_base, level)
|
127
|
+
else
|
128
|
+
tag = cached_last_version_tag(commit_base)
|
129
|
+
tag =~ /\+/ ? mask.increase_version($`, level) : nil
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
110
133
|
def steps_to_increase_version(level, commit_base = "HEAD", message = nil)
|
111
|
-
|
112
|
-
tag = tag.sub(/\+$/, '')
|
113
|
-
new_tag = mask.increase_version(tag, level)
|
134
|
+
new_tag = next_version_tag(commit_base, level)
|
114
135
|
notes = cached_detached_notes_as_hash(commit_base)
|
115
136
|
commands = []
|
116
137
|
commands << "git fetch" if cached_fetched_remotes.any?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: step-up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 2
|
10
|
+
version: 0.8.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marcelo Manzan
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2013-01-07 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: thor
|