rake-n-bake 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d54433eb1dc7d02df5a553362d95cbfd2c6f5b96
4
- data.tar.gz: 38e0812467a6bcbcb19b360c37f59f81b414cfc6
3
+ metadata.gz: d416c51bf6ac943aa3cfbf97389557ca1d17d4f5
4
+ data.tar.gz: 9eb9acb3e384f03f3c2832943f27040f498420c6
5
5
  SHA512:
6
- metadata.gz: 449f20f17a18f2c68dc77441d5e0f241c78f43926d3b083f6b97f3186379e590a664389f8a86a16485fcf3463db99ce2b26e2177720bd76058794baa99054b57
7
- data.tar.gz: f45de510a5d91089ac6c8cd038a1b8e098181e8a2fc82e08f4d67b60b18e47e7b51f32a9bcec54d9de5c89e3596f667bc7efd1122e60ef9b48a964f9dde99577
6
+ metadata.gz: 58d695b0463cf22a91a871c3d952f6d9fa4e2569806f2f26bf3645301f1faf2a3542dad975fadb04d622bf830bce62a44850cff26a59db203e0f8edd467844eb
7
+ data.tar.gz: 7cb760f6db95a6689c8bb0e4b410e389b74d166c65a40c469777c9f52737fdb3a3e03343ad1760682236edb6bb6be6c922782e18397cfdc57ae3d44019b8e4b8
data/history.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.0.4 (21 October 2014)
2
+
3
+ * Update history.rdoc in semver tasks
4
+
1
5
  == 1.0.3 (21 October 2014)
2
6
 
3
7
  * Wrap rspec require in a begiun rescue
@@ -51,6 +51,19 @@ module RakeNBake
51
51
  v.save
52
52
  end
53
53
 
54
+ def self.update_history_file
55
+ history_file = File.join(File.dirname(__FILE__), '../history.rdoc')
56
+ if File.exist? history_file
57
+ current_history = File.read history_file
58
+ File.open history_file, 'w' do |f|
59
+ f.puts "== #{current_version} (#{Time.now.strftime "%d %B %Y"})"
60
+ f.puts
61
+ f.print current_history
62
+ end
63
+ `git add history.rdoc`
64
+ end
65
+ end
66
+
54
67
  def self.tag
55
68
  v = current_version.to_s
56
69
  `git add .semver && git commit -m 'Increment version to #{v}' && git tag #{v} -a -m '#{Time.now}'`
data/rake-n-bake.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "rake-n-bake"
7
- spec.version = '1.0.3'
7
+ spec.version = '1.0.4'
8
8
  spec.authors = ["Richard Vickerstaff", "Adam Whittingham"]
9
9
  spec.email = ["m3akq@btinternet.com", "adam.whittingham@gmail.com"]
10
10
  spec.description = "Common rake tasks, baked to perfection and ready to serve!"
@@ -16,18 +16,26 @@ describe RakeNBake::SemverVersioning do
16
16
  if File.exist? File.join(File.dirname(__FILE__), '../.semver')
17
17
  @current_semver_file = File.read(File.join(File.dirname(__FILE__), '../.semver'), force: true)
18
18
  end
19
+ if File.exist? File.join(File.dirname(__FILE__), '../history.rdoc')
20
+ @current_history_file = File.read(File.join(File.dirname(__FILE__), '../history.rdoc'), force: true)
21
+ end
19
22
  end
20
23
 
21
24
  after(:all) do
22
25
  if @current_semver_file
23
26
  File.write(File.join(File.dirname(__FILE__), '../.semver'), @current_semver_file, force: true)
24
27
  end
28
+ if @current_history_file
29
+ File.write(File.join(File.dirname(__FILE__), '../history.rdoc'), @current_history_file, force: true)
30
+ end
25
31
  end
26
- before do
32
+ before(:each) do
27
33
  FileUtils.rm(File.join(File.dirname(__FILE__), '../.semver'), force: true)
34
+ FileUtils.rm(File.join(File.dirname(__FILE__), '../history.rdoc'), force: true)
28
35
  end
29
- after do
36
+ after(:each) do
30
37
  FileUtils.rm(File.join(File.dirname(__FILE__), '../.semver'), force: true)
