temporal_tables 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +4 -0
  3. data/.gitignore +19 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +6 -0
  6. data/CHANGELOG.md +73 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +139 -0
  10. data/Rakefile +9 -0
  11. data/config.ru +7 -0
  12. data/gemfiles/Gemfile.5.2.mysql +16 -0
  13. data/gemfiles/Gemfile.5.2.mysql.lock +155 -0
  14. data/gemfiles/Gemfile.5.2.pg +16 -0
  15. data/gemfiles/Gemfile.5.2.pg.lock +155 -0
  16. data/lib/temporal_tables.rb +63 -0
  17. data/lib/temporal_tables/connection_adapters/mysql_adapter.rb +56 -0
  18. data/lib/temporal_tables/connection_adapters/postgresql_adapter.rb +81 -0
  19. data/lib/temporal_tables/history_hook.rb +50 -0
  20. data/lib/temporal_tables/relation_extensions.rb +125 -0
  21. data/lib/temporal_tables/scope_extensions.rb +13 -0
  22. data/lib/temporal_tables/temporal_adapter.rb +159 -0
  23. data/lib/temporal_tables/temporal_class.rb +91 -0
  24. data/lib/temporal_tables/version.rb +3 -0
  25. data/lib/temporal_tables/whodunnit.rb +19 -0
  26. data/spec/basic_history_spec.rb +91 -0
  27. data/spec/extensions/combustion.rb +9 -0
  28. data/spec/internal/app/models/coven.rb +3 -0
  29. data/spec/internal/app/models/person.rb +4 -0
  30. data/spec/internal/app/models/wart.rb +7 -0
  31. data/spec/internal/config/database.sample.yml +12 -0
  32. data/spec/internal/config/routes.rb +3 -0
  33. data/spec/internal/db/schema.rb +16 -0
  34. data/spec/internal/log/.gitignore +1 -0
  35. data/spec/internal/public/favicon.ico +0 -0
  36. data/spec/spec_helper.rb +17 -0
  37. data/spec/support/database.rb +9 -0
  38. data/temporal_tables.gemspec +24 -0
  39. metadata +149 -0
@@ -0,0 +1 @@
1
+ *.log
File without changes
@@ -0,0 +1,17 @@
1
+ require 'gemika'
2
+ require 'combustion'
3
+
4
+ Dir["#{File.dirname(__FILE__)}/extensions/*.rb"].sort.each {|f| require f}
5
+ Dir["#{File.dirname(__FILE__)}/support/*.rb"].sort.each {|f| require f}
6
+
7
+ Combustion.initialize! :active_record do
8
+ Rails.env = TemporalTables::DatabaseAdapter.adapter_name
9
+ end
10
+
11
+ DatabaseCleaner.strategy = :deletion
12
+
13
+ RSpec.configure do |config|
14
+ config.before(:all) do
15
+ DatabaseCleaner.clean
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module TemporalTables::DatabaseAdapter
2
+ def self.adapter_name
3
+ if Gemika::Env.gem?('pg')
4
+ "postgresql"
5
+ elsif Gemika::Env.gem?('mysql2')
6
+ "mysql"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'temporal_tables/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "temporal_tables"
8
+ gem.version = TemporalTables::VERSION
9
+ gem.authors = ["Brent Kroeker"]
10
+ gem.email = ["brent@bkroeker.com"]
11
+ gem.description = %q{Easily recall what your data looked like at any point in the past! TemporalTables sets up and maintains history tables to track all temporal changes to to your data.}
12
+ gem.summary = %q{Tracks all history of changes to a table automatically in a history table.}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency "rails", "~> 5.2"
21
+ gem.add_development_dependency "rspec", "~> 3.4"
22
+ gem.add_development_dependency "combustion", "~> 0.9.1"
23
+ gem.add_development_dependency "gemika"
24
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: temporal_tables
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.1
5
+ platform: ruby
6
+ authors:
7
+ - Brent Kroeker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-07-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: combustion
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: gemika
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Easily recall what your data looked like at any point in the past! TemporalTables
70
+ sets up and maintains history tables to track all temporal changes to to your data.
71
+ email:
72
+ - brent@bkroeker.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".editorconfig"
78
+ - ".gitignore"
79
+ - ".ruby-version"
80
+ - ".travis.yml"
81
+ - CHANGELOG.md
82
+ - Gemfile
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - config.ru
87
+ - gemfiles/Gemfile.5.2.mysql
88
+ - gemfiles/Gemfile.5.2.mysql.lock
89
+ - gemfiles/Gemfile.5.2.pg
90
+ - gemfiles/Gemfile.5.2.pg.lock
91
+ - lib/temporal_tables.rb
92
+ - lib/temporal_tables/connection_adapters/mysql_adapter.rb
93
+ - lib/temporal_tables/connection_adapters/postgresql_adapter.rb
94
+ - lib/temporal_tables/history_hook.rb
95
+ - lib/temporal_tables/relation_extensions.rb
96
+ - lib/temporal_tables/scope_extensions.rb
97
+ - lib/temporal_tables/temporal_adapter.rb
98
+ - lib/temporal_tables/temporal_class.rb
99
+ - lib/temporal_tables/version.rb
100
+ - lib/temporal_tables/whodunnit.rb
101
+ - spec/basic_history_spec.rb
102
+ - spec/extensions/combustion.rb
103
+ - spec/internal/app/models/coven.rb
104
+ - spec/internal/app/models/person.rb
105
+ - spec/internal/app/models/wart.rb
106
+ - spec/internal/config/database.sample.yml
107
+ - spec/internal/config/routes.rb
108
+ - spec/internal/db/schema.rb
109
+ - spec/internal/log/.gitignore
110
+ - spec/internal/public/favicon.ico
111
+ - spec/spec_helper.rb
112
+ - spec/support/database.rb
113
+ - temporal_tables.gemspec
114
+ homepage: ''
115
+ licenses: []
116
+ metadata: {}
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 2.7.6
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: Tracks all history of changes to a table automatically in a history table.
137
+ test_files:
138
+ - spec/basic_history_spec.rb
139
+ - spec/extensions/combustion.rb
140
+ - spec/internal/app/models/coven.rb
141
+ - spec/internal/app/models/person.rb
142
+ - spec/internal/app/models/wart.rb
143
+ - spec/internal/config/database.sample.yml
144
+ - spec/internal/config/routes.rb
145
+ - spec/internal/db/schema.rb
146
+ - spec/internal/log/.gitignore
147
+ - spec/internal/public/favicon.ico
148
+ - spec/spec_helper.rb
149
+ - spec/support/database.rb