step-up 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -15
- data/lib/step-up/cli.rb +53 -17
- data/lib/step-up/driver/git.rb +13 -12
- data/lib/step-up/git_extensions.rb +6 -6
- data/lib/step-up/ranged_notes.rb +29 -4
- data/spec/lib/step-up/ranged_notes_spec.rb +103 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# StepUp: a project to step up your projects
|
2
|
-
StepUp is a tool to manage versioning
|
2
|
+
StepUp is a tool to manage versioning.
|
3
|
+
That means you can bump the version of your project, for example, from v3.0.11 to v4.0.0, check the current version, summarize all the history of versions in a changelog and more.
|
4
|
+
|
5
|
+
StepUp is based on source control management features (i.e. tags, branches, commits, notes etc), so it doesn't need to keep files with the current version (but it supports it, if you want), it has visibility of all history of changes and versions (doesn't matter if they are spread in many different branches), which adds a variety of possibilities in terms of management, depending on your project needs.
|
3
6
|
|
4
7
|
## Prerequisite
|
5
8
|
Git version 1.7.1 and above.
|
@@ -14,32 +17,26 @@ With that said, run
|
|
14
17
|
|
15
18
|
stepup init
|
16
19
|
|
17
|
-
It will create a file in your project called **.stepuprc
|
20
|
+
It will create a file in your project called **.stepuprc**.
|
18
21
|
We'll cover more about this in the next sections.
|
19
22
|
|
20
23
|
## The Basics
|
21
|
-
###
|
22
|
-
|
23
|
-
stepup version
|
24
|
-
|
25
|
-
or just
|
26
|
-
|
27
|
-
stepup
|
24
|
+
### Current project version
|
28
25
|
|
29
|
-
|
26
|
+
stepup [version]
|
30
27
|
|
31
|
-
|
28
|
+
An example of output would be
|
32
29
|
|
33
|
-
v0.2.0+
|
30
|
+
v0.2.0+3
|
34
31
|
|
35
|
-
The "+
|
32
|
+
The "+3" part means the project has one commit since last version.
|
36
33
|
The format of the version is totally customizable through **.stepuprc** which we will cover in more detail later.
|
37
34
|
|
38
|
-
###
|
35
|
+
### Stepping up a version
|
39
36
|
|
40
37
|
stepup version create [--level LEVEL_NAME]
|
41
38
|
|
42
|
-
where **LEVEL_NAME
|
39
|
+
where **LEVEL_NAME**, by default, could be
|
43
40
|
|
44
41
|
* major
|
45
42
|
* minor
|
data/lib/step-up/cli.rb
CHANGED
@@ -13,6 +13,7 @@ module StepUp
|
|
13
13
|
method_options %w(levels -L) => :boolean # $ stepup version [--levels|-L]
|
14
14
|
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
15
|
method_options %w(mask -M) => :string # stepup version show --mask development_hudson_build_0
|
16
|
+
method_options %w(masks) => :string # stepup version show --masks
|
16
17
|
VERSION_ACTIONS = %w[show create help]
|
17
18
|
def version(action = nil, commit_base = nil)
|
18
19
|
unless VERSION_ACTIONS.include?(action)
|
@@ -45,13 +46,15 @@ module StepUp
|
|
45
46
|
desc "changelog --top=<num> --format={default|wiki|html}", "show changelog from each version tag"
|
46
47
|
method_options %w[top -n] => :numeric
|
47
48
|
method_options %w[format -f] => :string
|
49
|
+
method_options %w(mask -M) => :string # stepup changelog --mask development_hudson_build_0
|
48
50
|
def changelog
|
49
51
|
log = []
|
50
52
|
method_name = "changelog_format_#{ options[:format] }"
|
51
53
|
method_name = "changelog_format_default" unless respond_to?(method_name)
|
54
|
+
driver = driver(options[:mask])
|
52
55
|
driver.all_version_tags.each_with_index do |tag, index|
|
53
56
|
break if options[:top] && index >= options[:top]
|
54
|
-
log << send(method_name, tag)
|
57
|
+
log << send(method_name, tag, driver.version_tag_info(tag))
|
55
58
|
end
|
56
59
|
puts log.join("\n\n")
|
57
60
|
end
|
@@ -59,7 +62,9 @@ module StepUp
|
|
59
62
|
desc "notes ACTION [base_object] [OPTIONS]", "show notes for the next version"
|
60
63
|
method_options :clean => :boolean, :steps => :boolean, :"-m" => :string, :since => :string, :after => :string, :upto => :string
|
61
64
|
method_options :fetch => :boolean
|
65
|
+
method_options :"with-commit" => :boolean
|
62
66
|
method_options %w[section -s] => :string
|
67
|
+
method_options :sections => :array
|
63
68
|
def notes(action = "show", commit_base = nil)
|
64
69
|
unless %w[show add remove help].include?(action)
|
65
70
|
commit_base ||= action
|
@@ -81,14 +86,12 @@ module StepUp
|
|
81
86
|
|
82
87
|
protected
|
83
88
|
|
84
|
-
def changelog_format_default(tag)
|
85
|
-
tag_info = driver.version_tag_info(tag)
|
89
|
+
def changelog_format_default(tag, tag_info)
|
86
90
|
created_at = tag_info[:date].strftime("%b/%d %Y %H:%M %z")
|
87
91
|
"\033[0;33m#{tag} (#{created_at} by #{tag_info[:tagger]})\033[0m\n\n#{ tag_info[:message] }"
|
88
92
|
end
|
89
93
|
|
90
|
-
def changelog_format_html(tag)
|
91
|
-
tag_info = driver.version_tag_info(tag)
|
94
|
+
def changelog_format_html(tag, tag_info)
|
92
95
|
created_at = tag_info[:date].strftime("%b/%d %Y %H:%M %z")
|
93
96
|
log = []
|
94
97
|
log << "<h3 class=\"changelog_header\">#{tag} (#{created_at} by #{tag_info[:tagger]})</h3>"
|
@@ -99,8 +102,7 @@ module StepUp
|
|
99
102
|
log.join("\n")
|
100
103
|
end
|
101
104
|
|
102
|
-
def changelog_format_wiki(tag)
|
103
|
-
tag_info = driver.version_tag_info(tag)
|
105
|
+
def changelog_format_wiki(tag, tag_info)
|
104
106
|
created_at = tag_info[:date].strftime("%b/%d %Y %H:%M %z")
|
105
107
|
log = []
|
106
108
|
log << "== #{tag} (#{created_at} by #{tag_info[:tagger]}) ==\n"
|
@@ -162,12 +164,16 @@ module StepUp
|
|
162
164
|
end
|
163
165
|
|
164
166
|
def notes_add
|
165
|
-
message = options[:m]
|
167
|
+
message = options[:m]
|
166
168
|
message = nil if options[:m] =~ /^(|m)$/
|
167
169
|
|
170
|
+
last_commit = driver.commit_history(commit_object, 1, :with_messages => true).first
|
171
|
+
if last_commit.nil?
|
172
|
+
puts "This repository has no commit history"
|
173
|
+
exit 1
|
174
|
+
end
|
168
175
|
unless message
|
169
|
-
|
170
|
-
message = last_commit.last if last_commit
|
176
|
+
message = last_commit.last
|
171
177
|
message << <<-TEXT
|
172
178
|
|
173
179
|
|
@@ -177,7 +183,7 @@ module StepUp
|
|
177
183
|
message = edit_message(driver.class::NOTE_MESSAGE_FILE_PATH, message)
|
178
184
|
end
|
179
185
|
|
180
|
-
unless message.empty?
|
186
|
+
unless message.nil? || message.empty?
|
181
187
|
section = options[:section] || choose(CONFIG.notes_sections.names, "Choose a section to add the note:")
|
182
188
|
if section.nil? || ! CONFIG.notes_sections.names.include?(section)
|
183
189
|
puts "Aborting due to invalid section"
|
@@ -194,6 +200,17 @@ module StepUp
|
|
194
200
|
version_levels.each do |level|
|
195
201
|
puts " - #{level}"
|
196
202
|
end
|
203
|
+
elsif options[:masks]
|
204
|
+
all_tags = driver.tags.scan(/[^\r\n]+/)
|
205
|
+
all_masks = all_tags.map{ |tag| tag.gsub(/\d+/, '0') }.uniq.sort
|
206
|
+
masks = []
|
207
|
+
prev = nil
|
208
|
+
all_masks.each do |mask|
|
209
|
+
next unless mask =~ /\d$/
|
210
|
+
mask = masks.pop + mask[prev.size..-1].gsub(/0/, '9') if prev && mask.start_with?(prev.gsub(/9/, '0'))
|
211
|
+
masks << (prev = mask)
|
212
|
+
end
|
213
|
+
puts masks.join("\n") if masks.any?
|
197
214
|
else
|
198
215
|
mask = options[:mask]
|
199
216
|
mask = nil if mask !~ /0/
|
@@ -324,8 +341,6 @@ module StepUp
|
|
324
341
|
f.write content
|
325
342
|
end
|
326
343
|
end
|
327
|
-
else
|
328
|
-
say_status :ignore, "Ignoring creation of lib/tasks/versioning.rake", :yellow
|
329
344
|
end
|
330
345
|
end
|
331
346
|
|
@@ -361,12 +376,32 @@ module StepUp
|
|
361
376
|
File.open(temp_file, "w"){ |f| f.write initial_content }
|
362
377
|
editor = driver.editor_name
|
363
378
|
if editor =~ /\w/
|
379
|
+
init_time = Time.now
|
364
380
|
if editor =~ /^vim?\b/
|
365
381
|
system "#{ editor } #{ temp_file }"
|
366
382
|
else
|
367
383
|
`#{ editor } #{ temp_file } && wait $!`
|
368
384
|
end
|
385
|
+
elapsed_time = Time.now - init_time
|
386
|
+
if elapsed_time < 1.0
|
387
|
+
puts "Premature termination of the text editor."
|
388
|
+
puts "Make sure of having set the editor as appropriate."
|
389
|
+
exit 1
|
390
|
+
end
|
369
391
|
File.read(temp_file).gsub(/^\#.*/m, '').rstrip
|
392
|
+
else
|
393
|
+
puts <<-TEXT
|
394
|
+
No editor found.
|
395
|
+
|
396
|
+
You can specify the editor by the following ways:
|
397
|
+
- By git-config
|
398
|
+
$ git config --global core.editor 'mate -w'
|
399
|
+
- By environment variables
|
400
|
+
$ export $GIT_EDITOR='mate -w'`
|
401
|
+
#or
|
402
|
+
$ export $EDITOR='mate -w'
|
403
|
+
TEXT
|
404
|
+
exit 1
|
370
405
|
end
|
371
406
|
end
|
372
407
|
|
@@ -386,7 +421,7 @@ module StepUp
|
|
386
421
|
|
387
422
|
initial_tag = sanitize_tag_version(initial_tag)
|
388
423
|
final_tag = sanitize_tag_version(final_tag)
|
389
|
-
@ranged_notes = StepUp::RangedNotes.new(driver, initial_tag, final_tag, :exclude_initial_tag_notes => options[:after])
|
424
|
+
@ranged_notes = StepUp::RangedNotes.new(driver, initial_tag, final_tag, :exclude_initial_tag_notes => options[:after], :notes_sections => options[:sections])
|
390
425
|
end
|
391
426
|
@ranged_notes
|
392
427
|
end
|
@@ -397,9 +432,9 @@ module StepUp
|
|
397
432
|
|
398
433
|
def get_notes(clean = options[:clean], custom_message = nil)
|
399
434
|
notes_options = {}
|
400
|
-
notes_options[:mode] = :with_objects unless clean
|
435
|
+
notes_options[:mode] = :with_objects unless clean || clean.nil? && ! options[:"with-commit"]
|
401
436
|
notes_options[:custom_message] = custom_message
|
402
|
-
notes_hash = (options[:since].nil? && options[:after].nil? ? driver.cached_detached_notes_as_hash(commit_object || "HEAD") : ranged_notes.all_notes.as_hash)
|
437
|
+
notes_hash = (options[:since].nil? && options[:after].nil? ? driver.cached_detached_notes_as_hash(commit_object || "HEAD", options["sections"]) : ranged_notes.all_notes.as_hash)
|
403
438
|
notes_hash.to_changelog(notes_options)
|
404
439
|
end
|
405
440
|
|
@@ -459,8 +494,9 @@ module StepUp
|
|
459
494
|
end
|
460
495
|
|
461
496
|
def check_notes_config
|
497
|
+
return true if driver.cached_fetched_remotes.empty?
|
462
498
|
remotes_with_notes = driver.fetched_remotes('notes')
|
463
|
-
unfetched_remotes = driver.
|
499
|
+
unfetched_remotes = driver.cached_fetched_remotes - remotes_with_notes
|
464
500
|
cmds = []
|
465
501
|
unless remotes_with_notes.any? || unfetched_remotes.empty?
|
466
502
|
answer = options[:fetch] ? "yes" : raw_ask("To perform this operation you need some additional fetch instruction on your git-config file.\nMay stepup add the missing instruction for you? [yes/no]:")
|
data/lib/step-up/driver/git.rb
CHANGED
@@ -10,7 +10,12 @@ module StepUp
|
|
10
10
|
new.last_version_tag
|
11
11
|
end
|
12
12
|
|
13
|
+
def empty_repository?
|
14
|
+
`git branch`.empty?
|
15
|
+
end
|
16
|
+
|
13
17
|
def commit_history(commit_base, *args)
|
18
|
+
return [] if empty_repository?
|
14
19
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
15
20
|
top = args.shift
|
16
21
|
top = "-n#{ top }" unless top.nil?
|
@@ -32,17 +37,13 @@ module StepUp
|
|
32
37
|
end
|
33
38
|
|
34
39
|
def objects_with_notes_of(ref)
|
35
|
-
`git notes --ref=#{ ref } list`.
|
40
|
+
`git notes --ref=#{ ref } list`.scan(/\w+$/)
|
36
41
|
end
|
37
42
|
|
38
43
|
def note_message(ref, commit)
|
39
44
|
`git notes --ref=#{ ref } show #{ commit }`
|
40
45
|
end
|
41
46
|
|
42
|
-
def notes_messages(objects_with_notes)
|
43
|
-
objects_with_notes.messages
|
44
|
-
end
|
45
|
-
|
46
47
|
def all_version_tags
|
47
48
|
@version_tags ||= tags.scan(mask.regex).map{ |tag| tag.collect(&:to_i) }.sort.map{ |tag| mask.format(tag) }.reverse
|
48
49
|
end
|
@@ -56,10 +57,10 @@ module StepUp
|
|
56
57
|
{:message => tag_message, :tagger => tagger, :date => date}
|
57
58
|
end
|
58
59
|
|
59
|
-
def detached_notes_as_hash(commit_base = "HEAD")
|
60
|
-
tag = cached_last_version_tag(commit_base)
|
61
|
-
tag = tag.sub(/\+$/, '')
|
62
|
-
RangedNotes.new(self, tag, commit_base).notes.as_hash
|
60
|
+
def detached_notes_as_hash(commit_base = "HEAD", notes_sections = nil)
|
61
|
+
tag = all_version_tags.any? ? cached_last_version_tag(commit_base) : nil
|
62
|
+
tag = tag.sub(/\+$/, '') unless tag.nil?
|
63
|
+
RangedNotes.new(self, tag, commit_base, :notes_sections => notes_sections).notes.as_hash
|
63
64
|
end
|
64
65
|
|
65
66
|
def steps_to_increase_version(level, commit_base = "HEAD", message = nil)
|
@@ -68,9 +69,9 @@ module StepUp
|
|
68
69
|
new_tag = mask.increase_version(tag, level)
|
69
70
|
notes = cached_detached_notes_as_hash(commit_base)
|
70
71
|
commands = []
|
71
|
-
commands << "git fetch"
|
72
|
+
commands << "git fetch" if cached_fetched_remotes.any?
|
72
73
|
commands << "git tag -a -m \"#{ (message || notes.to_changelog).gsub(/([\$\\"`])/, '\\\\\1') }\" #{ new_tag } #{ commit_base }"
|
73
|
-
commands << "git push #{cached_fetched_remotes("notes").first} refs/tags/#{new_tag}"
|
74
|
+
commands << "git push #{cached_fetched_remotes("notes").first} refs/tags/#{new_tag}" if cached_fetched_remotes.any?
|
74
75
|
commands + steps_for_archiving_notes(notes, new_tag)
|
75
76
|
end
|
76
77
|
|
@@ -107,7 +108,7 @@ module StepUp
|
|
107
108
|
end
|
108
109
|
|
109
110
|
def zero_version(commit_base = "HEAD", count_commits = false)
|
110
|
-
"%s+%s" % [mask.blank, "#{ commit_history(commit_base).size if count_commits }"]
|
111
|
+
"%s+%s" % [mask.blank, "#{ tags.empty? ? '0' : commit_history(commit_base).size if count_commits }"]
|
111
112
|
end
|
112
113
|
end
|
113
114
|
end
|
@@ -14,17 +14,17 @@ module StepUp
|
|
14
14
|
|
15
15
|
def steps_for_add_notes(section, message, commit_base = nil)
|
16
16
|
commands = []
|
17
|
-
commands << "git fetch"
|
17
|
+
commands << "git fetch" if cached_fetched_remotes.any?
|
18
18
|
commands << "git notes --ref=#{ section } add -m \"#{ message.gsub(/([\$\\"`])/, '\\\\\1') }\" #{ commit_base }"
|
19
|
-
commands << "git push #{ notes_remote } refs/notes/#{ section }"
|
19
|
+
commands << "git push #{ notes_remote } refs/notes/#{ section }" if cached_fetched_remotes.any?
|
20
20
|
commands
|
21
21
|
end
|
22
22
|
|
23
23
|
def steps_to_remove_notes(section, commit_base)
|
24
24
|
commands = []
|
25
|
-
commands << "git fetch"
|
25
|
+
commands << "git fetch" if cached_fetched_remotes.any?
|
26
26
|
commands << "git notes --ref=#{ section } remove #{ commit_base }"
|
27
|
-
commands << "git push #{ notes_remote } refs/notes/#{ section }"
|
27
|
+
commands << "git push #{ notes_remote } refs/notes/#{ section }" if cached_fetched_remotes.any?
|
28
28
|
commands
|
29
29
|
end
|
30
30
|
|
@@ -46,7 +46,7 @@ module StepUp
|
|
46
46
|
end
|
47
47
|
unless removed_notes.empty?
|
48
48
|
commands += removed_notes
|
49
|
-
commands << "git push #{ driver.notes_remote } refs/notes/#{ section }"
|
49
|
+
commands << "git push #{ driver.notes_remote } refs/notes/#{ section }" if driver.cached_fetched_remotes.any?
|
50
50
|
end
|
51
51
|
end
|
52
52
|
commands
|
@@ -69,7 +69,7 @@ module StepUp
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
72
|
-
commands << "git push #{ driver.notes_remote } refs/notes/#{ CONFIG.notes.after_versioned.section }" unless objects.empty?
|
72
|
+
commands << "git push #{ driver.notes_remote } refs/notes/#{ CONFIG.notes.after_versioned.section }" unless objects.empty? || driver.cached_fetched_remotes.empty?
|
73
73
|
commands
|
74
74
|
end
|
75
75
|
end
|
data/lib/step-up/ranged_notes.rb
CHANGED
@@ -7,6 +7,7 @@ module StepUp
|
|
7
7
|
|
8
8
|
def initialize(driver, first_commit = nil, last_commit = "HEAD", options={})
|
9
9
|
@include_initial_tag_notes = !options[:exclude_initial_tag_notes]
|
10
|
+
@notes_sections = notes_sections(options[:notes_sections])
|
10
11
|
@driver = driver
|
11
12
|
@last_commit = driver.commit_history(last_commit, 1).first
|
12
13
|
first_commit = driver.commit_history(first_commit, 1).first unless first_commit.nil?
|
@@ -69,7 +70,7 @@ module StepUp
|
|
69
70
|
def all_visible_notes
|
70
71
|
unless defined? @all_visible_notes
|
71
72
|
notes = []
|
72
|
-
|
73
|
+
@notes_sections.names.each do |section|
|
73
74
|
all_notes_of_section(section, all_commits).each{ |note| notes << note }
|
74
75
|
end
|
75
76
|
@all_visible_notes = notes
|
@@ -94,9 +95,9 @@ module StepUp
|
|
94
95
|
end
|
95
96
|
|
96
97
|
def scoped_commit_notes
|
97
|
-
prefixes =
|
98
|
-
sections =
|
99
|
-
tags =
|
98
|
+
prefixes = @notes_sections.prefixes
|
99
|
+
sections = @notes_sections.names
|
100
|
+
tags = @notes_sections.tags
|
100
101
|
notes = []
|
101
102
|
scoped_commits.each do |commit|
|
102
103
|
message = commit.last
|
@@ -129,6 +130,30 @@ module StepUp
|
|
129
130
|
def include_initial_tag_notes?
|
130
131
|
@include_initial_tag_notes
|
131
132
|
end
|
133
|
+
|
134
|
+
def notes_sections(notes_sections_names)
|
135
|
+
notes_sections = []
|
136
|
+
|
137
|
+
if notes_sections_names
|
138
|
+
notes_sections_names.each do |note_section_name|
|
139
|
+
sections_found = CONFIG.notes_sections.select { |ns| ns["name"] == note_section_name }
|
140
|
+
|
141
|
+
if sections_found.empty?
|
142
|
+
raise ArgumentError, "Invalid section: #{note_section_name}"
|
143
|
+
else
|
144
|
+
notes_sections << sections_found.first
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
class << notes_sections
|
149
|
+
include StepUp::ConfigSectionsExt
|
150
|
+
end
|
151
|
+
else
|
152
|
+
notes_sections = CONFIG.notes_sections
|
153
|
+
end
|
154
|
+
|
155
|
+
notes_sections
|
156
|
+
end
|
132
157
|
|
133
158
|
end
|
134
159
|
|
@@ -17,13 +17,14 @@ describe StepUp::RangedNotes do
|
|
17
17
|
|
18
18
|
context "testing notes" do
|
19
19
|
before do
|
20
|
-
notes_sections =
|
20
|
+
notes_sections = [{"name"=>"test_changes"}, {"name"=>"test_bugfixes"}, {"name"=>"test_features"}]
|
21
21
|
class << notes_sections
|
22
22
|
include StepUp::ConfigSectionsExt
|
23
23
|
end
|
24
24
|
StepUp::CONFIG.stubs(:notes_sections).returns(notes_sections)
|
25
25
|
StepUp::CONFIG.notes.after_versioned.stubs(:section).returns("test_versioning")
|
26
26
|
end
|
27
|
+
|
27
28
|
context "until object f4cfcc2" do
|
28
29
|
before do
|
29
30
|
@notes = StepUp::RangedNotes.new(@driver, nil, "f4cfcc2")
|
@@ -136,5 +137,106 @@ describe StepUp::RangedNotes do
|
|
136
137
|
@notes.notes.as_hash.to_changelog.should be == changelog
|
137
138
|
end
|
138
139
|
end
|
140
|
+
|
141
|
+
context "until object f4cfcc2 with specific notes sections" do
|
142
|
+
before do
|
143
|
+
@notes = StepUp::RangedNotes.new(@driver, nil, "f4cfcc2", {:notes_sections => ["test_changes", "test_features"]})
|
144
|
+
end
|
145
|
+
it "should get all detached notes" do
|
146
|
+
@notes.notes.should be == [
|
147
|
+
[5, "test_changes", 1, "8299243c7dac8f27c3572424a348a7f83ef0ce28",
|
148
|
+
"removing files from gemspec\n .gitignore\n lastversion.gemspec\n"],
|
149
|
+
[1, "test_changes", 1, "2fb8a3281fb6777405aadcd699adb852b615a3e4",
|
150
|
+
"loading default configuration yaml\n\nloading external configuration yaml\n"]
|
151
|
+
]
|
152
|
+
end
|
153
|
+
it "should get a hash of distinct notes" do
|
154
|
+
@notes.notes.should respond_to :as_hash
|
155
|
+
@notes.notes.as_hash.should be == {
|
156
|
+
"test_changes" => [
|
157
|
+
["8299243c7dac8f27c3572424a348a7f83ef0ce28",
|
158
|
+
"removing files from gemspec\n .gitignore\n lastversion.gemspec\n", 1],
|
159
|
+
["2fb8a3281fb6777405aadcd699adb852b615a3e4",
|
160
|
+
"loading default configuration yaml\n\nloading external configuration yaml\n", 1]
|
161
|
+
]
|
162
|
+
}
|
163
|
+
end
|
164
|
+
it "should get the changelog message without objects" do
|
165
|
+
@notes.notes.as_hash.should respond_to :to_changelog
|
166
|
+
changelog = <<-EOF
|
167
|
+
Test changes:
|
168
|
+
|
169
|
+
- removing files from gemspec
|
170
|
+
- .gitignore
|
171
|
+
- lastversion.gemspec
|
172
|
+
- loading default configuration yaml
|
173
|
+
- loading external configuration yaml
|
174
|
+
EOF
|
175
|
+
changelog.gsub!(/^\s{8}/, '')
|
176
|
+
changelog = changelog.rstrip
|
177
|
+
@notes.notes.as_hash.to_changelog.should be == changelog
|
178
|
+
end
|
179
|
+
it "should get the changelog message with objects" do
|
180
|
+
@notes.notes.as_hash.should respond_to :to_changelog
|
181
|
+
changelog = <<-EOF
|
182
|
+
Test changes:
|
183
|
+
|
184
|
+
- removing files from gemspec (8299243c7dac8f27c3572424a348a7f83ef0ce28)
|
185
|
+
- .gitignore
|
186
|
+
- lastversion.gemspec
|
187
|
+
- loading default configuration yaml (2fb8a3281fb6777405aadcd699adb852b615a3e4)
|
188
|
+
- loading external configuration yaml
|
189
|
+
EOF
|
190
|
+
changelog.gsub!(/^\s{8}/, '')
|
191
|
+
changelog = changelog.rstrip
|
192
|
+
@notes.notes.as_hash.to_changelog(:mode => :with_objects).should be == changelog
|
193
|
+
end
|
194
|
+
it "should get the changelog message with custom message" do
|
195
|
+
@notes.notes.as_hash.should respond_to :to_changelog
|
196
|
+
changelog = <<-EOF
|
197
|
+
Custom message:
|
198
|
+
|
199
|
+
- New version create feature
|
200
|
+
- Removed old version create feature
|
201
|
+
|
202
|
+
Test changes:
|
203
|
+
|
204
|
+
- removing files from gemspec
|
205
|
+
- .gitignore
|
206
|
+
- lastversion.gemspec
|
207
|
+
- loading default configuration yaml
|
208
|
+
- loading external configuration yaml
|
209
|
+
EOF
|
210
|
+
changelog.gsub!(/^\s{8}/, '')
|
211
|
+
changelog = changelog.rstrip
|
212
|
+
message_option = {:custom_message => "New version create feature\n\nRemoved old version create feature"}
|
213
|
+
@notes.notes.as_hash.to_changelog(message_option).should be == changelog
|
214
|
+
end
|
215
|
+
it "should get the changelog message without custom message" do
|
216
|
+
@notes.notes.as_hash.should respond_to :to_changelog
|
217
|
+
changelog = <<-EOF
|
218
|
+
Test changes:
|
219
|
+
|
220
|
+
- removing files from gemspec
|
221
|
+
- .gitignore
|
222
|
+
- lastversion.gemspec
|
223
|
+
- loading default configuration yaml
|
224
|
+
- loading external configuration yaml
|
225
|
+
EOF
|
226
|
+
changelog.gsub!(/^\s{8}/, '')
|
227
|
+
changelog = changelog.rstrip
|
228
|
+
@notes.notes.as_hash.to_changelog.should be == changelog
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
context "with specific notes section that doesn't exists" do
|
233
|
+
it "should raise an exception" do
|
234
|
+
block = lambda do
|
235
|
+
StepUp::RangedNotes.new(@driver, nil, "f4cfcc2", {:notes_sections => ["invalid_note_section"]})
|
236
|
+
end
|
237
|
+
|
238
|
+
block.should raise_error(ArgumentError)
|
239
|
+
end
|
240
|
+
end
|
139
241
|
end
|
140
242
|
end
|
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: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.6.0
|
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: 2011-
|
19
|
+
date: 2011-05-20 00:00:00 -03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|