gorillib 0.1.11 → 0.4.0pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +1 -2
- data/.yardopts +9 -0
- data/{CHANGELOG.textile → CHANGELOG.md} +35 -9
- data/Gemfile +21 -14
- data/Guardfile +19 -0
- data/{LICENSE.textile → LICENSE.md} +43 -29
- data/README.md +47 -52
- data/Rakefile +31 -30
- data/TODO.md +32 -0
- data/VERSION +1 -1
- data/examples/builder/ironfan.rb +133 -0
- data/examples/model/simple.rb +17 -0
- data/gorillib.gemspec +106 -86
- data/lib/alt/kernel/call_stack.rb +56 -0
- data/lib/gorillib/array/wrap.rb +53 -0
- data/lib/gorillib/base.rb +3 -3
- data/lib/gorillib/builder/field.rb +5 -0
- data/lib/gorillib/builder.rb +260 -0
- data/lib/gorillib/collection/has_collection.rb +31 -0
- data/lib/gorillib/collection.rb +129 -0
- data/lib/gorillib/configurable.rb +28 -0
- data/lib/gorillib/datetime/{flat.rb → to_flat.rb} +0 -0
- data/lib/gorillib/exception/confidence.rb +17 -0
- data/lib/gorillib/exception/raisers.rb +78 -0
- data/lib/gorillib/hash/mash.rb +202 -0
- data/lib/gorillib/hashlike/slice.rb +53 -19
- data/lib/gorillib/hashlike.rb +5 -3
- data/lib/gorillib/io/system_helpers.rb +30 -0
- data/lib/gorillib/logger/log.rb +18 -0
- data/lib/gorillib/metaprogramming/concern.rb +124 -0
- data/lib/gorillib/model/active_model_conversion.rb +68 -0
- data/lib/gorillib/model/active_model_naming.rb +87 -0
- data/lib/gorillib/model/active_model_shim.rb +33 -0
- data/lib/gorillib/model/base.rb +341 -0
- data/lib/gorillib/model/defaults.rb +71 -0
- data/lib/gorillib/model/errors.rb +14 -0
- data/lib/gorillib/model/factories.rb +372 -0
- data/lib/gorillib/model/field.rb +146 -0
- data/lib/gorillib/model/named_schema.rb +53 -0
- data/lib/gorillib/{struct/hashlike_iteration.rb → model/overlay.rb} +0 -0
- data/lib/gorillib/model/record_schema.rb +9 -0
- data/lib/gorillib/model/serialization.rb +23 -0
- data/lib/gorillib/model/validate.rb +22 -0
- data/lib/gorillib/model.rb +23 -0
- data/lib/gorillib/pathname.rb +78 -0
- data/lib/gorillib/{serialization.rb → serialization/to_wire.rb} +0 -0
- data/lib/gorillib/some.rb +11 -9
- data/lib/gorillib/string/constantize.rb +21 -14
- data/lib/gorillib/string/inflections.rb +6 -76
- data/lib/gorillib/string/inflector.rb +192 -0
- data/lib/gorillib/string/simple_inflector.rb +267 -0
- data/lib/gorillib/type/extended.rb +52 -0
- data/lib/gorillib/utils/capture_output.rb +28 -0
- data/lib/gorillib/utils/console.rb +131 -0
- data/lib/gorillib/utils/nuke_constants.rb +9 -0
- data/lib/gorillib/utils/stub_module.rb +33 -0
- data/spec/examples/builder/ironfan_spec.rb +37 -0
- data/spec/extlib/hash_spec.rb +64 -0
- data/spec/extlib/mash_spec.rb +312 -0
- data/spec/{array → gorillib/array}/compact_blank_spec.rb +2 -2
- data/spec/{array → gorillib/array}/extract_options_spec.rb +2 -2
- data/spec/gorillib/builder_spec.rb +187 -0
- data/spec/gorillib/collection_spec.rb +20 -0
- data/spec/gorillib/configurable_spec.rb +62 -0
- data/spec/{datetime → gorillib/datetime}/parse_spec.rb +3 -3
- data/spec/{datetime/flat_spec.rb → gorillib/datetime/to_flat_spec.rb} +4 -4
- data/spec/{enumerable → gorillib/enumerable}/sum_spec.rb +5 -5
- data/spec/gorillib/exception/raisers_spec.rb +60 -0
- data/spec/{hash → gorillib/hash}/compact_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/deep_compact_spec.rb +3 -3
- data/spec/{hash → gorillib/hash}/deep_merge_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/keys_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/reverse_merge_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/slice_spec.rb +2 -2
- data/spec/{hash → gorillib/hash}/zip_spec.rb +2 -2
- data/spec/{hashlike → gorillib/hashlike}/behave_same_as_hash_spec.rb +6 -3
- data/spec/{hashlike → gorillib/hashlike}/deep_hash_spec.rb +2 -2
- data/spec/{hashlike → gorillib/hashlike}/hashlike_behavior_spec.rb +32 -30
- data/spec/{hashlike → gorillib/hashlike}/hashlike_via_accessors_spec.rb +3 -3
- data/spec/{hashlike_spec.rb → gorillib/hashlike_spec.rb} +3 -3
- data/spec/{logger → gorillib/logger}/log_spec.rb +2 -2
- data/spec/{metaprogramming → gorillib/metaprogramming}/aliasing_spec.rb +3 -3
- data/spec/{metaprogramming → gorillib/metaprogramming}/class_attribute_spec.rb +3 -3
- data/spec/{metaprogramming → gorillib/metaprogramming}/delegation_spec.rb +3 -3
- data/spec/{metaprogramming → gorillib/metaprogramming}/singleton_class_spec.rb +3 -3
- data/spec/gorillib/model/record/defaults_spec.rb +108 -0
- data/spec/gorillib/model/record/factories_spec.rb +321 -0
- data/spec/gorillib/model/record/overlay_spec.rb +46 -0
- data/spec/gorillib/model/serialization_spec.rb +48 -0
- data/spec/gorillib/model_spec.rb +281 -0
- data/spec/{numeric → gorillib/numeric}/clamp_spec.rb +2 -2
- data/spec/{object → gorillib/object}/blank_spec.rb +2 -2
- data/spec/{object → gorillib/object}/try_dup_spec.rb +2 -2
- data/spec/{object → gorillib/object}/try_spec.rb +3 -2
- data/spec/gorillib/pathname_spec.rb +114 -0
- data/spec/{string → gorillib/string}/constantize_spec.rb +2 -2
- data/spec/{string → gorillib/string}/human_spec.rb +2 -2
- data/spec/{string → gorillib/string}/inflections_spec.rb +4 -3
- data/spec/{string → gorillib/string}/inflector_test_cases.rb +0 -0
- data/spec/{string → gorillib/string}/truncate_spec.rb +4 -10
- data/spec/gorillib/type/extended_spec.rb +120 -0
- data/spec/gorillib/utils/capture_output_spec.rb +71 -0
- data/spec/spec_helper.rb +8 -11
- data/spec/support/gorillib_test_helpers.rb +66 -0
- data/spec/support/hashlike_fuzzing_helper.rb +31 -33
- data/spec/support/hashlike_helper.rb +3 -3
- data/spec/support/model_test_helpers.rb +81 -0
- data/spec/support/shared_examples/included_module.rb +20 -0
- metadata +177 -158
- data/lib/gorillib/array/average.rb +0 -13
- data/lib/gorillib/array/sorted_median.rb +0 -11
- data/lib/gorillib/array/sorted_percentile.rb +0 -11
- data/lib/gorillib/array/sorted_sample.rb +0 -12
- data/lib/gorillib/dsl_object.rb +0 -64
- data/lib/gorillib/hash/indifferent_access.rb +0 -207
- data/lib/gorillib/hash/tree_merge.rb +0 -4
- data/lib/gorillib/hashlike/tree_merge.rb +0 -49
- data/lib/gorillib/metaprogramming/cattr_accessor.rb +0 -79
- data/lib/gorillib/metaprogramming/mattr_accessor.rb +0 -61
- data/lib/gorillib/receiver/active_model_shim.rb +0 -32
- data/lib/gorillib/receiver/acts_as_hash.rb +0 -195
- data/lib/gorillib/receiver/acts_as_loadable.rb +0 -42
- data/lib/gorillib/receiver/locale/en.yml +0 -27
- data/lib/gorillib/receiver/tree_diff.rb +0 -74
- data/lib/gorillib/receiver/validations.rb +0 -30
- data/lib/gorillib/receiver.rb +0 -402
- data/lib/gorillib/receiver_model.rb +0 -21
- data/lib/gorillib/struct/acts_as_hash.rb +0 -108
- data/notes/fancy_hashes_and_receivers.textile +0 -120
- data/notes/hash_rdocs.textile +0 -97
- data/spec/array/average_spec.rb +0 -24
- data/spec/array/sorted_median_spec.rb +0 -18
- data/spec/array/sorted_percentile_spec.rb +0 -24
- data/spec/array/sorted_sample_spec.rb +0 -28
- data/spec/dsl_object_spec.rb +0 -99
- data/spec/hash/indifferent_access_spec.rb +0 -391
- data/spec/metaprogramming/cattr_accessor_spec.rb +0 -43
- data/spec/metaprogramming/mattr_accessor_spec.rb +0 -45
- data/spec/receiver/acts_as_hash_spec.rb +0 -295
- data/spec/receiver_spec.rb +0 -551
- data/spec/struct/acts_as_hash_fuzz_spec.rb +0 -71
- data/spec/struct/acts_as_hash_spec.rb +0 -422
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.yardopts
ADDED
@@ -1,10 +1,36 @@
|
|
1
|
-
|
1
|
+
## Version 1.0
|
2
|
+
|
3
|
+
### 2012-04 - Version 1.0.0: DSL Magic
|
4
|
+
|
5
|
+
#### New functionality
|
6
|
+
|
7
|
+
* `pathname/path_to` -- templated file paths
|
8
|
+
* `serialization/to_zaml` -- predictable, structured YAML writer
|
9
|
+
* `test_helpers/capture_output` -- swallows $stdout/$stderr for testing purposes
|
10
|
+
|
11
|
+
#### Renamed
|
12
|
+
|
13
|
+
* moved `gorillib/serialization` to `gorillib/serialization/to_wire`
|
14
|
+
* renamed `datetime/flat` to `datetime/to_flat`
|
15
|
+
|
16
|
+
#### Removed:
|
17
|
+
|
18
|
+
* `receiver` and `receiver/*` -- see `property` and others
|
19
|
+
* `hash/tree_merge` and `hashlike/tree_merge` -- use overlays
|
20
|
+
* `hash/indifferent_access` -- use `mash`
|
21
|
+
* `metaprogramming/cattr_accessor` -- use `class_attribute`
|
22
|
+
* `metaprogramming/mattr_accessor` -- discouraged
|
23
|
+
* `struct/*` -- discouraged
|
24
|
+
|
25
|
+
## Version 0.x
|
26
|
+
|
27
|
+
### 2011-12-11 - Version 0.1.8: Gemfile fixes; Log.dump shows caller
|
2
28
|
|
3
29
|
* Gorillib has no real dependencies on spork, rcov, Redcloth, etc; these are only useful for rake tasks. Dialed down the urgency of version req's on rspec, yard, etc, and moved the esoterica (spork, rcov, watchr, RedCloth) into bundler groups. Bundler will still install them if you 'bundle install' from the gorillib directory, but the gemspec no longer forces upstream requirers to consider them dependencies
|
4
30
|
* Log.dump adds the immediate caller to the end of its output
|
5
31
|
* fix to Gemfile so that early versions of jruby don't hate on it
|
6
32
|
|
7
|
-
|
33
|
+
### 2011-08-21 - Version 0.1.6: Serialization and DeepHash
|
8
34
|
|
9
35
|
* Serialization with #to_wire -- like #to_hash, but hands #to_wire down the line to any element that contains it (as opposed to `#to_hash`, which should just do that)
|
10
36
|
* Hashlike#tree_merge: combined into the one version; gave it a block in the middle to do any fancy footwork
|
@@ -13,27 +39,27 @@ h3. 2011-08-21 - Version 0.1.6: Serialization and DeepHash
|
|
13
39
|
|
14
40
|
Will soon be deprecating Receiver, in favor of the far more powerful Icss::ReceiverModel in the icss library.
|
15
41
|
|
16
|
-
|
42
|
+
### 2011-06-29 - Version 0.1.3: Fancier receivers
|
17
43
|
|
18
44
|
* can now mix activemodel into a receiver, getting all its validation and other awesomeness
|
19
45
|
* added receiver_model as an experimental 'I'm a fancy cadillac-style receiver'
|
20
46
|
|
21
|
-
|
47
|
+
### 2011-06-24 Version 0.1.2: Receiver body fixes
|
22
48
|
|
23
49
|
* Better @Object.try@ (via active_support)
|
24
50
|
* Receiver body can now be an interpolated string or a hash; this lets you use anonymous classes. Added tuple methods (does an in-order traversal).
|
25
51
|
* Bugfix for inclusion order in ActsAsHash
|
26
52
|
|
27
|
-
|
53
|
+
### Version 0.1.0: Hashlike refactor, Receiver arrives
|
54
|
+
|
55
|
+
v0.1.0 brings:
|
28
56
|
|
29
|
-
v0.1.0 brings
|
30
57
|
* Receiver module
|
31
58
|
* refeactoring of hash decorations into a new hashlike class
|
32
59
|
* ability to inject hashlike behavior into Struct
|
33
60
|
|
34
|
-
|
61
|
+
### Version 0.0.7: full test coverage!
|
35
62
|
|
36
|
-
<pre>
|
37
63
|
lib/
|
38
64
|
|-- gorillib.rb
|
39
65
|
`-- gorillib
|
@@ -78,4 +104,4 @@ h3. Version 0.0.7: full test coverage!
|
|
78
104
|
|-- human.rb
|
79
105
|
|-- inflections.rb
|
80
106
|
`-- truncate.rb
|
81
|
-
|
107
|
+
|
data/Gemfile
CHANGED
@@ -1,25 +1,32 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem
|
3
|
+
gem 'multi_json', '~> 1.1'
|
4
|
+
gem 'json'
|
5
|
+
gem 'configliere', '>= 0.4.13'
|
4
6
|
|
5
|
-
# Add dependencies to develop your gem here.
|
6
|
-
# Include everything needed to run rake, tests, features, etc.
|
7
7
|
group :development do
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem 'yard', "~> 0.6"
|
12
|
-
gem 'cucumber', "~> 1"
|
13
|
-
gem 'aruba', "~> 0.4"
|
8
|
+
gem 'bundler', '~> 1'
|
9
|
+
gem 'pry'
|
10
|
+
gem 'jeweler', '~> 1.6'
|
14
11
|
end
|
15
12
|
|
16
13
|
group :docs do
|
17
|
-
gem '
|
14
|
+
gem 'yard', '~> 0.7'
|
15
|
+
gem 'redcarpet', '~> 2.1'
|
18
16
|
end
|
19
17
|
|
20
18
|
group :test do
|
21
|
-
gem
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
gem 'rspec', "~> 2.5"
|
20
|
+
if RUBY_PLATFORM.include?('darwin')
|
21
|
+
gem 'rb-fsevent', "~> 0.9"
|
22
|
+
# gem 'growl', "~> 1"
|
23
|
+
# gem 'ruby_gntp'
|
24
|
+
end
|
25
|
+
|
26
|
+
gem 'guard', "~> 1"
|
27
|
+
gem 'guard-rspec'
|
28
|
+
gem 'guard-yard'
|
29
|
+
gem 'guard-process'
|
30
|
+
|
31
|
+
# gem 'simplecov', ">= 0.5", :platform => :ruby_19
|
25
32
|
end
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
# guard 'yard', :stdout => '/dev/null' do
|
4
|
+
# watch(%r{lib/.+\.rb})
|
5
|
+
# watch(%r{notes/.+\.(md|txt)}) { "notes" }
|
6
|
+
# end
|
7
|
+
|
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 model_spec example_spec
|
12
|
+
|
13
|
+
guard 'rspec', :version => 2, :cli => "--format #{format} #{ tags.map{|tag| "--tag #{tag}"}.join(" ") }" do
|
14
|
+
watch(%r{^spec/.+_spec\.rb$})
|
15
|
+
watch(%r{^(examples/.+)\.rb}){|m| "spec/#{m[1]}_spec.rb" }
|
16
|
+
watch(%r{^lib/gorillib/(.+)\.rb$}){|m| ["spec/gorillib/#{m[1]}_spec.rb", "spec/examples/builder/ironfan_spec.rb"] }
|
17
|
+
watch('spec/spec_helper.rb'){ "spec" }
|
18
|
+
watch(/spec\/support\/(.+)\.rb/){ "spec" }
|
19
|
+
end
|
@@ -1,81 +1,95 @@
|
|
1
|
-
|
1
|
+
# License for Gorillib
|
2
2
|
|
3
|
+
The gorillib code is __Copyright (c) 2011, 2012 Infochimps, Inc__
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
5
|
+
This code is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
7
6
|
|
8
7
|
http://www.apache.org/licenses/LICENSE-2.0
|
9
8
|
|
10
9
|
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an **AS IS** BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
11
10
|
|
12
|
-
|
11
|
+
__________________________________________________________________________
|
12
|
+
|
13
|
+
# Apache License
|
14
|
+
|
13
15
|
|
14
16
|
Apache License
|
15
17
|
Version 2.0, January 2004
|
16
18
|
http://www.apache.org/licenses/
|
17
19
|
|
18
|
-
|
20
|
+
_TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION_
|
19
21
|
|
20
|
-
|
22
|
+
## 1. Definitions.
|
21
23
|
|
22
24
|
* **License** shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
25
|
+
|
23
26
|
* **Licensor** shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
24
|
-
|
27
|
+
|
28
|
+
* **Legal Entity** shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
29
|
+
|
25
30
|
* **You** (or **Your**) shall mean an individual or Legal Entity exercising permissions granted by this License.
|
31
|
+
|
26
32
|
* **Source** form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
33
|
+
|
27
34
|
* **Object** form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
35
|
+
|
28
36
|
* **Work** shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
37
|
+
|
29
38
|
* **Derivative Works** shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
30
|
-
|
39
|
+
|
40
|
+
* **Contribution** shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
41
|
+
|
31
42
|
* **Contributor** shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
32
43
|
|
33
|
-
|
44
|
+
## 2. Grant of Copyright License.
|
34
45
|
|
35
46
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
36
47
|
|
37
|
-
|
38
|
-
h2. 3. Grant of Patent License.
|
48
|
+
## 3. Grant of Patent License.
|
39
49
|
|
40
50
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
41
51
|
|
42
|
-
|
52
|
+
## 4. Redistribution.
|
43
53
|
|
44
54
|
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
45
55
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
- (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
57
|
+
- (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
58
|
+
- (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
59
|
+
- (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
50
60
|
|
51
61
|
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
52
62
|
|
53
|
-
|
63
|
+
## 5. Submission of Contributions.
|
54
64
|
|
55
65
|
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
56
66
|
|
57
|
-
|
67
|
+
## 6. Trademarks.
|
58
68
|
|
59
69
|
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
60
70
|
|
61
|
-
|
71
|
+
## 7. Disclaimer of Warranty.
|
62
72
|
|
63
|
-
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an
|
73
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
64
74
|
|
65
|
-
|
75
|
+
## 8. Limitation of Liability.
|
66
76
|
|
67
77
|
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
68
78
|
|
69
|
-
|
79
|
+
## 9. Accepting Warranty or Additional Liability.
|
70
80
|
|
71
81
|
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
72
82
|
|
73
|
-
|
74
|
-
|
75
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
83
|
+
_END OF TERMS AND CONDITIONS_
|
76
84
|
|
77
|
-
|
85
|
+
## APPENDIX: How to apply the Apache License to your work.
|
78
86
|
|
79
|
-
|
87
|
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets `[]` replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
80
88
|
|
81
|
-
|
89
|
+
> Copyright [yyyy] [name of copyright owner]
|
90
|
+
>
|
91
|
+
> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
92
|
+
>
|
93
|
+
> http://www.apache.org/licenses/LICENSE-2.0
|
94
|
+
>
|
95
|
+
> Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
+
# Gorillib: infochimps' lightweight subset of ruby convenience methods
|
1
2
|
|
2
|
-
|
3
|
-
|
4
|
-
We love the conveniences provided by `active_support` and `extlib`, we just don't love them at the same time and on top of each other. active_support is slow to load, has many dependencies, and is all intertwingled. We had too many collisions between `active_support` 2.x and 3.x and `extlib`.
|
3
|
+
We love the conveniences provided by `active_support` and `extlib`, we just don't love them at the same time and on top of each other. active_support is slow to load, has many dependencies, and is all intertwingled. We had too many collisions between `active_support` 2.x and 3.x and `extlib`.
|
5
4
|
|
6
5
|
What gorillib gives you is clarity over what features are brought in. If you want to *just* get `Object#blank?`, just `require 'gorillib/object/blank'`. No dependencies, no codependents.
|
7
6
|
|
@@ -17,42 +16,42 @@ Gorillib has at least one powerful addition to the canon: the receiver mixin.
|
|
17
16
|
* lightweight
|
18
17
|
* gives you weak type safety but doesn't jack around with setters/getters.
|
19
18
|
* object/hash semantics
|
20
|
-
|
19
|
+
|
21
20
|
### require 'gorillib'
|
22
21
|
|
23
|
-
* require 'gorrillib/base'
|
22
|
+
* `require 'gorrillib/base'`
|
24
23
|
|
25
24
|
### require 'gorillib/base'
|
26
25
|
|
27
26
|
requires the following libraries:
|
28
27
|
|
29
|
-
* gorillib/object/blank
|
30
|
-
* gorillib/hash/reverse_merge
|
31
|
-
* gorillib/hash/compact
|
32
|
-
* gorillib/array/compact_blank
|
33
|
-
* gorillib/object/try
|
28
|
+
* `gorillib/object/blank`
|
29
|
+
* `gorillib/hash/reverse_merge`
|
30
|
+
* `gorillib/hash/compact`
|
31
|
+
* `gorillib/array/compact_blank`
|
32
|
+
* `gorillib/object/try`
|
34
33
|
|
35
34
|
### require 'gorillib/some'
|
36
35
|
|
37
36
|
requires @gorillib/base@ and the following additional libraries:
|
38
37
|
|
39
|
-
* gorillib/logger/log.rb
|
40
|
-
* set
|
41
|
-
* time
|
42
|
-
* date
|
43
|
-
* gorillib/array/extract_options
|
44
|
-
* gorillib/enumerable/sum
|
45
|
-
* gorillib/datetime/flat
|
46
|
-
* gorillib/datetime/parse
|
47
|
-
* gorillib/hash/zip
|
48
|
-
* gorillib/hash/slice
|
49
|
-
* gorillib/hash/keys
|
50
|
-
* gorillib/metaprogramming/class_attribute
|
51
|
-
* gorillib/metaprogramming/cattr_accessor
|
52
|
-
* gorillib/metaprogramming/singleton_class
|
53
|
-
* gorillib/metaprogramming/remove_method
|
54
|
-
|
55
|
-
|
38
|
+
* `gorillib/logger/log.rb`
|
39
|
+
* `set`
|
40
|
+
* `time`
|
41
|
+
* `date`
|
42
|
+
* `gorillib/array/extract_options`
|
43
|
+
* `gorillib/enumerable/sum`
|
44
|
+
* `gorillib/datetime/flat`
|
45
|
+
* `gorillib/datetime/parse`
|
46
|
+
* `gorillib/hash/zip`
|
47
|
+
* `gorillib/hash/slice`
|
48
|
+
* `gorillib/hash/keys`
|
49
|
+
* `gorillib/metaprogramming/class_attribute`
|
50
|
+
* `gorillib/metaprogramming/cattr_accessor`
|
51
|
+
* `gorillib/metaprogramming/singleton_class`
|
52
|
+
* `gorillib/metaprogramming/remove_method`
|
53
|
+
|
54
|
+
__________________________________________________________________________
|
56
55
|
|
57
56
|
### gorillib/array
|
58
57
|
|
@@ -75,7 +74,7 @@ requires @gorillib/base@ and the following additional libraries:
|
|
75
74
|
|
76
75
|
* *gorillib/enumerable/sum*
|
77
76
|
- Enumerable sum
|
78
|
-
|
77
|
+
|
79
78
|
### gorillib/hash
|
80
79
|
|
81
80
|
* *gorillib/hash/compact*
|
@@ -146,36 +145,32 @@ requires @gorillib/base@ and the following additional libraries:
|
|
146
145
|
* *gorillib/string/truncate*
|
147
146
|
- String truncate
|
148
147
|
|
149
|
-
|
148
|
+
__________________________________________________________________________
|
150
149
|
|
151
|
-
##
|
150
|
+
## Colophon
|
152
151
|
|
153
|
-
|
152
|
+
### Credits & Copyright
|
154
153
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
* *gorillib/string/escaping*: _DEPENDENCIES_: htmlentities, addressable/uri
|
159
|
-
- String xml_escape
|
160
|
-
- String url_escape
|
161
|
-
- String escape_regexp, unescape_regexp
|
162
|
-
* *extlib/module/find_const*
|
163
|
-
- Module find_const
|
154
|
+
Most of this code is ripped from active_support and extlib -- their license
|
155
|
+
carries over. Everything else is Copyright (c) 2011 Infochimps. See LICENSE.md
|
156
|
+
for further details.
|
164
157
|
|
165
|
-
|
158
|
+
### Issues, Patches and Pull Requests
|
166
159
|
|
167
|
-
|
168
|
-
* Object tap isn't necessary -- included in 1.8.7+
|
169
|
-
* Symbol to_proc isn't necessary -- included in 1.8.7+
|
170
|
-
* Class class_inheritable_attribute -- use class_attribute instead
|
171
|
-
* Object to_flat on anything but Time and Date -- poorly-defined
|
172
|
-
* Object returning -- deprecated in favor of #tap
|
160
|
+
Find this repo useful? Thanks! We love you! Find this repo *nearly* useful? Awesome! We'd love to have your help improving it. One way to help is to file an articulate well-reasoned bug report, feature proposal, or short story about gorillib on the [Gorillib issue tracker](http://github.com/infochimps-labs/gorillib/issues). An even better way to help is to create a Patch or Pull Request
|
173
161
|
|
174
|
-
|
162
|
+
* Fork the project.
|
163
|
+
* Make your feature addition or bug fix.
|
164
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
165
|
+
* Commit, but please do not mess with rakefile, version, or history. (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)
|
166
|
+
* Send a pull request to github.com/infochimps-labs
|
167
|
+
* If you'd like, drop a line to the mailing list for infochimps open-source projects, infochimps-code@googlegroups.com
|
175
168
|
|
176
|
-
|
169
|
+
You might enjoy reading:
|
177
170
|
|
178
|
-
|
179
|
-
|
180
|
-
for
|
171
|
+
* [Style Guide for Ruby](https://github.com/infochimps-labs/style_guide/blob/master/style-guide-ruby.md)
|
172
|
+
* [Style Guide for README files](https://github.com/infochimps-labs/style_guide/blob/master/style-guide-for-readme-files.md) (aka our README README)
|
173
|
+
* [Style Guide for Repo Organization](https://github.com/infochimps-labs/style_guide/blob/master/style-guide-for-repo-organization.md)
|
174
|
+
* [The Name of the Wind](http://www.patrickrothfuss.com/content/books.asp), by Patrick Rothfuss.
|
181
175
|
|
176
|
+
(Don't let the existence of a style guide -- or really any sense of modesty -- keep you from submitting a patch. If it departs from the norm we'll either fix it up, or in some cases propose tweaks, but at least others hitting the same issue can enjoy its benefits. We'd rather have worky code with a section that reads like cobol-accented perl than something broken)
|
data/Rakefile
CHANGED
@@ -1,34 +1,36 @@
|
|
1
1
|
require 'rubygems' unless defined?(Gem)
|
2
2
|
require 'bundler'
|
3
3
|
begin
|
4
|
-
Bundler.setup(:default, :development)
|
4
|
+
Bundler.setup(:default, :development, :test)
|
5
5
|
rescue Bundler::BundlerError => e
|
6
6
|
$stderr.puts e.message
|
7
7
|
$stderr.puts "Run `bundle install` to install missing gems"
|
8
8
|
exit e.status_code
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
11
|
+
Bundler::GemHelper.install_tasks
|
12
|
+
|
13
|
+
# require 'jeweler'
|
14
|
+
# Jeweler::Tasks.new do |gem|
|
15
|
+
# # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
+
# gem.name = "gorillib"
|
17
|
+
# gem.homepage = "http://infochimps.com/labs"
|
18
|
+
# gem.license = "MIT"
|
19
|
+
# gem.summary = %Q{include only what you need. No dependencies, no creep}
|
20
|
+
# gem.description = %Q{Gorillib: infochimps lightweight subset of ruby convenience methods}
|
21
|
+
# gem.email = "coders@infochimps.org"
|
22
|
+
# gem.authors = ["Infochimps"]
|
23
|
+
|
24
|
+
# ignores = File.readlines(".gitignore").grep(/^[^#]\S+/).map{|s| s.chomp }
|
25
|
+
# dotfiles = [".gemtest", ".gitignore", ".rspec", ".yardopts"]
|
26
|
+
# gem.files = dotfiles + Dir["**/*"].
|
27
|
+
# reject{|f| f =~ %r{^(vendor|coverage)/} }.
|
28
|
+
# reject{|f| File.directory?(f) }.
|
29
|
+
# reject{|f| ignores.any?{|i| File.fnmatch(i, f) || File.fnmatch(i+'/**/*', f) || File.fnmatch(i+'/*', f) } }
|
30
|
+
# gem.test_files = gem.files.grep(/^spec\//)
|
31
|
+
# gem.require_paths = ['lib']
|
32
|
+
# end
|
33
|
+
# Jeweler::RubygemsDotOrgTasks.new
|
32
34
|
|
33
35
|
require 'rspec/core'
|
34
36
|
require 'rspec/core/rake_task'
|
@@ -37,20 +39,19 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
37
39
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
38
40
|
end
|
39
41
|
|
40
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
42
|
+
# RSpec::Core::RakeTask.new(:rcov) do |spec|
|
43
|
+
# Bundler.setup(:default, :development, :test)
|
44
|
+
# spec.pattern = 'spec/**/*_spec.rb'
|
45
|
+
# spec.rcov = true
|
46
|
+
# spec.rcov_opts = %w[ --exclude .rvm --no-comments --text-summary]
|
47
|
+
# end
|
46
48
|
|
47
49
|
require 'yard'
|
48
50
|
YARD::Rake::YardocTask.new do
|
49
51
|
Bundler.setup(:default, :development, :docs)
|
50
|
-
require 'redcloth'
|
51
52
|
end
|
52
53
|
|
53
54
|
# App-specific tasks
|
54
55
|
Dir[File.dirname(__FILE__)+'/lib/tasks/**/*.rake'].sort.each{|f| load f }
|
55
56
|
|
56
|
-
task :default =>
|
57
|
+
task :default => :spec
|
data/TODO.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
We need a convention for detailed inspection
|
3
|
+
|
4
|
+
### Record
|
5
|
+
|
6
|
+
FIXME: registry creation
|
7
|
+
|
8
|
+
FIXME: field creation is kinda gnarly
|
9
|
+
|
10
|
+
FIXME: number of things we have to import has grown large
|
11
|
+
|
12
|
+
### Builder
|
13
|
+
|
14
|
+
FIXME: read_attribute / write_attribute contract?
|
15
|
+
FIXME: naming of collection members -- who does it?
|
16
|
+
|
17
|
+
FIXME: collection factory stuff is all screwy
|
18
|
+
|
19
|
+
|
20
|
+
tester for a collection item -- `has_facet?` not `facet?`
|
21
|
+
|
22
|
+
### Collection
|
23
|
+
|
24
|
+
FIXME: factory stuff is all screwy
|
25
|
+
FIXME: conversion stuff screwy to some extent
|
26
|
+
|
27
|
+
FIXME: Should a collection be enumerable, and how?
|
28
|
+
|
29
|
+
|
30
|
+
repeated logic in has_collection and builder stuff ...
|
31
|
+
should you be able to decorate anything with a decorator?
|
32
|
+
with a field?
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0pre
|