delta_changes 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  rvm:
2
2
  - ree
3
- - 1.9.2
4
3
  - 1.9.3
4
+ - 2.0.0
data/Appraisals CHANGED
@@ -1,15 +1,5 @@
1
- appraise "rails2" do
2
- version = "2.3.14"
3
- gem 'activerecord', version
4
- end
5
-
6
- appraise "rails30" do
7
- version = "3.2.3"
8
- gem 'activerecord', version
9
- end
10
-
11
-
12
- appraise "rails32" do
13
- version = "3.2.3"
14
- gem 'activerecord', version
1
+ ["2.3.18", "3.0.20", "3.1.12", "3.2.13"].each do |version|
2
+ appraise "rails#{version[0..2].sub(".","")}" do
3
+ gem 'activerecord', version
4
+ end
15
5
  end
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  gem "appraisal"
5
5
  gem "rake"
6
6
  gem "rspec", "~>2"
7
7
  gem "sqlite3"
8
+ gem "bump"
data/Gemfile.lock CHANGED
@@ -1,32 +1,33 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- delta_changes (0.0.1)
4
+ delta_changes (1.0.0)
5
5
  activerecord
6
6
 
7
7
  GEM
8
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.8)
11
- activesupport (= 3.2.8)
10
+ activemodel (3.2.13)
11
+ activesupport (= 3.2.13)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.8)
14
- activemodel (= 3.2.8)
15
- activesupport (= 3.2.8)
13
+ activerecord (3.2.13)
14
+ activemodel (= 3.2.13)
15
+ activesupport (= 3.2.13)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.8)
19
- i18n (~> 0.6)
18
+ activesupport (3.2.13)
19
+ i18n (= 0.6.1)
20
20
  multi_json (~> 1.0)
21
- appraisal (0.4.1)
21
+ appraisal (0.5.2)
22
22
  bundler
23
23
  rake
24
24
  arel (3.0.2)
25
- builder (3.0.3)
25
+ builder (3.0.4)
26
+ bump (0.4.2)
26
27
  diff-lcs (1.1.3)
27
28
  i18n (0.6.1)
28
- multi_json (1.3.6)
29
- rake (0.9.2)
29
+ multi_json (1.7.6)
30
+ rake (10.0.4)
30
31
  rspec (2.6.0)
31
32
  rspec-core (~> 2.6.0)
32
33
  rspec-expectations (~> 2.6.0)
@@ -36,13 +37,14 @@ GEM
36
37
  diff-lcs (~> 1.1.2)
37
38
  rspec-mocks (2.6.0)
38
39
  sqlite3 (1.3.6)
39
- tzinfo (0.3.33)
40
+ tzinfo (0.3.37)
40
41
 
41
42
  PLATFORMS
42
43
  ruby
43
44
 
44
45
  DEPENDENCIES
45
46
  appraisal
47
+ bump
46
48
  delta_changes!
47
49
  rake
48
50
  rspec (~> 2)
data/Rakefile CHANGED
@@ -1,27 +1,12 @@
1
+ require "bundler/setup"
1
2
  require "bundler/gem_tasks"
2
3
  require "appraisal"
4
+ require "bump/tasks"
3
5
 
4
6
  task :spec do
5
7
  sh "rspec spec/"
6
8
  end
7
9
 
8
10
  task :default do
9
- sh "bundle exec rake appraisal:install && bundle exec rake appraisal spec"
10
- end
11
-
12
- # extracted from https://github.com/grosser/project_template
13
- rule /^version:bump:.*/ do |t|
14
- file = "lib/delta_changes/version.rb"
15
-
16
- sh "git status | grep 'nothing to commit'" # ensure we are not dirty
17
- index = ["major", "minor", "patch"].index(t.name.split(':').last)
18
- version_file = File.read(file)
19
- old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
20
- version_parts[index] = version_parts[index].to_i + 1
21
- version_parts[2] = 0 if index < 2 # remove patch for minor
22
- version_parts[1] = 0 if index < 1 # remove minor for major
23
- new_version = version_parts * '.'
24
-
25
- File.open(file,"w"){|f| f.write(version_file.sub(old_version, new_version)) }
26
- sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
11
+ sh "rake appraisal:install && rake appraisal spec"
27
12
  end
@@ -1,11 +1,12 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
6
  gem "rake"
7
7
  gem "rspec", "~>2"
8
8
  gem "sqlite3"
9
- gem "activerecord", "2.3.14"
9
+ gem "bump"
10
+ gem "activerecord", "2.3.18"
10
11
 
