anvil-core 0.0.1.pre.alpha.2 → 0.0.1.pre.alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/anvil.rb +2 -0
- data/lib/tasks/gem/bump_task.rb +14 -0
- data/spec/lib/tasks/gem/bump_task_spec.rb +40 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11c632bfef80657b2626182273510e405208c03
|
4
|
+
data.tar.gz: 191dab915a4d5e375f421145dd4e84c2dc9ad35f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 786e8d0568a15e2490d5a57335dac9e12183f6425441df80383c455e5c0158183cb13d34bcf3c6af13398e53499bd3d0cd57b1df9568733df40957a547c7c73b
|
7
|
+
data.tar.gz: a026c61d5e629bd7aecf88ec5cd28b3462420956a7278ca924c323676c091813678e67bb75b0bea19fd0857b0e137a743ffa2f7a9f75451232d2bd4418a54c56
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.1-alpha.
|
1
|
+
0.0.1-alpha.3
|
data/lib/anvil.rb
CHANGED
data/lib/tasks/gem/bump_task.rb
CHANGED
@@ -15,6 +15,7 @@ class Gem::BumpTask < Anvil::Task
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def task
|
18
|
+
prepare_repo
|
18
19
|
version = bump(read_version)
|
19
20
|
write_version version
|
20
21
|
|
@@ -48,6 +49,7 @@ class Gem::BumpTask < Anvil::Task
|
|
48
49
|
git.add 'VERSION'
|
49
50
|
git.commit "Bump version v#{version}"
|
50
51
|
git.add_tag "v#{version}"
|
52
|
+
git.push
|
51
53
|
end
|
52
54
|
|
53
55
|
def write_version(version)
|
@@ -58,4 +60,16 @@ class Gem::BumpTask < Anvil::Task
|
|
58
60
|
|
59
61
|
commit_and_tag version
|
60
62
|
end
|
63
|
+
|
64
|
+
def prepare_repo
|
65
|
+
fail Anvil::RepoNotClean unless clean?
|
66
|
+
|
67
|
+
git.pull
|
68
|
+
end
|
69
|
+
|
70
|
+
def clean?
|
71
|
+
git.status.changed.empty? &&
|
72
|
+
git.status.deleted.empty? &&
|
73
|
+
git.status.added.empty?
|
74
|
+
end
|
61
75
|
end
|
@@ -1,15 +1,53 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'tasks/gem/bump_task'
|
3
|
+
require 'git'
|
4
|
+
require 'anvil'
|
3
5
|
|
4
6
|
describe Gem::BumpTask do
|
7
|
+
subject { Gem::BumpTask.new :major }
|
8
|
+
|
5
9
|
describe '#task' do
|
6
|
-
subject { Gem::BumpTask.new :major }
|
7
10
|
before { subject.stub(:read_version).and_return('2.0.0') }
|
8
11
|
|
9
12
|
it 'bumps the version and writes it' do
|
10
|
-
expect(subject).to receive(:
|
13
|
+
expect(subject).to receive(:prepare_repo).and_return(true)
|
14
|
+
expect(subject).to receive(:write_version).and_return(true)
|
11
15
|
|
12
16
|
expect(subject.task).to eq('3.0.0')
|
13
17
|
end
|
14
18
|
end
|
19
|
+
|
20
|
+
describe '#write_version' do
|
21
|
+
it 'writes the file and push the changes' do
|
22
|
+
expect(subject).to receive(:version_file).with('w+')
|
23
|
+
expect(subject).to receive(:commit_and_tag)
|
24
|
+
end
|
25
|
+
|
26
|
+
after { subject.send :write_version, '2.0.0' }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#prepare_repo' do
|
30
|
+
context 'on a clean repo' do
|
31
|
+
before do
|
32
|
+
subject.stub(:clean?).and_return(true)
|
33
|
+
subject.stub(:git).and_return(double)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'pulls' do
|
37
|
+
expect(subject.send(:git)).to receive(:pull)
|
38
|
+
end
|
39
|
+
|
40
|
+
after { subject.send :prepare_repo }
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'on a dirty repo' do
|
44
|
+
before { subject.stub(:clean?).and_return(false) }
|
45
|
+
|
46
|
+
it 'raises RepoNotClean' do
|
47
|
+
expect do
|
48
|
+
subject.send :prepare_repo
|
49
|
+
end.to raise_error(Anvil::RepoNotClean)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
15
53
|
end
|