archiving 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +4 -0
- data/Rakefile +38 -0
- data/lib/archiving/archive_table.rb +108 -0
- data/lib/archiving/migrations.rb +16 -0
- data/lib/archiving/railtie.rb +12 -0
- data/lib/archiving.rb +3 -0
- data/test/archive_table_test.rb +195 -0
- data/test/archiving_test.rb +7 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/log_day.rb +8 -0
- data/test/dummy/app/models/log_line.rb +6 -0
- data/test/dummy/app/models/post.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/boot.rb +4 -0
- data/test/dummy/config/database.yml +28 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +32 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +44 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20140220134827_create_posts.rb +10 -0
- data/test/dummy/db/migrate/20140220140852_posts_archive.rb +10 -0
- data/test/dummy/db/migrate/20140220140952_posts_tag.rb +6 -0
- data/test/dummy/db/migrate/20140317201702_create_logs.rb +22 -0
- data/test/dummy/db/migrate/20140414124125_create_postable_on_log_day.rb +8 -0
- data/test/dummy/db/schema.rb +56 -0
- data/test/dummy/log/development.log +15 -0
- data/test/dummy/log/test.log +20234 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/unit/post_test.rb +7 -0
- data/test/migrations_test.rb +58 -0
- data/test/test_helper.rb +17 -0
- metadata +257 -0
@@ -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,58 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Comment < ActiveRecord::Base
|
4
|
+
has_archive_table
|
5
|
+
end
|
6
|
+
|
7
|
+
class CreateComments < ActiveRecord::Migration
|
8
|
+
def up
|
9
|
+
create_table :comments do |t|
|
10
|
+
t.string :author
|
11
|
+
t.text :body
|
12
|
+
end
|
13
|
+
|
14
|
+
create_archive_table :comments
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class MigrationTest < ActiveSupport::TestCase
|
19
|
+
def connection
|
20
|
+
ActiveRecord::Base.connection
|
21
|
+
end
|
22
|
+
|
23
|
+
def drop_tables
|
24
|
+
connection.drop_table(:comments) if table_exists?(:comments)
|
25
|
+
connection.drop_table(:comments_archive) if table_exists?(:comments_archive)
|
26
|
+
end
|
27
|
+
|
28
|
+
setup do
|
29
|
+
drop_tables
|
30
|
+
end
|
31
|
+
|
32
|
+
teardown do
|
33
|
+
drop_tables
|
34
|
+
end
|
35
|
+
|
36
|
+
test "create_archive_table" do
|
37
|
+
CreateComments.new.up
|
38
|
+
|
39
|
+
assert table_exists?(:comments_archive),
|
40
|
+
"Expected table 'comments_archive' to exist."
|
41
|
+
|
42
|
+
assert_equal Comment.attribute_names, Comment.archive.attribute_names
|
43
|
+
end
|
44
|
+
|
45
|
+
test "ignore existing archive table" do
|
46
|
+
CreateComments.new.up
|
47
|
+
CreateComments.new.create_archive_table :comments # we can re-run archive table creator without errors
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def table_exists?(table_name)
|
52
|
+
if connection.respond_to?(:data_source_exists?)
|
53
|
+
connection.data_source_exists?(table_name)
|
54
|
+
else
|
55
|
+
connection.table_exists?(table_name)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
ActiveSupport.test_order = :random if ActiveSupport.respond_to?(:test_order=)
|
10
|
+
|
11
|
+
# Load support files
|
12
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
13
|
+
|
14
|
+
# Load fixtures from the engine
|
15
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
16
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,257 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: archiving
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Harry Vangberg
|
8
|
+
- Michael Kyed
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activerecord
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '4.2'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '6.0'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '4.2'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '6.0'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: mysql2
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rails
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.2'
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '6.0'
|
58
|
+
type: :development
|
59
|
+
prerelease: false
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '4.2'
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '6.0'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: jquery-rails
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rake
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: pry
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.9.10
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - '='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.9.10
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: pry-nav
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.2.2
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - '='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.2.2
|
124
|
+
description: Archiving aged records to archive table
|
125
|
+
email:
|
126
|
+
- teknik@firmafon.dk
|
127
|
+
executables: []
|
128
|
+
extensions: []
|
129
|
+
extra_rdoc_files: []
|
130
|
+
files:
|
131
|
+
- MIT-LICENSE
|
132
|
+
- README.md
|
133
|
+
- Rakefile
|
134
|
+
- lib/archiving.rb
|
135
|
+
- lib/archiving/archive_table.rb
|
136
|
+
- lib/archiving/migrations.rb
|
137
|
+
- lib/archiving/railtie.rb
|
138
|
+
- test/archive_table_test.rb
|
139
|
+
- test/archiving_test.rb
|
140
|
+
- test/dummy/README.rdoc
|
141
|
+
- test/dummy/Rakefile
|
142
|
+
- test/dummy/app/assets/javascripts/application.js
|
143
|
+
- test/dummy/app/assets/stylesheets/application.css
|
144
|
+
- test/dummy/app/controllers/application_controller.rb
|
145
|
+
- test/dummy/app/helpers/application_helper.rb
|
146
|
+
- test/dummy/app/models/log_day.rb
|
147
|
+
- test/dummy/app/models/log_line.rb
|
148
|
+
- test/dummy/app/models/post.rb
|
149
|
+
- test/dummy/app/views/layouts/application.html.erb
|
150
|
+
- test/dummy/bin/bundle
|
151
|
+
- test/dummy/bin/rails
|
152
|
+
- test/dummy/bin/rake
|
153
|
+
- test/dummy/config.ru
|
154
|
+
- test/dummy/config/application.rb
|
155
|
+
- test/dummy/config/boot.rb
|
156
|
+
- test/dummy/config/database.yml
|
157
|
+
- test/dummy/config/environment.rb
|
158
|
+
- test/dummy/config/environments/development.rb
|
159
|
+
- test/dummy/config/environments/production.rb
|
160
|
+
- test/dummy/config/environments/test.rb
|
161
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
162
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
163
|
+
- test/dummy/config/initializers/inflections.rb
|
164
|
+
- test/dummy/config/initializers/mime_types.rb
|
165
|
+
- test/dummy/config/initializers/secret_token.rb
|
166
|
+
- test/dummy/config/initializers/session_store.rb
|
167
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
168
|
+
- test/dummy/config/locales/en.yml
|
169
|
+
- test/dummy/config/routes.rb
|
170
|
+
- test/dummy/db/migrate/20140220134827_create_posts.rb
|
171
|
+
- test/dummy/db/migrate/20140220140852_posts_archive.rb
|
172
|
+
- test/dummy/db/migrate/20140220140952_posts_tag.rb
|
173
|
+
- test/dummy/db/migrate/20140317201702_create_logs.rb
|
174
|
+
- test/dummy/db/migrate/20140414124125_create_postable_on_log_day.rb
|
175
|
+
- test/dummy/db/schema.rb
|
176
|
+
- test/dummy/log/development.log
|
177
|
+
- test/dummy/log/test.log
|
178
|
+
- test/dummy/public/404.html
|
179
|
+
- test/dummy/public/422.html
|
180
|
+
- test/dummy/public/500.html
|
181
|
+
- test/dummy/public/favicon.ico
|
182
|
+
- test/dummy/script/rails
|
183
|
+
- test/dummy/test/unit/post_test.rb
|
184
|
+
- test/migrations_test.rb
|
185
|
+
- test/test_helper.rb
|
186
|
+
homepage: https://github.com/firmafon/archiving
|
187
|
+
licenses: []
|
188
|
+
metadata: {}
|
189
|
+
post_install_message:
|
190
|
+
rdoc_options: []
|
191
|
+
require_paths:
|
192
|
+
- lib
|
193
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: '0'
|
203
|
+
requirements: []
|
204
|
+
rubyforge_project:
|
205
|
+
rubygems_version: 2.4.5.1
|
206
|
+
signing_key:
|
207
|
+
specification_version: 4
|
208
|
+
summary: MySQL Archive Tables
|
209
|
+
test_files:
|
210
|
+
- test/archive_table_test.rb
|
211
|
+
- test/archiving_test.rb
|
212
|
+
- test/dummy/app/assets/javascripts/application.js
|
213
|
+
- test/dummy/app/assets/stylesheets/application.css
|
214
|
+
- test/dummy/app/controllers/application_controller.rb
|
215
|
+
- test/dummy/app/helpers/application_helper.rb
|
216
|
+
- test/dummy/app/models/log_day.rb
|
217
|
+
- test/dummy/app/models/log_line.rb
|
218
|
+
- test/dummy/app/models/post.rb
|
219
|
+
- test/dummy/app/views/layouts/application.html.erb
|
220
|
+
- test/dummy/bin/bundle
|
221
|
+
- test/dummy/bin/rails
|
222
|
+
- test/dummy/bin/rake
|
223
|
+
- test/dummy/config/application.rb
|
224
|
+
- test/dummy/config/boot.rb
|
225
|
+
- test/dummy/config/database.yml
|
226
|
+
- test/dummy/config/environment.rb
|
227
|
+
- test/dummy/config/environments/development.rb
|
228
|
+
- test/dummy/config/environments/production.rb
|
229
|
+
- test/dummy/config/environments/test.rb
|
230
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
231
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
232
|
+
- test/dummy/config/initializers/inflections.rb
|
233
|
+
- test/dummy/config/initializers/mime_types.rb
|
234
|
+
- test/dummy/config/initializers/secret_token.rb
|
235
|
+
- test/dummy/config/initializers/session_store.rb
|
236
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
237
|
+
- test/dummy/config/locales/en.yml
|
238
|
+
- test/dummy/config/routes.rb
|
239
|
+
- test/dummy/config.ru
|
240
|
+
- test/dummy/db/migrate/20140220134827_create_posts.rb
|
241
|
+
- test/dummy/db/migrate/20140220140852_posts_archive.rb
|
242
|
+
- test/dummy/db/migrate/20140220140952_posts_tag.rb
|
243
|
+
- test/dummy/db/migrate/20140317201702_create_logs.rb
|
244
|
+
- test/dummy/db/migrate/20140414124125_create_postable_on_log_day.rb
|
245
|
+
- test/dummy/db/schema.rb
|
246
|
+
- test/dummy/log/development.log
|
247
|
+
- test/dummy/log/test.log
|
248
|
+
- test/dummy/public/404.html
|
249
|
+
- test/dummy/public/422.html
|
250
|
+
- test/dummy/public/500.html
|
251
|
+
- test/dummy/public/favicon.ico
|
252
|
+
- test/dummy/Rakefile
|
253
|
+
- test/dummy/README.rdoc
|
254
|
+
- test/dummy/script/rails
|
255
|
+
- test/dummy/test/unit/post_test.rb
|
256
|
+
- test/migrations_test.rb
|
257
|
+
- test/test_helper.rb
|