dolly 3.1.4 → 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 738547c90419b3df331400218f9585604d37c9ed31e2d43aa11a7017dc02ef95
4
- data.tar.gz: 4417136be7f90b1fea148e071c2ba115b81c0fd907f35820656158485953e207
3
+ metadata.gz: c05943aabfd347226c64d622f7e2f872ad8f1f78e52e1229697a3a60364a5e53
4
+ data.tar.gz: 7a64b93ef1232cec80ca842f9d4e4ebb5dd1e260b967549d8b6ec0d12b0e929d
5
5
  SHA512:
6
- metadata.gz: bbc3008042dc480608d1dc0d53bf35e660c7c3f0748107d144347c36d350bd06650f9b2541c37b3b49be6af08dfb405f42db50ab158536fa78a59b8e7531983c
7
- data.tar.gz: b7ab59a556e5d13b703fd6c5a2817db524200b01932b4249b8090edacc23eb41303e97ffa9d3de40c56160fbea9a0acb0d5a85cc78055a11701c1f303e54c8c8
6
+ metadata.gz: a50e0365e3dabf0620e6f0c2d13d57f029709616d02733758f2bb1317ef0d4906c4ec999dfef81f5dc95f94d94997dba36004ed1f3a7bf4f0be59f51895fe578
7
+ data.tar.gz: ff4faa8af117ef82db9c428387a0d31d24dd1d59f3e831d41fe4399ef03faf5ea710ac732bc39108a710191645fefdd31a5284a7448803de5dd1786893b704c0
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Dolly3
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dolly3`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ The thing you move your couch with...
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ![example workflow](https://github.com/amco/dolly/actions/workflows/ruby.yml/badge.svg)
6
6
 
7
7
  ## Installation
8
8
 
@@ -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::load(ERB.new(@config_data).result)[app_env.to_s]
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
@@ -27,6 +27,10 @@ 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
@@ -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).post(DESIGN, build_index_structure(name, fields, type))
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
- Dolly::Connection.new(database.to_sym, Rails.env || :development)
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
@@ -33,7 +33,7 @@ module Dolly
33
33
  end
34
34
 
35
35
  def update_doc(key, _value = nil)
36
- doc.regular_writer(key.to_s, instance_variable_get(:"@#{key}"))
36
+ doc[key.to_s] = instance_variable_get(:"@#{key}")
37
37
  end
38
38
 
39
39
  def properties
data/lib/dolly/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dolly
2
- VERSION = "3.1.4"
2
+ VERSION = "3.1.5"
3
3
  end
@@ -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)[:foo]
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
 
@@ -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
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: 2023-01-03 00:00:00.000000000 Z
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.0.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: