dolly 3.1.3 → 3.1.5
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 +4 -4
- data/README.md +2 -2
- data/lib/dolly/configuration.rb +1 -1
- data/lib/dolly/connection.rb +7 -1
- data/lib/dolly/mango_index.rb +6 -2
- data/lib/dolly/property_manager.rb +1 -1
- data/lib/dolly/version.rb +1 -1
- data/test/document_test.rb +1 -1
- data/test/mango_index_test.rb +20 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c05943aabfd347226c64d622f7e2f872ad8f1f78e52e1229697a3a60364a5e53
|
4
|
+
data.tar.gz: 7a64b93ef1232cec80ca842f9d4e4ebb5dd1e260b967549d8b6ec0d12b0e929d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a50e0365e3dabf0620e6f0c2d13d57f029709616d02733758f2bb1317ef0d4906c4ec999dfef81f5dc95f94d94997dba36004ed1f3a7bf4f0be59f51895fe578
|
7
|
+
data.tar.gz: ff4faa8af117ef82db9c428387a0d31d24dd1d59f3e831d41fe4399ef03faf5ea710ac732bc39108a710191645fefdd31a5284a7448803de5dd1786893b704c0
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Dolly3
|
2
2
|
|
3
|
-
|
3
|
+
The thing you move your couch with...
|
4
4
|
|
5
|
-
|
5
|
+

|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
data/lib/dolly/configuration.rb
CHANGED
@@ -33,7 +33,7 @@ module Dolly
|
|
33
33
|
def configuration
|
34
34
|
@config_data ||= File.read(config_file)
|
35
35
|
raise Dolly::InvalidConfigFileError if @config_data&.empty?
|
36
|
-
YAML::
|
36
|
+
YAML::safe_load(ERB.new(@config_data).result, aliases: true)[app_env.to_s]
|
37
37
|
end
|
38
38
|
|
39
39
|
def config_file
|
data/lib/dolly/connection.rb
CHANGED
@@ -27,13 +27,19 @@ module Dolly
|
|
27
27
|
@app_env = defined?(Rails) ? Rails.env : app_env
|
28
28
|
end
|
29
29
|
|
30
|
+
def skip_migrations?
|
31
|
+
env['skip_migrations']
|
32
|
+
end
|
33
|
+
|
30
34
|
def get(resource, data = {})
|
31
35
|
query = { query: values_to_json(data) } if data
|
32
36
|
request :get, resource, query
|
33
37
|
end
|
34
38
|
|
35
39
|
def post resource, data
|
36
|
-
|
40
|
+
query_str = to_query(data.delete(:query)) if data[:query]
|
41
|
+
query = "?#{query_str}" if query_str
|
42
|
+
request :post, "#{resource.cgi_escape}#{query}", data
|
37
43
|
end
|
38
44
|
|
39
45
|
def put resource, data
|
data/lib/dolly/mango_index.rb
CHANGED
@@ -23,7 +23,10 @@ module Dolly
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def create_in_database(database, name, fields, type = 'json')
|
26
|
-
connection_for_database(database)
|
26
|
+
db_conn = connection_for_database(database)
|
27
|
+
return "Migrations for #{database} skiped." if db_conn.skip_migrations?
|
28
|
+
|
29
|
+
db_conn.post(DESIGN, build_index_structure(name, fields, type))
|
27
30
|
end
|
28
31
|
|
29
32
|
def find_by_fields(fields)
|
@@ -46,7 +49,8 @@ module Dolly
|
|
46
49
|
private
|
47
50
|
|
48
51
|
def connection_for_database(database)
|
49
|
-
|
52
|
+
rails_env = defined?(Rails) ? Rails.env : :development
|
53
|
+
Dolly::Connection.new(database.to_sym, rails_env)
|
50
54
|
end
|
51
55
|
|
52
56
|
def connection
|
data/lib/dolly/version.rb
CHANGED
data/test/document_test.rb
CHANGED
@@ -463,7 +463,7 @@ class DocumentTest < Test::Unit::TestCase
|
|
463
463
|
test_foo = FooBar.new
|
464
464
|
test_foo.foo = 'test_value'
|
465
465
|
assert_equal 'test_value', test_foo.foo
|
466
|
-
assert_equal 'test_value', test_foo.send(:doc)[
|
466
|
+
assert_equal 'test_value', test_foo.send(:doc)['foo']
|
467
467
|
assert_equal 'test_value', test_foo.instance_variable_get(:@foo)
|
468
468
|
end
|
469
469
|
|
data/test/mango_index_test.rb
CHANGED
@@ -21,7 +21,7 @@ class MangoIndexTest < Test::Unit::TestCase
|
|
21
21
|
ddoc: nil,
|
22
22
|
name:"_all_docs",
|
23
23
|
type:"special",
|
24
|
-
def:{ fields:[{ _id:"asc" }] }
|
24
|
+
def:{ fields:[{ _id: "asc" }] }
|
25
25
|
},
|
26
26
|
{
|
27
27
|
ddoc: "_design/1",
|
@@ -32,6 +32,25 @@ class MangoIndexTest < Test::Unit::TestCase
|
|
32
32
|
]}.to_json)
|
33
33
|
end
|
34
34
|
|
35
|
+
test '#create_in_database' do
|
36
|
+
assert_equal "Migrations for design_skipped skiped.", Dolly::MangoIndex.create_in_database(
|
37
|
+
:design_skipped,
|
38
|
+
"demo",
|
39
|
+
[:_id]
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
test '#create_in_database' do
|
44
|
+
stub_request(:post, "http://localhost:5984/test/_index").
|
45
|
+
to_return(status: 200, body: "Design doc run", headers: {})
|
46
|
+
|
47
|
+
assert_equal "Design doc run", Dolly::MangoIndex.create_in_database(
|
48
|
+
:default,
|
49
|
+
"demo",
|
50
|
+
[:_id]
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
35
54
|
test '#delete_all' do
|
36
55
|
previous_indexes = Dolly::MangoIndex.all
|
37
56
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dolly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- javierg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -178,7 +178,7 @@ files:
|
|
178
178
|
homepage: https://www.amco.me
|
179
179
|
licenses: []
|
180
180
|
metadata: {}
|
181
|
-
post_install_message:
|
181
|
+
post_install_message:
|
182
182
|
rdoc_options: []
|
183
183
|
require_paths:
|
184
184
|
- lib
|
@@ -193,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
197
|
-
signing_key:
|
196
|
+
rubygems_version: 3.1.6
|
197
|
+
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: will write something
|
200
200
|
test_files:
|