step-up 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GEM_VERSION +1 -0
- data/README.md +42 -20
- data/lib/step-up.rb +1 -0
- data/lib/step-up/cli.rb +41 -2
- data/lib/step-up/driver.rb +4 -0
- data/lib/step-up/driver/git.rb +18 -2
- data/lib/step-up/notes_util.rb +12 -0
- data/lib/step-up/ranged_notes.rb +1 -5
- data/lib/step-up/version.rb +6 -2
- data/templates/default/Gemfile +1 -1
- metadata +8 -8
data/GEM_VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
v0.7.0
|
data/README.md
CHANGED
@@ -1,27 +1,21 @@
|
|
1
1
|
# StepUp: a project to step up your projects
|
2
|
+
|
2
3
|
StepUp is a tool to manage versioning.
|
3
4
|
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
|
|
5
6
|
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.
|
6
7
|
|
7
|
-
## Prerequisite
|
8
|
-
Git version 1.7.1 and above.
|
9
|
-
|
10
8
|
## Installation
|
11
9
|
|
12
10
|
gem install step-up
|
13
11
|
|
14
12
|
## First of all
|
15
|
-
Have in mind that StepUp has only Git support for now (more to come soon!!), so any StepUp command must be performed inside a git repository path.
|
16
|
-
With that said, run
|
17
13
|
|
18
|
-
|
19
|
-
|
20
|
-
It will create a file in your project called **.stepuprc**.
|
21
|
-
We'll cover more about this in the next sections.
|
14
|
+
Your installed git-scm version must be v1.7.1 or higher.
|
22
15
|
|
23
16
|
## The Basics
|
24
|
-
|
17
|
+
|
18
|
+
### Checking current project version
|
25
19
|
|
26
20
|
stepup [version]
|
27
21
|
|
@@ -29,12 +23,13 @@ An example of output would be
|
|
29
23
|
|
30
24
|
v0.2.0+3
|
31
25
|
|
32
|
-
|
33
|
-
The
|
26
|
+
Consider that your project has a tag named "v0.2.0".
|
27
|
+
The "+3" part of the output above means the project has three commits since last version tag.
|
28
|
+
The format of the version is totally customizable, and we will cover in more detail later.
|
34
29
|
|
35
30
|
### Stepping up a version
|
36
31
|
|
37
|
-
stepup version create [--level LEVEL_NAME]
|
32
|
+
stepup version create [--level LEVEL_NAME] [--no-editor]
|
38
33
|
|
39
34
|
where **LEVEL_NAME**, by default, could be
|
40
35
|
|
@@ -46,9 +41,9 @@ where **LEVEL_NAME**, by default, could be
|
|
46
41
|
This command will ask user to input a message for the version and will increment the version number accordingly.
|
47
42
|
|
48
43
|
Each level corresponds to a position in the version mask.
|
49
|
-
Considering default settings
|
44
|
+
Considering default settings, this means:
|
50
45
|
|
51
|
-
v0.0.0.
|
46
|
+
v0.0.0.9 => vMAJOR.MINOR.PATCH.TINY
|
52
47
|
|
53
48
|
The versioning increment is based on the last version tag found in the repository, and works as follows:
|
54
49
|
|
@@ -57,20 +52,25 @@ The versioning increment is based on the last version tag found in the repositor
|
|
57
52
|
v0.5.3.2 => v0.6.0 (MINOR increment)
|
58
53
|
v0.5.3.2 => v1.0.0 (MAJOR increment)
|
59
54
|
|
55
|
+
As you can see, the TINY level is omitted when its value is zero.
|
56
|
+
The mask allows you to configure the less relevant levels this way.
|
57
|
+
|
60
58
|
### Checking out the changelog
|
61
59
|
|
62
|
-
stepup changelog
|
60
|
+
stepup changelog [--top=N]
|
63
61
|
|
64
62
|
## StepUp beyond basics
|
65
63
|
|
66
64
|
### Working with notes
|
67
65
|
|
68
66
|
With StepUp we are able to attach additional comments on existing commit objects.
|
69
|
-
The great goal of this Gem is giving to developers an easy way to manage these notes
|
70
|
-
|
67
|
+
*The great goal of this Gem is giving to developers an easy way to manage these notes*.
|
68
|
+
|
69
|
+
The note is created with a command as the example below:
|
71
70
|
|
72
71
|
$ stepup notes add --section bugfixes -m "support for old installations"
|
73
72
|
|
73
|
+
It's possible to use the same command with no paramenters. This way an wizard will guide through the process.
|
74
74
|
Still with this example we can check the created note with the following command:
|
75
75
|
|
76
76
|
$ stepup notes
|
@@ -80,11 +80,33 @@ Still with this example we can check the created note with the following command
|
|
80
80
|
- support for old installations
|
81
81
|
|
82
82
|
The command above fetches the entire commit history, gets each note and organizes them in sections.
|
83
|
-
Found notes are displayed as a
|
83
|
+
Found notes are displayed as a changelog message.
|
84
84
|
|
85
85
|
### Creating rich changelogs
|
86
86
|
|
87
|
-
|
87
|
+
With a culture of notating all the relevant developments, its possible to retrieve a summary of a range of versions besides that specifying what kind of information will be retrieved.
|
88
|
+
For example, imagine that you want to see all the features implemented in your application since the version v1.10.1 up to v2.0.0
|
89
|
+
|
90
|
+
stepup notes --since v1.10.1 upto v2.0.0 --sections pre_deploy pos_deploy
|
91
|
+
|
92
|
+
The result would be something like the following:
|
93
|
+
|
94
|
+
Showing notes since v1.10.1 up to v2.0.0 (including notes of tags: v1.10.1, v1.10.2, v1.51.0, v2.0.0)
|
95
|
+
---
|
96
|
+
Pre-Deploy:
|
97
|
+
|
98
|
+
- dependency of version v10 of project XYZ
|
99
|
+
- it needed to rename the following file
|
100
|
+
- config/environment_variables.yml.sample -> config/environment_variables.yml
|
101
|
+
- rake articles:index
|
102
|
+
|
103
|
+
Pos-Deploy:
|
104
|
+
|
105
|
+
- Reindex articles
|
106
|
+
- rake articles:index
|
107
|
+
- rake db:seed
|
108
|
+
- rake categories:reload
|
109
|
+
|
88
110
|
|
89
111
|
## Project
|
90
112
|
* https://github.com/kawamanza/step-up
|
data/lib/step-up.rb
CHANGED
@@ -4,6 +4,7 @@ module StepUp
|
|
4
4
|
autoload :Driver, 'step-up/driver.rb'
|
5
5
|
autoload :GitExtensions, 'step-up/git_extensions.rb'
|
6
6
|
autoload :RangedNotes, 'step-up/ranged_notes.rb'
|
7
|
+
autoload :NotesUtil, 'step-up/notes_util.rb'
|
7
8
|
module Parser
|
8
9
|
autoload :VersionMask, 'step-up/parser/version_mask.rb'
|
9
10
|
end
|
data/lib/step-up/cli.rb
CHANGED
@@ -179,17 +179,48 @@ module StepUp
|
|
179
179
|
|
180
180
|
# Please enter the note message for your changes. Lines starting
|
181
181
|
# with '#' will be ignored, and an empty message aborts the operation.
|
182
|
+
#
|
183
|
+
# We recommend that the note message has a short sentence, or try to
|
184
|
+
# transform your message in a topic. Example:
|
185
|
+
#
|
186
|
+
# New field for Account model
|
187
|
+
# Last access date
|
188
|
+
#
|
189
|
+
# The breakline and two-spaces indentation will be converted as follows:
|
190
|
+
#
|
191
|
+
# - New field for Account model
|
192
|
+
# - Last access date
|
193
|
+
#
|
194
|
+
# Thus, the note becomes easier to read, instead of using big sentences.
|
195
|
+
#
|
196
|
+
# If you still need to describe the change in one big sentence, you may
|
197
|
+
# use one-space indentation to indicates the sentence continues in the
|
198
|
+
# next line. Example:
|
199
|
+
#
|
200
|
+
# The Account model receives a new field named "last_access_date",
|
201
|
+
# and his value changes every sign-in made by user on website.
|
202
|
+
#
|
203
|
+
# The one-space indentation will be converted as follows:
|
204
|
+
#
|
205
|
+
# - The Account model receives a new field named "last_access_date",
|
206
|
+
# and his value changes every sign-in made by user on website.
|
207
|
+
#
|
208
|
+
# You can make several combinations of one-space or two-spaces indentation
|
209
|
+
# if you need. We hope this helps you to improve your release notes.
|
182
210
|
TEXT
|
183
211
|
message = edit_message(driver.class::NOTE_MESSAGE_FILE_PATH, message)
|
184
212
|
end
|
185
213
|
|
186
214
|
unless message.nil? || message.empty?
|
187
|
-
|
215
|
+
puts "Your note will be displayed as follows:"
|
216
|
+
puts NotesUtil.parse_message(message)
|
217
|
+
section = options[:section] || choose(CONFIG.notes_sections.names, "---\nChoose a section to add the note:")
|
188
218
|
if section.nil? || ! CONFIG.notes_sections.names.include?(section)
|
189
219
|
puts "Aborting due to invalid section"
|
220
|
+
puts "The note you was about to add is still available into file #{driver.class::NOTE_MESSAGE_FILE_PATH}"
|
190
221
|
exit(1)
|
191
222
|
end
|
192
|
-
steps = driver.steps_for_add_notes(section, message,
|
223
|
+
steps = driver.steps_for_add_notes(section, message, last_commit.first)
|
193
224
|
print_or_run(steps, options[:steps])
|
194
225
|
end
|
195
226
|
end
|
@@ -219,6 +250,10 @@ module StepUp
|
|
219
250
|
end
|
220
251
|
|
221
252
|
def version_create
|
253
|
+
unless check_notes_config
|
254
|
+
say_status(:fail, "Abort version increment. Could not retrieve the notes", :red)
|
255
|
+
exit 1
|
256
|
+
end
|
222
257
|
level = options[:level] || "auto"
|
223
258
|
message = get_notes(true, get_custom_message)
|
224
259
|
|
@@ -494,6 +529,10 @@ TEXT
|
|
494
529
|
end
|
495
530
|
|
496
531
|
def check_notes_config
|
532
|
+
if fail_banner = driver.cached_unsupported_scm_banner
|
533
|
+
puts fail_banner
|
534
|
+
exit 1
|
535
|
+
end
|
497
536
|
return true if driver.cached_fetched_remotes.empty?
|
498
537
|
remotes_with_notes = driver.fetched_remotes('notes')
|
499
538
|
unfetched_remotes = driver.cached_fetched_remotes - remotes_with_notes
|
data/lib/step-up/driver.rb
CHANGED
data/lib/step-up/driver/git.rb
CHANGED
@@ -6,6 +6,22 @@ module StepUp
|
|
6
6
|
|
7
7
|
include GitExtensions::Notes
|
8
8
|
|
9
|
+
def unsupported_scm_banner
|
10
|
+
if `git --version`.chomp =~ /\d\.[^\s]+/
|
11
|
+
v = $&
|
12
|
+
if Gem::Version.correct?(v)
|
13
|
+
if Gem::Version.new("1.7.1") > Gem::Version.new(v)
|
14
|
+
"Unsupported installed GIT version: #{v}\n" +
|
15
|
+
"Please install version 1.7.1 or newer"
|
16
|
+
end
|
17
|
+
else
|
18
|
+
"Installed GIT version unknown: #{v}"
|
19
|
+
end
|
20
|
+
else
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
9
25
|
def self.last_version
|
10
26
|
new.last_version_tag
|
11
27
|
end
|
@@ -90,7 +106,7 @@ module StepUp
|
|
90
106
|
return tag
|
91
107
|
end
|
92
108
|
end
|
93
|
-
|
109
|
+
count_commits == true ? zero_version(commit_base, true) : nil
|
94
110
|
else
|
95
111
|
zero_version(commit_base, count_commits)
|
96
112
|
end
|
@@ -108,7 +124,7 @@ module StepUp
|
|
108
124
|
end
|
109
125
|
|
110
126
|
def zero_version(commit_base = "HEAD", count_commits = false)
|
111
|
-
"%s+%s" % [mask.blank, "#{
|
127
|
+
"%s+%s" % [mask.blank, "#{ commit_history(commit_base).size if count_commits }"]
|
112
128
|
end
|
113
129
|
end
|
114
130
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module StepUp
|
2
|
+
module NotesUtil
|
3
|
+
def parse_message(message)
|
4
|
+
message = message.rstrip.gsub(/^((?: )*)( )?([^ \-\n])/){ "%s %s %s" % [$1, $2 || '-', $3] }
|
5
|
+
begin
|
6
|
+
changed = message.sub!(/^(\s*-\s.*?\n)(?:\s*\n)+(\s*-\s)/, '\1\2')
|
7
|
+
end until changed.nil?
|
8
|
+
message
|
9
|
+
end
|
10
|
+
extend self
|
11
|
+
end
|
12
|
+
end
|
data/lib/step-up/ranged_notes.rb
CHANGED
@@ -183,11 +183,7 @@ module StepUp
|
|
183
183
|
private
|
184
184
|
|
185
185
|
def parse_message(message)
|
186
|
-
|
187
|
-
begin
|
188
|
-
changed = message.sub!(/^(\s*-\s.*?\n)\n+(\s*-\s)/, '\1\2')
|
189
|
-
end until changed.nil?
|
190
|
-
message
|
186
|
+
NotesUtil.parse_message(message)
|
191
187
|
end
|
192
188
|
end
|
193
189
|
|
data/lib/step-up/version.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
module StepUp
|
2
2
|
version = nil
|
3
|
-
|
4
|
-
version =
|
3
|
+
version_file = ::File.expand_path('../../../GEM_VERSION', __FILE__)
|
4
|
+
version = File.read(version_file) if ::File.exists?(version_file)
|
5
|
+
if version.nil? && ::File.exists?(::File.expand_path('../../../.git', __FILE__))
|
6
|
+
version = Driver::Git.new.last_version_tag("HEAD", true) rescue "v0.0.0+0"
|
7
|
+
::File.open(version_file, "w"){ |f| f.write version }
|
8
|
+
end
|
5
9
|
VERSION = version.gsub(/^v?([^\+]+)\+?\d*$/, '\1')
|
6
10
|
end
|
data/templates/default/Gemfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
gem 'step-up', "~> {{stepup_version}}", :group => [:
|
1
|
+
gem 'step-up', "~> {{stepup_version}}", :group => [:source]
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 7
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.7.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marcelo Manzan
|
@@ -16,8 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
20
|
-
default_executable:
|
19
|
+
date: 2011-10-19 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: thor
|
@@ -85,6 +84,7 @@ files:
|
|
85
84
|
- lib/step-up/driver.rb
|
86
85
|
- lib/step-up/driver/git.rb
|
87
86
|
- lib/step-up/git_extensions.rb
|
87
|
+
- lib/step-up/notes_util.rb
|
88
88
|
- lib/step-up/parser/version_mask.rb
|
89
89
|
- lib/step-up/ranged_notes.rb
|
90
90
|
- lib/step-up/version.rb
|
@@ -92,12 +92,12 @@ files:
|
|
92
92
|
- templates/default/Gemfile
|
93
93
|
- templates/default/Rakefile
|
94
94
|
- templates/default/lib/version.rb
|
95
|
+
- GEM_VERSION
|
95
96
|
- spec/lib/config_spec.rb
|
96
97
|
- spec/lib/step-up/driver/git_spec.rb
|
97
98
|
- spec/lib/step-up/parser/version_mask_spec.rb
|
98
99
|
- spec/lib/step-up/ranged_notes_spec.rb
|
99
100
|
- spec/spec_helper.rb
|
100
|
-
has_rdoc: true
|
101
101
|
homepage: https://github.com/kawamanza/step-up
|
102
102
|
licenses: []
|
103
103
|
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
requirements: []
|
130
130
|
|
131
131
|
rubyforge_project: step-up
|
132
|
-
rubygems_version: 1.
|
132
|
+
rubygems_version: 1.8.10
|
133
133
|
signing_key:
|
134
134
|
specification_version: 3
|
135
135
|
summary: The best way to manage your project's versioning
|