11
12
  gemspec :path=>"../"
@@ -0,0 +1,39 @@
1
+ PATH
2
+ remote: /Users/mgrosser/code/tools/delta_changes
3
+ specs:
4
+ delta_changes (0.0.1)
5
+ activerecord
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activerecord (2.3.18)
11
+ activesupport (= 2.3.18)
12
+ activesupport (2.3.18)
13
+ appraisal (0.5.2)
14
+ bundler
15
+ rake
16
+ bump (0.4.2)
17
+ diff-lcs (1.2.4)
18
+ rake (10.0.4)
19
+ rspec (2.13.0)
20
+ rspec-core (~> 2.13.0)
21
+ rspec-expectations (~> 2.13.0)
22
+ rspec-mocks (~> 2.13.0)
23
+ rspec-core (2.13.1)
24
+ rspec-expectations (2.13.0)
25
+ diff-lcs (>= 1.1.3, < 2.0)
26
+ rspec-mocks (2.13.1)
27
+ sqlite3 (1.3.7)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ activerecord (= 2.3.18)
34
+ appraisal
35
+ bump
36
+ delta_changes!
37
+ rake
38
+ rspec (~> 2)
39
+ sqlite3
@@ -1,11 +1,12 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
6
  gem "rake"
7
7
  gem "rspec", "~>2"
8
8
  gem "sqlite3"
9
- gem "activerecord", "3.2.3"
9
+ gem "bump"
10
+ gem "activerecord", "3.0.20"
10
11
 
11
12
  gemspec :path=>"../"
@@ -1,49 +1,49 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/delta_changes
3
3
  specs:
4
- delta_changes (0.0.0)
4
+ delta_changes (0.0.1)
5
5
  activerecord
6
6
 
7
7
  GEM
8
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.3)
11
- activesupport (= 3.2.3)
12
- builder (~> 3.0.0)
13
- activerecord (3.2.3)
14
- activemodel (= 3.2.3)
15
- activesupport (= 3.2.3)
16
- arel (~> 3.0.2)
17
- tzinfo (~> 0.3.29)
18
- activesupport (3.2.3)
19
- i18n (~> 0.6)
20
- multi_json (~> 1.0)
21
- appraisal (0.4.1)
10
+ activemodel (3.0.20)
11
+ activesupport (= 3.0.20)
12
+ builder (~> 2.1.2)
13
+ i18n (~> 0.5.0)
14
+ activerecord (3.0.20)
15
+ activemodel (= 3.0.20)
16
+ activesupport (= 3.0.20)
17
+ arel (~> 2.0.10)
18
+ tzinfo (~> 0.3.23)
19
+ activesupport (3.0.20)
20
+ appraisal (0.5.2)
22
21
  bundler
23
22
  rake
24
- arel (3.0.2)
25
- builder (3.0.3)
26
- diff-lcs (1.1.3)
27
- i18n (0.6.1)
28
- multi_json (1.3.6)
29
- rake (0.9.2.2)
30
- rspec (2.11.0)
31
- rspec-core (~> 2.11.0)
32
- rspec-expectations (~> 2.11.0)
33
- rspec-mocks (~> 2.11.0)
34
- rspec-core (2.11.1)
35
- rspec-expectations (2.11.3)
36
- diff-lcs (~> 1.1.3)
37
- rspec-mocks (2.11.2)
38
- sqlite3 (1.3.6)
39
- tzinfo (0.3.33)
23
+ arel (2.0.10)
24
+ builder (2.1.2)
25
+ bump (0.4.2)
26
+ diff-lcs (1.2.4)
27
+ i18n (0.5.0)
28
+ rake (10.0.4)
29
+ rspec (2.13.0)
30
+ rspec-core (~> 2.13.0)
31
+ rspec-expectations (~> 2.13.0)
32
+ rspec-mocks (~> 2.13.0)
33
+ rspec-core (2.13.1)
34
+ rspec-expectations (2.13.0)
35
+ diff-lcs (>= 1.1.3, < 2.0)
36
+ rspec-mocks (2.13.1)
37
+ sqlite3 (1.3.7)
38
+ tzinfo (0.3.37)
40
39
 
41
40
  PLATFORMS
42
41
  ruby
43
42
 
44
43
  DEPENDENCIES
45
- activerecord (= 3.2.3)
44
+ activerecord (= 3.0.20)
46
45
  appraisal
46
+ bump
47
47
  delta_changes!
