tumbler 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.0.11
2
+
3
+ * Use custom matcher for searching in file. (Joshua Hull, 8d16801)
4
+ * add tests for to check constant_name and also to handle '-' => :: (Arthur Chiu, 824e022)
5
+
1
6
  == 0.0.10
2
7
 
3
8
  * Added preflight task for easy injection of arbitrary code before tumbler runs. (Joshua Hull, bdb7ed7)
@@ -37,7 +37,9 @@ module Tumbler
37
37
  end
38
38
 
39
39
  def constant_name
40
- @name.split('_').map{|p| p.capitalize}.join
40
+ result = @name.split('_').map{|p| p.capitalize}.join
41
+ result = result.split('-').map{|q| q.capitalize}.join('::') if result =~ /-/
42
+ result
41
43
  end
42
44
 
43
45
  def write
@@ -1,3 +1,3 @@
1
1
  module Tumbler
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
3
3
  end
@@ -17,8 +17,7 @@ describe Tumbler::Manager::Changelog do
17
17
  Tumbler::Gem.any_instance.stubs(:push).once.returns(true)
18
18
  tumbler.bump_and_push(:tiny)
19
19
  tumbler.version.to_s.should == '0.0.1'
20
- changelog = File.read(tumbler.changelog.file)
21
- changelog.should match(/== 0\.0\.1\s+\* added file2 \(.*?, [a-f0-9]{7}\)\s+\* added file1 \(.*?, [a-f0-9]{7}\)/)
20
+ tumbler.changelog.file.should match_in_file(/== 0\.0\.1\s+\* added file2 \(.*?, [a-f0-9]{7}\)\s+\* added file1 \(.*?, [a-f0-9]{7}\)/)
22
21
  }
23
22
  end
24
23
 
@@ -50,5 +49,4 @@ describe Tumbler::Manager::Changelog do
50
49
  tumbler.sh('git log').split(/\n/)[0].should == "commit #{current_rev}"
51
50
  }
52
51
  end
53
-
54
- end
52
+ end
@@ -13,6 +13,20 @@ describe Tumbler::Generate do
13
13
  end
14
14
  end
15
15
 
16
+ it "should generate the gem constant correctly with -" do
17
+ temp_dir('test') do |test_dir|
18
+ Tumbler::Generate.app(test_dir, 'my-gem', :changelog => nil).write
19
+ File.join(test_dir, 'lib','my-gem','version.rb').should match_in_file(/My::Gem/)
20
+ end
21
+ end
22
+
23
+ it "should generate the gem constant correctly with _" do
24
+ temp_dir('test') do |test_dir|
25
+ Tumbler::Generate.app(test_dir, 'my_gem', :changelog => nil).write
26
+ File.join(test_dir, 'lib','my_gem','version.rb').should match_in_file(/MyGem/)
27
+ end
28
+ end
29
+
16
30
  it "should generate a gemspec" do
17
31
  temp_dir('test') do |test_dir|
18
32
  Tumbler::Generate.app(test_dir, 'mygem').write
@@ -32,9 +46,9 @@ describe Tumbler::Generate do
32
46
  temp_dir('test2') do |test_dir|
33
47
  Tumbler::Generate.app(test_dir, 'mygem', :dependencies => 'eventmachine').write
34
48
  spec = Gem::Specification.load("#{test_dir}/mygem.gemspec")
35
- spec.dependencies.size.should == 2
36
49
  spec.dependencies.should include(Gem::Dependency.new('tumbler', '>=0', :development))
37
50
  spec.dependencies.should include(Gem::Dependency.new('eventmachine', '>=0', :runtime))
51
+ spec.dependencies.size.should == 2
38
52
  end
39
53
  end
40
54
 
@@ -42,9 +56,9 @@ describe Tumbler::Generate do
42
56
  temp_dir('test2') do |test_dir|
43
57
  Tumbler::Generate.app(test_dir, 'mygem', :dependencies => [['eventmachine', '>=1.0.0']]).write
44
58
  spec = Gem::Specification.load("#{test_dir}/mygem.gemspec")
45
- spec.dependencies.size.should == 2
46
59
  spec.dependencies.should include(Gem::Dependency.new('tumbler', '>=0', :development))
47
60
  spec.dependencies.should include(Gem::Dependency.new('eventmachine', '>=1.0.0', :runtime))
61
+ spec.dependencies.size.should == 2
48
62
  end
49
63
  end
50
64
  end
data/spec/spec_helper.rb CHANGED
@@ -50,4 +50,35 @@ def temp_dir(name)
50
50
  else
51
51
  dir
52
52
  end
53
- end
53
+ end
54
+
55
+ module Matchers
56
+ class MatchInFile
57
+ def initialize(pattern)
58
+ @pattern = pattern
59
+ end
60
+
61
+ def matches?(file)
62
+ @file = file
63
+ @file = File.exist?(file) ? File.read(file) : false
64
+ @file and @file =~ @pattern
65
+ end
66
+
67
+ def failure_message
68
+ "expected #{@pattern} to match in '#{@file}'"
69
+ end
70
+
71
+ def negative_failure_message
72
+ "expected #{@pattern} to not match in '#{@file}'"
73
+ end
74
+ end
75
+
76
+ def match_in_file(expected)
77
+ MatchInFile.new(expected)
78
+ end
79
+
80
+ end
81
+
82
+ Spec::Runner.configure do |config|
83
+ config.include(Matchers)
84
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tumbler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Hull
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-17 00:00:00 -04:00
18
+ date: 2010-06-18 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency