archivist 1.0.5.1 → 1.1.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.
Files changed (58) hide show
  1. data/MIT-LICENSE +17 -15
  2. data/README.rdoc +3 -0
  3. data/Rakefile +36 -0
  4. data/lib/archivist.rb +0 -1
  5. data/lib/archivist/archive.rb +10 -4
  6. data/lib/archivist/base.rb +59 -51
  7. data/lib/archivist/migration.rb +1 -1
  8. data/lib/archivist/version.rb +3 -0
  9. data/lib/tasks/archivist_tasks.rake +4 -0
  10. data/test/archive_test.rb +16 -0
  11. data/test/archivist_test.rb +17 -0
  12. data/test/base_test.rb +342 -0
  13. data/test/db/migrate/01_add_to_some_models.rb +11 -0
  14. data/test/db_test.rb +42 -0
  15. data/test/dummy/README.rdoc +261 -0
  16. data/test/dummy/Rakefile +7 -0
  17. data/test/dummy/app/assets/javascripts/application.js +15 -0
  18. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  19. data/test/dummy/app/controllers/application_controller.rb +3 -0
  20. data/test/dummy/app/helpers/application_helper.rb +2 -0
  21. data/test/dummy/app/models/another_model.rb +4 -0
  22. data/test/dummy/app/models/some_model.rb +12 -0
  23. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  24. data/test/dummy/config.ru +4 -0
  25. data/test/dummy/config/application.rb +61 -0
  26. data/test/dummy/config/boot.rb +10 -0
  27. data/test/dummy/config/database.yml +19 -0
  28. data/test/dummy/config/environment.rb +5 -0
  29. data/test/dummy/config/environments/development.rb +37 -0
  30. data/test/dummy/config/environments/production.rb +67 -0
  31. data/test/dummy/config/environments/test.rb +37 -0
  32. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/test/dummy/config/initializers/inflections.rb +15 -0
  34. data/test/dummy/config/initializers/mime_types.rb +5 -0
  35. data/test/dummy/config/initializers/secret_token.rb +7 -0
  36. data/test/dummy/config/initializers/session_store.rb +8 -0
  37. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  38. data/test/dummy/config/locales/en.yml +5 -0
  39. data/test/dummy/config/routes.rb +58 -0
  40. data/test/dummy/db/schema.rb +41 -0
  41. data/test/dummy/db/test.sqlite3 +0 -0
  42. data/test/dummy/lib/this_module.rb +3 -0
  43. data/test/dummy/log/development.log +7 -0
  44. data/test/dummy/log/test.log +35228 -0
  45. data/test/dummy/public/404.html +26 -0
  46. data/test/dummy/public/422.html +26 -0
  47. data/test/dummy/public/500.html +25 -0
  48. data/test/dummy/public/favicon.ico +0 -0
  49. data/test/dummy/script/rails +6 -0
  50. data/test/dummy/test/fixtures/another_models.yml +9 -0
  51. data/test/dummy/test/fixtures/some_models.yml +13 -0
  52. data/test/dummy/test/unit/another_model_test.rb +7 -0
  53. data/test/dummy/test/unit/some_model_test.rb +7 -0
  54. data/test/factories/some_model_factory.rb +8 -0
  55. data/test/migration_test.rb +69 -0
  56. data/test/test_helper.rb +27 -0
  57. metadata +210 -16
  58. data/README.md +0 -162
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ first_name: MyString
5
+ last_name: MyString
6
+
7
+ two:
8
+ first_name: MyString
9
+ last_name: MyString
@@ -0,0 +1,13 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ first_name: MyString
5
+ last_name: MyString
6
+ random_array: MyString
7
+ some_hash: MyString
8
+
9
+ two:
10
+ first_name: MyString
11
+ last_name: MyString
12
+ random_array: MyString
13
+ some_hash: MyString
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class AnotherModelTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class SomeModelTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,8 @@
1
+ FactoryGirl.define do
2
+ factory :some_model do
3
+ first_name 'Scott'
4
+ last_name 'Adams'
5
+ random_array [1,2,3,4]
6
+ some_hash { {:cat => 'Catbert'} }
7
+ end
8
+ end
@@ -0,0 +1,69 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require File.join(File.dirname(__FILE__),'db','migrate','01_add_to_some_models')
3
+
4
+ class MigrationTest < ActiveSupport::TestCase
5
+ context "The Migrations module" do
6
+ context "when migrating up" do
7
+ setup do
8
+ orig_stdout = $stdout
9
+ $stdout = File.new('/dev/null','w')
10
+ @old_columns = column_list("some_models")
11
+ @old_archive = column_list("archived_some_models")
12
+ AddToSomeModels.migrate(:up)
13
+ @new_columns = column_list("some_models")
14
+ puts @old_columns.inspect
15
+ puts @new_columns.inspect
16
+ @new_archive = column_list("archived_some_models")
17
+ $stdout = orig_stdout
18
+ end
19
+
20
+ teardown do
21
+ orig_stdout = $stdout
22
+ $stdout = File.new('/dev/null','w')
23
+ AddToSomeModels.migrate(:down)
24
+ $stdout = orig_stdout
25
+ end
26
+
27
+ should "migrate the original table" do
28
+ assert_equal ['birth_date','height'],(@new_columns - @old_columns)
29
+ end
30
+
31
+ should "migrate the archive table" do
32
+ assert_equal ['birth_date','height'],(@new_archive - @old_archive)
33
+ end
34
+ end
35
+
36
+ context "when migrating down" do
37
+ setup do
38
+ orig_stdout = $stdout
39
+ $stdout = File.new('/dev/null','w')
40
+ AddToSomeModels.migrate(:up)
41
+ @old_columns = column_list("some_models")
42
+ puts @old_columns*','
43
+ @old_archive = column_list("archived_some_models")
44
+ AddToSomeModels.migrate(:down)
45
+ @new_columns = column_list("some_models")
46
+ @new_archive = column_list("archived_some_models")
47
+ $stdout = orig_stdout
48
+ end
49
+
50
+ should "migrate the original table" do
51
+ assert_equal ['birth_date','height'],(@old_columns - @new_columns)
52
+ end
53
+
54
+ should "migrate the archive table" do
55
+ assert_equal ['birth_date','height'],(@old_archive - @new_archive)
56
+ end
57
+ end
58
+
59
+ if ActiveRecord::VERSION::STRING >= "3.1"
60
+ context "when generating new migrations in Rails 3.1+" do
61
+ should "not munge up the timestamped file names" do
62
+ # debugger
63
+ next_number = AddToSomeModels.next_migration_number(1)
64
+ assert_match /#{Time.now.utc.strftime("%Y%m%d%H%M%S")}/,next_number
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,27 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+ require 'shoulda'
7
+ require 'factory_girl'
8
+ if FactoryGirl.factories.first.nil?
9
+ FactoryGirl.find_definitions
10
+ end
11
+
12
+ if RUBY_VERSION < "1.9"
13
+ require 'ruby-debug'
14
+ else
15
+ require 'debugger'
16
+ end
17
+
18
+ Rails.backtrace_cleaner.remove_silencers!
19
+
20
+ # Load support files
21
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
22
+
23
+ class ActiveSupport::TestCase
24
+ def column_list(table)
25
+ ActiveRecord::Base.connection.columns(table).collect{|c| c.name}
26
+ end
27
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archivist
3
3
  version: !ruby/object:Gem::Version
