acts_as_revisionable 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,14 +6,13 @@ desc 'Default: run unit tests.'
6
6
  task :default => :test
7
7
 
8
8
  begin
9
- require 'spec/rake/spectask'
10
- desc 'Test the gem.'
11
- Spec::Rake::SpecTask.new(:test) do |t|
12
- t.spec_files = FileList.new('spec/**/*_spec.rb')
13
- end
9
+ require 'rspec'
10
+ require 'rspec/core/rake_task'
11
+ desc 'Run the unit tests'
12
+ RSpec::Core::RakeTask.new(:test)
14
13
  rescue LoadError
15
- tast :test do
16
- STDERR.puts "You must have rspec >= 1.3.0 to run the tests"
14
+ task :test do
15
+ STDERR.puts "You must have rspec 2.0 installed to run the tests"
17
16
  end
18
17
  end
19
18
 
@@ -38,7 +37,7 @@ begin
38
37
 
39
38
  gem.add_dependency('activerecord', '>= 2.2')
40
39
  gem.add_development_dependency('sqlite3')
41
- gem.add_development_dependency('rspec', '>= 1.3.0')
40
+ gem.add_development_dependency('rspec', '>= 2.0.0')
42
41
  gem.add_development_dependency('jeweler')
43
42
  end
44
43
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
@@ -1,65 +1,63 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_revisionable}
8
- s.version = "1.0.4"
8
+ s.version = "1.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Durand"]
12
- s.date = %q{2010-10-08}
12
+ s.date = %q{2011-01-28}
13
13
  s.description = %q{ActiveRecord extension that provides revision support so that history can be tracked and changes can be reverted. Emphasis for this plugin versus similar ones is including associations, saving on storage, and extensibility of the model.}
14
14
  s.email = %q{brian@embellishedvisions.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
- ".gitignore",
20
- "MIT-LICENSE",
21
- "README.rdoc",
22
- "Rakefile",
23
- "VERSION",
24
- "acts_as_revisionable.gemspec",
25
- "lib/acts_as_revisionable.rb",
26
- "lib/acts_as_revisionable/revision_record.rb",
27
- "spec/acts_as_revisionable_spec.rb",
28
- "spec/full_spec.rb",
29
- "spec/revision_record_spec.rb",
30
- "spec/spec_helper.rb"
19
+ "MIT-LICENSE",
20
+ "README.rdoc",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "acts_as_revisionable.gemspec",
24
+ "lib/acts_as_revisionable.rb",
25
+ "lib/acts_as_revisionable/revision_record.rb",
26
+ "spec/acts_as_revisionable_spec.rb",
27
+ "spec/full_spec.rb",
28
+ "spec/revision_record_spec.rb",
29
+ "spec/spec_helper.rb"
31
30
  ]
32
31
  s.homepage = %q{http://github.com/bdurand/acts_as_revisionable}
33
32
  s.rdoc_options = ["--charset=UTF-8", "--main", "README.rdoc"]
34
33
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.7}
34
+ s.rubygems_version = %q{1.4.1}
36
35
  s.summary = %q{ActiveRecord extension that provides revision support so that history can be tracked and changes can be reverted.}
37
36
  s.test_files = [
38
37
  "spec/acts_as_revisionable_spec.rb",
39
- "spec/full_spec.rb",
40
- "spec/revision_record_spec.rb",
41
- "spec/spec_helper.rb"
38
+ "spec/full_spec.rb",
39
+ "spec/revision_record_spec.rb",
40
+ "spec/spec_helper.rb"
42
41
  ]
43
42
 
44
43
  if s.respond_to? :specification_version then
45
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
44
  s.specification_version = 3
47
45
 
48
46
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
47
  s.add_runtime_dependency(%q<activerecord>, [">= 2.2"])
50
48
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
51
- s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
49
+ s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
52
50
  s.add_development_dependency(%q<jeweler>, [">= 0"])
53
51
  else
54
52
  s.add_dependency(%q<activerecord>, [">= 2.2"])
