deep_cloneable 1.7.0 → 2.0.0

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
  SHA1:
3
- metadata.gz: 4f8ee9b4a7a7e7e22b8a9b329e4cf95c7d5bed93
4
- data.tar.gz: d6b6a654ee08c7c0fd903d9a75e30043033785be
3
+ metadata.gz: db1696a5b12a6de3c8780ae4eabaf94531dc7213
4
+ data.tar.gz: 392237ca46af2ff5c40e19b03988fc4c092fec89
5
5
  SHA512:
6
- metadata.gz: 161420b3d29dd21abd32e702f78eefed39b3dc70bad588dc94841f01c47c5e68ad71843b5d02dc70f7b5d6b893c3ee9f337cb3431e60657b4ab3919fd74d31f7
7
- data.tar.gz: aa4d87c683367f05c1be6bc5cbf2ea725a9ec3a5a8ce5352c0f548bcb9fe7ff24303cbe07b92b41ca8eb64d2972b873748b4b99d1e77f2a96863b1096a13b89c
6
+ metadata.gz: e6925639f7cb22d67cd55e24357df3a1f9a53093f0547c2e6bb0e56b268868c31eb8695b675b2b6f81dd16a750e0b4c6702aec2605b73efbfecfd5b546525925
7
+ data.tar.gz: b53468ac2757bc8149fe40b50732e85ed618e14803d95d7c95489f9bbd4a5b31bf71118f3d233f553f946593f997cc26b39d634fa454015748f963b4f81f5829
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'activerecord', '>= 3.1.0'
4
- gem 'activesupport', '>= 3.1.0'
3
+ gem 'activerecord', '>= 3.1.0', '< 5.0.0'
5
4
 
6
5
  gem 'minitest', :group => :test
7
6
  gem 'appraisal', :group => :test
data/Gemfile.lock CHANGED
@@ -74,8 +74,7 @@ PLATFORMS
74
74
  ruby
75
75
 
76
76
  DEPENDENCIES
77
- activerecord (>= 3.1.0)
78
- activesupport (>= 3.1.0)
77
+ activerecord (>= 3.1.0, < 5.0.0)
79
78
  appraisal
80
79
  jeweler
81
80
  minitest
data/README.rdoc CHANGED
@@ -16,11 +16,11 @@ This gem gives every ActiveRecord::Base object the possibility to do a deep clon
16
16
 
17
17
  * In your Gemfile:
18
18
 
19
- gem 'deep_cloneable', '~> 1.7.0'
19
+ gem 'deep_cloneable', '~> 2.0.0'
20
20
 
21
- == Note
21
+ == Upgrading from v1
22
22
 
23
- Version 1.7.0 deprecates the use of the method 'dup' for deep cloning. Please update your code to use 'deep_clone' instead. The dup method will be removed in deep_cloneable 2.0.0.
23
+ The 'dup' method with arguments has been replaced in deep_cloneable 2 by the method 'deep_clone'. Please update your sources accordingly.
24
24
 
25
25
  == Example
26
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 2.0.0
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: deep_cloneable 1.7.0 ruby lib
5
+ # stub: deep_cloneable 2.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "deep_cloneable"
9
- s.version = "1.7.0"
9
+ s.version = "2.0.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Reinier de Lange"]
14
- s.date = "2014-06-25"
14
+ s.date = "2014-06-26"
15
15
  s.description = "Extends the functionality of ActiveRecord::Base#clone to perform a deep clone that includes user specified associations. "
16
16
  s.email = "r.j.delange@nedforce.nl"