4
- hash: 73
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 0
9
- - 5
10
8
  - 1
11
- version: 1.0.5.1
9
+ - 0
10
+ version: 1.1.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Tyler Pickett
@@ -16,8 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2011-02-15 00:00:00 -06:00
20
- default_executable:
18
+ date: 2012-06-26 00:00:00 Z
21
19
  dependencies:
22
20
  - !ruby/object:Gem::Dependency
23
21
  name: activerecord
@@ -25,18 +23,18 @@ dependencies:
25
23
  requirement: &id001 !ruby/object:Gem::Requirement
26
24
  none: false
27
25
  requirements:
28
- - - ~>
26
+ - - ">="
29
27
  - !ruby/object:Gem::Version
30
- hash: 5
28
+ hash: 7
31
29
  segments:
32
30
  - 3
33
31
  - 0
34
- - 1
35
- version: 3.0.1
32
+ - 0
33
+ version: 3.0.0
36
34
  type: :runtime
37
35
  version_requirements: *id001
38
36
  - !ruby/object:Gem::Dependency
39
- name: thoughtbot-shoulda
37
+ name: minitest
40
38
  prerelease: false
41
39
  requirement: &id002 !ruby/object:Gem::Requirement
42
40
  none: false
@@ -49,6 +47,107 @@ dependencies:
49
47
  version: "0"
