active_versioning 0.2.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9d19c8a3b3761a1629700f15c81e88b4158fd65e
4
- data.tar.gz: 021dc5d964d3577811f29a52617993a71198c143
2
+ SHA256:
3
+ metadata.gz: f0f6b041131d10e434b3afb69942cbce0fc685b4c7d29e9cee9b77b16dc9255f
4
+ data.tar.gz: d506fa806b43c27e7ea1126ff53c6c9a93022cb6c62359206dcabe0ca9e06345
5
5
  SHA512:
6
- metadata.gz: 560a5941478c2512c334128e8f9a6f838d3b5cae3720784bd36a4cffe1591a277c62ec3e66c9d70f9bf726066b315f739fbde46ef9d96ee6b2ff9da3355a368f
7
- data.tar.gz: 545ed05264a6b7d06bcf842b3e9d160d02cbf6cb5cfd2299cbad64404e84a569436e6e94d4fbe6b74de1e56ee9a35a2ddcb72fa9a1e904bfcdd925ef12c6b92d
6
+ metadata.gz: 01d42ab0cf2834b64d3cf91c8e54a3d226fa3e5cbf1c0c0e5b70e6fed3d69e0010b005e3b61ee5ecf994163d2d45eea113f6b1596d0b3b3ef17a8e729c3594ca
7
+ data.tar.gz: 0ce8e5bdb28b81b1535ae84054ceed20c6165f440874948d136ae1af5520d241b9b99034e88e3f1a02f89a4d6771d2cb7a7d2f50a11d1cf8c0609ded9b247493
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ActiveVersioning
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/active_versioning.svg)](http://badge.fury.io/rb/active_versioning) [![Code Climate](https://codeclimate.com/github/vigetlabs/active_versioning/badges/gpa.svg)](https://codeclimate.com/github/vigetlabs/active_versioning) [![Test Coverage](https://codeclimate.com/github/vigetlabs/active_versioning/badges/coverage.svg)](https://codeclimate.com/github/vigetlabs/active_versioning/coverage) [![Circle CI](https://circleci.com/gh/vigetlabs/active_versioning.svg?style=svg)](https://circleci.com/gh/vigetlabs/active_versioning)
3
+ [![Gem Version](https://badge.fury.io/rb/active_versioning.svg)](http://badge.fury.io/rb/active_versioning) [![Circle CI](https://circleci.com/gh/vigetlabs/active_versioning.svg?style=svg)](https://circleci.com/gh/vigetlabs/active_versioning)
4
4
 
5
5
  ActiveVersioning provides out-of-the-box versioning functionality in Rails. ActiveVersioning serializes attributes when records are saved and allows for version and draft management.
6
6
 
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
 
23
23
  Once installed, generate the necessary files and run migrations:
24
24
 
25
- $ rails generate active_versioning
25
+ $ rails generate active_versioning:install
26
26
  $ bundle exec rake db:migrate
27
27
 
28
28
  ## Setup
@@ -102,6 +102,15 @@ If you want to see the attributes the are versioned, use...
102
102
  post.versioned_attributes # => { 'id' => 1, 'title' => 'Default Title' }
103
103
  ```
104
104
 
105
+ By default, ActiveVersioning blacklists the following attributes:
106
+ ```ruby
107
+ ActiveVersioning::VersionManager::BLACKLISTED_ATTRIBUTES = %w(
108
+ created_at
109
+ updated_at
110
+ published
111
+ )
112
+ ```
113
+
105
114
  If you require additional versioned attributes, overwrite the `versioned_attribute_names` method in your model:
106
115
  ```ruby
107
116
  class Post < ActiveRecord::Base
@@ -138,3 +147,11 @@ rescue ActiveVersioning::Errors::IncompatibleVersion => error
138
147
  error.version # => our `incompatible_version`
139
148
  end
140
149
  ```
150
+
151
+ ***
152
+
153
+ <a href="http://code.viget.com">
154
+ <img src="http://code.viget.com/github-banner.png" alt="Code At Viget">
155
+ </a>
156
+
157
+ Visit [code.viget.com](http://code.viget.com) to see more projects from [Viget.](https://viget.com)
@@ -20,15 +20,14 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency "rails", ">= 4.2.1"
23
+ spec.add_dependency "rails", "> 5.0"
24
24
 
25
25
  spec.add_development_dependency "bundler", ">= 1.10"
26
26
  spec.add_development_dependency "rake", ">= 10.0"
27
27
  spec.add_development_dependency "rspec"
28
- spec.add_development_dependency "shoulda-matchers"
28
+ spec.add_development_dependency "shoulda-matchers", '2.8.0'
29
29
  spec.add_development_dependency "database_cleaner"
30
30
  spec.add_development_dependency "generator_spec"
31
31
  spec.add_development_dependency "pry"
32
32
  spec.add_development_dependency "sqlite3"
33
- spec.add_development_dependency "codeclimate-test-reporter"
34
33
  end
data/circle.yml CHANGED
@@ -4,3 +4,6 @@ database:
4
4
  dependencies:
5
5
  pre:
6
6
  - gem install bundler --pre
7
+ machine:
8
+ ruby:
9
+ version: 2.3.1
@@ -1,3 +1,4 @@
1
+ require 'rails'
1
2
  require 'active_versioning/version'
2
3
  require 'generators/active_versioning/install_generator'
3
4
 
@@ -6,4 +7,14 @@ module ActiveVersioning
6
7
  autoload :Events, 'active_versioning/events'
7
8
  autoload :Model, 'active_versioning/model'
8
9
  autoload :VersionManager, 'active_versioning/version_manager'
10
+
11
+ def self.versioned_models
12
+ @@versioned_models ||= begin
13
+ Rails.application.eager_load!
14
+
15
+ ActiveRecord::Base.descendants.select do |model|
16
+ model.included_modules.include? Model::Versioned
17
+ end
18
+ end
19
+ end
9
20
  end
@@ -24,10 +24,10 @@ module ActiveVersioning
24
24
  end
25
25
 
26
26
  def reify
27
- resource = versionable(true)
27
+ resource = reload_versionable
28
28
 
29
29
  # Necessary to ensure resource and versionable are two distinct objects in memory
30
- versionable(true)
30
+ reload_versionable
31
31
 
32
32
  resource.assign_attributes(object.slice(*resource.versioned_attribute_names))
33
33
  resource
@@ -1,3 +1,3 @@
1
1
  module ActiveVersioning
2
- VERSION = "0.2.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -25,7 +25,7 @@ module ActiveVersioning
25
25
  end
26
26
 
27
27
  def incompatible_attributes(version)
28
- version.object.keys - record.attributes.keys
28
+ version.object.keys - record.versioned_attributes.keys
29
29
  end
30
30
  end
31
31
  end
@@ -1,4 +1,4 @@
1
- class CreateVersions < ActiveRecord::Migration
1
+ class CreateVersions < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
3
  create_table :versions do |t|
4
4
  t.string :versionable_type, null: false
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_versioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stenberg
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2021-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.1
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.1
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: shoulda-matchers
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 2.8.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 2.8.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: database_cleaner
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -136,20 +136,6 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: codeclimate-test-reporter
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
139
  description: ActiveVersioning serializes attributes when records are saved and allows
154
140
  for version and draft management.
155
141
  email:
@@ -160,6 +146,7 @@ extra_rdoc_files: []
160
146
  files:
161
147
  - ".gitignore"
162
148
  - ".rspec"
149
+ - ".ruby-version"
163
150
  - ".travis.yml"
164
151
  - Gemfile
165
152
  - README.md
@@ -184,7 +171,7 @@ homepage: https://github.com/vigetlabs/active_versioning
184
171
  licenses:
185
172
  - BSD
186
173
  metadata: {}
187
- post_install_message:
174
+ post_install_message:
188
175
  rdoc_options: []
189
176
  require_paths:
190
177
  - lib
@@ -199,9 +186,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
186
  - !ruby/object:Gem::Version
200
187
  version: '0'
201
188
  requirements: []
202
- rubyforge_project:
203
- rubygems_version: 2.4.5
204
- signing_key:
189
+ rubyforge_project:
190
+ rubygems_version: 2.7.6
191
+ signing_key:
205
192
  specification_version: 4
206
193
  summary: Plug-and-Play Versioning for Rails
207
194
  test_files: []