bozo 0.3.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,36 @@
1
- module Bozo::Versioning
2
-
3
- class VersionBumper
4
-
5
- include Bozo::Logging
6
-
7
- def bump(part)
8
- unless can_be_bumped?
9
- raise VersionBumpError.new "State of the repository means the version can't be bumped. Ensure the staging index is empty."
10
- end
11
-
12
- version = Version.load_from_file
13
- original_version = version.to_s
14
-
15
- version.bump part
16
- version.write_to_file
17
-
18
- commit_version original_version, version
19
-
20
- log_info "Bumped #{original_version} to #{version}"
21
- end
22
-
23
- private
24
-
25
- def can_be_bumped?
26
- `git diff --cached --name-only`.length == 0
27
- end
28
-
29
- def commit_version(original, new)
30
- `git add VERSION`
31
- `git commit -m "Bumped #{original} to #{new}."`
32
- end
33
-
34
- end
35
-
36
- end
1
+ module Bozo::Versioning
2
+
3
+ class VersionBumper
4
+
5
+ include Bozo::Logging
6
+
7
+ def bump(part)
8
+ unless can_be_bumped?
9
+ raise VersionBumpError.new "State of the repository means the version can't be bumped. Ensure the staging index is empty."
10
+ end
11
+
12
+ version = Version.load_from_file
13
+ original_version = version.to_s
14
+
15
+ version.bump part
16
+ version.write_to_file
17
+
18
+ commit_version original_version, version
19
+
20
+ log_info "Bumped #{original_version} to #{version}"
21
+ end
22
+
23
+ private
24
+
25
+ def can_be_bumped?
26
+ `git diff --cached --name-only`.length == 0
27
+ end
28
+
29
+ def commit_version(original, new)
30
+ `git add VERSION`
31
+ `git commit -m "Bumped #{original} to #{new}."`
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -1,42 +1,42 @@
1
- require 'test_helper'
2
-
3
- class BozoConfigurationVersion < Test::Unit::TestCase
4
-
5
- include FileUtils
6
-
7
- def setup
8
- @original_path = Dir.pwd
9
- @temp_dir = File.expand_path File.join(@original_path, 'temp')
10
- rm_rf @temp_dir if Dir.exist? @temp_dir
11
- mkdir_p @temp_dir
12
- Dir.chdir @temp_dir
13
- end
14
-
15
- def teardown
16
- Dir.chdir @original_path
17
- rm_rf @temp_dir
18
- end
19
-
20
- def test_loads_version
21
- File.open("VERSION", 'w') { |f| f << '1.2.3' }
22
-
23
- configuration = Bozo::BozoConfiguration.new
24
- assert_equal configuration.version.to_s, '1.2.3'
25
- end
26
-
27
- def test_version_file_does_not_exist
28
- # ensure the VERSION file doesn't exist
29
- rm 'VERSION' if File.exist? 'VERSION'
30
-
31
- configuration = Bozo::BozoConfiguration.new
32
- assert_raise(Bozo::ConfigurationError) { configuration.version }
33
- end
34
-
35
- def test_no_version
36
- touch 'VERSION'
37
-
38
- configuration = Bozo::BozoConfiguration.new
39
- assert_raise(Bozo::ConfigurationError) { configuration.version }
40
- end
41
-
1
+ require 'test_helper'
2
+
3
+ class BozoConfigurationVersion < Test::Unit::TestCase
4
+
5
+ include FileUtils
6
+
7
+ def setup
8
+ @original_path = Dir.pwd
9
+ @temp_dir = File.expand_path File.join(@original_path, 'temp')
10
+ rm_rf @temp_dir if Dir.exist? @temp_dir
11
+ mkdir_p @temp_dir
12
+ Dir.chdir @temp_dir
13
+ end
14
+
15
+ def teardown
16
+ Dir.chdir @original_path
17
+ rm_rf @temp_dir
18
+ end
19
+
20
+ def test_loads_version
21
+ File.open("VERSION", 'w') { |f| f << '1.2.3' }
22
+
23
+ configuration = Bozo::BozoConfiguration.new
24
+ assert_equal configuration.version.to_s, '1.2.3'
25
+ end
26
+
27
+ def test_version_file_does_not_exist
28
+ # ensure the VERSION file doesn't exist
29
+ rm 'VERSION' if File.exist? 'VERSION'
30
+
31
+ configuration = Bozo::BozoConfiguration.new
32
+ assert_raise(Bozo::ConfigurationError) { configuration.version }
33
+ end
34
+
35
+ def test_no_version
36
+ touch 'VERSION'
37
+
38
+ configuration = Bozo::BozoConfiguration.new
39
+ assert_raise(Bozo::ConfigurationError) { configuration.version }
40
+ end
41
+
42
42
  end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,3 @@
1
- require 'bundler/setup'
2
- require 'test/unit'
1
+ require 'bundler/setup'
2
+ require 'test/unit'
3
3
  require File.dirname(__FILE__) + '/../lib/bozo'
