octopolo 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.ruby-version +1 -1
- data/.soyuz.yml +13 -0
- data/CHANGELOG.markdown +18 -0
- data/bin/octopolo +1 -1
- data/bin/op +1 -1
- data/{bash_completion.sh → completion/octopolo.sh} +0 -0
- data/completion/octopolo.zsh +14 -0
- data/lib/octopolo/commands/pull_request.rb +1 -1
- data/lib/octopolo/commands/tag_release.rb +11 -4
- data/lib/octopolo/config.rb +4 -0
- data/lib/octopolo/git.rb +14 -0
- data/lib/octopolo/scripts/github_auth.rb +4 -0
- data/lib/octopolo/scripts/tag_release.rb +72 -13
- data/lib/octopolo/semver_tag_scrubber.rb +21 -0
- data/lib/octopolo/version.rb +1 -1
- data/octopolo.gemspec +1 -0
- data/spec/octopolo/git_spec.rb +15 -0
- data/spec/octopolo/scripts/tag_release_spec.rb +139 -23
- data/spec/octopolo/semver_tag_scrubber_spec.rb +31 -0
- metadata +23 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YThjY2Y2ZTMyNzRjNTdjYTZlMjk5MjhjNzI5YWU5NDQyYzM5Y2U3Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmE2NjdkMzE5MDc5NWI5ODU4YWQ4OWJlM2QwYWJlZTZjN2NkOWVhMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmU3ZmJlOTg4MTE0NWVhNDhkODkwYzdiODc0Mjc4Zjg1ODBiM2U4MzQyYzZm
|
10
|
+
NGYxMmU1MTYxZmQ0NDQyNTg4MDZiZDUyYjY5ZmJlYzQ1ZDNmMzRmYTg4YjZh
|
11
|
+
YmM3N2IwMzRhMjlkMTAxYzMwYzQxMDhlMzQ2MjM3NTBlZDYxYTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjI1OTllMmVlYzBmMzI3N2QxOWEzZjYxZTNmYmEzNzM3ZGVmZDU5YjVlYWFm
|
14
|
+
YmMxM2UzZGExY2Y4ZDYwNmUzYjVhOTRiZDMwZjFkODM4YTkzZjZmNzBkMTI0
|
15
|
+
YTAzOTgwN2ZkZjMyZGM4MTk0ZTZlN2I1YTYyMDQzNWQ4ZDUwOWQ=
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.3
|
1
|
+
1.9.3
|
data/.soyuz.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
defaults:
|
2
|
+
deploy_cmd: gem push *.gem
|
3
|
+
before_deploy_cmds:
|
4
|
+
- /usr/local/bin/op tag-release
|
5
|
+
- sed -i "" -e "s/\".*/\"$(git tag| sort -n -t. -k1,1 -k2,2 -k3,3 | tail -1 | sed s/v//)\"/" lib/octopolo/version.rb
|
6
|
+
- git add lib/octopolo/version.rb
|
7
|
+
- git commit -m "Version Bump" && git push
|
8
|
+
- gem build octopolo.gemspec
|
9
|
+
after_deploy_cmds:
|
10
|
+
- rm *.gem
|
11
|
+
environments:
|
12
|
+
-
|
13
|
+
rubygems: {}
|
data/CHANGELOG.markdown
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
#### v0.1.4
|
2
|
+
#### v0.2.0
|
3
|
+
* Fixes github-auth
|
4
|
+
|
5
|
+
> Nick LaMuro: Elliot Hursh: https://github.com/sportngin/octopolo/pull/38
|
6
|
+
|
7
|
+
* Add semantic versioning tagging
|
8
|
+
|
9
|
+
> Alec Gorjestani, Nick LaMuro: Michael Pillsbury: https://github.com/sportngin/octopolo/pull/35
|
10
|
+
|
11
|
+
* Use the correct key when passing destination flag
|
12
|
+
|
13
|
+
> Nick LaMuro: Elliot Hursh: https://github.com/sportngin/octopolo/pull/33
|
14
|
+
|
15
|
+
* minor changes to the help text
|
16
|
+
|
17
|
+
> Michael Pillsbury: Andy Fleener: https://github.com/sportngin/octopolo/pull/32
|
18
|
+
|
1
19
|
#### v0.1.3
|
2
20
|
|
3
21
|
* Label tweaks
|
data/bin/octopolo
CHANGED
data/bin/op
CHANGED
File without changes
|
@@ -8,6 +8,6 @@ command 'pull-request' do |c|
|
|
8
8
|
c.action do |global_options, options, args|
|
9
9
|
require_relative '../scripts/pull_request'
|
10
10
|
options = global_options.merge(options)
|
11
|
-
Octopolo::Scripts::PullRequest.execute options[:
|
11
|
+
Octopolo::Scripts::PullRequest.execute options[:destination]
|
12
12
|
end
|
13
13
|
end
|
@@ -1,13 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
desc "Create and push a timestamped tag with an optional suffix"
|
1
|
+
desc "Create and push a tag (timestamped tag with an optional suffix or semantic version tag)"
|
4
2
|
command 'tag-release' do |c|
|
3
|
+
c.flag :prefix, :desc => "Prefix to apply to to the tag"
|
4
|
+
c.flag :suffix, :desc => "Suffix to apply to to the tag"
|
5
|
+
|
5
6
|
c.desc "Create tag even if not on deploy branch"
|
6
7
|
c.switch :force, :negatable => false
|
8
|
+
c.desc "Increment major version (if semantic_versioning enabled)"
|
9
|
+
c.switch :major, :negatable => false
|
10
|
+
c.desc "Increment minor version (if semantic_versioning enabled)"
|
11
|
+
c.switch :minor, :negatable => false
|
12
|
+
c.desc "Increment patch version (if semantic_versioning enabled)"
|
13
|
+
c.switch :patch, :negatable => false
|
7
14
|
|
8
15
|
c.action do |global_options, options, args|
|
9
16
|
require_relative '../scripts/tag_release'
|
10
17
|
options = global_options.merge(options)
|
11
|
-
Octopolo::Scripts::TagRelease.execute
|
18
|
+
Octopolo::Scripts::TagRelease.execute options
|
12
19
|
end
|
13
20
|
end
|
data/lib/octopolo/config.rb
CHANGED
data/lib/octopolo/git.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "semantic" # semantic versioning class (parsing, comparing)
|
2
|
+
|
1
3
|
module Octopolo
|
2
4
|
# Abstraction around local Git commands
|
3
5
|
class Git
|
@@ -6,6 +8,9 @@ module Octopolo
|
|
6
8
|
# we use date-based tags, so look for anything starting with a 4-digit year
|
7
9
|
RELEASE_TAG_FILTER = /^\d{4}.*/
|
8
10
|
RECENT_TAG_LIMIT = 9
|
11
|
+
# for semver tags
|
12
|
+
SEMVER_TAG_FILTER = Semantic::Version::SemVerRegexp
|
13
|
+
|
9
14
|
# branch prefixes
|
10
15
|
DEPLOYABLE_PREFIX = "deployable"
|
11
16
|
STAGING_PREFIX = "staging"
|
@@ -204,6 +209,15 @@ module Octopolo
|
|
204
209
|
release_tags.last(RECENT_TAG_LIMIT)
|
205
210
|
end
|
206
211
|
|
212
|
+
# Public: The list of releases with semantic versioning which have been tagged
|
213
|
+
#
|
214
|
+
# Returns an Array of Strings containing the tag names
|
215
|
+
def self.semver_tags
|
216
|
+
Git.perform_quietly("tag").split("\n").select do |tag|
|
217
|
+
tag.sub(/\Av/i,'') =~ SEMVER_TAG_FILTER
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
207
221
|
# Public: Create a new tag with the given name
|
208
222
|
#
|
209
223
|
# tag_name - The name of the tag to create
|
@@ -1,4 +1,8 @@
|
|
1
1
|
require "date" # necessary to get the Date.today convenience method
|
2
|
+
require "semantic" # semantic versioning class (parsing, comparing)
|
3
|
+
require "semantic/core_ext"
|
4
|
+
require "octopolo/semver_tag_scrubber"
|
5
|
+
|
2
6
|
require_relative "../scripts"
|
3
7
|
require_relative "../changelog"
|
4
8
|
|
@@ -9,19 +13,31 @@ module Octopolo
|
|
9
13
|
include ConfigWrapper
|
10
14
|
include GitWrapper
|
11
15
|
|
16
|
+
attr_accessor :prefix
|
12
17
|
attr_accessor :suffix
|
13
18
|
attr_accessor :force
|
19
|
+
attr_accessor :major
|
20
|
+
attr_accessor :minor
|
21
|
+
attr_accessor :patch
|
14
22
|
alias_method :force?, :force
|
23
|
+
alias_method :major?, :major
|
24
|
+
alias_method :minor?, :minor
|
25
|
+
alias_method :patch?, :patch
|
15
26
|
|
16
27
|
TIMESTAMP_FORMAT = "%Y.%m.%d.%H.%M"
|
28
|
+
SEMVER_CHOICES = %w[Major Minor Patch]
|
17
29
|
|
18
|
-
def self.execute(
|
19
|
-
new(
|
30
|
+
def self.execute(options=nil)
|
31
|
+
new(options).execute
|
20
32
|
end
|
21
33
|
|
22
|
-
def initialize(
|
23
|
-
@
|
24
|
-
@
|
34
|
+
def initialize(options={})
|
35
|
+
@prefix = options[:prefix]
|
36
|
+
@suffix = options[:suffix]
|
37
|
+
@force = options[:force]
|
38
|
+
@major = options[:major]
|
39
|
+
@minor = options[:minor]
|
40
|
+
@patch = options[:patch]
|
25
41
|
end
|
26
42
|
|
27
43
|
def execute
|
@@ -40,6 +56,14 @@ module Octopolo
|
|
40
56
|
force? || (git.current_branch == config.deploy_branch)
|
41
57
|
end
|
42
58
|
|
59
|
+
def update_changelog
|
60
|
+
changelog.open do |log|
|
61
|
+
log.puts "#### #{tag_name}"
|
62
|
+
end
|
63
|
+
git.perform("add #{changelog.filename}")
|
64
|
+
git.perform("commit -m 'Updating Changelog for #{tag_name}'")
|
65
|
+
end
|
66
|
+
|
43
67
|
# Public: Generate a tag for the current release
|
44
68
|
def tag_release
|
45
69
|
git.new_tag tag_name
|
@@ -47,21 +71,56 @@ module Octopolo
|
|
47
71
|
|
48
72
|
# Public: The name to apply to the new tag
|
49
73
|
def tag_name
|
50
|
-
|
74
|
+
if config.semantic_versioning
|
75
|
+
@tag_name ||= tag_semver
|
76
|
+
else
|
77
|
+
@tag_name ||= %Q(#{Time.now.strftime(TIMESTAMP_FORMAT)}#{"_#{suffix}" if suffix})
|
78
|
+
end
|
51
79
|
end
|
52
80
|
|
53
|
-
def
|
54
|
-
|
81
|
+
def tag_semver
|
82
|
+
current_version = get_current_version
|
83
|
+
set_prefix
|
84
|
+
ask_user_version unless @major || @minor || @patch
|
85
|
+
new_version = upgrade_version current_version
|
86
|
+
"#{prefix}#{new_version.to_s}"
|
55
87
|
end
|
56
88
|
|
57
|
-
def
|
58
|
-
|
59
|
-
|
89
|
+
def get_current_version
|
90
|
+
tags = git.semver_tags
|
91
|
+
tags.map{|tag| Octopolo::SemverTagScrubber.scrub_prefix(tag); tag.to_version }.sort.last || "0.0.0".to_version
|
92
|
+
end
|
93
|
+
|
94
|
+
def ask_user_version
|
95
|
+
response = cli.ask("Which version section do you want to increment?", SEMVER_CHOICES)
|
96
|
+
send("#{response.downcase}=", true)
|
97
|
+
end
|
98
|
+
|
99
|
+
def upgrade_version current_version
|
100
|
+
if @major
|
101
|
+
current_version.major += 1
|
102
|
+
current_version.minor = 0
|
103
|
+
current_version.patch = 0
|
104
|
+
elsif @minor
|
105
|
+
current_version.minor += 1
|
106
|
+
current_version.patch = 0
|
107
|
+
elsif @patch
|
108
|
+
current_version.patch+=1
|
60
109
|
end
|
61
|
-
|
62
|
-
git.perform("commit -m 'Updating Changelog for #{tag_name}'")
|
110
|
+
current_version
|
63
111
|
end
|
64
112
|
|
113
|
+
# Private: the changelog file
|
114
|
+
def changelog
|
115
|
+
@changelog ||= Changelog.new
|
116
|
+
end
|
117
|
+
|
118
|
+
# Private: sets/removes the prefix from the tag
|
119
|
+
#
|
120
|
+
# Allows the tag to play nice with the semantic gem
|
121
|
+
def set_prefix
|
122
|
+
@prefix ||= Octopolo::SemverTagScrubber.scrub_prefix(git.semver_tags.last)
|
123
|
+
end
|
65
124
|
end
|
66
125
|
end
|
67
126
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Octopolo
|
2
|
+
class SemverTagScrubber
|
3
|
+
|
4
|
+
def self.scrub_prefix(tag)
|
5
|
+
scrub_via_regexp(tag, /\A[a-z]*/i)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.scrub_suffix(tag)
|
9
|
+
scrub_via_regexp(tag, /[a-z]*\z/i)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def self.scrub_via_regexp(tag, regexp)
|
15
|
+
result = tag.match(regexp)[0]
|
16
|
+
tag.gsub!(regexp, '')
|
17
|
+
result
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
data/lib/octopolo/version.rb
CHANGED
data/octopolo.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_dependency 'highline', '~> 1.6'
|
24
24
|
gem.add_dependency 'pivotal-tracker', '~> 0.5'
|
25
25
|
gem.add_dependency 'jiralicious'
|
26
|
+
gem.add_dependency 'semantic', '~> 1.3.0'
|
26
27
|
|
27
28
|
gem.add_development_dependency 'rspec', '~> 2.99.0'
|
28
29
|
gem.add_development_dependency "guard"
|
data/spec/octopolo/git_spec.rb
CHANGED
@@ -323,6 +323,21 @@ module Octopolo
|
|
323
323
|
end
|
324
324
|
end
|
325
325
|
|
326
|
+
context ".semver_tags" do
|
327
|
+
let(:valid1) { "0.0.1" }
|
328
|
+
let(:valid2) { "v0.0.3" }
|
329
|
+
let(:invalid) { "foothing" }
|
330
|
+
let(:tags) { [valid1, invalid, valid2].join("\n") }
|
331
|
+
|
332
|
+
it "returns all the tags set as a sematic version" do
|
333
|
+
Git.should_receive(:perform_quietly).with("tag") { tags }
|
334
|
+
release_tags = Git.semver_tags
|
335
|
+
release_tags.should_not include invalid
|
336
|
+
release_tags.should include valid1
|
337
|
+
release_tags.should include valid2
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
326
341
|
context ".new_branch(new_branch_name, source_branch_name)" do
|
327
342
|
let(:new_branch_name) { "foo" }
|
328
343
|
let(:source_branch_name) { "bar" }
|
@@ -4,10 +4,12 @@ require "octopolo/scripts/tag_release"
|
|
4
4
|
module Octopolo
|
5
5
|
module Scripts
|
6
6
|
describe TagRelease do
|
7
|
-
let(:config) { stub(:config, deploy_branch: "something") }
|
7
|
+
let(:config) { stub(:config, deploy_branch: "something", semantic_versioning: false) }
|
8
8
|
let(:cli) { stub(:cli) }
|
9
9
|
let(:git) { stub(:git) }
|
10
|
-
let(:
|
10
|
+
let(:prefix) { "foo" }
|
11
|
+
let(:suffix) { "bar" }
|
12
|
+
let(:options) { Hash.new }
|
11
13
|
subject { TagRelease.new }
|
12
14
|
|
13
15
|
before do
|
@@ -17,25 +19,50 @@ module Octopolo
|
|
17
19
|
:git => git
|
18
20
|
})
|
19
21
|
TagRelease.any_instance.stub(:update_changelog)
|
22
|
+
options[:force] = false
|
23
|
+
options[:major] = false
|
24
|
+
options[:minor] = false
|
25
|
+
options[:patch] = false
|
20
26
|
end
|
21
27
|
|
22
|
-
|
23
|
-
it "accepts
|
24
|
-
|
28
|
+
describe "#new" do
|
29
|
+
it "accepts a flag to set the tag prefix" do
|
30
|
+
options[:prefix] = prefix
|
31
|
+
expect(TagRelease.new(options).prefix).to eq(prefix)
|
25
32
|
end
|
26
33
|
|
27
|
-
it "accepts a flag to
|
34
|
+
it "accepts a flag to set the tag suffix" do
|
35
|
+
options[:suffix] = suffix
|
36
|
+
expect(TagRelease.new(options).suffix).to eq(suffix)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "accepts a switch to force creating the new tag even if not on deploy branch" do
|
40
|
+
options[:force] = true
|
41
|
+
expect(TagRelease.new(options).force?).to be_true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "accepts a switch to increment major version" do
|
45
|
+
options[:major] = true
|
46
|
+
expect(TagRelease.new(options).major?).to be_true
|
47
|
+
end
|
28
48
|
|
29
|
-
|
49
|
+
it "accepts a switch to increment minor version" do
|
50
|
+
options[:minor] = true
|
51
|
+
expect(TagRelease.new(options).minor?).to be_true
|
52
|
+
end
|
53
|
+
|
54
|
+
it "accepts a switch to increment patch version" do
|
55
|
+
options[:patch] = true
|
56
|
+
expect(TagRelease.new(options).patch?).to be_true
|
30
57
|
end
|
31
58
|
|
32
59
|
it "defaults to no suffix and not to force" do
|
33
60
|
expect(subject.suffix).to be_nil
|
34
|
-
expect(subject.force?).to
|
61
|
+
expect(subject.force?).to be_falsey
|
35
62
|
end
|
36
63
|
end
|
37
64
|
|
38
|
-
|
65
|
+
describe "#execute" do
|
39
66
|
it "tags the release if on the release branch" do
|
40
67
|
subject.stub(:should_create_branch?) { true }
|
41
68
|
subject.should_receive(:tag_release)
|
@@ -49,7 +76,7 @@ module Octopolo
|
|
49
76
|
end
|
50
77
|
end
|
51
78
|
|
52
|
-
|
79
|
+
describe "#should_create_branch?" do
|
53
80
|
before do
|
54
81
|
subject.force = false
|
55
82
|
end
|
@@ -76,32 +103,121 @@ module Octopolo
|
|
76
103
|
end
|
77
104
|
end
|
78
105
|
|
79
|
-
|
106
|
+
describe "#tag_release" do
|
80
107
|
it "tells Git to make the tag" do
|
81
|
-
subject.stub(:tag_name) { "
|
108
|
+
subject.stub(:tag_name) { "some-tag" }
|
82
109
|
git.should_receive(:new_tag).with(subject.tag_name)
|
83
110
|
subject.tag_release
|
84
111
|
end
|
85
112
|
end
|
86
113
|
|
87
|
-
|
88
|
-
|
89
|
-
|
114
|
+
describe "#tag_name" do
|
115
|
+
context "with timestamp tag" do
|
116
|
+
let(:sample_time) { Time.new }
|
117
|
+
let(:formatted_timestamp) { sample_time.strftime(TagRelease::TIMESTAMP_FORMAT) }
|
90
118
|
|
91
|
-
|
92
|
-
|
119
|
+
before do
|
120
|
+
Time.stub(:now) { sample_time }
|
121
|
+
end
|
122
|
+
|
123
|
+
it "is based on the timestamp" do
|
124
|
+
subject.suffix = nil
|
125
|
+
expect(subject.tag_name).to eq(formatted_timestamp)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "applies the suffix if has one" do
|
129
|
+
subject.suffix = suffix
|
130
|
+
expect(subject.tag_name).to eq("#{formatted_timestamp}_#{suffix}")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context "with semantic versioning tag of 0.0.2" do
|
135
|
+
before do
|
136
|
+
subject.config.stub(:semantic_versioning) { true }
|
137
|
+
subject.git.stub(:semver_tags) { ['0.0.1', '0.0.2'] }
|
138
|
+
end
|
139
|
+
|
140
|
+
context "incrementing patch" do
|
141
|
+
it "bumps the version to 0.0.3" do
|
142
|
+
subject.patch = true
|
143
|
+
expect(subject.tag_name).to eq('0.0.3')
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context "incrementing minor" do
|
148
|
+
it "bumps the version to 0.1.0" do
|
149
|
+
subject.minor = true
|
150
|
+
expect(subject.tag_name).to eq('0.1.0')
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context "incrementing major" do
|
155
|
+
it "bumps the version to 1.0.0" do
|
156
|
+
subject.major = true
|
157
|
+
expect(subject.tag_name).to eq('1.0.0')
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context "with a prefix of v" do
|
162
|
+
before do
|
163
|
+
subject.major = true
|
164
|
+
subject.git.stub(:semver_tags) { %w[v0.0.1 v0.0.2] }
|
165
|
+
end
|
166
|
+
|
167
|
+
it "sets the prefix to v" do
|
168
|
+
subject.tag_name
|
169
|
+
expect(subject.prefix).to eq('v')
|
170
|
+
end
|
171
|
+
|
172
|
+
it "returns the tag name with the prefix" do
|
173
|
+
subject.instance_variable_set(:@tag_name, nil)
|
174
|
+
expect(subject.tag_name).to eq('v1.0.0')
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end # describe "#tag_name"
|
179
|
+
|
180
|
+
describe "#ask_user_version" do
|
181
|
+
let(:semver_choice_question) { "Which version section do you want to increment?" }
|
182
|
+
|
183
|
+
it "sets @major when user response with 'Major'" do
|
184
|
+
expect(subject.cli).to receive(:ask).with(semver_choice_question, TagRelease::SEMVER_CHOICES)
|
185
|
+
.and_return('Major')
|
186
|
+
subject.ask_user_version
|
187
|
+
expect(subject.major).to be_true
|
93
188
|
end
|
94
189
|
|
95
|
-
it "
|
96
|
-
subject.
|
97
|
-
|
190
|
+
it "sets @minor when user response with 'minor'" do
|
191
|
+
expect(subject.cli).to receive(:ask).with(semver_choice_question, TagRelease::SEMVER_CHOICES)
|
192
|
+
.and_return('Minor')
|
193
|
+
subject.ask_user_version
|
194
|
+
expect(subject.minor).to be_true
|
98
195
|
end
|
99
196
|
|
100
|
-
it "
|
101
|
-
subject.
|
102
|
-
|
197
|
+
it "sets @patch when user response with 'patch'" do
|
198
|
+
expect(subject.cli).to receive(:ask).with(semver_choice_question, TagRelease::SEMVER_CHOICES)
|
199
|
+
.and_return('Patch')
|
200
|
+
subject.ask_user_version
|
201
|
+
expect(subject.patch).to be_true
|
103
202
|
end
|
104
203
|
end
|
204
|
+
|
205
|
+
describe "#set_prefix" do
|
206
|
+
let(:tag) { "v0.0.2" }
|
207
|
+
let(:git) { double(:semver_tags => [tag]) }
|
208
|
+
|
209
|
+
it "sets the prefix" do
|
210
|
+
subject.set_prefix
|
211
|
+
expect(subject.prefix).to eq("v")
|
212
|
+
end
|
213
|
+
|
214
|
+
it "does not overwrite the prefix" do
|
215
|
+
subject.prefix = "prefix"
|
216
|
+
subject.set_prefix
|
217
|
+
expect(subject.prefix).to eq("prefix")
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
105
221
|
end
|
106
222
|
end
|
107
223
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "octopolo/semver_tag_scrubber"
|
3
|
+
|
4
|
+
module Octopolo
|
5
|
+
describe SemverTagScrubber do
|
6
|
+
let(:tag) { "Prefix0.0.1Suffix" }
|
7
|
+
|
8
|
+
describe "::scrub_prefix" do
|
9
|
+
it "returns the prefix" do
|
10
|
+
expect(SemverTagScrubber.scrub_prefix tag).to eq("Prefix")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "scrub the prefix from the tag" do
|
14
|
+
SemverTagScrubber.scrub_prefix tag
|
15
|
+
expect(tag).to eq("0.0.1Suffix")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "::scrub_suffix" do
|
20
|
+
it "returns the suffix" do
|
21
|
+
expect(SemverTagScrubber.scrub_suffix tag).to eq("Suffix")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "scrub the suffix from the tag" do
|
25
|
+
SemverTagScrubber.scrub_suffix tag
|
26
|
+
expect(tag).to eq("Prefix0.0.1")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopolo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Byrne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - ! '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: semantic
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ~>
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 1.3.0
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.3.0
|
112
126
|
- !ruby/object:Gem::Dependency
|
113
127
|
name: rspec
|
114
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +192,7 @@ files:
|
|
178
192
|
- .gitignore
|
179
193
|
- .ruby-gemset
|
180
194
|
- .ruby-version
|
195
|
+
- .soyuz.yml
|
181
196
|
- .travis.yml
|
182
197
|
- CHANGELOG.markdown
|
183
198
|
- Gemfile
|
@@ -185,9 +200,10 @@ files:
|
|
185
200
|
- MIT-LICENSE
|
186
201
|
- README.markdown
|
187
202
|
- Rakefile
|
188
|
-
- bash_completion.sh
|
189
203
|
- bin/octopolo
|
190
204
|
- bin/op
|
205
|
+
- completion/octopolo.sh
|
206
|
+
- completion/octopolo.zsh
|
191
207
|
- lib/octopolo.rb
|
192
208
|
- lib/octopolo/changelog.rb
|
193
209
|
- lib/octopolo/cli.rb
|
@@ -238,6 +254,7 @@ files:
|
|
238
254
|
- lib/octopolo/scripts/stale_branches.rb
|
239
255
|
- lib/octopolo/scripts/sync_branch.rb
|
240
256
|
- lib/octopolo/scripts/tag_release.rb
|
257
|
+
- lib/octopolo/semver_tag_scrubber.rb
|
241
258
|
- lib/octopolo/templates/pull_request_body.erb
|
242
259
|
- lib/octopolo/user_config.rb
|
243
260
|
- lib/octopolo/version.rb
|
@@ -275,6 +292,7 @@ files:
|
|
275
292
|
- spec/octopolo/scripts/stale_branches_spec.rb
|
276
293
|
- spec/octopolo/scripts/sync_branch_spec.rb
|
277
294
|
- spec/octopolo/scripts/tag_release_spec.rb
|
295
|
+
- spec/octopolo/semver_tag_scrubber_spec.rb
|
278
296
|
- spec/octopolo/user_config_spec.rb
|
279
297
|
- spec/octopolo_spec.rb
|
280
298
|
- spec/spec_helper.rb
|
@@ -304,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
322
|
version: '0'
|
305
323
|
requirements: []
|
306
324
|
rubyforge_project:
|
307
|
-
rubygems_version: 2.
|
325
|
+
rubygems_version: 2.4.4
|
308
326
|
signing_key:
|
309
327
|
specification_version: 4
|
310
328
|
summary: A set of Github workflow scripts.
|
@@ -340,6 +358,7 @@ test_files:
|
|
340
358
|
- spec/octopolo/scripts/stale_branches_spec.rb
|
341
359
|
- spec/octopolo/scripts/sync_branch_spec.rb
|
342
360
|
- spec/octopolo/scripts/tag_release_spec.rb
|
361
|
+
- spec/octopolo/semver_tag_scrubber_spec.rb
|
343
362
|
- spec/octopolo/user_config_spec.rb
|
344
363
|
- spec/octopolo_spec.rb
|
345
364
|
- spec/spec_helper.rb
|