project_releaser 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -16
- data/lib/project_releaser.rb +2 -2
- data/lib/project_releaser/cli.rb +6 -6
- data/lib/project_releaser/project.rb +2 -1
- data/lib/project_releaser/project/info.rb +5 -7
- data/lib/project_releaser/project/releaser.rb +2 -2
- data/lib/project_releaser/project/repository.rb +18 -19
- data/lib/project_releaser/version.rb +1 -1
- data/spec/project_releaser/project/info_spec.rb +0 -1
- data/spec/project_releaser/project/repository_spec.rb +48 -52
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1cd379709acc477b4a850bf86d807f573a468a9
|
4
|
+
data.tar.gz: 3bca27c5d820261d5b09715e71b6ceb0c423495a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90299be31807c6dc33bb8607b146338af3ca5c7f368325c9a5942e944727ec98d4f00f28d534345b31f5a8ef70498c5a777cb538285d1555b4560d57b69e5902
|
7
|
+
data.tar.gz: 15424416eeb4b5d798abeba31036bf14f5f425bc451a939c0715ff01f323937d99e7638f2e0f388557da86be3757e5d2c1f1744da43ba98085d289c0a31d66b3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
project_releaser (0.0.
|
4
|
+
project_releaser (0.0.6)
|
5
5
|
colorize
|
6
6
|
commander
|
7
7
|
git
|
@@ -9,32 +9,32 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
coderay (1.1.
|
12
|
+
coderay (1.1.1)
|
13
13
|
colorize (0.8.1)
|
14
|
-
commander (4.4.
|
14
|
+
commander (4.4.3)
|
15
15
|
highline (~> 1.7.2)
|
16
16
|
diff-lcs (1.2.5)
|
17
17
|
git (1.3.0)
|
18
18
|
highline (1.7.8)
|
19
19
|
method_source (0.8.2)
|
20
|
-
pry (0.10.
|
20
|
+
pry (0.10.4)
|
21
21
|
coderay (~> 1.1.0)
|
22
22
|
method_source (~> 0.8.1)
|
23
23
|
slop (~> 3.4)
|
24
|
-
rake (
|
25
|
-
rspec (3.
|
26
|
-
rspec-core (~> 3.
|
27
|
-
rspec-expectations (~> 3.
|
28
|
-
rspec-mocks (~> 3.
|
29
|
-
rspec-core (3.
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-expectations (3.
|
24
|
+
rake (12.0.0)
|
25
|
+
rspec (3.5.0)
|
26
|
+
rspec-core (~> 3.5.0)
|
27
|
+
rspec-expectations (~> 3.5.0)
|
28
|
+
rspec-mocks (~> 3.5.0)
|
29
|
+
rspec-core (3.5.4)
|
30
|
+
rspec-support (~> 3.5.0)
|
31
|
+
rspec-expectations (3.5.0)
|
32
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.
|
34
|
-
rspec-mocks (3.
|
33
|
+
rspec-support (~> 3.5.0)
|
34
|
+
rspec-mocks (3.5.0)
|
35
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.
|
37
|
-
rspec-support (3.
|
36
|
+
rspec-support (~> 3.5.0)
|
37
|
+
rspec-support (3.5.0)
|
38
38
|
slop (3.6.0)
|
39
39
|
|
40
40
|
PLATFORMS
|
data/lib/project_releaser.rb
CHANGED
data/lib/project_releaser/cli.rb
CHANGED
@@ -34,7 +34,7 @@ module ProjectReleaser
|
|
34
34
|
command :version do |c|
|
35
35
|
c.syntax = 'project version'
|
36
36
|
c.description = 'Current version of the project'
|
37
|
-
action c do
|
37
|
+
action c do
|
38
38
|
logger.info "Current version of '#{project.name}' is #{project.current_version}"
|
39
39
|
end
|
40
40
|
end
|
@@ -44,7 +44,7 @@ module ProjectReleaser
|
|
44
44
|
command :name do |c|
|
45
45
|
c.syntax = 'project name'
|
46
46
|
c.description = 'Infer project name from git remotes'
|
47
|
-
action c do
|
47
|
+
action c do
|
48
48
|
logger.info "You are working on project '#{project.name}'"
|
49
49
|
end
|
50
50
|
end
|
@@ -54,7 +54,7 @@ module ProjectReleaser
|
|
54
54
|
command :update do |c|
|
55
55
|
c.syntax = 'project update'
|
56
56
|
c.description = 'Updates release and develop branches from all remotes'
|
57
|
-
action c do
|
57
|
+
action c do
|
58
58
|
ProjectReleaser::Project.update
|
59
59
|
end
|
60
60
|
end
|
@@ -64,7 +64,7 @@ module ProjectReleaser
|
|
64
64
|
command :release do |c|
|
65
65
|
c.syntax = 'project release'
|
66
66
|
c.description = 'Merges develop into release and pushes it with new version tag'
|
67
|
-
action c do |args,
|
67
|
+
action c do |args, _options|
|
68
68
|
ProjectReleaser::Project.release args.first
|
69
69
|
end
|
70
70
|
end
|
@@ -74,9 +74,9 @@ module ProjectReleaser
|
|
74
74
|
ProjectReleaser::Project
|
75
75
|
end
|
76
76
|
|
77
|
-
def action(cmd
|
77
|
+
def action(cmd)
|
78
78
|
proc = lambda do |args, options|
|
79
|
-
|
79
|
+
yield args, options
|
80
80
|
logger.info '`Done!`'
|
81
81
|
end
|
82
82
|
cmd.action(&proc)
|
@@ -19,7 +19,7 @@ module ProjectReleaser
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def next_version(version_type = :patch)
|
22
|
-
version_type = (version_type
|
22
|
+
version_type = (version_type || :patch).to_sym
|
23
23
|
return exact_version(version_type) unless valid_version_part? version_type
|
24
24
|
|
25
25
|
new_version = @git.current_version
|
@@ -29,12 +29,10 @@ module ProjectReleaser
|
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
32
|
+
|
32
33
|
def exact_version(version)
|
33
|
-
|
34
|
-
|
35
|
-
else
|
36
|
-
raise ArgumentError
|
37
|
-
end
|
34
|
+
raise ArgumentError unless version =~ /\Av{0,1}\d+\.\d+\.\d+\Z/
|
35
|
+
version.to_s.prepend('v').sub('vv', 'v')
|
38
36
|
end
|
39
37
|
|
40
38
|
def valid_version_part?(version)
|
@@ -48,7 +46,7 @@ module ProjectReleaser
|
|
48
46
|
def reset_lesser_versions(full_version, cutoff_version)
|
49
47
|
keys = full_version.keys
|
50
48
|
index = keys.index cutoff_version
|
51
|
-
Hash[
|
49
|
+
Hash[full_version.map { |k, v| keys.index(k) <= index ? [k, v] : [k, 0] }]
|
52
50
|
end
|
53
51
|
end
|
54
52
|
end
|
@@ -19,7 +19,7 @@ module ProjectReleaser
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def update_local_branches
|
22
|
-
logger.info
|
22
|
+
logger.info 'updating local branches'
|
23
23
|
@git.pull branches
|
24
24
|
end
|
25
25
|
|
@@ -36,7 +36,7 @@ module ProjectReleaser
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def branches
|
39
|
-
@branches ||=begin
|
39
|
+
@branches ||= begin
|
40
40
|
branches = [:master]
|
41
41
|
branches += [:develop] if @git.has_branch? :develop
|
42
42
|
branches
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module ProjectReleaser
|
2
2
|
module Project
|
3
3
|
class Repository
|
4
|
-
class RepositoryHasNoBranches < RuntimeError; end
|
5
|
-
class RepositoryNotFound < RuntimeError; end
|
6
|
-
class MissingBranch < RuntimeError; end
|
4
|
+
class RepositoryHasNoBranches < RuntimeError; end
|
5
|
+
class RepositoryNotFound < RuntimeError; end
|
6
|
+
class MissingBranch < RuntimeError; end
|
7
7
|
|
8
|
-
VERSION_PARTS = %I(major minor patch)
|
9
|
-
DEFAULT_VERSION = [1, 0, 0]
|
8
|
+
VERSION_PARTS = %I(major minor patch).freeze
|
9
|
+
DEFAULT_VERSION = [1, 0, 0].freeze
|
10
10
|
|
11
11
|
def initialize(repo_path)
|
12
12
|
@git = open_repository(repo_path)
|
@@ -20,7 +20,7 @@ module ProjectReleaser
|
|
20
20
|
branches.each do |branch|
|
21
21
|
checkout branch
|
22
22
|
@git.remotes.each do |remote|
|
23
|
-
@git.fetch remote.name #otherwise it wouldnt get new tags...
|
23
|
+
@git.fetch remote.name # otherwise it wouldnt get new tags...
|
24
24
|
@git.pull remote.name, branch
|
25
25
|
end
|
26
26
|
end
|
@@ -39,20 +39,18 @@ module ProjectReleaser
|
|
39
39
|
def push(branch, version_name)
|
40
40
|
checkout branch
|
41
41
|
@git.add_tag version_name
|
42
|
-
@git.
|
43
|
-
|
44
|
-
@git.push r.name, version_name
|
45
|
-
end
|
42
|
+
@git.push 'origin', branch
|
43
|
+
@git.push 'origin', version_name
|
46
44
|
end
|
47
45
|
|
48
46
|
def remotes
|
49
|
-
Hash[@git.remotes.map{ |r| [r.name, r.url] }]
|
47
|
+
Hash[@git.remotes.map { |r| [r.name, r.url] }]
|
50
48
|
end
|
51
49
|
|
52
50
|
def current_branch
|
53
51
|
raise RepositoryHasNoBranches unless @git.branches.count > 0
|
54
52
|
|
55
|
-
@git.branches.find
|
53
|
+
@git.branches.find(&:current).name
|
56
54
|
end
|
57
55
|
|
58
56
|
def checkout(branch)
|
@@ -62,32 +60,32 @@ module ProjectReleaser
|
|
62
60
|
end
|
63
61
|
|
64
62
|
def fetch_tags
|
65
|
-
@git.remotes.each { |r| @git.fetch(r.name, :
|
63
|
+
@git.remotes.each { |r| @git.fetch(r.name, tags: true) }
|
66
64
|
end
|
67
65
|
|
68
66
|
def has_branch?(branch_name)
|
69
67
|
@git.branches.map(&:name).include? branch_name.to_s
|
70
68
|
end
|
71
69
|
|
72
|
-
def returning_to_current_branch
|
70
|
+
def returning_to_current_branch
|
73
71
|
branch = current_branch
|
74
72
|
yield self
|
75
73
|
checkout branch
|
76
74
|
end
|
77
75
|
|
78
|
-
private
|
76
|
+
private
|
79
77
|
|
80
78
|
def versions
|
81
79
|
tags = @git.tags
|
82
80
|
return [DEFAULT_VERSION] if tags.empty?
|
83
81
|
valid_tags = tags
|
84
|
-
|
85
|
-
|
82
|
+
.map(&:name)
|
83
|
+
.select { |n| n =~ /\Av?\d+(\.\d+){1,2}\z/ }
|
86
84
|
|
87
85
|
return [DEFAULT_VERSION] if valid_tags.empty?
|
88
86
|
valid_tags
|
89
|
-
.map{ |n| n.sub('v', '').split('.').map(&:to_i) }
|
90
|
-
.map{ |a| a.fill(0, a.size..2) }
|
87
|
+
.map { |n| n.sub('v', '').split('.').map(&:to_i) }
|
88
|
+
.map { |a| a.fill(0, a.size..2) }
|
91
89
|
.sort
|
92
90
|
end
|
93
91
|
|
@@ -99,3 +97,4 @@ module ProjectReleaser
|
|
99
97
|
end
|
100
98
|
end
|
101
99
|
end
|
100
|
+
|
@@ -7,7 +7,7 @@ describe ProjectReleaser::Project::Repository do
|
|
7
7
|
|
8
8
|
it 'raises exception if directory has no git repository' do
|
9
9
|
allow(Git).to receive(:open).with(dir).and_raise(ArgumentError)
|
10
|
-
expect{subject}.to raise_error ProjectReleaser::Project::Repository::RepositoryNotFound
|
10
|
+
expect { subject }.to raise_error ProjectReleaser::Project::Repository::RepositoryNotFound
|
11
11
|
end
|
12
12
|
|
13
13
|
context 'when dir has repository' do
|
@@ -15,72 +15,70 @@ describe ProjectReleaser::Project::Repository do
|
|
15
15
|
allow(Git).to receive(:open).with(dir).and_return(git)
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
18
|
describe '#current_version' do
|
20
19
|
it 'takes version from last tag' do
|
21
|
-
tag_1 = double 'tag', :
|
22
|
-
tag_2 = double 'tag', :
|
20
|
+
tag_1 = double 'tag', name: 'v1.2.3'
|
21
|
+
tag_2 = double 'tag', name: 'v1.2.4'
|
23
22
|
allow(git).to receive(:tags).and_return([tag_1, tag_2])
|
24
|
-
expect(subject.current_version).to eq :
|
23
|
+
expect(subject.current_version).to eq major: 1, minor: 2, patch: 4
|
25
24
|
end
|
26
25
|
|
27
26
|
it 'supports version without v prefix' do
|
28
|
-
tag = double 'tag', :
|
27
|
+
tag = double 'tag', name: '1.2.8'
|
29
28
|
allow(git).to receive(:tags).and_return([tag])
|
30
|
-
expect(subject.current_version).to eq :
|
29
|
+
expect(subject.current_version).to eq major: 1, minor: 2, patch: 8
|
31
30
|
end
|
32
31
|
|
33
32
|
it 'recognizes partial versions' do
|
34
|
-
tag = double 'tag', :
|
33
|
+
tag = double 'tag', name: 'v1.2'
|
35
34
|
allow(git).to receive(:tags).and_return([tag])
|
36
|
-
expect(subject.current_version).to eq :
|
35
|
+
expect(subject.current_version).to eq major: 1, minor: 2, patch: 0
|
37
36
|
end
|
38
37
|
|
39
38
|
it 'sorts tags by patch version' do
|
40
|
-
tag_1 = double 'tag', :
|
41
|
-
tag_2 = double 'tag', :
|
39
|
+
tag_1 = double 'tag', name: 'v1.2.10'
|
40
|
+
tag_2 = double 'tag', name: 'v1.2.2'
|
42
41
|
allow(git).to receive(:tags).and_return([tag_1, tag_2])
|
43
|
-
expect(subject.current_version).to eq :
|
42
|
+
expect(subject.current_version).to eq major: 1, minor: 2, patch: 10
|
44
43
|
end
|
45
44
|
|
46
45
|
it 'sorts tags by minor version' do
|
47
|
-
tag_1 = double 'tag', :
|
48
|
-
tag_2 = double 'tag', :
|
46
|
+
tag_1 = double 'tag', name: 'v1.10.2'
|
47
|
+
tag_2 = double 'tag', name: 'v1.2.2'
|
49
48
|
allow(git).to receive(:tags).and_return([tag_1, tag_2])
|
50
|
-
expect(subject.current_version).to eq :
|
49
|
+
expect(subject.current_version).to eq major: 1, minor: 10, patch: 2
|
51
50
|
end
|
52
51
|
|
53
52
|
it 'sorts tags by patch version' do
|
54
|
-
tag_1 = double 'tag', :
|
55
|
-
tag_2 = double 'tag', :
|
53
|
+
tag_1 = double 'tag', name: 'v0.2.2'
|
54
|
+
tag_2 = double 'tag', name: 'v1.2.2'
|
56
55
|
allow(git).to receive(:tags).and_return([tag_1, tag_2])
|
57
|
-
expect(subject.current_version).to eq :
|
56
|
+
expect(subject.current_version).to eq major: 1, minor: 2, patch: 2
|
58
57
|
end
|
59
58
|
|
60
59
|
it 'returns default version when there are none' do
|
61
60
|
allow(git).to receive(:tags).and_return([])
|
62
|
-
expect(subject.current_version).to eq :
|
61
|
+
expect(subject.current_version).to eq major: 1, minor: 0, patch: 0
|
63
62
|
end
|
64
63
|
|
65
64
|
it 'returns default version when there are no valid tags' do
|
66
|
-
tag = double 'tag', :
|
65
|
+
tag = double 'tag', name: 'random tag'
|
67
66
|
allow(git).to receive(:tags).and_return([tag])
|
68
|
-
expect(subject.current_version).to eq :
|
67
|
+
expect(subject.current_version).to eq major: 1, minor: 0, patch: 0
|
69
68
|
end
|
70
69
|
|
71
70
|
it 'ignores tags that do not match semantic versioning and returns default one' do
|
72
|
-
tag_1 = double 'tag', :
|
73
|
-
tag_2 = double 'tag', :
|
71
|
+
tag_1 = double 'tag', name: 'g1.2.3'
|
72
|
+
tag_2 = double 'tag', name: 'random string'
|
74
73
|
allow(git).to receive(:tags).and_return([tag_1, tag_2])
|
75
|
-
expect(subject.current_version).to eq :
|
74
|
+
expect(subject.current_version).to eq major: 1, minor: 0, patch: 0
|
76
75
|
end
|
77
76
|
end
|
78
77
|
|
79
|
-
|
80
|
-
describe '#pull' do
|
78
|
+
describe '#pull' do
|
81
79
|
it 'updates provided branches from remote urls' do
|
82
|
-
remote_1 = double 'remote url', :
|
83
|
-
remote_2 = double 'remote url', :
|
80
|
+
remote_1 = double 'remote url', name: 'remote_1'
|
81
|
+
remote_2 = double 'remote url', name: 'remote_2'
|
84
82
|
|
85
83
|
allow(git).to receive(:remotes).and_return([remote_1, remote_2])
|
86
84
|
|
@@ -100,7 +98,6 @@ describe ProjectReleaser::Project::Repository do
|
|
100
98
|
end
|
101
99
|
end
|
102
100
|
|
103
|
-
|
104
101
|
describe '#merge' do
|
105
102
|
it 'merges two branches' do
|
106
103
|
expect(git).to receive(:checkout).with(:branch_1).ordered
|
@@ -119,16 +116,16 @@ describe ProjectReleaser::Project::Repository do
|
|
119
116
|
end
|
120
117
|
end
|
121
118
|
|
122
|
-
|
123
119
|
describe '#push' do
|
124
|
-
it 'tags with provided version and pushes to
|
125
|
-
remote = double 'remote url', :
|
126
|
-
|
120
|
+
it 'tags with provided version and pushes only to origin remote url' do
|
121
|
+
remote = double 'remote url', name: 'some_origin'
|
122
|
+
origin = double 'remote url', name: 'origin'
|
123
|
+
allow(git).to receive(:remotes).and_return([origin, remote])
|
127
124
|
|
128
125
|
expect(git).to receive(:checkout).with(:branch).ordered
|
129
126
|
expect(git).to receive(:add_tag).with('v1.0.0')
|
130
|
-
expect(git).to receive(:push).with('
|
131
|
-
expect(git).to receive(:push).with('
|
127
|
+
expect(git).to receive(:push).with('origin', :branch).ordered
|
128
|
+
expect(git).to receive(:push).with('origin', 'v1.0.0').ordered
|
132
129
|
|
133
130
|
subject.push :branch, 'v1.0.0'
|
134
131
|
end
|
@@ -136,8 +133,8 @@ describe ProjectReleaser::Project::Repository do
|
|
136
133
|
|
137
134
|
describe '#remotes' do
|
138
135
|
it 'returns hash with remote names and urls' do
|
139
|
-
remote_1 = double 'remote url', :
|
140
|
-
remote_2 = double 'remote url', :
|
136
|
+
remote_1 = double 'remote url', name: 'remote_1', url: 'url_1'
|
137
|
+
remote_2 = double 'remote url', name: 'remote_2', url: 'url_2'
|
141
138
|
|
142
139
|
allow(git).to receive(:remotes).and_return([remote_1, remote_2])
|
143
140
|
|
@@ -145,12 +142,11 @@ describe ProjectReleaser::Project::Repository do
|
|
145
142
|
end
|
146
143
|
end
|
147
144
|
|
148
|
-
|
149
145
|
describe '#current_branch' do
|
150
146
|
it 'returns current repository branch name' do
|
151
|
-
branch_1 = double 'git branch', :
|
152
|
-
branch_2 = double 'git branch', :
|
153
|
-
branch_3 = double 'git branch', :
|
147
|
+
branch_1 = double 'git branch', name: 'my_feature 1', current: false
|
148
|
+
branch_2 = double 'git branch', name: 'my_feature 2', current: true
|
149
|
+
branch_3 = double 'git branch', name: 'my_feature 3', current: false
|
154
150
|
allow(git).to receive(:branches).and_return([branch_1, branch_2, branch_3])
|
155
151
|
|
156
152
|
expect(subject.current_branch).to eq 'my_feature 2'
|
@@ -159,7 +155,7 @@ describe ProjectReleaser::Project::Repository do
|
|
159
155
|
it 'raises exception of repository has no branches' do
|
160
156
|
allow(git).to receive(:branches).and_return([])
|
161
157
|
|
162
|
-
expect{subject.current_branch}.to raise_error ProjectReleaser::Project::Repository::RepositoryHasNoBranches
|
158
|
+
expect { subject.current_branch }.to raise_error ProjectReleaser::Project::Repository::RepositoryHasNoBranches
|
163
159
|
end
|
164
160
|
end
|
165
161
|
|
@@ -172,31 +168,31 @@ describe ProjectReleaser::Project::Repository do
|
|
172
168
|
|
173
169
|
it 'raises exception if the branch is missing' do
|
174
170
|
allow(git).to receive(:checkout).with(:branch).and_raise(Git::GitExecuteError)
|
175
|
-
expect{subject.checkout :branch}.to raise_error ProjectReleaser::Project::Repository::MissingBranch
|
171
|
+
expect { subject.checkout :branch }.to raise_error ProjectReleaser::Project::Repository::MissingBranch
|
176
172
|
end
|
177
173
|
end
|
178
174
|
|
179
175
|
describe '#fetch_tags' do
|
180
176
|
it 'fetches tags from all remotes' do
|
181
|
-
remote_1 = double 'remote url', :
|
182
|
-
remote_2 = double 'remote url', :
|
177
|
+
remote_1 = double 'remote url', name: 'remote_1'
|
178
|
+
remote_2 = double 'remote url', name: 'remote_2'
|
183
179
|
allow(git).to receive(:remotes).and_return([remote_1, remote_2])
|
184
180
|
|
185
|
-
expect(git).to receive(:fetch).with('remote_1', :
|
186
|
-
expect(git).to receive(:fetch).with('remote_2', :
|
181
|
+
expect(git).to receive(:fetch).with('remote_1', tags: true)
|
182
|
+
expect(git).to receive(:fetch).with('remote_2', tags: true)
|
187
183
|
|
188
184
|
subject.fetch_tags
|
189
185
|
end
|
190
186
|
end
|
191
187
|
|
192
188
|
describe '#has_branch' do
|
193
|
-
let(:branch) {double 'git branch', :
|
189
|
+
let(:branch) { double 'git branch', name: 'the_branch' }
|
194
190
|
before :each do
|
195
191
|
allow(git).to receive(:branches).and_return([branch])
|
196
192
|
end
|
197
193
|
|
198
194
|
it 'returns true if branch exists' do
|
199
|
-
expect(subject.has_branch?(:the_branch)).to be_truthy
|
195
|
+
expect(subject.has_branch?(:the_branch)).to be_truthy
|
200
196
|
end
|
201
197
|
|
202
198
|
it 'returns false if branch exists' do
|
@@ -206,8 +202,8 @@ describe ProjectReleaser::Project::Repository do
|
|
206
202
|
|
207
203
|
describe '#returning_to_current_branch' do
|
208
204
|
let(:git) { double('git').as_null_object }
|
209
|
-
let(:tmp_branch) { double 'git branch', :
|
210
|
-
let(:current_branch) { double 'git branch', :
|
205
|
+
let(:tmp_branch) { double 'git branch', name: :tmp_branch, current: false }
|
206
|
+
let(:current_branch) { double 'git branch', name: :current_branch, current: true }
|
211
207
|
|
212
208
|
before :each do
|
213
209
|
allow(Git).to receive(:open).with(dir).and_return(git)
|
@@ -222,7 +218,7 @@ describe ProjectReleaser::Project::Repository do
|
|
222
218
|
|
223
219
|
it 'checks out current branch after yielding block' do
|
224
220
|
subject.returning_to_current_branch do
|
225
|
-
#change current branch to something else
|
221
|
+
# change current branch to something else
|
226
222
|
allow(current_branch).to receive(:current).and_return(false)
|
227
223
|
allow(tmp_branch).to receive(:current).and_return(true)
|
228
224
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: project_releaser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kagux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|