gorillib 0.4.1pre → 0.4.2pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.gitignore +13 -10
  2. data/.rspec +1 -1
  3. data/.yardopts +1 -0
  4. data/CHANGELOG.md +47 -0
  5. data/Gemfile +22 -19
  6. data/Guardfile +23 -9
  7. data/README.md +12 -12
  8. data/Rakefile +29 -40
  9. data/VERSION +1 -1
  10. data/examples/benchmark/factories_benchmark.rb +87 -0
  11. data/examples/builder/ironfan.rb +1 -19
  12. data/examples/hash/slicing_methods.rb +101 -0
  13. data/gorillib.gemspec +36 -35
  14. data/lib/gorillib/array/deep_compact.rb +4 -3
  15. data/lib/gorillib/array/simple_statistics.rb +76 -0
  16. data/lib/gorillib/base.rb +0 -1
  17. data/lib/gorillib/builder.rb +15 -30
  18. data/lib/gorillib/collection.rb +159 -57
  19. data/lib/gorillib/collection/model_collection.rb +136 -43
  20. data/lib/gorillib/datetime/parse.rb +4 -2
  21. data/lib/gorillib/{array → deprecated/array}/average.rb +0 -0
  22. data/lib/gorillib/{array → deprecated/array}/random.rb +2 -1
  23. data/lib/gorillib/{array → deprecated/array}/sorted_median.rb +0 -0
  24. data/lib/gorillib/{array → deprecated/array}/sorted_percentile.rb +0 -0
  25. data/lib/gorillib/deprecated/array/sorted_sample.rb +13 -0
  26. data/lib/gorillib/{metaprogramming → deprecated/metaprogramming}/aliasing.rb +0 -0
  27. data/lib/gorillib/enumerable/sum.rb +3 -3
  28. data/lib/gorillib/exception/raisers.rb +92 -22
  29. data/lib/gorillib/factories.rb +550 -0
  30. data/lib/gorillib/hash/mash.rb +15 -58
  31. data/lib/gorillib/hashlike/deep_compact.rb +2 -2
  32. data/lib/gorillib/hashlike/slice.rb +55 -40
  33. data/lib/gorillib/model.rb +5 -3
  34. data/lib/gorillib/model/base.rb +33 -119
  35. data/lib/gorillib/model/defaults.rb +58 -14
  36. data/lib/gorillib/model/errors.rb +10 -0
  37. data/lib/gorillib/model/factories.rb +1 -367
  38. data/lib/gorillib/model/field.rb +40 -18
  39. data/lib/gorillib/model/fixup.rb +16 -0
  40. data/lib/gorillib/model/positional_fields.rb +35 -0
  41. data/lib/gorillib/model/schema_magic.rb +162 -0
  42. data/lib/gorillib/model/serialization.rb +1 -2
  43. data/lib/gorillib/model/serialization/csv.rb +59 -0
  44. data/lib/gorillib/pathname.rb +19 -8
  45. data/lib/gorillib/some.rb +2 -0
  46. data/lib/gorillib/string/constantize.rb +17 -10
  47. data/lib/gorillib/string/inflector.rb +11 -7
  48. data/lib/gorillib/type/boolean.rb +40 -0
  49. data/lib/gorillib/type/extended.rb +76 -40
  50. data/lib/gorillib/type/url.rb +6 -4
  51. data/lib/gorillib/utils/console.rb +1 -18
  52. data/lib/gorillib/utils/edge_cases.rb +18 -0
  53. data/spec/examples/builder/ironfan_spec.rb +5 -10
  54. data/spec/gorillib/array/compact_blank_spec.rb +36 -21
  55. data/spec/gorillib/array/simple_statistics_spec.rb +143 -0
  56. data/spec/gorillib/builder_spec.rb +16 -20
  57. data/spec/gorillib/collection_spec.rb +131 -35
  58. data/spec/gorillib/exception/raisers_spec.rb +39 -0
  59. data/spec/gorillib/hash/deep_compact_spec.rb +3 -3
  60. data/spec/gorillib/model/{record/defaults_spec.rb → defaults_spec.rb} +5 -1
  61. data/spec/gorillib/model/factories_spec.rb +335 -0
  62. data/spec/gorillib/model/{record/overlay_spec.rb → overlay_spec.rb} +0 -0
  63. data/spec/gorillib/model/serialization_spec.rb +2 -2
  64. data/spec/gorillib/model_spec.rb +19 -18
  65. data/spec/gorillib/pathname_spec.rb +7 -7
  66. data/spec/gorillib/string/truncate_spec.rb +3 -13
  67. data/spec/gorillib/type/extended_spec.rb +50 -2
  68. data/spec/gorillib/utils/capture_output_spec.rb +1 -1
  69. data/spec/spec_helper.rb +10 -7
  70. data/spec/support/factory_test_helpers.rb +76 -0
  71. data/spec/support/gorillib_test_helpers.rb +36 -24
  72. data/spec/support/model_test_helpers.rb +39 -2
  73. metadata +86 -51
  74. data/lib/alt/kernel/call_stack.rb +0 -56
  75. data/lib/gorillib/array/sorted_sample.rb +0 -12
  76. data/lib/gorillib/builder/field.rb +0 -5
  77. data/lib/gorillib/collection/has_collection.rb +0 -31
  78. data/lib/gorillib/collection/list_collection.rb +0 -58
  79. data/lib/gorillib/exception/confidence.rb +0 -17
  80. data/lib/gorillib/io/system_helpers.rb +0 -30
  81. data/lib/gorillib/model/record_schema.rb +0 -9
  82. data/lib/gorillib/utils/stub_module.rb +0 -33
  83. data/spec/array/average_spec.rb +0 -24
  84. data/spec/array/sorted_median_spec.rb +0 -18
  85. data/spec/array/sorted_percentile_spec.rb +0 -24
  86. data/spec/array/sorted_sample_spec.rb +0 -28
  87. data/spec/gorillib/metaprogramming/aliasing_spec.rb +0 -180
  88. data/spec/gorillib/model/record/factories_spec.rb +0 -335
  89. data/spec/support/kcode_test_helper.rb +0 -16