50
48
  type: :development
51
49
  version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: rake
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: shoulda
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ type: :development
77
+ version_requirements: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ name: appraisal
80
+ prerelease: false
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :development
91
+ version_requirements: *id005
92
+ - !ruby/object:Gem::Dependency
93
+ name: mysql2
94
+ prerelease: false
95
+ requirement: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ type: :development
105
+ version_requirements: *id006
106
+ - !ruby/object:Gem::Dependency
107
+ name: ruby-debug
108
+ prerelease: false
109
+ requirement: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 3
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ type: :development
119
+ version_requirements: *id007
120
+ - !ruby/object:Gem::Dependency
121
+ name: factory_girl
122
+ prerelease: false
123
+ requirement: &id008 !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - <
127
+ - !ruby/object:Gem::Version
128
+ hash: 7
129
+ segments:
130
+ - 3
131
+ - 0
132
+ version: "3.0"
133
+ type: :development
134
+ version_requirements: *id008
135
+ - !ruby/object:Gem::Dependency
136
+ name: rails
137
+ prerelease: false
138
+ requirement: &id009 !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ hash: 7
144
+ segments:
145
+ - 3
146
+ - 0
147
+ - 0
148
+ version: 3.0.0
149
+ type: :development
150
+ version_requirements: *id009
52
151
  description: |-
53
152
  This is a functional replacement for acts_as_archive in
54
153
  rails 3 applications, the only functionality that is not
@@ -66,10 +165,59 @@ files:
66
165
  - lib/archivist/base/db.rb
67
166
  - lib/archivist/base.rb
68
167
  - lib/archivist/migration.rb
168
+ - lib/archivist/version.rb
69
169
  - lib/archivist.rb
170
+ - lib/tasks/archivist_tasks.rake
70
171
  - MIT-LICENSE
71
- - README.md
72
- has_rdoc: true
172
+ - Rakefile
173
+ - README.rdoc
174
+ - test/archive_test.rb
175
+ - test/archivist_test.rb
176
+ - test/base_test.rb
177
+ - test/db/migrate/01_add_to_some_models.rb
178
+ - test/db_test.rb
179
+ - test/dummy/app/assets/javascripts/application.js
180
+ - test/dummy/app/assets/stylesheets/application.css
181
+ - test/dummy/app/controllers/application_controller.rb
182
+ - test/dummy/app/helpers/application_helper.rb
183
+ - test/dummy/app/models/another_model.rb
184
+ - test/dummy/app/models/some_model.rb
185
+ - test/dummy/app/views/layouts/application.html.erb
186
+ - test/dummy/config/application.rb
187
+ - test/dummy/config/boot.rb
188
+ - test/dummy/config/database.yml
189
+ - test/dummy/config/environment.rb
190
+ - test/dummy/config/environments/development.rb
191
+ - test/dummy/config/environments/production.rb
192
+ - test/dummy/config/environments/test.rb
193
+ - test/dummy/config/initializers/backtrace_silencers.rb
194
+ - test/dummy/config/initializers/inflections.rb
195
+ - test/dummy/config/initializers/mime_types.rb
196
+ - test/dummy/config/initializers/secret_token.rb
197
+ - test/dummy/config/initializers/session_store.rb
198
+ - test/dummy/config/initializers/wrap_parameters.rb
199
+ - test/dummy/config/locales/en.yml
200
+ - test/dummy/config/routes.rb
201
+ - test/dummy/config.ru
202
+ - test/dummy/db/schema.rb
203
+ - test/dummy/db/test.sqlite3
204
+ - test/dummy/lib/this_module.rb
205
+ - test/dummy/log/development.log
206
+ - test/dummy/log/test.log
207
+ - test/dummy/public/404.html
208
+ - test/dummy/public/422.html
209
+ - test/dummy/public/500.html
210
+ - test/dummy/public/favicon.ico
211
+ - test/dummy/Rakefile
212
+ - test/dummy/README.rdoc
213
+ - test/dummy/script/rails
214
+ - test/dummy/test/fixtures/another_models.yml
215
+ - test/dummy/test/fixtures/some_models.yml
216
+ - test/dummy/test/unit/another_model_test.rb
217
+ - test/dummy/test/unit/some_model_test.rb
218
+ - test/factories/some_model_factory.rb
219
+ - test/migration_test.rb
220
+ - test/test_helper.rb
73
221
  homepage: http://github.com/tpickett66/archivist
