clone_kit 0.5.2 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 596b570e7050a768cfc6defb35524e3e07fba114
4
- data.tar.gz: b7f12a242104463b3c4f1760640f82f607afa5f5
2
+ SHA256:
3
+ metadata.gz: 1837ffa6f7b44a9d3c4e39fd6fd2a50c310c7033c1a6ba5b35de06dee51aa638
4
+ data.tar.gz: 7fcf54af416183ea480ac13305bd593e7fe9994ffad5170d81508b181bce130e
5
5
  SHA512:
6
- metadata.gz: 23f977ba070227d559041b951f526361c242a0af1f1893d8549a93f13b97249b56c410b09e39cf55183a40db55d74108de3fcad08d5370e148966c8f7105e699
7
- data.tar.gz: e505317b762f5764f3ad5690bdee2cb6749e10c9e4114a5910ba0bc3fbf16ba721ffd0b00c37fc6565fe4c5f32577845d87487a1fd70f28b360f3674d4c1bbd1
6
+ metadata.gz: 8d46e6443528061c6cc878f441f969ee64edd5d60da68025a28868e9c69079c3a20a49aec85e6afe346ff98e6319e792a43cf1f294f87d502dcad4913cc4cfce
7
+ data.tar.gz: 0e637ab67b7375b4705482bc8beca5372228d5c3e99fa7dfdfecb349623dfb2ebf8c1c836475a5544f45ab8e12f09991cc9b36efa5590170b88f6611f5efdf33
data/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
  All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
3
3
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- ## [0.5.2](https://github.com/kapost/clone_kit/compare/v0.5.0...v0.5.2) - 2019-04-02
5
+ ## [0.5.2](https://github.com/kapost/clone_kit/compare/v0.5.1...v0.5.2) - 2019-04-02
6
6
  - Do not hardcode classname in CloneKit::Strategies::Synchronous
7
7
 
8
8
  ## [0.5.1](https://github.com/kapost/clone_kit/compare/v0.5.0...v0.5.1) - 2018-12-20
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Kapost
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/clone_kit.gemspec CHANGED
@@ -30,7 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "combustion", "~> 0.7.0"
31
31
  spec.add_development_dependency "database_cleaner", "1.5.3"
32
32
  spec.add_development_dependency "fakeredis"
33
- spec.add_development_dependency "mongoid", "~> 4.0.2"
33
+ spec.add_development_dependency "mongo", "2.8.0"
34
+ spec.add_development_dependency "mongoid", "~> 5.2.1"
34
35
  spec.add_development_dependency "pg", "~> 0.18.4"
35
36
  spec.add_development_dependency "pry"
36
37
  spec.add_development_dependency "pry-byebug"
@@ -75,9 +75,7 @@ module CloneKit
75
75
 
76
76
  def insert(model)
77
77
  insert_op = model.class.arel_table.create_insert.tap do |insert_mgr|
78
- insert_mgr.insert(
79
- model.send(:arel_attributes_with_values_for_create, model.attribute_names)
80
- )
78
+ insert_mgr.insert(arel_attributes_with_values_for_create(model))
81
79
  end
82
80
 
83
81
  connection.execute(insert_op.to_sql)
@@ -104,6 +102,22 @@ module CloneKit
104
102
  def connection
105
103
  ActiveRecord::Base.connection
106
104
  end
105
+
106
+ private
107
+
108
+ # This method has been deprecated in rails 5.2 (https://github.com/rails/rails/commit/2f45157f2ebbe4f3fa43d3998b459c8eb9ec2b89)
109
+ # Workarounds to this method started to fail other parts of the code base. Hence I am defining it here.
110
+ def arel_attributes_with_values_for_create(model)
111
+ attrs = {}
112
+ arel_table = model.class.arel_table
113
+ attribute_names = model.send(:attributes_for_create, model.attribute_names)
114
+
115
+ attribute_names.each do |name|
116
+ attrs[arel_table[name]] = model.send(:_read_attribute, name)
117
+ end
118
+
119
+ attrs
120
+ end
107
121
  end
108
122
  end
109
123
  end
@@ -105,7 +105,7 @@ module CloneKit
105
105
  model_that_we_wont_save = document_klass.new(attributes)
106
106
 
107
107
  if model_that_we_wont_save.valid?
108
- model_klass.collection.insert(attributes)
108
+ model_klass.collection.insert_one(attributes)
109
109
  else
110
110
  report_errors(attributes, model_that_we_wont_save)
111
111
  end
@@ -145,7 +145,7 @@ module CloneKit
145
145
 
146
146
  def each_existing_record(ids)
147
147
  ids.each do |id|
148
- record = model_klass.collection.find(_id: id).one
148
+ record = model_klass.collection.find(_id: id).first
149
149
  next if record.nil?
150
150
 
151
151
  yield record
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CloneKit
4
- VERSION = "0.5.2"
4
+ VERSION = "0.6.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clone_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Croft
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-02 00:00:00.000000000 Z
11
+ date: 2024-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -108,20 +108,34 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: mongo
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 2.8.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 2.8.0
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: mongoid
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: 4.0.2
131
+ version: 5.2.1
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: 4.0.2
138
+ version: 5.2.1
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: pg
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -264,6 +278,7 @@ files:
264
278
  - ".ruby-version"
265
279
  - CHANGELOG.md
266
280
  - Gemfile
281
+ - LICENSE
267
282
  - README.md
268
283
  - Rakefile
269
284
  - bin/console
@@ -313,8 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
328
  - !ruby/object:Gem::Version
314
329
  version: '0'
315
330
  requirements: []
316
- rubyforge_project:
317
- rubygems_version: 2.6.14.3
331
+ rubygems_version: 3.2.3
318
332
  signing_key:
319
333
  specification_version: 4
320
334
  summary: A toolkit to assist in complex cloning operations