data/.gitignore CHANGED
@@ -1,9 +1,11 @@
1
1
  ## OS
2
2
  .DS_Store
3
- Icon?
3
+ Icon
4
4
  nohup.out
5
5
  .bak
6
6
 
7
+ *.pem
8
+
7
9
  ## EDITORS
8
10
  \#*
9
11
  .\#*
@@ -31,6 +33,11 @@ a.out
31
33
  .svn
32
34
 
33
35
  ## PROJECT::GENERAL
36
+
37
+ log/*
38
+ tmp/*
39
+ pkg/*
40
+
34
41
  coverage
35
42
  rdoc
36
43
  doc
@@ -38,17 +45,13 @@ pkg
38
45
  .rake_test_cache
39
46
  .bundle
40
47
  .yardoc
41
- *_private.*
42
- *.pem
43
48
 
44
- log/*
45
- tmp/*
46
- pkg/*
49
+ .vendor
47
50
 
48
51
  ## PROJECT::SPECIFIC
49
- *.rdb
50
52
 
51
- .vendor
52
- .bundle
53
53
  Gemfile.lock
54
- old/*
54
+ .rvmrc
55
+ .rbenv-version
56
+
57
+ .rbx
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --color
2
- --format progress
2
+ --format documentation
data/.yardopts CHANGED
@@ -1,5 +1,6 @@
1
1
  --readme README.md
2
2
  --markup markdown
3
+ --verbose
3
4
  -
4
5
  VERSION
5
6
  CHANGELOG.md
@@ -1,6 +1,53 @@
1
+ # Gorillib Changelog
2
+
1
3
  ## Version 1.0
2
4
 
3
5
 
6
+ ### 2012-08 - Version 1.0.3-pre
7
+
8
+ #### Deprecations
9
+
10
+ The following have been relocated to `gorillib/deprecated/{old name}`. So, if you were using `gorillib/array/random` and can't stand to migrate yet, just include `gorillib/deprecated/array/random` instead.
11
+
12
+ * deprecated `Array#random_element` -- `Array#sample` exists.
13
+ * combined `array/average`, `array/sorted_median` and `array/sorted_percentile` under `array/simple_statistics`. Just include that instead.
14
+ - `Array#average`, `Array#sorted_median` and `Array#sorted_percentile` are not deprecated, just moved.
15
+ - `Array#sorted_sample` is now `Array#sorted_nths`. There is a `sample` method on array with a non-similar purpose. Also modified it to land on the half-stride: `[1,2,3,4,5].sorted_nths(2)` is `[2,4]` not `[3,5]`.
16
+ - metaprogramming/aliasing.rb
17
+
18
+
19
+ #### Organized files in `gorillib/model`
20
+
21
+ * `gorillib/model/factories` is now `gorillib/factories.rb`
22
+ * `gorillib/builder/field` was empty, removed it
23
+
24
+ #### Questions
25
+
26
+ * move `compact_blank`, `deep_compact` to `enumerable/compact`?
27
+
28
+ #### Other
29
+
30
+ * stripping back the gem dependencies.
31
+ - `json` & `OJ` alongside bundler and rake in the `:development` group
32
+
33
+
34
+ ### 2012-06 - Version 1.0.2-pre: First wave of refactors
35
+
36
+ **positional args**:
37
+
38
+ * You must explicitly declare the field to be positional in its definition:
39
+
40
+ class Smurf
41
+ include Gorillib::Model
42
+ field :smurfiness, Integer, :position => 0
43
+ field :weapon, String, :position => 1
44
+ end
45
+
46
+ Positions must be non-conflicting and in minimal order: if a subclass would bomb out if it declared `field :foo, Whatever, :position => 1` (or any position besides `2`).
47
+
48
+ * Builder's `receive!` method returns the *block*'s return value, not `self`.
49
+
50
+
4
51
  ### 2012-06 - Version 1.0.1-pre: First wave of refactors
5
52
 
6
53
  **model**:
data/Gemfile CHANGED
@@ -1,36 +1,39 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
3
  gem 'multi_json', ">= 1.1"
4
4
 
5
5
  # Only gems that you want listed as development dependencies in the gemspec
6
6
  group :development do
7
7
  gem 'bundler', "~> 1.1"
8
- gem 'rake'
9
- gem 'oj', ">= 1.2"
10
- gem 'json', :platform => :jruby
11
- end
12
-
13
- # Gems you would use if hacking on this gem (rather than with it)
14
- group :support do
15
- gem 'jeweler', ">= 1.6"
16
- gem 'pry'
8
+ gem 'rake', :require => false
9
+ gem 'yard', ">= 0.7", :require => false
10
+ gem 'rspec', ">= 2.8", :require => false
11
+ gem 'jeweler', ">= 1.6", :require => false
17
12
  end
18
13
 
19
14
  group :docs do
20
- gem 'yard', ">= 0.7"
21
- gem 'redcarpet', ">= 2.1"
15
+ gem 'redcarpet', ">= 2.1", :platform => [:ruby]
16
+ gem 'kramdown', :platform => [:jruby]
22
17
  end
23
18
 
24
19
  # Gems for testing and coverage
25
20
  group :test do
26
- gem 'rspec', "~> 2.8"
27
- gem 'simplecov', ">= 0.5", :platform => :ruby_19
28
- #
29
- gem 'guard', ">= 1.0"
30
- gem 'guard-rspec', ">= 0.6"
31
- gem 'guard-yard'
21
+ gem 'simplecov', ">= 0.5", :platform => [:ruby_19], :require => false
22
+ gem 'json'
23
+ end
24
+
25
+ # Gems you would use if hacking on this gem (rather than with it)
26
+ group :support do
27
+ gem 'pry'
28
+ # gem 'perftools.rb', :platform => [:mri]
32
29
  #
30
+ gem 'guard', ">= 1.0", :platform => [:ruby_19]
31
+ gem 'guard-rspec', ">= 0.6", :platform => [:ruby_19]
32
+ gem 'guard-yard', :platform => [:ruby_19]
33
33
  if RUBY_PLATFORM.include?('darwin')
34
- gem 'rb-fsevent', ">= 0.9"
34
+ gem 'rb-fsevent', ">= 0.9", :platform => [:ruby_19]
35
+ end
36
+ if ENV['GORILLIB_YARD']
37
+ gem 'guard-livereload', ">= 1.0"
35
38
  end
36
39
  end
data/Guardfile CHANGED
@@ -1,19 +1,33 @@
1
1
  # -*- ruby -*-
2
2
 
3
- # guard 'yard', :stdout => '/dev/null' do
4
- # watch(%r{lib/.+\.rb})
5
- # watch(%r{notes/.+\.(md|txt)}) { "notes" }
6
- # end
3
+ # require 'guard/notifiers/emacs'
4
+ # ::Guard::Notifier::DEFAULTS.merge!(
5
+ # :success => '#e7fde4',
6
+ # :failed => '#faeedc',
7
+ # :default => '#eee8d6',
8
+ # )
9
+ # p ['emacs notifier:', ::Guard::Notifier::DEFAULTS]
7
10
 
8
- # '--format doc' for more verbose, --format progress for less
9
- format = "progress"
10
- # '--tag record_spec' to only run tests tagged :record_spec
11
- tags = %w[ ] # builder_spec example_spec model_spec
11
+ format = "progress" # '--format doc' for more verbose, --format progress for less
12
+ tags = %w[ ] # '--tag record_spec' to only run tests tagged :record_spec
12
13
 
13
- guard 'rspec', :version => 2, :cli => "--format #{format} #{ tags.map{|tag| "--tag #{tag}"}.join(" ") }" do
14
+ guard('rspec', version: 2, all_after_pass: false, all_on_start: false,
15
+ cli: "--format #{format} #{ tags.map{|tag| "--tag #{tag}"}.join(" ") }") do
14
16
  watch(%r{^spec/.+_spec\.rb$})
15
17
  watch(%r{^(examples/.+)\.rb}){|m| "spec/#{m[1]}_spec.rb" }
16
18
  watch(%r{^lib/gorillib/(.+)\.rb$}){|m| ["spec/gorillib/#{m[1]}_spec.rb", "spec/examples/builder/ironfan_spec.rb"] }
17
19
  watch('spec/spec_helper.rb'){ "spec" }
18
20
  watch(/spec\/support\/(.+)\.rb/){ "spec" }
19
21
  end
22
+
23
+ if ENV['GORILLIB_YARD']
24
+
25
+ guard 'yard', use_cache: true, server: false, stdout: '/dev/null' do
26
+ watch(%r{lib/.+\.rb})
27
+ watch(%r{notes/.+\.(md|txt)}){ "notes" }
28
+ end
29
+
30
+ guard 'livereload' do
31
+ watch(/^doc\/(.*\.html)/) # {|match| [ match[1], "frames.html" ] }
32
+ end
33
+ end
data/README.md CHANGED
@@ -9,27 +9,27 @@ What gorillib gives you is clarity over what features are brought in. If you wan
9
9
  * Upwards compatible with `active_record` and `extlib`
10
10
  - the `active_support` components have significantly more robust internationalization, and some functions have rich option sets in `active_support` vs. basic functionality in `gorillib`. So the rule is if you were happy with `gorillib` you'll be happy with `active_support`, but not vice-versa.
11
11
 
12
- ### require 'gorillib/receiver'
12
+ ### require 'gorillib/model
13
13
 
14
- Gorillib has at least one powerful addition to the canon: the receiver mixin.
14
+ Gorillib has at least one powerful addition to the canon: the `Gorillib::Model` mixin.
15
+
16
+ Think of it like 'An ORM for JSON'. It's designed for data that spends as much time on the wire as it does in action -- things like API handlers or clients, data processing scripts, wukong jobs.
15
17
 
16
18
  * lightweight
17
- * gives you weak type safety but doesn't jack around with setters/getters.
18
- * object/hash semantics
19
+ * serializes to/from JSON, TSV or plain hashes
20
+ * type converts when you need it, but doesn't complicate normal accessors
21
+ * upward compatible with ActiveModel
19
22
 
20
23
  ### require 'gorillib'
21
24
 
22
- * `require 'gorrillib/base'`
23
-
24
- ### require 'gorillib/base'
25
-
26
- requires the following libraries:
25
+ Requires only the following minimal set of libraries:
27
26
 
28
- * `gorillib/object/blank`
29
- * `gorillib/hash/reverse_merge`
27
+ * `gorillib/object/blank` -- fluent boolean methods `foo.blank?` & `foo.present?`
28
+ * `gorillib/array/extract_options` -- get optional keyword args from a `*args` signature
29
+ * `gorillib/hash/reverse_merge` --
30
30
  * `gorillib/hash/compact`
31
31
  * `gorillib/array/compact_blank`
32
- * `gorillib/object/try`
32
+ * `gorillib/exception/raisers` -- DRY exceptions: `ArgumentError.check_arity!`, `TypeMismatchError`,
33
33
 
34
34
  ### require 'gorillib/some'
35
35
 
data/Rakefile CHANGED
@@ -1,57 +1,46 @@
1
1
  require 'rubygems' unless defined?(Gem)
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development, :support, :test)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
2
+ require 'bundler/setup'
3
+ Bundler.setup(:default, :development)
10
4
  require 'rake'
11
5
 
6
+ task :default => :rspec
7
+
8
+ require 'rspec/core/rake_task'
9
+ RSpec::Core::RakeTask.new(:rspec) do |spec|
10
+ Bundler.setup(:default, :development, :test)
11
+ spec.pattern = 'spec/**/*_spec.rb'
12
+ end
13
+
14
+ desc "Run RSpec with code coverage"
15
+ task :cov do
16
+ ENV['GORILLIB_COV'] = "yep"
17
+ Rake::Task[:rspec].execute
18
+ end
19
+
20
+ require 'yard'
21
+ YARD::Rake::YardocTask.new do
22
+ Bundler.setup(:default, :development, :docs)
23
+ end
24
+
12
25
  require 'jeweler'
