revisions 0.1.1 → 0.3.0
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/VERSION +1 -1
- data/lib/revisions.rb +3 -3
- data/revisions.gemspec +18 -27
- metadata +17 -16
- data/.gitignore +0 -21
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/revisions.rb
CHANGED
@@ -4,7 +4,7 @@ module Revisions
|
|
4
4
|
STATUSES = ['draft', 'published', 'revision']
|
5
5
|
|
6
6
|
def has_revisions opts={}
|
7
|
-
|
7
|
+
class_attribute :unrevised_attributes
|
8
8
|
|
9
9
|
has_many :revisions,
|
10
10
|
:class_name => self.name,
|
@@ -37,7 +37,7 @@ module Revisions
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def save_revision
|
40
|
-
new_copy = self.
|
40
|
+
new_copy = self.dup
|
41
41
|
attributes_to_nil = {}
|
42
42
|
self.unrevised_attributes.each {|a| attributes_to_nil[a] = nil }
|
43
43
|
new_copy.attributes=attributes_to_nil
|
@@ -47,7 +47,7 @@ module Revisions
|
|
47
47
|
if new_copy.save
|
48
48
|
true
|
49
49
|
else
|
50
|
-
new_copy.errors.each {|attribute,message| self.errors
|
50
|
+
new_copy.errors.each {|attribute,message| self.errors[attribute] = message}
|
51
51
|
false
|
52
52
|
end
|
53
53
|
end
|
data/revisions.gemspec
CHANGED
@@ -1,52 +1,43 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
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{revisions}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{
|
11
|
+
s.authors = [%q{Brian Hamman}]
|
12
|
+
s.date = %q{2011-10-12}
|
13
13
|
s.description = %q{Save and apply revisions to a model, while keeping track of old revisiions}
|
14
14
|
s.email = %q{hamman@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
"test/test_revisions.rb"
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/revisions.rb",
|
26
|
+
"revisions.gemspec",
|
27
|
+
"test/helper.rb",
|
28
|
+
"test/models.rb",
|
29
|
+
"test/schema.rb",
|
30
|
+
"test/test_revisions.rb"
|
32
31
|
]
|
33
32
|
s.homepage = %q{http://github.com/hamman/revisions}
|
34
|
-
s.
|
35
|
-
s.
|
36
|
-
s.rubygems_version = %q{1.3.6}
|
33
|
+
s.require_paths = [%q{lib}]
|
34
|
+
s.rubygems_version = %q{1.8.8}
|
37
35
|
s.summary = %q{A lightweight way to handle Wordpress-like revisions}
|
38
|
-
s.test_files = [
|
39
|
-
"test/helper.rb",
|
40
|
-
"test/models.rb",
|
41
|
-
"test/schema.rb",
|
42
|
-
"test/test_revisions.rb"
|
43
|
-
]
|
44
36
|
|
45
37
|
if s.respond_to? :specification_version then
|
46
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
38
|
s.specification_version = 3
|
48
39
|
|
49
|
-
if Gem::Version.new(Gem::
|
40
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
41
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
51
42
|
else
|
52
43
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revisions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Brian Hamman
|
@@ -14,16 +15,17 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2011-10-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: thoughtbot-shoulda
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
27
29
|
segments:
|
28
30
|
- 0
|
29
31
|
version: "0"
|
@@ -40,7 +42,6 @@ extra_rdoc_files:
|
|
40
42
|
- README.rdoc
|
41
43
|
files:
|
42
44
|
- .document
|
43
|
-
- .gitignore
|
44
45
|
- LICENSE
|
45
46
|
- README.rdoc
|
46
47
|
- Rakefile
|
@@ -51,38 +52,38 @@ files:
|
|
51
52
|
- test/models.rb
|
52
53
|
- test/schema.rb
|
53
54
|
- test/test_revisions.rb
|
54
|
-
has_rdoc: true
|
55
55
|
homepage: http://github.com/hamman/revisions
|
56
56
|
licenses: []
|
57
57
|
|
58
58
|
post_install_message:
|
59
|
-
rdoc_options:
|
60
|
-
|
59
|
+
rdoc_options: []
|
60
|
+
|
61
61
|
require_paths:
|
62
62
|
- lib
|
63
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
64
65
|
requirements:
|
65
66
|
- - ">="
|
66
67
|
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
67
69
|
segments:
|
68
70
|
- 0
|
69
71
|
version: "0"
|
70
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
71
74
|
requirements:
|
72
75
|
- - ">="
|
73
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
74
78
|
segments:
|
75
79
|
- 0
|
76
80
|
version: "0"
|
77
81
|
requirements: []
|
78
82
|
|
79
83
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.8.8
|
81
85
|
signing_key:
|
82
86
|
specification_version: 3
|
83
87
|
summary: A lightweight way to handle Wordpress-like revisions
|
84
|
-
test_files:
|
85
|
-
|
86
|
-
- test/models.rb
|
87
|
-
- test/schema.rb
|
88
|
-
- test/test_revisions.rb
|
88
|
+
test_files: []
|
89
|
+
|