74
222
  licenses: []
75
223
 
@@ -99,9 +247,55 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
247
  requirements: []
100
248
 
101
249
  rubyforge_project:
102
- rubygems_version: 1.4.1
250
+ rubygems_version: 1.8.17
103
251
  signing_key:
104
252
  specification_version: 3
105
253
  summary: A rails 3 model archiving system based on acts_as_archive
106
- test_files: []
107
-
254
+ test_files:
255
+ - test/archive_test.rb
256
+ - test/archivist_test.rb
257
+ - test/base_test.rb
258
+ - test/db/migrate/01_add_to_some_models.rb
259
+ - test/db_test.rb
260
+ - test/dummy/app/assets/javascripts/application.js
261
+ - test/dummy/app/assets/stylesheets/application.css
262
+ - test/dummy/app/controllers/application_controller.rb
263
+ - test/dummy/app/helpers/application_helper.rb
264
+ - test/dummy/app/models/another_model.rb
265
+ - test/dummy/app/models/some_model.rb
266
+ - test/dummy/app/views/layouts/application.html.erb
267
+ - test/dummy/config/application.rb
268
+ - test/dummy/config/boot.rb
269
+ - test/dummy/config/database.yml
270
+ - test/dummy/config/environment.rb
271
+ - test/dummy/config/environments/development.rb
272
+ - test/dummy/config/environments/production.rb
273
+ - test/dummy/config/environments/test.rb
274
+ - test/dummy/config/initializers/backtrace_silencers.rb
275
+ - test/dummy/config/initializers/inflections.rb
276
+ - test/dummy/config/initializers/mime_types.rb
277
+ - test/dummy/config/initializers/secret_token.rb
278
+ - test/dummy/config/initializers/session_store.rb
279
+ - test/dummy/config/initializers/wrap_parameters.rb
280
+ - test/dummy/config/locales/en.yml
281
+ - test/dummy/config/routes.rb
282
+ - test/dummy/config.ru
283
+ - test/dummy/db/schema.rb
284
+ - test/dummy/db/test.sqlite3
285
+ - test/dummy/lib/this_module.rb
286
+ - test/dummy/log/development.log
287
+ - test/dummy/log/test.log
288
+ - test/dummy/public/404.html
289
+ - test/dummy/public/422.html
290
+ - test/dummy/public/500.html
291
+ - test/dummy/public/favicon.ico
292
+ - test/dummy/Rakefile
293
+ - test/dummy/README.rdoc
294
+ - test/dummy/script/rails
295
+ - test/dummy/test/fixtures/another_models.yml
296
+ - test/dummy/test/fixtures/some_models.yml
297
+ - test/dummy/test/unit/another_model_test.rb
298
+ - test/dummy/test/unit/some_model_test.rb
299
+ - test/factories/some_model_factory.rb
300
+ - test/migration_test.rb
301
+ - test/test_helper.rb