13
26
  Jeweler::Tasks.new do |gem|
14
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "gorillib"
16
- gem.homepage = "http://infochimps.com/labs"
17
- gem.license = "MIT"
27
+ Bundler.setup(:default, :development, :test)
28
+ gem.name = 'gorillib'
29
+ gem.homepage = 'https://github.com/infochimps-labs/gorillib'
30
+ gem.license = 'Apache 2.0'
31
+ gem.email = 'coders@infochimps.org'
32
+ gem.authors = ['Infochimps']
33
+
18
34
  gem.summary = %Q{include only what you need. No dependencies, no creep}
19
35
  gem.description = %Q{Gorillib: infochimps lightweight subset of ruby convenience methods}
20
- gem.email = "coders@infochimps.org"
21
- gem.authors = ["Infochimps"]
22
36
 
23
37
  ignores = File.readlines(".gitignore").grep(/^[^#]\S+/).map{|s| s.chomp }
24
38
  dotfiles = [".gemtest", ".gitignore", ".rspec", ".yardopts"]
25
39
  gem.files = dotfiles + Dir["**/*"].
26
- reject{|f| f =~ %r{^(vendor|coverage)/} }.
40
+ reject{|f| f =~ %r{^(vendor|coverage|old|away)/} }.
27
41
  reject{|f| File.directory?(f) }.
28
42
  reject{|f| ignores.any?{|i| File.fnmatch(i, f) || File.fnmatch(i+'/**/*', f) || File.fnmatch(i+'/*', f) } }
29
43
  gem.test_files = gem.files.grep(/^spec\//)
30
44
  gem.require_paths = ['lib']
31
45
  end
32
46
  Jeweler::RubygemsDotOrgTasks.new
33
-
34
- require 'rspec/core'
35
- require 'rspec/core/rake_task'
36
- RSpec::Core::RakeTask.new(:spec) do |spec|
37
- Bundler.setup(:default, :development, :test)
38
- spec.pattern = FileList['spec/**/*_spec.rb']
39
- end
40
-
41
- # if rcov shits the bed with ruby 1.9, see
42
- # https://github.com/relevance/rcov/issues/31
43
- RSpec::Core::RakeTask.new(:rcov) do |spec|
44
- spec.pattern = 'spec/**/*_spec.rb'
45
- spec.rcov = true
46
- spec.rcov_opts = %w[ --exclude .rvm --no-comments --text-summary]
47
- end
48
-
49
- require 'yard'
50
- YARD::Rake::YardocTask.new do
51
- Bundler.setup(:default, :development, :docs)
52
- end
53
-
54
- # App-specific tasks
55
- Dir[File.dirname(__FILE__)+'/lib/tasks/**/*.rake'].sort.each{|f| load f }
56
-
57
- task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2pre
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'benchmark'
4
+ require 'benchmark/ips' # https://github.com/evanphx/benchmark-ips and benchmark_suite
5
+
6
+ require 'gorillib'
7
+ require 'gorillib/model'
8
+ # load(File.expand_path("../gorillib/lib/gorillib/model/factories.rb"))
9
+
10
+ module Gorillib::Factory
11
+
12
+ NUMERIC_FACTORIES = {
13
+ :int => IntegerFactory.new(), # uses Integer() -- strict (will not convert a float-y string)
14
+ :flt => FloatFactory.new(), # uses Float() -- strict
15
+ :gr_int => GraciousIntegerFactory.new(),
16
+ :gr_float => GraciousFloatFactory.new(),
17
+
18
+ # indiscriminately Integer or to_i anything you see
19
+ :gri_to_i => GraciousIntegerFactory.new(convert: ->(obj){ obj.to_i }),
20
+ :gri_dirct => GraciousIntegerFactory.new(convert: ->(obj){ Integer(obj) }),
21
+
22
+ # same as basic GraciousIntegerFactory, but strangely defining a block here
23
+ # is *way* faster, so for fair conversion to :gr_int_direct and :gr_int_to_i
24
+ # I've duplicated it here
25
+ :gri_blk => IntegerFactory.new(convert: ->(obj){
26
+ if String === obj then
27
+ obj = obj.to_s.tr(FLT_CRUFT_CHARS, '') ;
28
+ obj = Float(obj) if FLT_NOT_INT_RE === obj ;
29
+ end
30
+ Integer(obj) } ),
31
+ }
32
+
33
+ NUMERIC_OBJECTS = [
34
+ "1_234.5e4f",
35
+ "1_234_567.1234e+40",
36
+ "1_234",
37
+ "123456789_123456789_123456789_123456789_123456789",
38
+ "1234L",
39
+ "1,234,567",
40
+ "1_234.5e4",
41
+ 1234, 1234.5,
42
+ Time.now,
43
+ "0x11", '0x1.999999999999ap4'
44
+ ]
45
+
46
+ class FactoryBencher
47
+ include Gorillib::Model
48
+ field :step_duration, Integer, position: 0, default: 2.0, doc: "Target duration of each benchmarking step"
49
+ field :warm_duration, Integer, position: 0, default: 0.1, doc: "Target duration of warmup step"
50
+
51
+ def benchmark_factory(factories)
52
+ NUMERIC_OBJECTS.each do |obj|
53
+ puts "=== Converting +%-20s+: %s" % [
54
+ obj.inspect, factories.map{|fn, fact| "#{fn}: #{fact.receive(obj) rescue '(err)'}" }.join(" | ")]
55
+ end
56
+ NUMERIC_OBJECTS.each do |obj|
57
+ ips do |bench|
58
+ factories.each do |factory_name, factory|
59
+ msg = "%-15s%10s" % [obj.inspect[0..14], factory_name]
60
+ bench.report(msg){ factory.receive(obj) }
61
+ end
62
+ bench.report('to_i baseline' ){ obj.to_i }
63
+ bench.report('to_f baseline' ){ obj.to_f }
64
+ end
65
+ end
66
+ end
67
+
68
+ def benchmark_baseline
69
+ objs = NUMERIC_OBJECTS
70
+ ips do |bench|
71
+ objs.each{|obj| bench.report("#{obj.inspect[0..9]} #to_i" ){ obj.to_i } }
72
+ objs.each{|obj| bench.report("#{obj.inspect[0..9]} #to_f" ){ obj.to_f } }
73
+ objs.each{|obj| bench.report("#{obj.inspect[0..9]} Integer()" ){ Integer(obj) } }
74
+ objs.each{|obj| bench.report("#{obj.inspect[0..9]} Float())" ){ Float(obj) } }
75
+ objs.each{|obj| bench.report("#{obj.inspect[0..9]} Int(Fl())" ){ Integer(Float(obj)) } }
76
+ end
77
+ end
78
+
79
+ def ips(&block)
80
+ Benchmark.ips(step_duration, warm_duration, &block)
81
+ end
82
+ end
83
+
84
+ bencher = FactoryBencher.new
85
+ bencher.benchmark_factory(NUMERIC_FACTORIES)
86
+ bencher.benchmark_baseline
87
+ end
@@ -24,8 +24,6 @@ module Gorillib::Test
24
24
  class Aspect < IronfanBuilder ; end
25
25
  class Machine < IronfanBuilder ; end
26
26
  class ChefNode < IronfanBuilder ; def save() ; end ; end
27
- class ChefClient < IronfanBuilder ; def save() ; end ; end
28
- class ChefRole < IronfanBuilder ; def save() ; end ; end
29
27
 
30
28
  module Ironfan
31
29
  class << self
@@ -39,7 +37,7 @@ module Gorillib::Test
39
37
 
40
38
  class ComputeBuilder < IronfanBuilder
41
39
  magic :environment, Symbol
42
- collection :clouds, Cloud
40
+ collection :clouds, Cloud
43
41
  collection :volumes, Volume
44
42
  collection :components, Component
45
43
 
@@ -53,22 +51,6 @@ module Gorillib::Test
53
51
  def servers() organization.servers.where(:cluster_name => self.name) ; end
54
52
  end
55
53
 
56
- module ComputeBuilder::Deprecated
57
- def bogosity() ; end
58
- def bogus?() ; end
59
- def raid_group() ; end
60
- def root_volume() ; end
61
- def role() ; end
62
- def recipe() ; end
63
- def role_implication() ; end
64
- end
65
- module Cluster::Deprecated
66
- attr_accessor :chef_roles
67
- def find_facet(facet_name)
68
- facets.fetch(facet_name){ raise("Facet '#{facet_name}' is not defined in cluster '#{self.name}'") }
69
- end
70
- end
71
-
72
54
  class Facet < ComputeBuilder
73
55
  belongs_to :cluster, Cluster
74
56
  collection :servers, Server