@@ -1,62 +1,62 @@
1
- require 'test_helper'
2
-
3
- class VersionBumperTests < Test::Unit::TestCase
4
-
5
- include FileUtils
6
-
7
- def setup
8
- @original_path = Dir.pwd
9
- @temp_dir = File.expand_path File.join(@original_path, 'temp')
10
- rm_rf @temp_dir if Dir.exist? @temp_dir
11
- mkdir_p @temp_dir
12
- Dir.chdir @temp_dir
13
- end
14
-
15
- def teardown
16
- Dir.chdir @original_path
17
- rm_rf @temp_dir
18
- end
19
-
20
- def test_bumps_version_file
21
- git_init_and_commit_initial
22
- File.open("VERSION", 'w') { |f| f << '1.1.1' }
23
-
24
- version_bumper = Bozo::Versioning::VersionBumper.new
25
- version_bumper.bump :major
26
-
27
- assert_equal File.read('VERSION').strip, '2.0.0'
28
- end
29
-
30
- def test_bump_commits_file
31
- git_init_and_commit_initial
32
- File.open("VERSION", 'w') { |f| f << '1.1.1' }
33
-
34
- version_bumper = Bozo::Versioning::VersionBumper.new
35
- version_bumper.bump :major
36
-
37
- assert_true `git log -1 --oneline`.include?('Bumped 1.1.1 to 2.0.0')
38
- end
39
-
40
- def test_git_staging_pending_stops_bump
41
- git_init_and_commit_initial
42
-
43
- touch 'tempfile2'
44
- `git add tempfile2` # add file to staging to block bump
45
-
46
- File.open("VERSION", 'w') { |f| f << '1.1.1' }
47
-
48
- version_bumper = Bozo::Versioning::VersionBumper.new
49
-
50
- assert_raise(Bozo::Versioning::VersionBumpError) { version_bumper.bump :major }
51
- end
52
-
53
- private
54
-
55
- def git_init_and_commit_initial
56
- touch 'tempfile'
57
- `git init`
58
- `git add tempfile`
59
- `git commit -m "initial commit"`
60
- end
61
-
1
+ require 'test_helper'
2
+
3
+ class VersionBumperTests < Test::Unit::TestCase
4
+
5
+ include FileUtils
6
+
7
+ def setup
8
+ @original_path = Dir.pwd
9
+ @temp_dir = File.expand_path File.join(@original_path, 'temp')
10
+ rm_rf @temp_dir if Dir.exist? @temp_dir
11
+ mkdir_p @temp_dir
12
+ Dir.chdir @temp_dir
13
+ end
14
+
15
+ def teardown
16
+ Dir.chdir @original_path
17
+ rm_rf @temp_dir
18
+ end
19
+
20
+ def test_bumps_version_file
21
+ git_init_and_commit_initial
22
+ File.open("VERSION", 'w') { |f| f << '1.1.1' }
23
+
24
+ version_bumper = Bozo::Versioning::VersionBumper.new
25
+ version_bumper.bump :major
26
+
27
+ assert_equal File.read('VERSION').strip, '2.0.0'
28
+ end
29
+
30
+ def test_bump_commits_file
31
+ git_init_and_commit_initial
32
+ File.open("VERSION", 'w') { |f| f << '1.1.1' }
33
+
34
+ version_bumper = Bozo::Versioning::VersionBumper.new
35
+ version_bumper.bump :major
36
+
37
+ assert_true `git log -1 --oneline`.include?('Bumped 1.1.1 to 2.0.0')
38
+ end
39
+
40
+ def test_git_staging_pending_stops_bump
41
+ git_init_and_commit_initial
42
+
43
+ touch 'tempfile2'
44
+ `git add tempfile2` # add file to staging to block bump
45
+
46
+ File.open("VERSION", 'w') { |f| f << '1.1.1' }
47
+
48
+ version_bumper = Bozo::Versioning::VersionBumper.new
49
+
50
+ assert_raise(Bozo::Versioning::VersionBumpError) { version_bumper.bump :major }
51
+ end
52
+
53
+ private
54
+
55
+ def git_init_and_commit_initial
56
+ touch 'tempfile'
57
+ `git init`
58
+ `git add tempfile`
59
+ `git commit -m "initial commit"`
60
+ end
61
+
62
62
  end
@@ -1,26 +1,26 @@
1
- require 'test_helper'
2
-
3
- class VersionTests < Test::Unit::TestCase
4
-
5
- def test_bumps_major
6
- version = Bozo::Versioning::Version.parse '1.1.1'
7
- version.bump :major
8
-
9
- assert_equal version.to_s, '2.0.0'
10
- end
11
-
12
- def test_bumps_minor
13
- version = Bozo::Versioning::Version.parse '1.1.1'
14
- version.bump :minor
15
-
16
- assert_equal version.to_s, '1.2.0'
17
- end
18
-
19
- def test_bumps_patch
20
- version = Bozo::Versioning::Version.parse '1.1.1'
21
- version.bump :patch
22
-
23
- assert_equal version.to_s, '1.1.2'
24
- end
25
-
1
+ require 'test_helper'
2
+
3
+ class VersionTests < Test::Unit::TestCase
4
+
5
+ def test_bumps_major
6
+ version = Bozo::Versioning::Version.parse '1.1.1'
7
+ version.bump :major
8
+
9
+ assert_equal version.to_s, '2.0.0'
10
+ end
11
+
12
+ def test_bumps_minor
13
+ version = Bozo::Versioning::Version.parse '1.1.1'
14
+ version.bump :minor
15
+
16
+ assert_equal version.to_s, '1.2.0'
17
+ end
18
+
19
+ def test_bumps_patch
20
+ version = Bozo::Versioning::Version.parse '1.1.1'
21
+ version.bump :patch
22
+
23
+ assert_equal version.to_s, '1.1.2'
24
+ end
25
+
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bozo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garry Shutler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-13 00:00:00.000000000 Z
12
+ date: 2015-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gli
@@ -68,6 +68,7 @@ files:
68
68
  - lib/bozo.rb
69
69
  - lib/bozo/bozo.rb
70
70
  - lib/bozo/bozo_configuration.rb
71
+ - lib/bozo/build_dependency_resolver.rb
71
72
  - lib/bozo/class_name_helpers.rb
72
73
  - lib/bozo/configuration_error.rb
73
74
  - lib/bozo/execution_error.rb