risky 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ require 'risky'
2
+
3
+ # Choose protocol/backend for riak connection
4
+ # Risky.riak = Riak::Client.new(:host => '127.0.0.1')
5
+ # Risky.riak = Riak::Client.new(:host => '127.0.0.1', :http_backend => :Excon)
6
+ Risky.riak = Riak::Client.new(:host => '127.0.0.1', :protocol => 'pbc')
7
+
8
+ Riak.disable_list_keys_warnings = true
9
+
10
+ def sort(ary)
11
+ ary.sort { |a,b| ( a && b ) ? a <=> b : ( a ? 1 : -1 ) }
12
+ end
13
+
14
+ def conflict(klass, field, values)
15
+ key = rand(100000).to_s
16
+ object = klass.new(key).save
17
+
18
+ # Create conflicting versions
19
+ values.each_with_index.map do |value, i|
20
+ klass.riak.client_id = i + 1
21
+ [klass[key], value]
22
+ end.each_with_index do |pair, i|
23
+ o, value = pair
24
+ klass.riak.client_id = i + 1
25
+ o[field] = value
26
+ o.save
27
+ end
28
+
29
+ ro = klass.bucket[key]
30
+ ro.conflict?.should be_true
31
+ begin
32
+ sort(ro.siblings.map { |s| s.data[field] }).should == sort(values)
33
+ rescue ArgumentError
34
+ ro.siblings.map { |s| s.data[field] }.to_set.should == values.to_set
35
+ end
36
+
37
+ # Get all conflicts
38
+ klass[key, {:r => :all}]
39
+ end
40
+
metadata CHANGED
@@ -1,67 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: risky
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kyle Kingsbury
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-14 00:00:00.000000000 Z
11
+ date: 2014-03-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: riak-client
16
- requirement: &4647040 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 1.0.4
19
+ version: 1.4.0
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *4647040
25
- description:
26
- email: aphyr@aphyr.com
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: excon
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A lightweight Ruby ORM for Riak.
56
+ email:
57
+ - aphyr@aphyr.com
27
58
  executables: []
28
59
  extensions: []
29
60
  extra_rdoc_files: []
30
61
  files:
31
- - lib/risky/all.rb
62
+ - .gitignore
63
+ - .rspec
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - LICENSE
67
+ - README.markdown
68
+ - Rakefile.rb
69
+ - lib/risky.rb
70
+ - lib/risky/cron_list.rb
71
+ - lib/risky/gzip.rb
72
+ - lib/risky/indexes.rb
73
+ - lib/risky/inflector.rb
32
74
  - lib/risky/invalid.rb
75
+ - lib/risky/list_keys.rb
33
76
  - lib/risky/not_found.rb
77
+ - lib/risky/paginated_collection.rb
34
78
  - lib/risky/resolver.rb
35
- - lib/risky/threadsafe.rb
36
- - lib/risky/version.rb
79
+ - lib/risky/secondary_indexes.rb
37
80
  - lib/risky/timestamps.rb
38
- - lib/risky/indexes.rb
39
- - lib/risky/cron_list.rb
40
- - lib/risky.rb
41
- - LICENSE
42
- - README.markdown
81
+ - lib/risky/version.rb
82
+ - risky.gemspec
83
+ - spec/risky/cron_list_spec.rb
84
+ - spec/risky/crud_spec.rb
85
+ - spec/risky/enumerable_spec.rb
86
+ - spec/risky/gzip_spec.rb
87
+ - spec/risky/indexes_spec.rb
88
+ - spec/risky/resolver_spec.rb
89
+ - spec/risky/secondary_indexes_spec.rb
90
+ - spec/risky/threads_spec.rb
91
+ - spec/risky_spec.rb
92
+ - spec/spec_helper.rb
43
93
  homepage: https://github.com/aphyr/risky
44
- licenses: []
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
45
97
  post_install_message:
46
98
  rdoc_options: []
47
99
  require_paths:
48
100
  - lib
49
101
  required_ruby_version: !ruby/object:Gem::Requirement
50
- none: false
51
102
  requirements:
52
- - - ! '>='
103
+ - - '>='
53
104
  - !ruby/object:Gem::Version
54
- version: 1.8.6
105
+ version: '0'
55
106
  required_rubygems_version: !ruby/object:Gem::Requirement
56
- none: false
57
107
  requirements:
58
- - - ! '>='
108
+ - - '>='
59
109
  - !ruby/object:Gem::Version
60
110
  version: '0'
61
111
  requirements: []
62
- rubyforge_project: risky
63
- rubygems_version: 1.8.10
112
+ rubyforge_project:
113
+ rubygems_version: 2.0.3
64
114
  signing_key:
65
- specification_version: 3
115
+ specification_version: 4
66
116
  summary: A Ruby ORM for the Riak distributed database.
67
- test_files: []
117
+ test_files:
118
+ - spec/risky/cron_list_spec.rb
119
+ - spec/risky/crud_spec.rb
120
+ - spec/risky/enumerable_spec.rb
121
+ - spec/risky/gzip_spec.rb
122
+ - spec/risky/indexes_spec.rb
123
+ - spec/risky/resolver_spec.rb
124
+ - spec/risky/secondary_indexes_spec.rb
125
+ - spec/risky/threads_spec.rb
126
+ - spec/risky_spec.rb
127
+ - spec/spec_helper.rb
@@ -1,4 +0,0 @@
1
- require 'risky/cron_list'
2
- require 'risky/indexes'
3
- require 'risky/resolver'
4
- require 'risky/timestamps'
@@ -1,42 +0,0 @@
1
- # Autoload is broken with threading.
2
- Riak::Bucket
3
- Riak::Client
4
- Riak::Link
5
- Riak::WalkSpec
6
- Riak::RObject
7
-
8
- Riak::FailedRequest
9
- Riak::MapReduceError
10
-
11
- Riak::Util::Escape
12
- Riak::Util::Headers
13
- Riak::Util::Multipart
14
- Riak::Util::Translation
15
-
16
- Riak::Client::HTTPBackend
17
- Riak::Client::HTTPBackend::RequestHeaders
18
- Riak::Client::HTTPBackend::TransportMethods
19
- Riak::Client::HTTPBackend::ObjectMethods
20
- Riak::Client::HTTPBackend::Configuration
21
-
22
- Riak::Client::NetHTTPBackend
23
-
24
- Riak::MapReduce
25
- Riak::MapReduce::Phase
26
-
27
- I18n::ArgumentError
28
- I18n::Backend
29
- I18n::Backend::Base
30
- I18n::Backend::Simple
31
- I18n::Config
32
- I18n::ExceptionHandler
33
- I18n::Gettext
34
- I18n::InvalidLocale
35
- I18n::InvalidLocaleData
36
- I18n::InvalidPluralizationData
37
- I18n::Locale
38
- I18n::MissingInterpolationArgument
39
- I18n::MissingTranslationData
40
- I18n::ReservedInterpolationKey
41
- I18n::Tests
42
- I18n::UnknownFileType