rake-n-bake 1.1.5 → 1.2.0

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: 1e6b3c19ad4d0a859560c57bf029c01705c4ba88
4
- data.tar.gz: 437044342ae1c3f1297feac26f97670dce8f7fc9
3
+ metadata.gz: b27f8375fc4e4be7856074896c4dd5f41b5952d7
4
+ data.tar.gz: e5b15d34fada459e6e410ae8ba095c1794342062
5
5
  SHA512:
6
- metadata.gz: e524432b46dea8a1de773a499bae797847dff5af5356b4857eee03ae2d113a17444f7f220f596108a203b8ac92a23b6b0aedd2d8ac2e1f5e10e64a1387f4033a
7
- data.tar.gz: 619df3d26e027408b3cb43f52ffd8d2b67f803725efd4120a66759bbb9b003b4a2ce0f8d74980aaa961a74a90948eefe214409ad0fd5ebfa3895f5d512fdf64d
6
+ metadata.gz: b6b9c69af6d973c43efaaef31e83339ec502579d5bbd81f500969bed2cc722f1cb18b9923fe1647aa4420776a932d16e655029b2ac717b50eb95a4274b789349
7
+ data.tar.gz: 522d28a77818545db8f3e2598b4805359c1db4fa1ac31fbea4cdb194f04276a95a2c833832fe5b4191d12bae168e13108c24b0cb1ef396f189f854432474abaa
data/.semver CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  :major: 1
3
- :minor: 1
4
- :patch: 5
3
+ :minor: 2
4
+ :patch: 0
5
5
  :special: ''
6
6
  :metadata: ''
data/history.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == v1.2.0 (28 June 2015)
2
+
3
+ * Remove deprecated versioning task
4
+
1
5
  == v1.1.5 (28 June 2015)
2
6
 
3
7
  == v1.1.4 (24 March 2015)
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RakeNBake
2
- VERSION = "1.1.5"
2
+ VERSION = "1.2.0"
3
3
  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.1.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Vickerstaff
@@ -80,14 +80,12 @@ files:
80
80
  - lib/rake_n_bake.rb
81
81
  - lib/semver_versioning.rb
82
82
  - lib/version.rb
83
- - lib/versioning.rb
84
83
  - rake-n-bake.gemspec
85
84
  - spec/.keep
86
85
  - spec/assistant_baker_spec.rb
87
86
  - spec/dependency_checker_spec.rb
88
87
  - spec/semver_versioning_spec.rb
89
88
  - spec/spec_helper.rb
90
- - spec/versioning_spec.rb
91
89
  - tasks/bundler_audit.rake
92
90
  - tasks/check_external_deps.rake
93
91
  - tasks/code_quality.rake
@@ -96,7 +94,6 @@ files:
96
94
  - tasks/rails_best_practices.rake
97
95
  - tasks/rspec.rake
98
96
  - tasks/semver.rake
99
- - tasks/version.rake
100
97
  homepage: https://github.com/RichardVickerstaff/rake-n-bake
101
98
  licenses:
102
99
  - MIT
