rake-n-bake 1.1.0 → 1.1.1

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: 952bb7568d12e64bc8bb2e92468daf1975e1ad88
4
- data.tar.gz: eb3d3abd30e2d592029bf248e5394c19c87c1bdb
3
+ metadata.gz: 82dd55dfc3c86d02f8b55d0d5a0185594c9f3d83
4
+ data.tar.gz: f49055e5ace00e06457a4899fd0d8a099f192bff
5
5
  SHA512:
6
- metadata.gz: 4e3b7fe8cfb0a2559d6cf479fbb50472f180ebea8de36221e49317ce5bff3f837df509ed218aa7744e3c4e2f14f1660270385f0f1d61eaea6be5522d44e3d67c
7
- data.tar.gz: 90a3977c4c2f4b18ca87c3089d89d982bea9237479c75bfac8299d0e328be67d95c673ae14d797868de256587dc2b1684055ebbc276194c59f25bb2f4660d284
6
+ metadata.gz: 968058fde3cebd0977b9b294338408f5743237a6cb1cb62c762d6955d1ab09bd58e2c4ae7657be9030c33b154d0e80a23470bcbbf2c0c88068a43eb1e98dd78c
7
+ data.tar.gz: ff452ed8445814f80c770fcbd837e99ce53d66a8428275a31e076866b9713a0f43ec6f97aa6e5b426d8640fcd71ef471fd981b6d0ed723ff8748bdf5f8f494f8
data/history.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.1.1 (05 January 2015)
2
+
3
+ * SemVer now uses integers instead of strings for major, minor and patch
4
+
1
5
  == 1.1.0 (09 December 2014)
2
6
 
3
7
  == 1.0.6 (23 October 2014)
@@ -14,15 +14,15 @@ module RakeNBake
14
14
  def self.inc_major
15
15
  v = current_version
16
16
  v.major = v.major.to_i + 1
17
- v.minor = '0'
18
- v.patch = '0'
17
+ v.minor = 0
18
+ v.patch = 0
19
19
  v.save
20
20
  end
21
21
 
22
22
  def self.inc_minor
23
23
  v = current_version
24
24
  v.minor = v.minor.to_i + 1
25
- v.patch = '0'
25
+ v.patch = 0
26
26
  v.save
27
27
  end
28
28
 
data/lib/version.rb CHANGED
@@ -1,64 +1,3 @@
1
1
  module RakeNBake
2
- class Version
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
2
+ VERSION = "1.1.1"
64
3
  end
data/lib/versioning.rb ADDED
@@ -0,0 +1,64 @@
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
data/rake-n-bake.gemspec CHANGED
@@ -1,10 +1,11 @@
1
1
  # coding: utf-8
2
+ require File.expand_path('../lib/version', __FILE__)
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = "rake-n-bake"
7
- spec.version = '1.1.0'
8
+ spec.version = RakeNBake::VERSION
8
9
  spec.authors = ["Richard Vickerstaff", "Adam Whittingham"]
9
10
  spec.email = ["m3akq@btinternet.com", "adam.whittingham@gmail.com"]
10
11
  spec.description = "Common rake tasks, baked to perfection and ready to serve!"
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require production_code
3
3
 
4
- describe RakeNBake::Version do
4
+ describe RakeNBake::Versioning do
5
5
  before do
6
6
  allow(described_class).to receive(:`)
7
7
  allow(described_class).to receive(:puts)
data/tasks/version.rake CHANGED
@@ -1,15 +1,15 @@
1
- require_relative '../lib/version'
1
+ require_relative '../lib/versioning'
2
2
 
3
3
  desc "Display the latest version (from history.rdoc)"
4
4
  task :"bake:version" do
5
- puts "Latest version is #{RakeNBake::Version.latest_version}"
5
+ puts "Latest version is #{RakeNBake::Versioning.latest_version}"
6
6
  end
7
7
 
8
8
  namespace :bake do
9
9
  namespace :version do
10
10
  desc "Increment the major version in history.rdoc (eg 1.2.3 => 2.0.0)"
11
11
  task :major do
12
- new_version = RakeNBake::Version.latest_version
12
+ new_version = RakeNBake::Versioning.latest_version
13
13
  new_version[0] += 1
14
14
  new_version[1,2] = 0, 0
15
15
  RakeNBake::Version.update_to new_version
@@ -17,7 +17,7 @@ namespace :bake do
17
17
 
18
18
  desc "Increment the minor version in history.rdoc (eg 1.2.3 => 1.3.0)"
19
19
  task :minor do
20
- new_version = RakeNBake::Version.latest_version
20
+ new_version = RakeNBake::Versioning.latest_version
21
21
  new_version[1] += 1
22
22
  new_version[2] = 0
23
23
  RakeNBake::Version.update_to new_version
@@ -25,9 +25,9 @@ namespace :bake do
25
25
 
26
26
  desc "Increment the patch version in history.rdoc (eg 1.2.3 => 1.2.4)"
27
27
  task :patch do
28
- new_version = RakeNBake::Version.latest_version
28
+ new_version = RakeNBake::Versioning.latest_version
29
29
  new_version[2] += 1
30
- RakeNBake::Version.update_to new_version
30
+ RakeNBake::Versioning.update_to new_version
31
31
  end
32
32
  end
33
33
  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.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Vickerstaff
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-09 00:00:00.000000000 Z
12
+ date: 2015-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -79,13 +79,14 @@ files:
79
79
  - lib/rake_n_bake.rb
80
80
  - lib/semver_versioning.rb
81
81
  - lib/version.rb
82
+ - lib/versioning.rb
82
83
  - rake-n-bake.gemspec
83
84
  - spec/.keep
84
85
  - spec/assistant_baker_spec.rb
85
86
  - spec/dependency_checker_spec.rb
86
87
  - spec/semver_versioning_spec.rb
87
88
  - spec/spec_helper.rb
88
- - spec/version_spec.rb
89
+ - spec/versioning_spec.rb
89
90
  - tasks/bundler_audit.rake
90
91
  - tasks/check_external_deps.rake
91
92
  - tasks/code_quality.rake