ar_transaction_changes 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e81a329fd3cebf47884e144eb617d4383464e9ed
4
+ data.tar.gz: f44c13f9cfe8270f18c16aec9dee68e2814bac0e
5
+ SHA512:
6
+ metadata.gz: 00b1b8405525c0f5359efb2c81c1d62c094e8e034bbf27430c6000b37db3df501fc888ac527b6baaa5b472f7a18939c51c8d46cbb361c70e3c88aa3a9b2080fa
7
+ data.tar.gz: dd19380b41cc98136a48980d6d2a53548cf1d71541bd774469f32943bdd842b8f81744afc591916c81547b128dce4a58413a36207060b0256528cc529b0df894
@@ -2,13 +2,15 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.1
5
6
 
6
7
  gemfile:
7
- - gemfiles/rails32.gemfile
8
- - gemfiles/rails4.gemfile
8
+ - gemfiles/rails_3_2.gemfile
9
+ - gemfiles/rails_4_0_5.gemfile
10
+ - gemfiles/rails_4_1_stable.gemfile
9
11
 
10
12
  services:
11
13
  - mysql
12
14
 
13
15
  before_script:
14
- - mysql -e 'create database ar_transaction_changes_test'
16
+ - mysql -e 'create database ar_transaction_changes_test'
data/Appraisals CHANGED
@@ -1,7 +1,11 @@
1
- appraise "rails32" do
1
+ appraise "rails-3-2" do
2
2
  gem "rails", "~> 3.2"
3
3
  end
4
4
 
5
- appraise "rails4" do
6
- gem "rails", "~> 4.0"
7
- end
5
+ appraise "rails-4-0-5" do
6
+ gem "rails", "4.0.5"
7
+ end
8
+
9
+ appraise "rails-4-1-stable" do
10
+ gem "rails", "~> 4.1.1", github: 'rails/rails', branch: '4-1-stable'
11
+ end
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 3.2"
6
6
 
7
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 4.0"
5
+ gem "rails", "4.0.5"
6
6
 
7
- gemspec :path=>"../"
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 4.1.1", :github => "rails/rails", :branch => "4-1-stable"
6
+
7
+ gemspec :path => "../"
@@ -1,15 +1,24 @@
1
1
  require "ar_transaction_changes/version"
2
2
 
3
3
  module ArTransactionChanges
4
- create_or_update_suffix = ActiveRecord::VERSION::MAJOR <= 3 ? "" : "_record"
4
+ # rails 4.0.0: renamed create/update to create_record/update_record
5
+ # rails 4.0.6/4.1.2: prefixed create_record/update_record with an underscore
6
+ create_or_update_method_format = ["_%s_record", "%s_record", "%s"].detect do |format|
7
+ ["create", "update"].all? do |action|
8
+ method_name = format % action
9
+ ActiveRecord::Persistence.private_method_defined?(method_name.to_sym)
10
+ end
11
+ end or raise "Failed to find create/update record methods to monkey patch"
12
+ create_method_name = (create_or_update_method_format % "create").to_sym
13
+ update_method_name = (create_or_update_method_format % "update").to_sym
5
14
 
6
- define_method :"create#{create_or_update_suffix}" do |*args|
15
+ define_method(create_method_name) do |*args|
7
16
  super(*args).tap do |status|
8
17
  store_transaction_changed_attributes if status != false
9
18
  end
10
19
  end
11
20
 
12
- define_method :"update#{create_or_update_suffix}" do |*args|
21
+ define_method(update_method_name) do |*args|
13
22
  super(*args).tap do |status|
14
23
  store_transaction_changed_attributes if status != false
15
24
  end
@@ -1,3 +1,3 @@
1
1
  module ArTransactionChanges
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -8,8 +8,7 @@ require 'minitest/autorun'
8
8
  test_dir = Pathname.new(File.dirname(__FILE__))
9
9
  config_filename = test_dir.join("database.yml").exist? ? "database.yml" : "database.yml.default"
10
10
  database_yml = YAML.load(test_dir.join(config_filename).read)
11
- ActiveRecord::Base.configurations = database_yml
12
- ActiveRecord::Base.establish_connection "test"
11
+ ActiveRecord::Base.establish_connection database_yml['test']
13
12
 