48
48
  rake
49
49
  rspec (~> 2)
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "rake"
7
+ gem "rspec", "~>2"
8
+ gem "sqlite3"
9
+ gem "bump"
10
+ gem "activerecord", "3.1.12"
11
+
12
+ gemspec :path=>"../"
@@ -0,0 +1,52 @@
1
+ PATH
2
+ remote: /Users/mgrosser/code/tools/delta_changes
3
+ specs:
4
+ delta_changes (0.0.1)
5
+ activerecord
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (3.1.12)
11
+ activesupport (= 3.1.12)
12
+ builder (~> 3.0.0)
13
+ i18n (~> 0.6)
14
+ activerecord (3.1.12)
15
+ activemodel (= 3.1.12)
16
+ activesupport (= 3.1.12)
17
+ arel (~> 2.2.3)
18
+ tzinfo (~> 0.3.29)
19
+ activesupport (3.1.12)
20
+ multi_json (~> 1.0)
21
+ appraisal (0.5.2)
22
+ bundler
23
+ rake
24
+ arel (2.2.3)
25
+ builder (3.0.4)
26
+ bump (0.4.2)
27
+ diff-lcs (1.2.4)
28
+ i18n (0.6.4)
29
+ multi_json (1.7.6)
30
+ rake (10.0.4)
31
+ rspec (2.13.0)
32
+ rspec-core (~> 2.13.0)
33
+ rspec-expectations (~> 2.13.0)
34
+ rspec-mocks (~> 2.13.0)
35
+ rspec-core (2.13.1)
36
+ rspec-expectations (2.13.0)
37
+ diff-lcs (>= 1.1.3, < 2.0)
38
+ rspec-mocks (2.13.1)
39
+ sqlite3 (1.3.7)
40
+ tzinfo (0.3.37)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ activerecord (= 3.1.12)
47
+ appraisal
48
+ bump
49
+ delta_changes!
50
+ rake
51
+ rspec (~> 2)
52
+ sqlite3
@@ -1,11 +1,12 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
6
  gem "rake"
7
7
  gem "rspec", "~>2"
8
8
  gem "sqlite3"
9
- gem "activerecord", "3.2.3"
9
+ gem "bump"
10
+ gem "activerecord", "3.2.13"
10
11
 
11
12
  gemspec :path=>"../"
@@ -1,49 +1,51 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/delta_changes
3
3
  specs:
4
- delta_changes (0.0.0)
4
+ delta_changes (0.0.1)
5
5
  activerecord
6
6
 
7
7
  GEM
8
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.3)
11
- activesupport (= 3.2.3)
10
+ activemodel (3.2.13)
11
+ activesupport (= 3.2.13)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.3)
14
- activemodel (= 3.2.3)
15
- activesupport (= 3.2.3)
13
+ activerecord (3.2.13)
14
+ activemodel (= 3.2.13)
15
+ activesupport (= 3.2.13)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.3)
19
- i18n (~> 0.6)
18
+ activesupport (3.2.13)
19
+ i18n (= 0.6.1)
20
20
  multi_json (~> 1.0)
21
- appraisal (0.4.1)
21
+ appraisal (0.5.2)
22
22
  bundler
23
23
  rake
24
24
  arel (3.0.2)
25
- builder (3.0.3)
26
- diff-lcs (1.1.3)
25
+ builder (3.0.4)
26
+ bump (0.4.2)
27
+ diff-lcs (1.2.4)
27
28
  i18n (0.6.1)
28
- multi_json (1.3.6)
29
- rake (0.9.2.2)
30
- rspec (2.11.0)
31
- rspec-core (~> 2.11.0)
32
- rspec-expectations (~> 2.11.0)
33
- rspec-mocks (~> 2.11.0)
34
- rspec-core (2.11.1)
35
- rspec-expectations (2.11.3)
36
- diff-lcs (~> 1.1.3)
37
- rspec-mocks (2.11.2)
38
- sqlite3 (1.3.6)
39
- tzinfo (0.3.33)
29
+ multi_json (1.7.6)
30
+ rake (10.0.4)
31
+ rspec (2.13.0)
32
+ rspec-core (~> 2.13.0)
33
+ rspec-expectations (~> 2.13.0)
34
+ rspec-mocks (~> 2.13.0)
35
+ rspec-core (2.13.1)
36
+ rspec-expectations (2.13.0)
37
+ diff-lcs (>= 1.1.3, < 2.0)
38
+ rspec-mocks (2.13.1)
39
+ sqlite3 (1.3.7)
40
+ tzinfo (0.3.37)
40
41
 
