historiographer 4.1.14 → 4.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.
- checksums.yaml +4 -4
- data/.document +5 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/.standalone_migrations +6 -0
- data/Gemfile +33 -0
- data/Gemfile.lock +341 -0
- data/Guardfile +4 -0
- data/README.md +0 -168
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/historiographer-4.1.12.gem +0 -0
- data/historiographer-4.1.13.gem +0 -0
- data/historiographer-4.1.14.gem +0 -0
- data/historiographer.gemspec +136 -0
- data/init.rb +18 -0
- data/instructions/implementation.md +282 -0
- data/instructions/todo.md +96 -0
- data/lib/historiographer/history.rb +1 -20
- data/lib/historiographer/version.rb +1 -1
- data/lib/historiographer.rb +27 -14
- data/spec/db/database.yml +27 -0
- data/spec/db/migrate/20161121212228_create_posts.rb +19 -0
- data/spec/db/migrate/20161121212229_create_post_histories.rb +10 -0
- data/spec/db/migrate/20161121212230_create_authors.rb +13 -0
- data/spec/db/migrate/20161121212231_create_author_histories.rb +10 -0
- data/spec/db/migrate/20161121212232_create_users.rb +9 -0
- data/spec/db/migrate/20171011194624_create_safe_posts.rb +19 -0
- data/spec/db/migrate/20171011194715_create_safe_post_histories.rb +9 -0
- data/spec/db/migrate/20191024142304_create_thing_with_compound_index.rb +10 -0
- data/spec/db/migrate/20191024142352_create_thing_with_compound_index_history.rb +11 -0
- data/spec/db/migrate/20191024203106_create_thing_without_history.rb +7 -0
- data/spec/db/migrate/20221018204220_create_silent_posts.rb +21 -0
- data/spec/db/migrate/20221018204255_create_silent_post_histories.rb +9 -0
- data/spec/db/migrate/20241109182017_create_comments.rb +13 -0
- data/spec/db/migrate/20241109182020_create_comment_histories.rb +9 -0
- data/spec/db/migrate/20241119000000_create_datasets.rb +17 -0
- data/spec/db/migrate/2025082100000_create_projects.rb +14 -0
- data/spec/db/migrate/2025082100001_create_project_files.rb +18 -0
- data/spec/db/schema.rb +352 -0
- data/spec/factories/post.rb +7 -0
- data/spec/historiographer_spec.rb +920 -0
- data/spec/models/application_record.rb +3 -0
- data/spec/models/author.rb +5 -0
- data/spec/models/author_history.rb +4 -0
- data/spec/models/comment.rb +5 -0
- data/spec/models/comment_history.rb +5 -0
- data/spec/models/easy_ml/column.rb +6 -0
- data/spec/models/easy_ml/column_history.rb +6 -0
- data/spec/models/post.rb +45 -0
- data/spec/models/post_history.rb +8 -0
- data/spec/models/project.rb +4 -0
- data/spec/models/project_file.rb +5 -0
- data/spec/models/project_file_history.rb +4 -0
- data/spec/models/project_history.rb +4 -0
- data/spec/models/safe_post.rb +5 -0
- data/spec/models/safe_post_history.rb +5 -0
- data/spec/models/silent_post.rb +3 -0
- data/spec/models/silent_post_history.rb +4 -0
- data/spec/models/thing_with_compound_index.rb +3 -0
- data/spec/models/thing_with_compound_index_history.rb +4 -0
- data/spec/models/thing_without_history.rb +2 -0
- data/spec/models/user.rb +2 -0
- data/spec/spec_helper.rb +105 -0
- metadata +62 -31
data/spec/models/post.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'application_record'
|
2
|
+
|
3
|
+
class Post < ApplicationRecord
|
4
|
+
include Historiographer
|
5
|
+
acts_as_paranoid
|
6
|
+
has_many :comments
|
7
|
+
|
8
|
+
validates :type, inclusion: { in: ['Post', 'PrivatePost', nil] }
|
9
|
+
before_validation :set_defaults
|
10
|
+
after_find :set_comment_count
|
11
|
+
|
12
|
+
attr_reader :comment_count
|
13
|
+
|
14
|
+
def set_defaults
|
15
|
+
@type ||= "Post"
|
16
|
+
end
|
17
|
+
|
18
|
+
def summary
|
19
|
+
"This is a summary of the post."
|
20
|
+
end
|
21
|
+
|
22
|
+
def formatted_title
|
23
|
+
"Title: #{title}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def locked_value
|
27
|
+
"My Great Post v1"
|
28
|
+
end
|
29
|
+
|
30
|
+
def complex_lookup
|
31
|
+
%Q(
|
32
|
+
Here is a complicated value, it
|
33
|
+
is: #{locked_value}
|
34
|
+
And another: #{formatted_title}
|
35
|
+
).strip.gsub(/\n{2}/, " ").split(" ").join(" ")
|
36
|
+
end
|
37
|
+
|
38
|
+
def set_comment_count
|
39
|
+
comment_count
|
40
|
+
end
|
41
|
+
|
42
|
+
def comment_count
|
43
|
+
@comment_count ||= comments.count
|
44
|
+
end
|
45
|
+
end
|
data/spec/models/user.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
ENV["HISTORIOGRAPHER_ENV"] = "test"
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require_relative "../init.rb"
|
5
|
+
require "ostruct"
|
6
|
+
require "factory_bot"
|
7
|
+
require "zeitwerk"
|
8
|
+
|
9
|
+
# Add custom inflections for test environment
|
10
|
+
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
11
|
+
inflect.acronym 'XGBoost'
|
12
|
+
inflect.acronym 'ML'
|
13
|
+
inflect.acronym 'EasyML'
|
14
|
+
end
|
15
|
+
|
16
|
+
# Set up autoloading
|
17
|
+
loader = Zeitwerk::Loader.new
|
18
|
+
loader.push_dir(File.join(File.dirname(__FILE__), 'models'))
|
19
|
+
|
20
|
+
# Configure Zeitwerk inflector with a custom inflection method
|
21
|
+
class CustomInflector < Zeitwerk::Inflector
|
22
|
+
def camelize(basename, abspath)
|
23
|
+
case basename
|
24
|
+
when 'xgboost'
|
25
|
+
'XGBoost'
|
26
|
+
when 'xgboost_history'
|
27
|
+
'XGBoostHistory'
|
28
|
+
when /\Aeasy_ml\z/
|
29
|
+
'EasyML'
|
30
|
+
when /\Aml_model\z/
|
31
|
+
'MLModel'
|
32
|
+
else
|
33
|
+
super
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
loader.inflector = CustomInflector.new
|
39
|
+
loader.setup
|
40
|
+
|
41
|
+
# Enable Rails-like constant lookup
|
42
|
+
module Rails
|
43
|
+
def self.root
|
44
|
+
Pathname.new(File.join(File.dirname(__FILE__), '..'))
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.application
|
48
|
+
OpenStruct.new(
|
49
|
+
config: OpenStruct.new(
|
50
|
+
eager_load_namespaces: [],
|
51
|
+
autoloader: loader
|
52
|
+
)
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
FactoryBot.definition_file_paths = %w{./factories ./spec/factories}
|
58
|
+
FactoryBot.find_definitions
|
59
|
+
|
60
|
+
RSpec.configure do |config|
|
61
|
+
config.expect_with :rspec do |expectations|
|
62
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
63
|
+
end
|
64
|
+
|
65
|
+
config.mock_with :rspec do |mocks|
|
66
|
+
mocks.verify_partial_doubles = true
|
67
|
+
end
|
68
|
+
|
69
|
+
config.filter_run :focus
|
70
|
+
config.run_all_when_everything_filtered = true
|
71
|
+
|
72
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
73
|
+
|
74
|
+
if config.files_to_run.one?
|
75
|
+
config.default_formatter = 'doc'
|
76
|
+
end
|
77
|
+
|
78
|
+
config.profile_examples = 10
|
79
|
+
|
80
|
+
config.order = :random
|
81
|
+
|
82
|
+
Kernel.srand config.seed
|
83
|
+
|
84
|
+
config.before(:suite) do
|
85
|
+
DatabaseCleaner.strategy = :transaction
|
86
|
+
DatabaseCleaner.clean_with(:truncation)
|
87
|
+
ActiveRecord::Migration.maintain_test_schema!
|
88
|
+
end
|
89
|
+
|
90
|
+
config.around(:each) do |example|
|
91
|
+
DatabaseCleaner.strategy = :transaction
|
92
|
+
DatabaseCleaner.start
|
93
|
+
example.run
|
94
|
+
DatabaseCleaner.clean
|
95
|
+
DatabaseCleaner.clean_with(:truncation)
|
96
|
+
end
|
97
|
+
|
98
|
+
config.before(:each, :logsql) do
|
99
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
100
|
+
end
|
101
|
+
|
102
|
+
config.after(:each, :logsql) do
|
103
|
+
ActiveRecord::Base.logger = nil
|
104
|
+
end
|
105
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: historiographer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- brettshollenberger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -164,20 +164,6 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: bundler
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - "~>"
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '1.0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - "~>"
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '1.0'
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
168
|
name: jeweler
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,21 +206,7 @@ dependencies:
|
|
220
206
|
- - ">="
|
221
207
|
- !ruby/object:Gem::Version
|
222
208
|
version: '0'
|
223
|
-
|
224
|
-
name: zeitwerk
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - ">="
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
type: :development
|
231
|
-
prerelease: false
|
232
|
-
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
requirements:
|
234
|
-
- - ">="
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: '0'
|
237
|
-
description: Append-only histories + chained snapshots of your ActiveRecord tables
|
209
|
+
description: Creates separate tables for each history table
|
238
210
|
email: brett.shollenberger@gmail.com
|
239
211
|
executables: []
|
240
212
|
extensions: []
|
@@ -242,8 +214,24 @@ extra_rdoc_files:
|
|
242
214
|
- LICENSE.txt
|
243
215
|
- README.md
|
244
216
|
files:
|
217
|
+
- ".document"
|
218
|
+
- ".rspec"
|
219
|
+
- ".ruby-version"
|
220
|
+
- ".standalone_migrations"
|
221
|
+
- Gemfile
|
222
|
+
- Gemfile.lock
|
223
|
+
- Guardfile
|
245
224
|
- LICENSE.txt
|
246
225
|
- README.md
|
226
|
+
- Rakefile
|
227
|
+
- VERSION
|
228
|
+
- historiographer-4.1.12.gem
|
229
|
+
- historiographer-4.1.13.gem
|
230
|
+
- historiographer-4.1.14.gem
|
231
|
+
- historiographer.gemspec
|
232
|
+
- init.rb
|
233
|
+
- instructions/implementation.md
|
234
|
+
- instructions/todo.md
|
247
235
|
- lib/historiographer.rb
|
248
236
|
- lib/historiographer/configuration.rb
|
249
237
|
- lib/historiographer/history.rb
|
@@ -255,6 +243,49 @@ files:
|
|
255
243
|
- lib/historiographer/safe.rb
|
256
244
|
- lib/historiographer/silent.rb
|
257
245
|
- lib/historiographer/version.rb
|
246
|
+
- spec/db/database.yml
|
247
|
+
- spec/db/migrate/20161121212228_create_posts.rb
|
248
|
+
- spec/db/migrate/20161121212229_create_post_histories.rb
|
249
|
+
- spec/db/migrate/20161121212230_create_authors.rb
|
250
|
+
- spec/db/migrate/20161121212231_create_author_histories.rb
|
251
|
+
- spec/db/migrate/20161121212232_create_users.rb
|
252
|
+
- spec/db/migrate/20171011194624_create_safe_posts.rb
|
253
|
+
- spec/db/migrate/20171011194715_create_safe_post_histories.rb
|
254
|
+
- spec/db/migrate/20191024142304_create_thing_with_compound_index.rb
|
255
|
+
- spec/db/migrate/20191024142352_create_thing_with_compound_index_history.rb
|
256
|
+
- spec/db/migrate/20191024203106_create_thing_without_history.rb
|
257
|
+
- spec/db/migrate/20221018204220_create_silent_posts.rb
|
258
|
+
- spec/db/migrate/20221018204255_create_silent_post_histories.rb
|
259
|
+
- spec/db/migrate/20241109182017_create_comments.rb
|
260
|
+
- spec/db/migrate/20241109182020_create_comment_histories.rb
|
261
|
+
- spec/db/migrate/20241119000000_create_datasets.rb
|
262
|
+
- spec/db/migrate/2025082100000_create_projects.rb
|
263
|
+
- spec/db/migrate/2025082100001_create_project_files.rb
|
264
|
+
- spec/db/schema.rb
|
265
|
+
- spec/factories/post.rb
|
266
|
+
- spec/historiographer_spec.rb
|
267
|
+
- spec/models/application_record.rb
|
268
|
+
- spec/models/author.rb
|
269
|
+
- spec/models/author_history.rb
|
270
|
+
- spec/models/comment.rb
|
271
|
+
- spec/models/comment_history.rb
|
272
|
+
- spec/models/easy_ml/column.rb
|
273
|
+
- spec/models/easy_ml/column_history.rb
|
274
|
+
- spec/models/post.rb
|
275
|
+
- spec/models/post_history.rb
|
276
|
+
- spec/models/project.rb
|
277
|
+
- spec/models/project_file.rb
|
278
|
+
- spec/models/project_file_history.rb
|
279
|
+
- spec/models/project_history.rb
|
280
|
+
- spec/models/safe_post.rb
|
281
|
+
- spec/models/safe_post_history.rb
|
282
|
+
- spec/models/silent_post.rb
|
283
|
+
- spec/models/silent_post_history.rb
|
284
|
+
- spec/models/thing_with_compound_index.rb
|
285
|
+
- spec/models/thing_with_compound_index_history.rb
|
286
|
+
- spec/models/thing_without_history.rb
|
287
|
+
- spec/models/user.rb
|
288
|
+
- spec/spec_helper.rb
|
258
289
|
homepage: http://github.com/brettshollenberger/historiographer
|
259
290
|
licenses:
|
260
291
|
- MIT
|