dolly 1.1.7 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -0
- data/lib/dolly.rb +1 -23
- data/lib/dolly/attachment.rb +29 -0
- data/lib/dolly/bulk_document.rb +27 -26
- data/lib/dolly/class_methods_delegation.rb +15 -0
- data/lib/dolly/collection.rb +26 -69
- data/lib/dolly/configuration.rb +35 -10
- data/lib/dolly/connection.rb +91 -22
- data/lib/dolly/depracated_database.rb +24 -0
- data/lib/dolly/document.rb +32 -206
- data/lib/dolly/document_creation.rb +20 -0
- data/lib/dolly/document_state.rb +65 -0
- data/lib/dolly/document_type.rb +28 -0
- data/lib/dolly/exceptions.rb +21 -0
- data/lib/dolly/identity_properties.rb +29 -0
- data/lib/dolly/properties.rb +31 -0
- data/lib/dolly/property.rb +58 -47
- data/lib/dolly/property_manager.rb +47 -0
- data/lib/dolly/property_set.rb +18 -0
- data/lib/dolly/query.rb +39 -67
- data/lib/dolly/query_arguments.rb +35 -0
- data/lib/dolly/request.rb +12 -107
- data/lib/dolly/request_header.rb +26 -0
- data/lib/dolly/timestamp.rb +24 -0
- data/lib/dolly/version.rb +1 -1
- data/lib/{dolly → railties}/railtie.rb +2 -1
- data/lib/refinements/string_refinements.rb +28 -0
- data/lib/tasks/db.rake +4 -3
- data/test/bulk_document_test.rb +8 -5
- data/test/document_test.rb +137 -53
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/log/test.log +46417 -46858
- data/test/test_helper.rb +14 -20
- metadata +42 -145
- data/Rakefile +0 -11
- data/lib/dolly/bulk_error.rb +0 -16
- data/lib/dolly/db_config.rb +0 -20
- data/lib/dolly/interpreter.rb +0 -5
- data/lib/dolly/logger.rb +0 -9
- data/lib/dolly/name_space.rb +0 -28
- data/lib/dolly/timestamps.rb +0 -21
- data/lib/exceptions/dolly.rb +0 -47
- data/test/collection_test.rb +0 -59
- data/test/configuration_test.rb +0 -9
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -27
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/couchdb.yml +0 -13
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -29
- data/test/dummy/config/environments/production.rb +0 -80
- data/test/dummy/config/environments/test.rb +0 -36
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -12
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -56
- data/test/dummy/lib/couch_rest_adapter/railtie.rb +0 -10
- data/test/dummy/public/404.html +0 -58
- data/test/dummy/public/422.html +0 -58
- data/test/dummy/public/500.html +0 -57
- data/test/dummy/public/favicon.ico +0 -0
- data/test/factories/factories.rb +0 -8
- data/test/request_test.rb +0 -25
data/test/test_helper.rb
CHANGED
@@ -1,37 +1,31 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'test/unit'
|
2
|
+
require 'webmock/test_unit'
|
3
|
+
require 'mocha/test_unit'
|
4
|
+
require 'securerandom'
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Rails.backtrace_cleaner.remove_silencers!
|
6
|
+
# Load gem files
|
7
|
+
Dir["#{File.dirname(__FILE__)}/../lib/dolly/**/*.rb"].each { |f| require f }
|
8
|
+
Dir["#{File.dirname(__FILE__)}/../lib/refinements/**/*.rb"].each { |f| require f }
|
9
|
+
Dir["#{File.dirname(__FILE__)}/../dolly.rb"].each { |f| require f }
|
9
10
|
|
10
11
|
# Load support files
|
11
12
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
13
|
|
13
|
-
|
14
|
-
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
15
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
class ActiveSupport::TestCase
|
14
|
+
class Test::Unit::TestCase
|
20
15
|
DEFAULT_DB = 'test'
|
21
16
|
|
22
17
|
setup :global_setup
|
23
18
|
|
24
19
|
def global_setup
|
25
|
-
|
20
|
+
response = { uuids: [SecureRandom.uuid] }.to_json
|
26
21
|
|
27
|
-
|
28
|
-
|
22
|
+
stub_request(:get, %r{http://.*:5984/_uuids.*}).
|
23
|
+
to_return(status: 200, body: response, headers: { 'Content-Type': 'application/json'})
|
29
24
|
end
|
30
25
|
|
31
26
|
protected
|
27
|
+
|
32
28
|
def base_path
|
33
|
-
%r
|
29
|
+
%r{http://.*:5984/#{DEFAULT_DB}}
|
34
30
|
end
|
35
|
-
|
36
31
|
end
|
37
|
-
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dolly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- javierg
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: oj
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,49 +25,35 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
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: rails
|
28
|
+
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - "
|
31
|
+
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
33
|
+
version: '2.0'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - "
|
38
|
+
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
40
|
+
version: '2.0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '10.0'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '10.0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: test-unit-full
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
@@ -81,49 +67,21 @@ dependencies:
|
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: webmock
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- - "
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.3.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.3.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: factory_girl_rails
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
73
|
+
- - ">="
|
102
74
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
75
|
+
version: '0'
|
104
76
|
type: :development
|
105
77
|
prerelease: false
|
106
78
|
version_requirements: !ruby/object:Gem::Requirement
|
107
79
|
requirements:
|
108
|
-
- - "
|
80
|
+
- - ">="
|
109
81
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
82
|
+
version: '0'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
84
|
name: mocha
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0.4'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.4'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: timecop
|
127
85
|
requirement: !ruby/object:Gem::Requirement
|
128
86
|
requirements:
|
129
87
|
- - ">="
|
@@ -143,69 +101,42 @@ executables: []
|
|
143
101
|
extensions: []
|
144
102
|
extra_rdoc_files: []
|
145
103
|
files:
|
146
|
-
-
|
104
|
+
- README.md
|
147
105
|
- lib/dolly.rb
|
106
|
+
- lib/dolly/attachment.rb
|
148
107
|
- lib/dolly/bulk_document.rb
|
149
|
-
- lib/dolly/
|
108
|
+
- lib/dolly/class_methods_delegation.rb
|
150
109
|
- lib/dolly/collection.rb
|
151
110
|
- lib/dolly/configuration.rb
|
152
111
|
- lib/dolly/connection.rb
|
153
|
-
- lib/dolly/
|
112
|
+
- lib/dolly/depracated_database.rb
|
154
113
|
- lib/dolly/document.rb
|
155
|
-
- lib/dolly/
|
156
|
-
- lib/dolly/
|
157
|
-
- lib/dolly/
|
114
|
+
- lib/dolly/document_creation.rb
|
115
|
+
- lib/dolly/document_state.rb
|
116
|
+
- lib/dolly/document_type.rb
|
117
|
+
- lib/dolly/exceptions.rb
|
118
|
+
- lib/dolly/identity_properties.rb
|
119
|
+
- lib/dolly/properties.rb
|
158
120
|
- lib/dolly/property.rb
|
121
|
+
- lib/dolly/property_manager.rb
|
122
|
+
- lib/dolly/property_set.rb
|
159
123
|
- lib/dolly/query.rb
|
160
|
-
- lib/dolly/
|
124
|
+
- lib/dolly/query_arguments.rb
|
161
125
|
- lib/dolly/request.rb
|
162
|
-
- lib/dolly/
|
126
|
+
- lib/dolly/request_header.rb
|
127
|
+
- lib/dolly/timestamp.rb
|
163
128
|
- lib/dolly/version.rb
|
164
|
-
- lib/
|
129
|
+
- lib/railties/railtie.rb
|
130
|
+
- lib/refinements/string_refinements.rb
|
165
131
|
- lib/tasks/db.rake
|
166
132
|
- test/bulk_document_test.rb
|
167
|
-
- test/collection_test.rb
|
168
|
-
- test/configuration_test.rb
|
169
133
|
- test/document_test.rb
|
170
|
-
- test/dummy/
|
171
|
-
- test/dummy/Rakefile
|
172
|
-
- test/dummy/app/assets/javascripts/application.js
|
173
|
-
- test/dummy/app/assets/stylesheets/application.css
|
174
|
-
- test/dummy/app/controllers/application_controller.rb
|
175
|
-
- test/dummy/app/helpers/application_helper.rb
|
176
|
-
- test/dummy/app/views/layouts/application.html.erb
|
177
|
-
- test/dummy/bin/bundle
|
178
|
-
- test/dummy/bin/rails
|
179
|
-
- test/dummy/bin/rake
|
180
|
-
- test/dummy/config.ru
|
181
|
-
- test/dummy/config/application.rb
|
182
|
-
- test/dummy/config/boot.rb
|
183
|
-
- test/dummy/config/couchdb.yml
|
184
|
-
- test/dummy/config/environment.rb
|
185
|
-
- test/dummy/config/environments/development.rb
|
186
|
-
- test/dummy/config/environments/production.rb
|
187
|
-
- test/dummy/config/environments/test.rb
|
188
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
189
|
-
- test/dummy/config/initializers/inflections.rb
|
190
|
-
- test/dummy/config/initializers/mime_types.rb
|
191
|
-
- test/dummy/config/initializers/secret_token.rb
|
192
|
-
- test/dummy/config/initializers/session_store.rb
|
193
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
194
|
-
- test/dummy/config/locales/en.yml
|
195
|
-
- test/dummy/config/routes.rb
|
196
|
-
- test/dummy/lib/couch_rest_adapter/railtie.rb
|
134
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
197
135
|
- test/dummy/log/test.log
|
198
|
-
- test/dummy/public/404.html
|
199
|
-
- test/dummy/public/422.html
|
200
|
-
- test/dummy/public/500.html
|
201
|
-
- test/dummy/public/favicon.ico
|
202
|
-
- test/factories/factories.rb
|
203
|
-
- test/request_test.rb
|
204
136
|
- test/support/test.txt
|
205
137
|
- test/test_helper.rb
|
206
|
-
homepage:
|
207
|
-
licenses:
|
208
|
-
- MIT
|
138
|
+
homepage: https://www.amco.me
|
139
|
+
licenses: []
|
209
140
|
metadata: {}
|
210
141
|
post_install_message:
|
211
142
|
rdoc_options: []
|
@@ -223,48 +154,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
154
|
version: '0'
|
224
155
|
requirements: []
|
225
156
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.6.13
|
227
158
|
signing_key:
|
228
159
|
specification_version: 4
|
229
160
|
summary: will write something
|
230
161
|
test_files:
|
231
|
-
- test/
|
232
|
-
- test/collection_test.rb
|
233
|
-
- test/configuration_test.rb
|
234
|
-
- test/document_test.rb
|
235
|
-
- test/dummy/app/assets/javascripts/application.js
|
236
|
-
- test/dummy/app/assets/stylesheets/application.css
|
237
|
-
- test/dummy/app/controllers/application_controller.rb
|
238
|
-
- test/dummy/app/helpers/application_helper.rb
|
239
|
-
- test/dummy/app/views/layouts/application.html.erb
|
240
|
-
- test/dummy/bin/bundle
|
241
|
-
- test/dummy/bin/rails
|
242
|
-
- test/dummy/bin/rake
|
243
|
-
- test/dummy/config/application.rb
|
244
|
-
- test/dummy/config/boot.rb
|
245
|
-
- test/dummy/config/couchdb.yml
|
246
|
-
- test/dummy/config/environment.rb
|
247
|
-
- test/dummy/config/environments/development.rb
|
248
|
-
- test/dummy/config/environments/production.rb
|
249
|
-
- test/dummy/config/environments/test.rb
|
250
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
251
|
-
- test/dummy/config/initializers/inflections.rb
|
252
|
-
- test/dummy/config/initializers/mime_types.rb
|
253
|
-
- test/dummy/config/initializers/secret_token.rb
|
254
|
-
- test/dummy/config/initializers/session_store.rb
|
255
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
256
|
-
- test/dummy/config/locales/en.yml
|
257
|
-
- test/dummy/config/routes.rb
|
258
|
-
- test/dummy/config.ru
|
259
|
-
- test/dummy/lib/couch_rest_adapter/railtie.rb
|
162
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
260
163
|
- test/dummy/log/test.log
|
261
|
-
- test/
|
262
|
-
- test/dummy/public/422.html
|
263
|
-
- test/dummy/public/500.html
|
264
|
-
- test/dummy/public/favicon.ico
|
265
|
-
- test/dummy/Rakefile
|
266
|
-
- test/dummy/README.rdoc
|
267
|
-
- test/factories/factories.rb
|
268
|
-
- test/request_test.rb
|
164
|
+
- test/bulk_document_test.rb
|
269
165
|
- test/support/test.txt
|
270
166
|
- test/test_helper.rb
|
167
|
+
- test/document_test.rb
|
data/Rakefile
DELETED
data/lib/dolly/bulk_error.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Dolly
|
2
|
-
class BulkError
|
3
|
-
attr_accessor :obj, :name, :message
|
4
|
-
|
5
|
-
def initialize options = {}
|
6
|
-
self.obj = options['obj']
|
7
|
-
self.name = options['error']
|
8
|
-
self.message = options['reason']
|
9
|
-
end
|
10
|
-
|
11
|
-
def to_s
|
12
|
-
message
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
data/lib/dolly/db_config.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Dolly
|
2
|
-
module DbConfig
|
3
|
-
attr_accessor :config_file
|
4
|
-
|
5
|
-
def parse_config
|
6
|
-
@config_data ||= File.read(config_file)
|
7
|
-
raise Dolly::InvalidConfigFileError unless @config_data.present?
|
8
|
-
YAML::load( ERB.new(@config_data).result )
|
9
|
-
end
|
10
|
-
|
11
|
-
def env
|
12
|
-
parse_config[Rails.env]
|
13
|
-
end
|
14
|
-
|
15
|
-
def config_file
|
16
|
-
root = Rails.root || File.expand_path("../../../test/dummy/", __FILE__)
|
17
|
-
File.join(root, 'config', 'couchdb.yml')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/dolly/interpreter.rb
DELETED
data/lib/dolly/logger.rb
DELETED
data/lib/dolly/name_space.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
module Dolly
|
2
|
-
module NameSpace
|
3
|
-
|
4
|
-
def name_paramitized
|
5
|
-
underscore name.split("::").last
|
6
|
-
end
|
7
|
-
|
8
|
-
def base_id id
|
9
|
-
id = URI.unescape id
|
10
|
-
id.sub %r~^#{name_paramitized}/~, ''
|
11
|
-
end
|
12
|
-
|
13
|
-
def namespace id
|
14
|
-
return id if id =~ %r~^#{name_paramitized}/~
|
15
|
-
"#{name_paramitized}/#{id}"
|
16
|
-
end
|
17
|
-
|
18
|
-
#FROM ActiveModel::Name
|
19
|
-
def underscore(camel_cased_word)
|
20
|
-
camel_cased_word.to_s.gsub(/::/, '/').
|
21
|
-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
22
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
23
|
-
tr("-", "_").
|
24
|
-
downcase
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
data/lib/dolly/timestamps.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Dolly
|
2
|
-
module Timestamps
|
3
|
-
|
4
|
-
def timestamps!
|
5
|
-
property :created_at, :updated_at, class_name: Time
|
6
|
-
|
7
|
-
self.timestamps[self.name] = true
|
8
|
-
|
9
|
-
self.class_eval do
|
10
|
-
|
11
|
-
def set_created_at
|
12
|
-
doc['created_at'] ||= Time.now
|
13
|
-
end
|
14
|
-
|
15
|
-
def set_updated_at
|
16
|
-
doc['updated_at'] = Time.now
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|