41
42
  PLATFORMS
42
43
  ruby
43
44
 
44
45
  DEPENDENCIES
45
- activerecord (= 3.2.3)
46
+ activerecord (= 3.2.13)
46
47
  appraisal
48
+ bump
47
49
  delta_changes!
48
50
  rake
49
51
  rspec (~> 2)
@@ -1,3 +1,3 @@
1
1
  module DeltaChanges
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/delta_changes.rb CHANGED
@@ -96,14 +96,19 @@ module DeltaChanges
96
96
  # The attribute already has an unsaved change.
97
97
  if delta_changed_attributes.include?(attr)
98
98
  old = delta_changed_attributes[attr]
99
- delta_changed_attributes.delete(attr) unless field_changed?(attr, old, value)
99
+ delta_changed_attributes.delete(attr) unless delta_changes_field_changed?(attr, old, value)
100
100
  else
101
101
  old = clone_attribute_value(:read_attribute, attr)
102
- delta_changed_attributes[attr] = old if field_changed?(attr, old, value)
102
+ delta_changed_attributes[attr] = old if delta_changes_field_changed?(attr, old, value)
103
103
  end
104
104
  end
105
105
 
106
106
  write_attribute_without_delta_changes(attr, value)
107
107
  end
108
+
109
+ def delta_changes_field_changed?(attr, old, value)
110
+ @delta_changes_field_changed ||= defined?(field_changed?)
111
+ @delta_changes_field_changed ? field_changed?(attr, old, value) : _field_changed?(attr, old, value) # rails 3.0-3.1 vs 3.2
112
+ end
108
113
  end
109
114
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delta_changes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-20 00:00:00.000000000 Z
12
+ date: 2013-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -40,10 +40,12 @@ files:
40
40
  - Rakefile
41
41
  - Readme.md
42
42
  - delta_changes.gemspec
43
- - gemfiles/rails2.gemfile
44
- - gemfiles/rails2.gemfile.lock
43
+ - gemfiles/rails23.gemfile
44
+ - gemfiles/rails23.gemfile.lock
45
45
  - gemfiles/rails30.gemfile
46
46
  - gemfiles/rails30.gemfile.lock
47
+ - gemfiles/rails31.gemfile
48
+ - gemfiles/rails31.gemfile.lock
47
49
  - gemfiles/rails32.gemfile
48
50
  - gemfiles/rails32.gemfile.lock
49
51
  - lib/delta_changes.rb
@@ -65,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
67
  version: '0'
66
68
  segments:
67
69
  - 0
68
- hash: 3940600882562868341
70
+ hash: -171365277466758643
69
71
  required_rubygems_version: !ruby/object:Gem::Requirement
70
72
  none: false
71
73
  requirements:
@@ -74,10 +76,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
76
  version: '0'
75
77
  segments:
76
78
  - 0
77
- hash: 3940600882562868341
79
+ hash: -171365277466758643
78
80
  requirements: []
79
81
  rubyforge_project:
80
- rubygems_version: 1.8.24
82
+ rubygems_version: 1.8.25
81
83
  signing_key:
82
84
  specification_version: 3
83
85
  summary: Additional real/virtual attribute change tracking independent of ActiveRecords
@@ -1,37 +0,0 @@
1
- PATH
2
- remote: /Users/mgrosser/code/tools/delta_changes
3
- specs:
4
- delta_changes (0.0.0)
5
- activerecord
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- activerecord (2.3.14)
11
- activesupport (= 2.3.14)
12
- activesupport (2.3.14)
13
- appraisal (0.4.1)
14
- bundler
15
- rake
16
- diff-lcs (1.1.3)
17
- rake (0.9.2.2)
18
- rspec (2.11.0)
19
- rspec-core (~> 2.11.0)
20
- rspec-expectations (~> 2.11.0)
21
- rspec-mocks (~> 2.11.0)
22
- rspec-core (2.11.1)
23
- rspec-expectations (2.11.3)
24
- diff-lcs (~> 1.1.3)
25
- rspec-mocks (2.11.2)
26
- sqlite3 (1.3.6)
27
-
28
- PLATFORMS
29
- ruby
30
-
31
- DEPENDENCIES
32
- activerecord (= 2.3.14)
33
- appraisal
34
- delta_changes!
35
- rake
36
- rspec (~> 2)
37
- sqlite3