laserlemon-vestal_versions 0.2.4 → 0.2.5
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.
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/lib/vestal_versions.rb +3 -6
- data/vestal_versions.gemspec +5 -4
- metadata +4 -4
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('vestal_versions', '0.2.
|
5
|
+
Echoe.new('vestal_versions', '0.2.5') do |g|
|
6
6
|
g.description = %(Keep a DRY history of your ActiveRecord models' changes)
|
7
7
|
g.url = 'http://github.com/laserlemon/vestal_versions'
|
8
8
|
g.author = 'Steve Richert'
|
data/VERSION.yml
CHANGED
data/lib/vestal_versions.rb
CHANGED
@@ -43,12 +43,10 @@ module LaserLemon
|
|
43
43
|
@version = nil
|
44
44
|
unless changes.blank?
|
45
45
|
if versions.empty?
|
46
|
-
content_columns = self.class.column_names.delete_if{|c| c == self.class.primary_key }.delete_if{|c| c =~ /^(cre|upd)ated_(at|on)$/ }
|
47
|
-
content_attributes = attributes.slice(*content_columns)
|
48
46
|
if new_record?
|
49
|
-
versions.build(:changes =>
|
47
|
+
versions.build(:changes => attributes)
|
50
48
|
else
|
51
|
-
reverted_attributes =
|
49
|
+
reverted_attributes = attributes.inject({}){|h,(k,v)| h.update(k => (changed.include?(k) ? changes[k].first : v)) }
|
52
50
|
version_timestamp = (try(:updated_at) || try(:created_at))
|
53
51
|
versions.build(:changes => reverted_attributes, :created_at => version_timestamp)
|
54
52
|
end
|
@@ -59,8 +57,7 @@ module LaserLemon
|
|
59
57
|
|
60
58
|
def version
|
61
59
|
@version ||= begin
|
62
|
-
last_version = versions.last
|
63
|
-
last_version.nil? ? 1 : last_version.number
|
60
|
+
new_record? || (last_version = versions.last).nil? ? 1 : last_version.number
|
64
61
|
end
|
65
62
|
end
|
66
63
|
|
data/vestal_versions.gemspec
CHANGED
@@ -2,26 +2,27 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{vestal_versions}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Steve Richert"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-12}
|
10
10
|
s.description = %q{Keep a DRY history of your ActiveRecord models' changes}
|
11
11
|
s.email = %q{steve@laserlemon.com}
|
12
12
|
s.extra_rdoc_files = ["lib/version.rb", "lib/vestal_versions.rb", "README.rdoc", "tasks/vestal_versions_tasks.rake"]
|
13
13
|
s.files = ["generators/vestal_versions_migration/templates/migration.rb", "generators/vestal_versions_migration/vestal_versions_migration_generator.rb", "init.rb", "lib/version.rb", "lib/vestal_versions.rb", "Manifest", "MIT-LICENSE", "Rakefile", "README.rdoc", "tasks/vestal_versions_tasks.rake", "test/test_helper.rb", "test/vestal_versions_test.rb", "VERSION.yml", "vestal_versions.gemspec"]
|
14
|
+
s.has_rdoc = true
|
14
15
|
s.homepage = %q{http://github.com/laserlemon/vestal_versions}
|
15
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Vestal_versions", "--main", "README.rdoc"]
|
16
17
|
s.require_paths = ["lib"]
|
17
18
|
s.rubyforge_project = %q{vestal_versions}
|
18
|
-
s.rubygems_version = %q{1.3.
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
19
20
|
s.summary = %q{Keep a DRY history of your ActiveRecord models' changes}
|
20
21
|
s.test_files = ["test/test_helper.rb", "test/vestal_versions_test.rb"]
|
21
22
|
|
22
23
|
if s.respond_to? :specification_version then
|
23
24
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
-
s.specification_version =
|
25
|
+
s.specification_version = 2
|
25
26
|
|
26
27
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
28
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: laserlemon-vestal_versions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Richert
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-12 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -39,7 +39,7 @@ files:
|
|
39
39
|
- test/vestal_versions_test.rb
|
40
40
|
- VERSION.yml
|
41
41
|
- vestal_versions.gemspec
|
42
|
-
has_rdoc:
|
42
|
+
has_rdoc: true
|
43
43
|
homepage: http://github.com/laserlemon/vestal_versions
|
44
44
|
post_install_message:
|
45
45
|
rdoc_options:
|
@@ -68,7 +68,7 @@ requirements: []
|
|
68
68
|
rubyforge_project: vestal_versions
|
69
69
|
rubygems_version: 1.2.0
|
70
70
|
signing_key:
|
71
|
-
specification_version:
|
71
|
+
specification_version: 2
|
72
72
|
summary: Keep a DRY history of your ActiveRecord models' changes
|
73
73
|
test_files:
|
74
74
|
- test/test_helper.rb
|