14
13
  ActiveRecord::Base.connection.tap do |db|
15
14
  db.drop_table(:users) if db.table_exists?(:users)
metadata CHANGED
@@ -1,84 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_transaction_changes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dylan Thacker-Smith
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-15 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
- - - <
20
+ - - "<"
23
21
  - !ruby/object:Gem::Version
24
22
  version: '5.0'
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: '3.0'
33
- - - <
30
+ - - "<"
34
31
  - !ruby/object:Gem::Version
35
32
  version: '5.0'
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: rake
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
- - - ! '>='
37
+ - - ">="
42
38
  - !ruby/object:Gem::Version
43
39
  version: '0'
44
40
  type: :development
45
41
  prerelease: false
46
42
  version_requirements: !ruby/object:Gem::Requirement
47
- none: false
48
43
  requirements:
49
- - - ! '>='
44
+ - - ">="
50
45
  - !ruby/object:Gem::Version
51
46
  version: '0'
52
47
  - !ruby/object:Gem::Dependency
53
48
  name: mysql2
54
49
  requirement: !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
- - - ! '>='
51
+ - - ">="
58
52
  - !ruby/object:Gem::Version
59
53
  version: '0'
60
54
  type: :development
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
57
  requirements:
65
- - - ! '>='
58
+ - - ">="
66
59
  - !ruby/object:Gem::Version
67
60
  version: '0'
68
61
  - !ruby/object:Gem::Dependency
69
62
  name: appraisal
70
63
  requirement: !ruby/object:Gem::Requirement
71
- none: false
72
64
  requirements:
73
- - - ! '>='
65
+ - - ">="
74
66
  - !ruby/object:Gem::Version
75
67
  version: '0'
76
68
  type: :development
77
69
  prerelease: false
78
70
  version_requirements: !ruby/object:Gem::Requirement
79
- none: false
80
71
  requirements:
81
- - - ! '>='
72
+ - - ">="
82
73
  - !ruby/object:Gem::Version
83
74
  version: '0'
84
75
  description: Solves the problem of trying to get all the changes to an object during
@@ -89,16 +80,17 @@ executables: []
89
80
  extensions: []
90
81
  extra_rdoc_files: []
91
82
  files:
92
- - .gitignore
93
- - .travis.yml
83
+ - ".gitignore"
84
+ - ".travis.yml"
94
85
  - Appraisals
95
86
  - Gemfile
96
87
  - LICENSE.txt
97
88
  - README.md
98
89
  - Rakefile
99
90
  - ar_transaction_changes.gemspec
100
- - gemfiles/rails32.gemfile
101
- - gemfiles/rails4.gemfile
91
+ - gemfiles/rails_3_2.gemfile
92
+ - gemfiles/rails_4_0_5.gemfile
93
+ - gemfiles/rails_4_1_stable.gemfile
102
94
  - lib/ar_transaction_changes.rb
103
95
  - lib/ar_transaction_changes/version.rb
104
96
  - test/database.yml.default
@@ -107,27 +99,26 @@ files:
107
99
  - test/transaction_changes_test.rb
108
100
  homepage: ''
109
101
  licenses: []
102
+ metadata: {}
110
103
  post_install_message:
111
104
  rdoc_options: []
112
105
  require_paths:
113
106
  - lib
114
107
  required_ruby_version: !ruby/object:Gem::Requirement
115
- none: false
116
108
  requirements:
117
- - - ! '>='
109
+ - - ">="
118
110
  - !ruby/object:Gem::Version
119
111
  version: '0'
120
112
  required_rubygems_version: !ruby/object:Gem::Requirement
121
- none: false
122
113
  requirements:
123
- - - ! '>='
114
+ - - ">="
124
115
  - !ruby/object:Gem::Version
125
116
  version: '0'
126
117
  requirements: []
127
118
  rubyforge_project:
128
- rubygems_version: 1.8.23
119
+ rubygems_version: 2.2.2
129
120
  signing_key:
130
- specification_version: 3
121
+ specification_version: 4
131
122
  summary: Store transaction changes for active record objects
132
123
  test_files:
133
124
  - test/database.yml.default