17
17
  s.extra_rdoc_files = [
@@ -53,15 +53,12 @@ Gem::Specification.new do |s|
53
53
  s.specification_version = 4
54
54
 
55
55
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
- s.add_runtime_dependency(%q<activerecord>, [">= 3.1.0"])
57
- s.add_runtime_dependency(%q<activesupport>, [">= 3.1.0"])
56
+ s.add_runtime_dependency(%q<activerecord>, ["< 5.0.0", ">= 3.1.0"])
58
57
  else
59
- s.add_dependency(%q<activerecord>, [">= 3.1.0"])
60
- s.add_dependency(%q<activesupport>, [">= 3.1.0"])
58
+ s.add_dependency(%q<activerecord>, ["< 5.0.0", ">= 3.1.0"])
61
59
  end
62
60
  else
63
- s.add_dependency(%q<activerecord>, [">= 3.1.0"])
64
- s.add_dependency(%q<activesupport>, [">= 3.1.0"])
61
+ s.add_dependency(%q<activerecord>, ["< 5.0.0", ">= 3.1.0"])
65
62
  end
66
63
  end
67
64
 
data/gemfiles/3.1.gemfile CHANGED
@@ -3,7 +3,6 @@
3
3
  source "http://rubygems.org"
4
4
 
5
5
  gem "minitest", :group=>:test
6
- gem "activesupport", ">= 3.1.0", :group=>:test
7
6
  gem "appraisal", :group=>:test
8
7
  gem "sqlite3", :group=>:test
9
8
  gem "rdoc", ">= 2.4.2", :group=>:test
@@ -32,7 +32,6 @@ PLATFORMS
32
32
 
33
33
  DEPENDENCIES
34
34
  activerecord (~> 3.1.0)
35
- activesupport (>= 3.1.0)
36
35
  appraisal
37
36
  minitest
38
37
  rdoc (>= 2.4.2)
data/gemfiles/3.2.gemfile CHANGED
@@ -3,7 +3,6 @@
3
3
  source "http://rubygems.org"
4
4
 
5
5
  gem "minitest", :group=>:test
6
- gem "activesupport", ">= 3.1.0", :group=>:test
7
6
  gem "appraisal", :group=>:test
8
7
  gem "sqlite3", :group=>:test
9
8
  gem "rdoc", ">= 2.4.2", :group=>:test
@@ -32,7 +32,6 @@ PLATFORMS
32
32
 
33
33
  DEPENDENCIES
34
34
  activerecord (~> 3.2.0)
35
- activesupport (>= 3.1.0)
36
35
  appraisal
37
36
  minitest
38
37
  rdoc (>= 2.4.2)
data/gemfiles/4.0.gemfile CHANGED
@@ -3,7 +3,6 @@
3
3
  source "http://rubygems.org"
4
4
 
5
5
  gem "minitest", :group=>:test
6
- gem "activesupport", ">= 3.1.0", :group=>:test
7
6
  gem "appraisal", :group=>:test
8
7
  gem "sqlite3", :group=>:test
9
8
  gem "rdoc", ">= 2.4.2", :group=>:test
@@ -39,7 +39,6 @@ PLATFORMS
39
39
 
40
40
  DEPENDENCIES
41
41
  activerecord (~> 4.0.0)
42
- activesupport (>= 3.1.0)
43
42
  appraisal
44
43
  minitest
45
44
  rdoc (>= 2.4.2)
data/gemfiles/4.1.gemfile CHANGED
@@ -3,7 +3,6 @@
3
3
  source "http://rubygems.org"
4
4
 
5
5
  gem "minitest", :group=>:test
6
- gem "activesupport", ">= 3.1.0", :group=>:test
7
6
  gem "appraisal", :group=>:test
8
7
  gem "sqlite3", :group=>:test
9
8
  gem "rdoc", ">= 2.4.2", :group=>:test
@@ -37,7 +37,6 @@ PLATFORMS
37
37
 
38
38
  DEPENDENCIES
39
39
  activerecord (~> 4.1.0)
40
- activesupport (>= 3.1.0)
41
40
  appraisal
42
41
  minitest
43
42
  rdoc (>= 2.4.2)
@@ -1,21 +1,6 @@
1
1
  class ActiveRecord::Base
2
2
  module DeepCloneable
3
3
 
4
- if ActiveRecord::VERSION::MAJOR < 4
5
- ActiveRecord::Base.class_eval do
6
- protected :initialize_dup
7
- module Dup
8
- def dup
9
- copy = super
10
- copy.send(:initialize_dup, self)
11
- copy
12
- end
13
- end
14
- remove_possible_method :dup
15
- include Dup
16
- end
17
- end
18
-
19
4
  # Deep dups an ActiveRecord model. See README.rdoc
20
5
  def deep_clone *args, &block
21
6
  options = args[0] || {}
@@ -91,12 +76,6 @@ class ActiveRecord::Base
91
76
  return kopy
92
77
  end
93
78
 
94
- def dup *args, &block
95
- return super() if args.empty? && !block
96
- ActiveSupport::Deprecation.warn("Calling dup with arguments or blocks is deprecated and will be removed in deep_cloneable 2. Use method 'deep_clone' instead.")
97
- deep_clone *args, &block
98
- end
99
-
100
79
  private
101
80
 
102
81
  def dup_belongs_to_association options, &block
@@ -146,6 +125,8 @@ class ActiveRecord::Base
146
125
  end
147
126
 
148
127
  class AssociationNotFoundException < StandardError; end
128
+
129
+ ActiveRecord::Base.class_eval { protected :initialize_dup } if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 1
149
130
  end
150
131
 
151
132
  include DeepCloneable
@@ -339,15 +339,4 @@ class TestDeepCloneable < MiniTest::Unit::TestCase
339
339
  assert_equal 'John', deep_clone.mateys.first.name
340
340
  end
341
341
 
342
- def test_should_deep_clone_via_dup
343
- deep_clone = @jack.dup(:include => :parrot) do |original, kopy|
344
- kopy.cloned_from_id = original.id
345
- end
346
-
347
- assert deep_clone.new_record?
348
- assert deep_clone.save
349
- assert_equal @jack.id, deep_clone.cloned_from_id
350
- assert_equal @jack.parrot.id, deep_clone.parrot.cloned_from_id
351
- end
352
-
353
342
  end
metadata CHANGED
@@ -1,33 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_cloneable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reinier de Lange
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-25 00:00:00.000000000 Z
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 3.1.0
27
- - !ruby/object:Gem::Dependency
28
- name: activesupport
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
19
+ version: 5.0.0
31
20
  - - ">="
32
21
  - !ruby/object:Gem::Version
33
22
  version: 3.1.0
@@ -35,6 +24,9 @@ dependencies:
35
24
  prerelease: false
36
25
  version_requirements: !ruby/object:Gem::Requirement
37
26
  requirements:
27
+ - - "<"
28
+ - !ruby/object:Gem::Version
29
+ version: 5.0.0
38
30
  - - ">="
39
31
  - !ruby/object:Gem::Version
40
32
  version: 3.1.0