38
+ FileUtils.rm(File.join(File.dirname(__FILE__), '../history.rdoc'), force: true)
31
39
  end
32
40
  describe '#current_version' do
33
41
  context 'when there is no .semver file' do
@@ -112,7 +120,20 @@ describe RakeNBake::SemverVersioning do
112
120
  describe '#update_history_file' do
113
121
  context 'when there is no history file' do
114
122
  it 'does nothing' do
123
+ described_class.update_history_file
124
+ expect(File.exist? '../history.rdoc').to eq false
125
+ end
126
+ end
127
+ context 'when there is a history file' do
128
+ before do
129
+ File.write(File.join(File.dirname(__FILE__), '../.semver'), YAML.dump(version))
130
+ File.write(File.join(File.dirname(__FILE__), '../history.rdoc'), '* Some changes')
131
+ end
115
132
 
133
+ it 'Adds the version number and date to the top of the file and adds it to git' do
134
+ expect(Object).to receive(:`).with('git add history.rdoc')
135
+ described_class.update_history_file
136
+ expect(File.read(File.join(File.dirname(__FILE__), '../history.rdoc')).lines.first).to eq "== v1.2.3 (#{Time.now.strftime "%d %B %Y"})\n"
116
137
  end
117
138
  end
118
139
  end
data/tasks/semver.rake CHANGED
@@ -3,27 +3,29 @@ begin
3
3
  namespace :bake do
4
4
  namespace :semver do
5
5
 
6
- desc "Display the latest version (form .semver)"
6
+ desc "Display the latest version (from .semver)"
7
7
  task :version do
8
8
  RakeNBake::SemverVersioning.latest_version
9
- RakeNBake::SemverVersioning.tag
10
9
  end
11
10
 
12
11
  desc 'Increment major version in .semver (eg 1.2.3 => 2.0.0)'
13
12
  task :major do
14
13
  RakeNBake::SemverVersioning.inc_major
14
+ RakeNBake::SemverVersioning.update_history_file
15
15
  RakeNBake::SemverVersioning.tag
16
16
  end
17
17
 
18
18
  desc 'Increment minor version in .semver (eg 1.2.3 => 1.3.0)'
19
19
  task :minor do
20
20
  RakeNBake::SemverVersioning.inc_minor
21
+ RakeNBake::SemverVersioning.update_history_file
21
22
  RakeNBake::SemverVersioning.tag
22
23
  end
23
24
 
24
25
  desc 'Increment patch version in .semver (eg 1.2.3 => 2.0.0)'
25
26
  task :patch do
26
27
  RakeNBake::SemverVersioning.inc_patch
28
+ RakeNBake::SemverVersioning.update_history_file
27
29
  RakeNBake::SemverVersioning.tag
28
30
  end
29
31
 
@@ -31,6 +33,7 @@ begin
31
33
  task :prerelease, [:version] do |task, args|
32
34
  version = args[:version] || fail("Invalid usage: rake bake:semver:prerelase['release name']")
33
35
  RakeNBake::SemverVersioning.prerelease version
36
+ RakeNBake::SemverVersioning.update_history_file
34
37
  RakeNBake::SemverVersioning.tag
35
38
  end
36
39
 
@@ -38,12 +41,14 @@ begin
38
41
  task :inc_prerelease, [:version] do |task, args|
39
42
  version = args[:version] || fail("Invalid usage: rake bake:semver:inc_prerelase['release name']")
40
43
  RakeNBake::SemverVersioning.inc_prerelease version
44
+ RakeNBake::SemverVersioning.update_history_file
41
45
  RakeNBake::SemverVersioning.tag
42
46
  end
43
47
 
44
48
  desc 'Remove prerelease version (eg 1.2.3-rc2 => 1.2.3)'
45
49
  task :release do
46
50
  RakeNBake::SemverVersioning.release
51
+ RakeNBake::SemverVersioning.update_history_file
47
52
  RakeNBake::SemverVersioning.tag
48
53
  end
49
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-n-bake
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Vickerstaff
@@ -53,7 +53,6 @@ files:
53
53
  - ".semver"
54
54
  - ".travis.yml"
55
55
  - Gemfile
56
- - Gemfile.lock
57
56
  - README.md
58
57
  - Rakefile
59
58
  - bin/bundle-audit