gibbler 0.9.0 → 0.10.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.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +27 -0
- data/.github/workflows/ruby-rake.yaml +38 -0
- data/.gitignore +16 -0
- data/.pre-commit-config.yaml +60 -0
- data/.rubocop.yml +27 -0
- data/{CHANGES.txt → CHANGELOG.md} +65 -82
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +4 -2
- data/README.md +258 -0
- data/VERSION.yml +2 -2
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/gibbler.gemspec +17 -66
- data/img/whoababy.gif +0 -0
- data/lib/gibbler/history.rb +39 -41
- data/lib/gibbler/mixins.rb +3 -4
- data/lib/gibbler/version.rb +17 -0
- data/lib/gibbler.rb +147 -187
- data/try/02_compat_try.rb +1 -10
- data/try/11_basic_try.rb +31 -25
- data/try/15_file_try.rb +8 -8
- metadata +75 -26
- data/README.rdoc +0 -236
- data/Rakefile +0 -39
data/try/02_compat_try.rb
CHANGED
@@ -1,14 +1,5 @@
|
|
1
|
-
|
1
|
+
require_relative '../lib/gibbler/mixins'
|
2
2
|
|
3
3
|
## Gibbler Objects have gibbler_cache method
|
4
4
|
"kimmy".respond_to? :gibbler_cache
|
5
5
|
#=> true
|
6
|
-
|
7
|
-
## Gibbler Objects have __gibbler_cache method
|
8
|
-
"kimmy".respond_to? :__gibbler_cache
|
9
|
-
#=> true
|
10
|
-
|
11
|
-
## __gibbler_cache returns the same value as gibbler_cache
|
12
|
-
@a = "kimmy" and @a.gibbler
|
13
|
-
@a.gibbler_cache
|
14
|
-
#=> @a.__gibbler_cache
|
data/try/11_basic_try.rb
CHANGED
@@ -13,7 +13,7 @@ require 'gibbler/mixins'
|
|
13
13
|
|
14
14
|
# Symbol digests are consistent
|
15
15
|
:kimmy.gibbler
|
16
|
-
#=> '52be7494a602d85ff5d8a8ab4ffe7f1b171587df'
|
16
|
+
#=> '52be7494a602d85ff5d8a8ab4ffe7f1b171587df'
|
17
17
|
|
18
18
|
# String digests are consistent
|
19
19
|
'kimmy'.gibbler
|
@@ -27,29 +27,29 @@ require 'gibbler/mixins'
|
|
27
27
|
Class.gibbler
|
28
28
|
#=> '25ac269ae3ef18cdb4143ad02ca315afb5026de9'
|
29
29
|
|
30
|
-
#
|
30
|
+
# Integer instance digests are consistent
|
31
31
|
1.gibbler
|
32
32
|
#=> 'a9cad665549bd22a4346fcf602d9d3c3b0482bbe'
|
33
33
|
|
34
|
-
#
|
35
|
-
|
34
|
+
# Large Integer instance
|
35
|
+
100_000_000_000.gibbler
|
36
36
|
#=> '608256db120251843843bba57e9b2c7adb7342aa'
|
37
37
|
|
38
38
|
# Empty Hash instance digests are consistent
|
39
39
|
Hash.new.gibbler
|
40
40
|
#=> '4fdcadc66a38feb9c57faf3c5a18d5e76a6d29bf'
|
41
|
-
|
41
|
+
|
42
42
|
# Populated Hash instance
|
43
43
|
{ :a => [1,2,3, [4,5,6]], :b => { :c => Class } }.gibbler
|
44
|
-
#=> "
|
45
|
-
|
44
|
+
#=> "8faca3e967c94fe996fac1b5a5f595ef77e10df4"
|
45
|
+
|
46
46
|
# Empty Array instance
|
47
|
-
Array.
|
48
|
-
#=> '
|
47
|
+
Array.gibbler
|
48
|
+
#=> '83c4994bb01eefc06aa267aa99aa12b55696616e'
|
49
49
|
|
50
50
|
# Populated Array instance
|
51
51
|
[1, 2, :runtime, [3, "four", [Object, true]]].gibbler
|
52
|
-
#=> "
|
52
|
+
#=> "067c28147176992b95b9301817846abc85cbd7e4"
|
53
53
|
|
54
54
|
# Knows when a Hash has not changed
|
55
55
|
a = { :magic => true }
|
@@ -65,25 +65,32 @@ require 'gibbler/mixins'
|
|
65
65
|
a.gibbled?
|
66
66
|
#=> true
|
67
67
|
|
68
|
-
# Two Symbol digests don't cross streams
|
69
|
-
a, b = :something, :anything
|
70
|
-
a.gibbler
|
71
|
-
b.gibbler
|
72
|
-
[a.gibbler_cache.short, b.gibbler_cache.short]
|
73
|
-
#=> ["667ce086", "92d5f7cd"]
|
74
|
-
|
75
68
|
# Two String digests don't cross streams"
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
69
|
+
a, b = 'something', 'anything'
|
70
|
+
a.gibbler
|
71
|
+
b.gibbler
|
72
|
+
[a.gibbler_cache.short, b.gibbler_cache.short]
|
80
73
|
#=> ["ce0c7694", "c13b2f02"]
|
81
74
|
|
75
|
+
# Strings aren't inherently "frozen" so their gibbler cache
|
76
|
+
# values are primed after running gibbler the first time.
|
77
|
+
a = 'something'
|
78
|
+
a.gibbler
|
79
|
+
[a.frozen?, a.gibbler_cache]
|
80
|
+
#=> [false, "ce0c7694"]
|
81
|
+
|
82
|
+
# Symbols are inherently "frozen" so their gibbler cache
|
83
|
+
# values are never populated.
|
84
|
+
a = :something
|
85
|
+
a.gibbler
|
86
|
+
[a.frozen?, a.gibbler_cache]
|
87
|
+
#=> [true, nil]
|
88
|
+
|
82
89
|
## DISABLED: If gibbler/history is required, there will be an
|
83
90
|
## additional attic_var (:gibbler_history), but only if the
|
84
91
|
## gibbler_history method has been called already (the history
|
85
92
|
## remains nil by default). The fix is not straightfroward and
|
86
|
-
## tests are not important anyway so disabling them is fine.
|
93
|
+
## tests are not important anyway so disabling them is fine.
|
87
94
|
## Symbol has list of attic vars", [:gibbler_cache]
|
88
95
|
# Symbol.attic_vars
|
89
96
|
#end
|
@@ -98,8 +105,8 @@ require 'gibbler/mixins'
|
|
98
105
|
|
99
106
|
# Freezing an object will update the digest
|
100
107
|
a = { :a => 1 }
|
101
|
-
pre = a.gibbler;
|
102
|
-
a[:a] = 2
|
108
|
+
pre = a.gibbler;
|
109
|
+
a[:a] = 2
|
103
110
|
post = a.freeze.gibbler
|
104
111
|
pre != post && post == a.gibbler_cache
|
105
112
|
#=> true
|
@@ -127,4 +134,3 @@ require 'gibbler/mixins'
|
|
127
134
|
a.gibbler
|
128
135
|
a.gibbler_cache
|
129
136
|
#=> 'c8027100ecc54945ab15ddac529230e38b1ba6a1'
|
130
|
-
|
data/try/15_file_try.rb
CHANGED
@@ -2,15 +2,15 @@ require 'tempfile'
|
|
2
2
|
require 'gibbler/mixins'
|
3
3
|
|
4
4
|
@tempfile = "tryouts-9000-awesome.txt"
|
5
|
-
|
5
|
+
|
6
6
|
## File can gibbler
|
7
|
-
file = File.new(File.join('.', '
|
7
|
+
file = File.new(File.join('.', 'LICENSE.txt'))
|
8
8
|
file.gibbler
|
9
|
-
#=> 'c052e87bd0acb7e08c98dad7f8b09b4382a08ef6'
|
10
|
-
|
9
|
+
#=> 'c052e87bd0acb7e08c98dad7f8b09b4382a08ef6'
|
10
|
+
|
11
11
|
## Gibbler is different for each path
|
12
|
-
file1 = File.new(File.join('.', '
|
13
|
-
file2 = File.new(File.join('.', 'README.
|
12
|
+
file1 = File.new(File.join('.', 'LICENSE.txt'))
|
13
|
+
file2 = File.new(File.join('.', 'README.md'))
|
14
14
|
file1.gibbler == file2.gibbler
|
15
15
|
#=> false
|
16
16
|
|
@@ -30,7 +30,7 @@ require 'gibbler/mixins'
|
|
30
30
|
#=> '6d93f752fc23f36bffa5ddf9ee97d04be82efbdb'
|
31
31
|
|
32
32
|
## JRuby doesn't like to use File.new with directories
|
33
|
-
###=> '92cbcb7de73d7748b28d9e911f461013de34410f'
|
33
|
+
###=> '92cbcb7de73d7748b28d9e911f461013de34410f'
|
34
34
|
### "File gibbler cares about trailing slash (/tmp/)", File.new(__FILE__)
|
35
35
|
|
36
|
-
File.unlink @tempfile if File.
|
36
|
+
File.unlink @tempfile if File.exist? @tempfile
|
metadata
CHANGED
@@ -1,34 +1,84 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gibbler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.10.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Delano Mandelbaum
|
9
|
-
autorequire:
|
10
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
15
|
-
|
11
|
+
date: 2024-04-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '13.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '13.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tryouts
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.2'
|
55
|
+
description: 'About Gibbler: Git-like hashes for Ruby objects'
|
56
|
+
email: gems@solutious.com
|
16
57
|
executables: []
|
17
58
|
extensions: []
|
18
|
-
extra_rdoc_files:
|
19
|
-
- LICENSE.txt
|
20
|
-
- README.rdoc
|
59
|
+
extra_rdoc_files: []
|
21
60
|
files:
|
22
|
-
-
|
61
|
+
- ".github/workflows/main.yml"
|
62
|
+
- ".github/workflows/ruby-rake.yaml"
|
63
|
+
- ".gitignore"
|
64
|
+
- ".pre-commit-config.yaml"
|
65
|
+
- ".rubocop.yml"
|
66
|
+
- CHANGELOG.md
|
67
|
+
- CODE_OF_CONDUCT.md
|
68
|
+
- Gemfile
|
69
|
+
- Gemfile.lock
|
23
70
|
- LICENSE.txt
|
24
|
-
- README.
|
25
|
-
- Rakefile
|
71
|
+
- README.md
|
26
72
|
- VERSION.yml
|
73
|
+
- bin/console
|
74
|
+
- bin/setup
|
27
75
|
- gibbler.gemspec
|
76
|
+
- img/whoababy.gif
|
28
77
|
- lib/gibbler.rb
|
29
78
|
- lib/gibbler/aliases.rb
|
30
79
|
- lib/gibbler/history.rb
|
31
80
|
- lib/gibbler/mixins.rb
|
81
|
+
- lib/gibbler/version.rb
|
32
82
|
- try/01_core_ext_try.rb
|
33
83
|
- try/02_compat_try.rb
|
34
84
|
- try/05_gibbler_digest_try.rb
|
@@ -50,28 +100,27 @@ files:
|
|
50
100
|
- try/59_history_exceptions_try.rb
|
51
101
|
- try/80_performance_try.rb
|
52
102
|
- try/90_alias_try.rb
|
53
|
-
homepage:
|
54
|
-
licenses:
|
55
|
-
|
103
|
+
homepage: https://github.com/delano/gibbler
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
56
108
|
rdoc_options: []
|
57
109
|
require_paths:
|
58
110
|
- lib
|
59
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
112
|
requirements:
|
62
|
-
- -
|
113
|
+
- - ">="
|
63
114
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
115
|
+
version: 2.6.8
|
65
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
117
|
requirements:
|
68
|
-
- -
|
118
|
+
- - ">="
|
69
119
|
- !ruby/object:Gem::Version
|
70
120
|
version: '0'
|
71
121
|
requirements: []
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
specification_version: 3
|
122
|
+
rubygems_version: 3.4.12
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
76
125
|
summary: Git-like hashes for Ruby objects
|
77
126
|
test_files: []
|
data/README.rdoc
DELETED
@@ -1,236 +0,0 @@
|
|
1
|
-
= Gibbler - v0.9
|
2
|
-
|
3
|
-
Git-like hashes and history for Ruby objects for Ruby 1.8, 1.9 and JRuby.
|
4
|
-
|
5
|
-
Check out the screencast[http://www.rubypulse.com/episode-0.3-gibbler.html] created by Alex Peuchert.
|
6
|
-
|
7
|
-
== Some things to keep in mind
|
8
|
-
|
9
|
-
* Digest calculation may change between minor releases (as it did between 0.6 and 0.7)
|
10
|
-
* Gibbler history is not suitable for very large objects since it keeps complete copies of the object in memory. This is a very early implementation of this feature so don't rely on it for production code.
|
11
|
-
* Don't forget to enjoy your life!
|
12
|
-
|
13
|
-
|
14
|
-
== Example 1 -- Standalone Usage
|
15
|
-
|
16
|
-
require 'gibbler'
|
17
|
-
|
18
|
-
g = Gibbler.new 'id', 1001 # => f4fb3796ababa3788d1bded8fdc589ab1ccb1c3d
|
19
|
-
g.base(36) # => sm71s7eam4hm5jlsuzlqkbuktwpe5h9
|
20
|
-
|
21
|
-
g == 'f4fb3796ababa3788d1bded8fdc589ab1ccb1c3d' # => true
|
22
|
-
g === 'f4fb379' # => true
|
23
|
-
|
24
|
-
== Example 2 -- Mixins Usage
|
25
|
-
|
26
|
-
require 'gibbler/mixins'
|
27
|
-
|
28
|
-
"kimmy".gibbler # => c8027100ecc54945ab15ddac529230e38b1ba6a1
|
29
|
-
:kimmy.gibbler # => 52be7494a602d85ff5d8a8ab4ffe7f1b171587df
|
30
|
-
|
31
|
-
config = {}
|
32
|
-
config.gibbler # => 4fdcadc66a38feb9c57faf3c5a18d5e76a6d29bf
|
33
|
-
config.gibbled? # => false
|
34
|
-
|
35
|
-
config[:server] = {
|
36
|
-
:users => [:dave, :ali],
|
37
|
-
:ports => [22, 80, 443]
|
38
|
-
}
|
39
|
-
config.gibbled? # => true
|
40
|
-
config.gibbler # => ef23d605f8c4fc80a8e580f9a0e8dab8426454a8
|
41
|
-
|
42
|
-
config[:server][:users] << :yanni
|
43
|
-
|
44
|
-
config.gibbler # => 4c558a56bc2abf5f8a845a69e47ceb5e0003683f
|
45
|
-
|
46
|
-
config.gibbler.short # => 4c558a56
|
47
|
-
|
48
|
-
config.gibbler.base36 # => 8x00l83jov4j80i9vfzpaxr9jag23wf
|
49
|
-
|
50
|
-
config.gibbler.base36.short # => 8x00l83j
|
51
|
-
|
52
|
-
|
53
|
-
== Example 3 -- Object History
|
54
|
-
|
55
|
-
Gibbler can also keep track of the history of changes to an object. By default Gibbler supports history for Hash, Array, and String objects. The <tt>gibbler_commit</tt> method creates a clone of the current object and stores in an instance variable using the current hash digest as the key.
|
56
|
-
|
57
|
-
require 'gibbler/mixins'
|
58
|
-
require 'gibbler/history'
|
59
|
-
|
60
|
-
a = { :magic => :original }
|
61
|
-
a.gibbler_commit # => d7049916ddb25e6cc438b1028fb957e5139f9910
|
62
|
-
|
63
|
-
a[:magic] = :updated
|
64
|
-
a.gibbler_commit # => b668098e16d08898532bf3aa33ce2253a3a4150e
|
65
|
-
|
66
|
-
a[:magic] = :changed
|
67
|
-
a.gibbler_commit # => 0b11c377fccd44554a601e5d2b135c46dc1c4cb1
|
68
|
-
|
69
|
-
a.gibbler_history # => d7049916, b668098e, 0b11c377
|
70
|
-
|
71
|
-
a.gibbler_revert! 'd7049916' # Return to a specific commit
|
72
|
-
a.gibbler # => d7049916ddb25e6cc438b1028fb957e5139f9910
|
73
|
-
a # => { :magic => :original }
|
74
|
-
|
75
|
-
a.delete :magic
|
76
|
-
|
77
|
-
a.gibbler_revert! # Return to the previous commit
|
78
|
-
a.gibbler # => 0b11c377fccd44554a601e5d2b135c46dc1c4cb1
|
79
|
-
a # => { :magic => :changed }
|
80
|
-
|
81
|
-
|
82
|
-
a.gibbler_object 'b668098e' # => { :magic => :updated }
|
83
|
-
a.gibbler_stamp # => 2009-07-01 18:56:52 -0400
|
84
|
-
|
85
|
-
http://delano.github.com/gibbler/img/whoababy.gif
|
86
|
-
|
87
|
-
|
88
|
-
== Example 4 -- Method Aliases
|
89
|
-
|
90
|
-
If you have control over the namespaces of your objects, you can use the method aliases to tighten up your code a bit. The "gibbler" and "gibbled?" methods can be accessed via "digest" and "changed?", respectively. (The reason they're not enabled by default is to avoid conflicts.)
|
91
|
-
|
92
|
-
require 'gibbler/aliases'
|
93
|
-
|
94
|
-
"kimmy".digest # => c8027100ecc54945ab15ddac529230e38b1ba6a1
|
95
|
-
:kimmy.digest # => 52be7494a602d85ff5d8a8ab4ffe7f1b171587df
|
96
|
-
|
97
|
-
a = [:a, :b, :c]
|
98
|
-
a.digest # => e554061823b8f06367555d1ee4c25b4ffee61944
|
99
|
-
a << :d
|
100
|
-
a.changed? # => true
|
101
|
-
|
102
|
-
|
103
|
-
The history methods also have aliases which remove the "gibbler_" prefix.
|
104
|
-
|
105
|
-
require 'gibbler/aliases'
|
106
|
-
require 'gibbler/history'
|
107
|
-
|
108
|
-
a = { :magic => :original }
|
109
|
-
a.commit
|
110
|
-
a.history
|
111
|
-
a.revert!
|
112
|
-
# etc...
|
113
|
-
|
114
|
-
== Example 5 -- Different Digest types
|
115
|
-
|
116
|
-
By default Gibbler creates SHA1 hashes. You can change this globally or per instance.
|
117
|
-
|
118
|
-
require 'gibbler/mixins'
|
119
|
-
|
120
|
-
Gibbler.digest_type = Digest::MD5
|
121
|
-
|
122
|
-
:kimmy.gibbler # => 0c61ff17f46223f355759934154d5dcb
|
123
|
-
|
124
|
-
:kimmy.gibbler(Digest::SHA1) # => 52be7494a602d85ff5d8a8ab4ffe7f1b171587df
|
125
|
-
|
126
|
-
|
127
|
-
In Jruby, you can grab the digest types from the openssl library.
|
128
|
-
|
129
|
-
require 'openssl'
|
130
|
-
|
131
|
-
Gibbler.digest_type = OpenSSL::Digest::SHA256
|
132
|
-
|
133
|
-
:kimmy.gibbler # => 1069428e6273cf329436c3dce9b680d4d4e229d7b7...
|
134
|
-
|
135
|
-
|
136
|
-
== Example 6 -- All your base
|
137
|
-
|
138
|
-
require 'gibbler/mixins'
|
139
|
-
|
140
|
-
:kimmy.gibbler # => 52be7494a602d85ff5d8a8ab4ffe7f1b171587df
|
141
|
-
:kimmy.gibbler.base(16) # => 52be7494a602d85ff5d8a8ab4ffe7f1b171587df
|
142
|
-
:kimmy.gibbler.base(36) # => 9nydr6mpv6w4k8ngo3jtx0jz1n97h7j
|
143
|
-
|
144
|
-
:kimmy.gibbler.base(10) # => 472384540402900668368761869477227308873774630879
|
145
|
-
:kimmy.gibbler.to_i # => 472384540402900668368761869477227308873774630879
|
146
|
-
|
147
|
-
|
148
|
-
== Example 7 -- Global secret
|
149
|
-
|
150
|
-
Gibbler can prepend all digest inputs with a global secret. You can set this once per project to ensure your project's digests are unique.
|
151
|
-
|
152
|
-
require 'gibbler/mixins'
|
153
|
-
|
154
|
-
:kimmy.gibbler # => 52be7494a602d85ff5d8a8ab4ffe7f1b171587df
|
155
|
-
|
156
|
-
Gibbler.secret = "sUp0r5ekRu7"
|
157
|
-
|
158
|
-
:kimmy.gibbler # => 6c5f5aff4d809cec7e7da091214a35a2698489f8
|
159
|
-
|
160
|
-
|
161
|
-
== Supported Classes
|
162
|
-
|
163
|
-
Gibbler methods are available only to the classes which explicitly include them (see RDocs[http://delano.github.com/gibbler] for details on which classes are supported by default). You can also extend custom objects:
|
164
|
-
|
165
|
-
class FullHouse
|
166
|
-
include Gibbler::Complex
|
167
|
-
attr_accessor :roles
|
168
|
-
end
|
169
|
-
|
170
|
-
a = FullHouse.new
|
171
|
-
a.gibbler # => 4192d4cb59975813f117a51dcd4454ac16df6703
|
172
|
-
|
173
|
-
a.roles = [:jesse, :joey, :danny, :kimmy, :michelle, :dj, :stephanie]
|
174
|
-
a.gibbler # => 6ea546919dc4caa2bab69799b71d48810a1b48fa
|
175
|
-
|
176
|
-
Gibbler::Complex creates a digest based on the name of the class and the names and values of the instance variables. See the RDocs[http://delano.github.com/gibbler] for other Gibbler::* types.
|
177
|
-
|
178
|
-
If you want to support all Ruby objects, add the following to your application:
|
179
|
-
|
180
|
-
class Object
|
181
|
-
include Gibbler::String
|
182
|
-
end
|
183
|
-
|
184
|
-
Gibbler::String creates a digest based on the name of the class and the output of the to_s method. This is a reasonable default for most objects however any object that includes the object address in to_s (e.g. "Object:0x0x4ac9f0...") will produce unreliable digests (because the address can change).
|
185
|
-
|
186
|
-
As of 0.7 all Proc objects have the same digest: <tt>12075835e94be34438376cd7a54c8db7e746f15d</tt>.
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
== Known Issues
|
191
|
-
|
192
|
-
* gibbler or gibbled? must be called at least once before gibbled? will be able to return a useful value (otherwise there is no previous digest value to compare to)
|
193
|
-
* Digests for Bignum objects are different between Ruby and JRuby. Why?
|
194
|
-
* Digests for Proc objects are different between Ruby 1.8 and 1.9 because Proc.arity returns different values and 1.8 has no lambda? method.
|
195
|
-
|
196
|
-
|
197
|
-
== Installation
|
198
|
-
|
199
|
-
Via Rubygems:
|
200
|
-
|
201
|
-
$ gem install gibbler
|
202
|
-
|
203
|
-
or via download:
|
204
|
-
* gibbler-latest.tar.gz[http://github.com/delano/gibbler/tarball/latest]
|
205
|
-
* gibbler-latest.zip[http://github.com/delano/gibbler/zipball/latest]
|
206
|
-
|
207
|
-
|
208
|
-
== What People Are Saying
|
209
|
-
|
210
|
-
* "nice approach - everything is an object, every object is 'gittish'" -- @olgen_morten[http://twitter.com/olgen_morten/statuses/2629909133]
|
211
|
-
* "gibbler is just awesome" -- @TomK32[http://twitter.com/TomK32/statuses/2618542872]
|
212
|
-
* "wie cool ist Gibbler eigentlich?" -- @we5[http://twitter.com/we5/statuses/2615274279]
|
213
|
-
* "it's nice idea and implementation!" -- HristoHristov[http://www.rubyinside.com/gibbler-git-like-hashes-and-history-for-ruby-objects-1980.html#comment-39092]
|
214
|
-
|
215
|
-
== More Info
|
216
|
-
|
217
|
-
* Codes[http://github.com/delano/gibbler]
|
218
|
-
* RDocs[http://delano.github.com/gibbler]
|
219
|
-
* Sponsor[http://solutious.com/]
|
220
|
-
* Inspiration[http://www.youtube.com/watch?v=fipD4DdV48g]
|
221
|
-
|
222
|
-
|
223
|
-
== Thanks
|
224
|
-
|
225
|
-
* Kalin Harvey (krrh[http://github.com/krrh]) for the early feedback and artistic direction.
|
226
|
-
* Alex Peuchert (aaalex[http://github.com/aaalex]) for creating the screencast.
|
227
|
-
|
228
|
-
|
229
|
-
== Credits
|
230
|
-
|
231
|
-
* [Delano Mandelbaum](http://delanotes.com/) (@solutious.com)
|
232
|
-
|
233
|
-
|
234
|
-
== License
|
235
|
-
|
236
|
-
See: LICENSE.txt
|
data/Rakefile
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "rake"
|
3
|
-
require "rake/clean"
|
4
|
-
require 'yaml'
|
5
|
-
|
6
|
-
require 'rdoc/task'
|
7
|
-
|
8
|
-
config = YAML.load_file("VERSION.yml")
|
9
|
-
task :default => ["build"]
|
10
|
-
CLEAN.include [ 'pkg', 'rdoc' ]
|
11
|
-
name = "gibbler"
|
12
|
-
|
13
|
-
begin
|
14
|
-
require "jeweler"
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
gem.version = "#{config[:MAJOR]}.#{config[:MINOR]}.#{config[:PATCH]}"
|
17
|
-
gem.name = name
|
18
|
-
gem.rubyforge_project = gem.name
|
19
|
-
gem.summary = "Git-like hashes for Ruby objects"
|
20
|
-
gem.description = "Git-like hashes for Ruby objects"
|
21
|
-
gem.email = "delano@solutious.com"
|
22
|
-
gem.homepage = "http://github.com/delano/gibbler"
|
23
|
-
gem.authors = ["Delano Mandelbaum"]
|
24
|
-
end
|
25
|
-
Jeweler::GemcutterTasks.new
|
26
|
-
rescue LoadError
|
27
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
28
|
-
end
|
29
|
-
|
30
|
-
RDoc::Task.new do |rdoc|
|
31
|
-
version = "#{config[:MAJOR]}.#{config[:MINOR]}.#{config[:PATCH]}"
|
32
|
-
rdoc.rdoc_dir = "rdoc"
|
33
|
-
rdoc.title = "#{name} #{version}"
|
34
|
-
rdoc.rdoc_files.include("README*")
|
35
|
-
rdoc.rdoc_files.include("LICENSE.txt")
|
36
|
-
rdoc.rdoc_files.include("bin/*.rb")
|
37
|
-
rdoc.rdoc_files.include("lib/**/*.rb")
|
38
|
-
end
|
39
|
-
|