data/lib/versioning.rb DELETED
@@ -1,64 +0,0 @@
1
- module RakeNBake
2
- class Versioning
3
- HISTORY_FILE = "history.rdoc"
4
- def self.current_history history_file
5
- unless File.exists? history_file
6
- File.open history_file, "w" do |f|
7
- f.puts "== 0.0.0 (#{Time.now.strftime "%d %B %Y"})"
8
- end
9
- end
10
- File.read history_file
11
- end
12
-
13
- def self.latest_version
14
- latest_version_string = current_history(HISTORY_FILE)[/== ([\d\.]*)/, 1] || "0.0.0"
15
- @latest_version ||= latest_version_string.split(".").map(&:to_i)
16
- def @latest_version.to_s
17
- join "."
18
- end
19
- @latest_version
20
- end
21
-
22
- def self.update_to version
23
- add_history_header version
24
- update_gem version if gem?
25
- commit version
26
- tag version
27
- branch = `git symbolic-ref HEAD`[%r{.*/(.*)}, 1]
28
- puts "To push the new tag, use 'git push origin #{branch} --tags'"
29
- end
30
-
31
- def self.add_history_header(version, history_file = HISTORY_FILE)
32
- history = current_history history_file
33
- File.open history_file, "w" do |f|
34
- f.puts "== #{version} (#{Time.now.strftime "%d %B %Y"})"
35
- f.puts
36
- f.print history
37
- end
38
- puts "Added version to history.rdoc"
39
- end
40
-
41
- def self.update_gem version
42
- path = Dir.glob('*.gemspec').first
43
- text = File.read path
44
- File.open(path, "w") do |file|
45
- file.puts text.sub(/(.*version\s*=\s*)(['|"].*['|"])/, "\\1'#{version}'")
46
- end
47
- puts "Added version to .gemfile"
48
- end
49
-
50
- def self.commit version
51
- `git add . && git commit -m 'increment version to #{version}'`
52
- puts "Committed change"
53
- end
54
-
55
- def self.tag version
56
- `git tag #{version}`
57
- puts "Tagged with #{version}"
58
- end
59
-
60
- def self.gem?
61
- !Dir.glob('*.gemspec').empty?
62
- end
63
- end
64
- end
@@ -1,166 +0,0 @@
1
- require 'spec_helper'
2
- require production_code
3
-
4
- describe RakeNBake::Versioning do
5
- before do
6
- allow(described_class).to receive(:`)
7
- allow(described_class).to receive(:puts)
8
- end
9
-
10
- describe '.current_history' do
11
- let(:tmp_file) { Tempfile.new(['history','.rdoc']) }
12
-
13
- context 'when there is a history file' do
14
- before do
15
- allow(File).to receive(:read).and_return 'history'
16
- allow(File).to receive(:exists?).and_return true
17
- end
18
-
19
- it 'returns the current history file' do
20
- expect(described_class.current_history(tmp_file.path)).to eq 'history'
21
- end
22
- end
23
-
24
- context 'when there is no history file' do
25
- before do
26
- allow(File).to receive(:exists?).and_return false
27
- end
28
-
29
- it 'creates a history file at version 0.0.0' do
30
- expect(described_class.current_history(tmp_file.path)).to match(/\= 0.0.0 /)
31
- end
32
- end
33
- end
34
-
35
- describe '.latest_version' do
36
- before do
37
- allow(File).to receive(:read).and_return "== 1.2.3 (16 July 2014)\n * Change version tack so it can update gem version"
38
- end
39
-
40
- context 'there is no version'do
41
- it 'returns a version of [0,0,0]' do
42
- allow(File).to receive(:read).and_return ""
43
- expect(described_class.latest_version).to eq [1,2,3]
44
- end
45
- end
46
-
47
- context 'there is a version' do
48
- it 'returns the latest version' do
49
- expect(described_class.latest_version).to eq [1,2,3]
50
- end
51
- end
52
-
53
- it 'defines the .to_s of the latest version'do
54
- expect(described_class.latest_version.to_s).to eq "1.2.3"
55
- end
56
- end
57
-
58
- describe '.gem?' do
59
- context 'the project is a gem' do
60
- before do
61
- allow(Dir).to receive(:glob).and_return ['a gem spec']
62
- end
63
-
64
- it 'returns true' do
65
- expect(described_class.gem?).to eq true
66
- end
67
- end
68
-
69
- context 'the project is not a gem' do
70
- before do
71
- allow(Dir).to receive(:glob).and_return []
72
- end
73
-
74
- it 'returns false' do
75
- expect(described_class.gem?).to eq false
76
- end
77
- end
78
- end
79
-
80
- describe '.update_gem' do
81
- let(:tmp_file) { Tempfile.new(['rake-n-bake','.gemspec']) }
82
-
83
- before do
84
- gemspec = <<-GEM
85
- Gem::Specification.new do |spec|
86
- spec.name = "rake-n-bake"
87
- spec.version = '0.0.5'
88
- spec.authors = ["Richard Vickerstaff", "Adam Whittingham"]
89
- end
90
- GEM
91
- tmp_file.write gemspec
92
- tmp_file.rewind
93
- allow(Dir).to receive(:glob).and_return [tmp_file.path]
94
- end
95
-
96
- it 'updates the gem version' do
97
- t = Time.local(2014, 7, 16)
98
- Timecop.travel(t) do
99
- described_class.update_gem 'foo'
100
- expect(File.read(tmp_file)).to match(/.*version\s*= 'foo'/)
101
- end
102
- end
103
-
104
- it 'outputs a message to the user' do
105
- expect(described_class).to receive(:puts).with 'Added version to .gemfile'
106
- described_class.update_gem 'foo'
107
- end
108
- end
109
-
110
- describe '.update_to' do
111
- before do
112
- allow(described_class).to receive(:`).and_return "refs/heads/master"
113
- end
114
-
115
- it 'updates the version' do
116
- expect(described_class).to receive(:add_history_header).with 'foo'
117
- expect(described_class).to receive(:update_gem).with 'foo'
118
- expect(described_class).to receive(:commit).with 'foo'
119
- expect(described_class).to receive(:tag).with 'foo'
120
- expect(described_class).to receive(:`).with 'git symbolic-ref HEAD'
121
- expect(described_class).to receive(:puts).with "To push the new tag, use 'git push origin master --tags'"
122
- described_class.update_to 'foo'
123
- end
124
- end
125
-
126
- describe '.add_history_header' do
127
- let(:tmp_file) { Tempfile.new('foo').path }
128
-
129
- it 'adds the new headre to the history.rdoc' do
130
- t = Time.local(2014, 7, 16)
131
- Timecop.travel(t) do
132
- described_class.add_history_header 'foo', tmp_file
133
- expect(File.read tmp_file).to eq "== foo (16 July 2014)\n\n"
134
- end
135
- end
136
-
137
- it 'outputs a message to the user' do
138
- expect(described_class).to receive(:puts).with 'Added version to history.rdoc'
139
- described_class.add_history_header 'foo', tmp_file
140
- end
141
- end
142
-
143
- describe '.commit' do
144
- it 'commits all changes' do
145
- expect(described_class).to receive(:`).with "git add . && git commit -m 'increment version to foo'"
146
- described_class.commit 'foo'
147
- end
148
-
149
- it 'outputs a message to the user' do
150
- expect(described_class).to receive(:puts).with 'Committed change'
151
- described_class.commit 'foo'
152
- end
153
- end
154
-
155
- describe '.tag' do
156
- it 'it tags the commit with the new version' do
157
- expect(described_class).to receive(:`).with 'git tag foo'
158
- described_class.tag 'foo'
159
- end
160
-
161
- it 'outputs a message to the user' do
162
- expect(described_class).to receive(:puts).with 'Tagged with foo'
163
- described_class.tag 'foo'
164
- end
165
- end
166
- end
data/tasks/version.rake DELETED
@@ -1,37 +0,0 @@
1
- require_relative '../lib/versioning'
2
-
3
- desc "Display the latest version (from history.rdoc)"
4
- task :"bake:version" do
5
- RakeNBake::AssistantBaker.log_warn "[DEPRECATION] `bake:version` is deprecated. Please use `bake:semver` instead."
6
- puts "Latest version is #{RakeNBake::Versioning.latest_version}"
7
- end
8
-
9
- namespace :bake do
10
- namespace :version do
11
- desc "Increment the major version in history.rdoc (eg 1.2.3 => 2.0.0)"
12
- task :major do
13
- RakeNBake::AssistantBaker.log_warn "[DEPRECATION] `bake:version` is deprecated. Please use `bake:semver` instead."
14
- new_version = RakeNBake::Versioning.latest_version
15
- new_version[0] += 1
16
- new_version[1,2] = 0, 0
17
- RakeNBake::Versioning.update_to new_version
18
- end
19
-
20
- desc "Increment the minor version in history.rdoc (eg 1.2.3 => 1.3.0)"
21
- task :minor do
22
- RakeNBake::AssistantBaker.log_warn "[DEPRECATION] `bake:version` is deprecated. Please use `bake:semver` instead."
23
- new_version = RakeNBake::Versioning.latest_version
24
- new_version[1] += 1
25
- new_version[2] = 0
26
- RakeNBake::Versioning.update_to new_version
27
- end
28
-
29
- desc "Increment the patch version in history.rdoc (eg 1.2.3 => 1.2.4)"
30
- task :patch do
31
- RakeNBake::AssistantBaker.log_warn "[DEPRECATION] `bake:version` is deprecated. Please use `bake:semver` instead."
32
- new_version = RakeNBake::Versioning.latest_version
33
- new_version[2] += 1
34
- RakeNBake::Versioning.update_to new_version
35
- end
36
- end
37
- end