bench_press 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ begin
13
13
  gem.add_dependency "facter", ">=1.5.7"
14
14
  gem.add_dependency "activesupport", ">=2.3.5"
15
15
  gem.add_dependency "httparty", ">=0.6.1"
16
+ gem.add_dependency "jeweler", ">=1.4.0"
16
17
  gem.add_development_dependency "rspec", "1.3.0"
17
18
  gem.add_development_dependency "ephemeral_response", ">=0.3.1"
18
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,19 +5,17 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bench_press}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sandro Turriate"]
12
- s.date = %q{2010-08-05}
12
+ s.date = %q{2010-08-06}
13
13
  s.default_executable = %q{bench_press}
14
14
  s.description = %q{Sharable benchmarks}
15
15
  s.email = %q{sandro.turriate@gmail.com}
16
16
  s.executables = ["bench_press"]
17
17
  s.extra_rdoc_files = [
18
- "README.markdown",
19
- "README.rdoc",
20
- "TODO"
18
+ "README.markdown"
21
19
  ]
22
20
  s.files = [
23
21
  ".dev",
@@ -27,7 +25,6 @@ Gem::Specification.new do |s|
27
25
  "Gemfile",
28
26
  "MIT-LICENSE",
29
27
  "README.markdown",
30
- "README.rdoc",
31
28
  "Rakefile",
32
29
  "VERSION",
33
30
  "bench_press.gemspec",
@@ -73,7 +70,6 @@ Gem::Specification.new do |s|
73
70
  "examples/clearing_an_array.rb",
74
71
  "examples/compare_rr_to_rspec.rb",
75
72
  "examples/existence_of_method.rb",
76
- "examples/foo.rb",
77
73
  "examples/hash_merge.rb",
78
74
  "examples/implicit_versus_explicit_return.rb",
79
75
  "examples/regexp_matching.rb",
@@ -88,12 +84,14 @@ Gem::Specification.new do |s|
88
84
  s.add_runtime_dependency(%q<facter>, [">= 1.5.7"])
89
85
  s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
90
86
  s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
87
+ s.add_runtime_dependency(%q<jeweler>, [">= 1.4.0"])
91
88
  s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
92
89
  s.add_development_dependency(%q<ephemeral_response>, [">= 0.3.1"])
93
90
  else
94
91
  s.add_dependency(%q<facter>, [">= 1.5.7"])
95
92
  s.add_dependency(%q<activesupport>, [">= 2.3.5"])
96
93
  s.add_dependency(%q<httparty>, [">= 0.6.1"])
94
+ s.add_dependency(%q<jeweler>, [">= 1.4.0"])
97
95
  s.add_dependency(%q<rspec>, ["= 1.3.0"])
98
96
  s.add_dependency(%q<ephemeral_response>, [">= 0.3.1"])
99
97
  end
@@ -101,6 +99,7 @@ Gem::Specification.new do |s|
101
99
  s.add_dependency(%q<facter>, [">= 1.5.7"])
102
100
  s.add_dependency(%q<activesupport>, [">= 2.3.5"])
103
101
  s.add_dependency(%q<httparty>, [">= 0.6.1"])
102
+ s.add_dependency(%q<jeweler>, [">= 1.4.0"])
104
103
  s.add_dependency(%q<rspec>, ["= 1.3.0"])
105
104
  s.add_dependency(%q<ephemeral_response>, [">= 0.3.1"])
106
105
  end
@@ -1,5 +1,5 @@
1
- require 'active_support/inflector'
2
1
  require 'date'
2
+ require 'time'
3
3
  require 'benchmark'
4
4
  require 'facter'
5
5
  require 'bench_press/cli'
@@ -9,7 +9,7 @@ require 'bench_press/report'
9
9
  require 'bench_press/system_information'
10
10
 
11
11
  module BenchPress
12
- VERSION = '0.3.0'
12
+ VERSION = '0.3.1'
13
13
 
14
14
  autoload :RubyBenchmark, 'bench_press/ruby_benchmark'
15
15
 
@@ -27,6 +27,12 @@ module BenchPress
27
27
 
28
28
  @run_at_exit = true
29
29
 
30
+ def self.titleize(string)
31
+ string.split(/[\W_]+/).map do |word|
32
+ word.capitalize
33
+ end.join(" ")
34
+ end
35
+
30
36
  def module_name
31
37
  @module_name
32
38
  end
@@ -83,7 +89,7 @@ module BenchPress
83
89
  end
84
90
 
85
91
  def report_name
86
- ActiveSupport::Inflector.titleize default_report_name
92
+ BenchPress.titleize default_report_name
87
93
  end
88
94
 
89
95
  def calling_script
@@ -92,5 +98,7 @@ module BenchPress
92
98
  end
93
99
 
94
100
  at_exit do
95
- puts(bench_press) if respond_to?(:bench_press) && BenchPress.run_at_exit?
101
+ if $!.nil? && respond_to?(:bench_press) && BenchPress.run_at_exit?
102
+ puts bench_press
103
+ end
96
104
  end
@@ -57,4 +57,34 @@ describe BenchPress do
57
57
  end.to raise_exception(TypeError)
58
58
  end
59
59
  end
60
+
61
+ describe "#titleize" do
62
+ subject do
63
+ BenchPress
64
+ end
65
+
66
+ it "test" do
67
+ subject.titleize("test").should == "Test"
68
+ end
69
+
70
+ it "regexp_matching" do
71
+ subject.titleize("regexp_matching").should == "Regexp Matching"
72
+ end
73
+
74
+ it "regexp-matching" do
75
+ subject.titleize("regexp-matching").should == "Regexp Matching"
76
+ end
77
+
78
+ it "multiple non word characters in a row" do
79
+ subject.titleize("regexp__matching").should == "Regexp Matching"
80
+ end
81
+
82
+ it "handles multiple non word characters" do
83
+ subject.titleize("one_two_three-four:five").should == "One Two Three Four Five"
84
+ end
85
+
86
+ it "lowercases everything but the first character" do
87
+ subject.titleize("ONE_TWO").should == "One Two"
88
+ end
89
+ end
60
90
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bench_press
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sandro Turriate
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-05 00:00:00 -04:00
18
+ date: 2010-08-06 00:00:00 -04:00
19
19
  default_executable: bench_press
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -67,9 +67,25 @@ dependencies:
67
67
  type: :runtime
68
68
  version_requirements: *id003
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: jeweler
71
71
  prerelease: false
72
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 7
78
+ segments:
79
+ - 1
80
+ - 4
81
+ - 0
82
+ version: 1.4.0
83
+ type: :runtime
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ name: rspec
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
73
89
  none: false
74
90
  requirements:
75
91
  - - "="
@@ -81,11 +97,11 @@ dependencies:
81
97
  - 0
82
98
  version: 1.3.0
83
99
  type: :development
84
- version_requirements: *id004
100
+ version_requirements: *id005
85
101
  - !ruby/object:Gem::Dependency
86
102
  name: ephemeral_response
87
103
  prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
104
+ requirement: &id006 !ruby/object:Gem::Requirement
89
105
  none: false
90
106
  requirements:
91
107
  - - ">="
@@ -97,7 +113,7 @@ dependencies:
97
113
  - 1
98
114
  version: 0.3.1
99
115
  type: :development
100
- version_requirements: *id005
116
+ version_requirements: *id006
101
117
  description: Sharable benchmarks
102
118
  email: sandro.turriate@gmail.com
103
119
  executables:
@@ -106,8 +122,6 @@ extensions: []
106
122
 
107
123
  extra_rdoc_files:
108
124
  - README.markdown
109
- - README.rdoc
110
- - TODO
111
125
  files:
112
126
  - .dev
113
127
  - .document
@@ -116,7 +130,6 @@ files:
116
130
  - Gemfile
117
131
  - MIT-LICENSE
118
132
  - README.markdown
119
- - README.rdoc
120
133
  - Rakefile
121
134
  - VERSION
122
135
  - bench_press.gemspec
@@ -144,8 +157,6 @@ files:
144
157
  - spec/spec.opts
145
158
  - spec/spec_helper.rb
146
159
  - spec/support/measurable.rb
147
- - TODO
148
- - examples/foo.rb
149
160
  has_rdoc: true
150
161
  homepage: http://github.com/sandro/bench_press
151
162
  licenses: []
@@ -192,7 +203,6 @@ test_files:
192
203
  - examples/clearing_an_array.rb
193
204
  - examples/compare_rr_to_rspec.rb
194
205
  - examples/existence_of_method.rb
195
- - examples/foo.rb
196
206
  - examples/hash_merge.rb
197
207
  - examples/implicit_versus_explicit_return.rb
198
208
  - examples/regexp_matching.rb
@@ -1,26 +0,0 @@
1
- = Bench Press
2
-
3
- Sharable benchmarks
4
-
5
- bench_press --help for options
6
-
7
- == Running the binary/examples locally
8
- I use rubygems but this library is $LOAD_PATH friendly which means we need to
9
- set up our own load path when playing locally.
10
-
11
- This quick and dirty solution will work for a single shell instance:
12
-
13
- export RUBYOPT='-r rubygems'
14
-
15
- == Note on Patches/Pull Requests
16
- * Fork the project.
17
- * Make your feature addition or bug fix.
18
- * Add tests for it. This is important so I don't break it in a
19
- future version unintentionally.
20
- * Commit, do not mess with rakefile, version, or history.
21
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
22
- * Send me a pull request. Bonus points for topic branches.
23
-
24
- == Copyright
25
-
26
- Copyright (c) 2009 Sandro Turriate. See LICENSE for details.
@@ -1,12 +0,0 @@
1
- require 'bench_press'
2
- extend BenchPress
3
-
4
- base_string = ""
5
- measure "string append" do
6
- base_string << "Hello World"
7
- end
8
-
9
- base_string = ""
10
- measure "string +=" do
11
- base_string += "Hello World"
12
- end