55
53
  s.add_dependency(%q<sqlite3>, [">= 0"])
56
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
54
+ s.add_dependency(%q<rspec>, [">= 2.0.0"])
57
55
  s.add_dependency(%q<jeweler>, [">= 0"])
58
56
  end
59
57
  else
60
58
  s.add_dependency(%q<activerecord>, [">= 2.2"])
61
59
  s.add_dependency(%q<sqlite3>, [">= 0"])
62
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
60
+ s.add_dependency(%q<rspec>, [">= 2.0.0"])
63
61
  s.add_dependency(%q<jeweler>, [">= 0"])
64
62
  end
65
63
  end
@@ -75,8 +75,8 @@ module ActsAsRevisionable
75
75
  sti_type = (/^::/ =~ type_name) ? type_name : "#{restore_class.parent.name}::#{type_name}"
76
76
  end
77
77
  restore_class = sti_type.constantize
78
- rescue NameError
79
- raise
78
+ rescue NameError => e
79
+ raise e
80
80
  # Seems our assumption was wrong and we have no STI
81
81
  end
82
82
  end
@@ -95,8 +95,10 @@ module ActsAsRevisionable
95
95
  association_attrs.each_pair do |association, attribute_values|
96
96
  restore_association(record, association, attribute_values)
97
97
  end
98
-
99
- record.instance_variable_set(:@new_record, nil)
98
+
99
+ record.instance_variable_set(:@new_record, nil) if record.instance_variable_defined?(:@new_record)
100
+ # ActiveRecord 3.0.2 and 3.0.3 used @persisted instead of @new_record
101
+ record.instance_variable_set(:@persisted, true) if record.instance_variable_defined?(:@persisted)
100
102
 
101
103
  return record
102
104
  end
@@ -220,8 +222,12 @@ module ActsAsRevisionable
220
222
  association_attrs.each_pair do |key, values|
221
223
  restore_association(associated_record, key, values)
222
224
  end
223
-
224
- associated_record.instance_variable_set(:@new_record, nil) if exists
225
+
226
+ if exists
227
+ associated_record.instance_variable_set(:@new_record, nil) if associated_record.instance_variable_defined?(:@new_record)
228
+ # ActiveRecord 3.0.2 and 3.0.3 used @persisted instead of @new_record
229
+ associated_record.instance_variable_set(:@persisted, true) if associated_record.instance_variable_defined?(:@persisted)
230
+ end
225
231
  end
226
232
  end
227
233
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,11 @@
1
1
  require 'rubygems'
2
+
3
+ if ENV["ACTIVE_RECORD_VERSION"]
4
+ gem 'activerecord', ENV["ACTIVE_RECORD_VERSION"]
5
+ else
6
+ gem 'activerecord'
7
+ end
8
+
2
9
  require File.expand_path('../../lib/acts_as_revisionable', __FILE__)
3
10
  require 'sqlite3'
4
11
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_revisionable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 29
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Durand
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-08 00:00:00 -05:00
18
+ date: 2011-01-28 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -55,12 +55,12 @@ dependencies:
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
- hash: 27
58
+ hash: 15
59
59
  segments:
60
- - 1
61
- - 3
60
+ - 2
61
+ - 0
62
62
  - 0
63
- version: 1.3.0
63
+ version: 2.0.0
64
64
  type: :development
65
65
  version_requirements: *id003
66
66
  - !ruby/object:Gem::Dependency
@@ -86,7 +86,6 @@ extensions: []
86
86
  extra_rdoc_files:
87
87
  - README.rdoc
88
88
  files:
89
- - .gitignore
90
89
  - MIT-LICENSE
91
90
  - README.rdoc
92
91
  - Rakefile
@@ -130,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
129
  requirements: []
131
130
 
132
131
  rubyforge_project:
133
- rubygems_version: 1.3.7
132
+ rubygems_version: 1.4.1
134
133
  signing_key:
135
134
  specification_version: 3
136
135
  summary: ActiveRecord extension that provides revision support so that history can be tracked and changes can be reverted.
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- pkg