paper_trail 1.6.5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +107 -0
- data/MIT-LICENSE +20 -0
- data/README.md +11 -5
- data/Rakefile +1 -1
- data/lib/paper_trail.rb +9 -4
- data/lib/paper_trail/controller.rb +0 -2
- data/lib/paper_trail/has_paper_trail.rb +2 -3
- data/lib/paper_trail/version.rb +15 -18
- data/lib/paper_trail/version_number.rb +1 -1
- data/paper_trail.gemspec +17 -24
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +16 -0
- data/test/dummy/app/controllers/test_controller.rb +5 -0
- data/test/dummy/app/controllers/widgets_controller.rb +18 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/article.rb +11 -0
- data/test/dummy/app/models/authorship.rb +5 -0
- data/test/dummy/app/models/book.rb +5 -0
- data/test/dummy/app/models/fluxor.rb +3 -0
- data/test/dummy/app/models/foo_widget.rb +2 -0
- data/test/dummy/app/models/person.rb +5 -0
- data/test/dummy/app/models/song.rb +12 -0
- data/test/dummy/app/models/widget.rb +5 -0
- data/test/dummy/app/models/wotsit.rb +4 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +45 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +22 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb +84 -0
- data/test/dummy/db/schema.rb +82 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/javascripts/application.js +2 -0
- data/test/dummy/public/javascripts/controls.js +965 -0
- data/test/dummy/public/javascripts/dragdrop.js +974 -0
- data/test/dummy/public/javascripts/effects.js +1123 -0
- data/test/dummy/public/javascripts/prototype.js +6001 -0
- data/test/dummy/public/javascripts/rails.js +175 -0
- data/test/dummy/public/stylesheets/.gitkeep +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/{paper_trail_controller_test.rb → functional/controller_test.rb} +7 -44
- data/test/{thread_safe_test.rb → functional/thread_safety_test.rb} +1 -7
- data/test/integration/navigation_test.rb +7 -0
- data/test/paper_trail_test.rb +7 -0
- data/test/support/integration_case.rb +5 -0
- data/test/test_helper.rb +27 -33
- data/test/{paper_trail_model_test.rb → unit/model_test.rb} +5 -68
- metadata +138 -123
- data/generators/paper_trail/USAGE +0 -2
- data/generators/paper_trail/paper_trail_generator.rb +0 -9
- data/generators/paper_trail/templates/create_versions.rb +0 -18
- data/init.rb +0 -1
- data/install.rb +0 -1
- data/test/paper_trail_schema_test.rb +0 -15
- data/test/schema.rb +0 -71
- data/test/schema_change.rb +0 -3
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paper_trail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 2.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Stewart
|
@@ -19,40 +19,22 @@ date: 2011-02-08 00:00:00 +00:00
|
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name: bundler
|
23
22
|
prerelease: false
|
24
|
-
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
27
26
|
- - ~>
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
version: "1.0"
|
34
|
-
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rake
|
38
|
-
prerelease: false
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - "="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 49
|
28
|
+
hash: 5
|
45
29
|
segments:
|
46
|
-
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
type: :
|
51
|
-
version_requirements: *id002
|
30
|
+
- 3
|
31
|
+
version: "3"
|
32
|
+
requirement: *id001
|
33
|
+
name: rails
|
34
|
+
type: :runtime
|
52
35
|
- !ruby/object:Gem::Dependency
|
53
|
-
name: shoulda
|
54
36
|
prerelease: false
|
55
|
-
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
56
38
|
none: false
|
57
39
|
requirements:
|
58
40
|
- - "="
|
@@ -63,27 +45,12 @@ dependencies:
|
|
63
45
|
- 10
|
64
46
|
- 3
|
65
47
|
version: 2.10.3
|
48
|
+
requirement: *id002
|
49
|
+
name: shoulda
|
66
50
|
type: :development
|
67
|
-
version_requirements: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: activesupport
|
70
|
-
prerelease: false
|
71
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
hash: 5
|
77
|
-
segments:
|
78
|
-
- 2
|
79
|
-
- 3
|
80
|
-
version: "2.3"
|
81
|
-
type: :development
|
82
|
-
version_requirements: *id004
|
83
51
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: sqlite3-ruby
|
85
52
|
prerelease: false
|
86
|
-
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
87
54
|
none: false
|
88
55
|
requirements:
|
89
56
|
- - ~>
|
@@ -93,68 +60,25 @@ dependencies:
|
|
93
60
|
- 1
|
94
61
|
- 2
|
95
62
|
version: "1.2"
|
63
|
+
requirement: *id003
|
64
|
+
name: sqlite3-ruby
|
96
65
|
type: :development
|
97
|
-
version_requirements: *id005
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: activerecord
|
100
|
-
prerelease: false
|
101
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
|
-
requirements:
|
104
|
-
- - ~>
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
hash: 5
|
107
|
-
segments:
|
108
|
-
- 2
|
109
|
-
- 3
|
110
|
-
version: "2.3"
|
111
|
-
type: :development
|
112
|
-
version_requirements: *id006
|
113
66
|
- !ruby/object:Gem::Dependency
|
114
|
-
name: actionpack
|
115
67
|
prerelease: false
|
116
|
-
|
68
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
117
69
|
none: false
|
118
70
|
requirements:
|
119
|
-
- -
|
71
|
+
- - ">="
|
120
72
|
- !ruby/object:Gem::Version
|
121
|
-
hash:
|
73
|
+
hash: 15
|
122
74
|
segments:
|
123
|
-
-
|
124
|
-
-
|
125
|
-
|
75
|
+
- 0
|
76
|
+
- 4
|
77
|
+
- 0
|
78
|
+
version: 0.4.0
|
79
|
+
requirement: *id004
|
80
|
+
name: capybara
|
126
81
|
type: :development
|
127
|
-
version_requirements: *id007
|
128
|
-
- !ruby/object:Gem::Dependency
|
129
|
-
name: activerecord
|
130
|
-
prerelease: false
|
131
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
132
|
-
none: false
|
133
|
-
requirements:
|
134
|
-
- - ~>
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
hash: 5
|
137
|
-
segments:
|
138
|
-
- 2
|
139
|
-
- 3
|
140
|
-
version: "2.3"
|
141
|
-
type: :runtime
|
142
|
-
version_requirements: *id008
|
143
|
-
- !ruby/object:Gem::Dependency
|
144
|
-
name: actionpack
|
145
|
-
prerelease: false
|
146
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
|
-
requirements:
|
149
|
-
- - ~>
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
hash: 5
|
152
|
-
segments:
|
153
|
-
- 2
|
154
|
-
- 3
|
155
|
-
version: "2.3"
|
156
|
-
type: :runtime
|
157
|
-
version_requirements: *id009
|
158
82
|
description: Track changes to your models' data. Good for auditing or versioning.
|
159
83
|
email: boss@airbladesoftware.com
|
160
84
|
executables: []
|
@@ -164,30 +88,75 @@ extensions: []
|
|
164
88
|
extra_rdoc_files: []
|
165
89
|
|
166
90
|
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- MIT-LICENSE
|
167
95
|
- README.md
|
168
96
|
- Rakefile
|
169
|
-
- paper_trail
|
170
|
-
- init.rb
|
171
|
-
- install.rb
|
97
|
+
- lib/generators/paper_trail/USAGE
|
172
98
|
- lib/generators/paper_trail/paper_trail_generator.rb
|
173
99
|
- lib/generators/paper_trail/templates/create_versions.rb
|
174
|
-
- lib/
|
100
|
+
- lib/paper_trail.rb
|
175
101
|
- lib/paper_trail/config.rb
|
176
102
|
- lib/paper_trail/controller.rb
|
177
103
|
- lib/paper_trail/has_paper_trail.rb
|
178
104
|
- lib/paper_trail/version.rb
|
179
105
|
- lib/paper_trail/version_number.rb
|
180
|
-
-
|
181
|
-
-
|
182
|
-
-
|
183
|
-
-
|
184
|
-
- test/
|
185
|
-
- test/
|
186
|
-
- test/
|
187
|
-
- test/
|
188
|
-
- test/
|
106
|
+
- paper_trail.gemspec
|
107
|
+
- test/dummy/Rakefile
|
108
|
+
- test/dummy/app/controllers/application_controller.rb
|
109
|
+
- test/dummy/app/controllers/test_controller.rb
|
110
|
+
- test/dummy/app/controllers/widgets_controller.rb
|
111
|
+
- test/dummy/app/helpers/application_helper.rb
|
112
|
+
- test/dummy/app/models/article.rb
|
113
|
+
- test/dummy/app/models/authorship.rb
|
114
|
+
- test/dummy/app/models/book.rb
|
115
|
+
- test/dummy/app/models/fluxor.rb
|
116
|
+
- test/dummy/app/models/foo_widget.rb
|
117
|
+
- test/dummy/app/models/person.rb
|
118
|
+
- test/dummy/app/models/song.rb
|
119
|
+
- test/dummy/app/models/widget.rb
|
120
|
+
- test/dummy/app/models/wotsit.rb
|
121
|
+
- test/dummy/app/views/layouts/application.html.erb
|
122
|
+
- test/dummy/config.ru
|
123
|
+
- test/dummy/config/application.rb
|
124
|
+
- test/dummy/config/boot.rb
|
125
|
+
- test/dummy/config/database.yml
|
126
|
+
- test/dummy/config/environment.rb
|
127
|
+
- test/dummy/config/environments/development.rb
|
128
|
+
- test/dummy/config/environments/production.rb
|
129
|
+
- test/dummy/config/environments/test.rb
|
130
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
131
|
+
- test/dummy/config/initializers/inflections.rb
|
132
|
+
- test/dummy/config/initializers/mime_types.rb
|
133
|
+
- test/dummy/config/initializers/secret_token.rb
|
134
|
+
- test/dummy/config/initializers/session_store.rb
|
135
|
+
- test/dummy/config/locales/en.yml
|
136
|
+
- test/dummy/config/routes.rb
|
137
|
+
- test/dummy/db/development.sqlite3
|
138
|
+
- test/dummy/db/migrate/20110208155312_set_up_test_tables.rb
|
139
|
+
- test/dummy/db/schema.rb
|
140
|
+
- test/dummy/db/test.sqlite3
|
141
|
+
- test/dummy/public/404.html
|
142
|
+
- test/dummy/public/422.html
|
143
|
+
- test/dummy/public/500.html
|
144
|
+
- test/dummy/public/favicon.ico
|
145
|
+
- test/dummy/public/javascripts/application.js
|
146
|
+
- test/dummy/public/javascripts/controls.js
|
147
|
+
- test/dummy/public/javascripts/dragdrop.js
|
148
|
+
- test/dummy/public/javascripts/effects.js
|
149
|
+
- test/dummy/public/javascripts/prototype.js
|
150
|
+
- test/dummy/public/javascripts/rails.js
|
151
|
+
- test/dummy/public/stylesheets/.gitkeep
|
152
|
+
- test/dummy/script/rails
|
153
|
+
- test/functional/controller_test.rb
|
154
|
+
- test/functional/thread_safety_test.rb
|
155
|
+
- test/integration/navigation_test.rb
|
156
|
+
- test/paper_trail_test.rb
|
157
|
+
- test/support/integration_case.rb
|
189
158
|
- test/test_helper.rb
|
190
|
-
- test/
|
159
|
+
- test/unit/model_test.rb
|
191
160
|
has_rdoc: true
|
192
161
|
homepage: http://github.com/airblade/paper_trail
|
193
162
|
licenses: []
|
@@ -223,10 +192,56 @@ signing_key:
|
|
223
192
|
specification_version: 3
|
224
193
|
summary: Track changes to your models' data. Good for auditing or versioning.
|
225
194
|
test_files:
|
226
|
-
- test/
|
227
|
-
- test/
|
228
|
-
- test/
|
229
|
-
- test/
|
230
|
-
- test/
|
195
|
+
- test/dummy/Rakefile
|
196
|
+
- test/dummy/app/controllers/application_controller.rb
|
197
|
+
- test/dummy/app/controllers/test_controller.rb
|
198
|
+
- test/dummy/app/controllers/widgets_controller.rb
|
199
|
+
- test/dummy/app/helpers/application_helper.rb
|
200
|
+
- test/dummy/app/models/article.rb
|
201
|
+
- test/dummy/app/models/authorship.rb
|
202
|
+
- test/dummy/app/models/book.rb
|
203
|
+
- test/dummy/app/models/fluxor.rb
|
204
|
+
- test/dummy/app/models/foo_widget.rb
|
205
|
+
- test/dummy/app/models/person.rb
|
206
|
+
- test/dummy/app/models/song.rb
|
207
|
+
- test/dummy/app/models/widget.rb
|
208
|
+
- test/dummy/app/models/wotsit.rb
|
209
|
+
- test/dummy/app/views/layouts/application.html.erb
|
210
|
+
- test/dummy/config.ru
|
211
|
+
- test/dummy/config/application.rb
|
212
|
+
- test/dummy/config/boot.rb
|
213
|
+
- test/dummy/config/database.yml
|
214
|
+
- test/dummy/config/environment.rb
|
215
|
+
- test/dummy/config/environments/development.rb
|
216
|
+
- test/dummy/config/environments/production.rb
|
217
|
+
- test/dummy/config/environments/test.rb
|
218
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
219
|
+
- test/dummy/config/initializers/inflections.rb
|
220
|
+
- test/dummy/config/initializers/mime_types.rb
|
221
|
+
- test/dummy/config/initializers/secret_token.rb
|
222
|
+
- test/dummy/config/initializers/session_store.rb
|
223
|
+
- test/dummy/config/locales/en.yml
|
224
|
+
- test/dummy/config/routes.rb
|
225
|
+
- test/dummy/db/development.sqlite3
|
226
|
+
- test/dummy/db/migrate/20110208155312_set_up_test_tables.rb
|
227
|
+
- test/dummy/db/schema.rb
|
228
|
+
- test/dummy/db/test.sqlite3
|
229
|
+
- test/dummy/public/404.html
|
230
|
+
- test/dummy/public/422.html
|
231
|
+
- test/dummy/public/500.html
|
232
|
+
- test/dummy/public/favicon.ico
|
233
|
+
- test/dummy/public/javascripts/application.js
|
234
|
+
- test/dummy/public/javascripts/controls.js
|
235
|
+
- test/dummy/public/javascripts/dragdrop.js
|
236
|
+
- test/dummy/public/javascripts/effects.js
|
237
|
+
- test/dummy/public/javascripts/prototype.js
|
238
|
+
- test/dummy/public/javascripts/rails.js
|
239
|
+
- test/dummy/public/stylesheets/.gitkeep
|
240
|
+
- test/dummy/script/rails
|
241
|
+
- test/functional/controller_test.rb
|
242
|
+
- test/functional/thread_safety_test.rb
|
243
|
+
- test/integration/navigation_test.rb
|
244
|
+
- test/paper_trail_test.rb
|
245
|
+
- test/support/integration_case.rb
|
231
246
|
- test/test_helper.rb
|
232
|
-
- test/
|
247
|
+
- test/unit/model_test.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
class CreateVersions < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :versions do |t|
|
4
|
-
t.string :item_type, :null => false
|
5
|
-
t.integer :item_id, :null => false
|
6
|
-
t.string :event, :null => false
|
7
|
-
t.string :whodunnit
|
8
|
-
t.text :object
|
9
|
-
t.datetime :created_at
|
10
|
-
end
|
11
|
-
add_index :versions, [:item_type, :item_id]
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.down
|
15
|
-
remove_index :versions, [:item_type, :item_id]
|
16
|
-
drop_table :versions
|
17
|
-
end
|
18
|
-
end
|
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'paper_trail'
|
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
puts 'You have chosen wisely.'
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PaperTrailSchemaTest < ActiveSupport::TestCase
|
4
|
-
def setup
|
5
|
-
load_schema
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_schema_has_loaded_correctly
|
9
|
-
assert_equal [], Widget.all
|
10
|
-
assert_equal [], Version.all
|
11
|
-
assert_equal [], Wotsit.all
|
12
|
-
assert_equal [], Fluxor.all
|
13
|
-
assert_equal [], Article.all
|
14
|
-
end
|
15
|
-
end
|
data/test/schema.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
ActiveRecord::Schema.define(:version => 0) do
|
2
|
-
|
3
|
-
create_table :widgets, :force => true do |t|
|
4
|
-
t.string :name
|
5
|
-
t.text :a_text
|
6
|
-
t.integer :an_integer
|
7
|
-
t.float :a_float
|
8
|
-
t.decimal :a_decimal
|
9
|
-
t.datetime :a_datetime
|
10
|
-
t.time :a_time
|
11
|
-
t.date :a_date
|
12
|
-
t.boolean :a_boolean
|
13
|
-
t.datetime :created_at, :updated_at
|
14
|
-
t.string :sacrificial_column
|
15
|
-
t.string :type
|
16
|
-
end
|
17
|
-
|
18
|
-
create_table :versions, :force => true do |t|
|
19
|
-
t.string :item_type, :null => false
|
20
|
-
t.integer :item_id, :null => false
|
21
|
-
t.string :event, :null => false
|
22
|
-
t.string :whodunnit
|
23
|
-
t.text :object
|
24
|
-
t.datetime :created_at
|
25
|
-
|
26
|
-
# Metadata columns.
|
27
|
-
t.integer :answer
|
28
|
-
t.string :action
|
29
|
-
t.string :question
|
30
|
-
t.integer :article_id
|
31
|
-
|
32
|
-
# Controller info columns.
|
33
|
-
t.string :ip
|
34
|
-
t.string :user_agent
|
35
|
-
end
|
36
|
-
add_index :versions, [:item_type, :item_id]
|
37
|
-
|
38
|
-
create_table :wotsits, :force => true do |t|
|
39
|
-
t.integer :widget_id
|
40
|
-
t.string :name
|
41
|
-
t.datetime :created_at, :updated_at
|
42
|
-
end
|
43
|
-
|
44
|
-
create_table :fluxors, :force => true do |t|
|
45
|
-
t.integer :widget_id
|
46
|
-
t.string :name
|
47
|
-
end
|
48
|
-
|
49
|
-
create_table :articles, :force => true do |t|
|
50
|
-
t.string :title
|
51
|
-
t.string :content
|
52
|
-
end
|
53
|
-
|
54
|
-
create_table :books, :force => true do |t|
|
55
|
-
t.string :title
|
56
|
-
end
|
57
|
-
|
58
|
-
create_table :authorships, :force => true do |t|
|
59
|
-
t.integer :book_id
|
60
|
-
t.integer :person_id
|
61
|
-
end
|
62
|
-
|
63
|
-
create_table :people, :force => true do |t|
|
64
|
-
t.string :name
|
65
|
-
end
|
66
|
-
|
67
|
-
create_table :songs, :force => true do |t|
|
68
|
-
t.integer :length
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|