draftsman 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +17 -0
- data/README.md +2 -2
- data/lib/draftsman/draft.rb +3 -1
- data/lib/draftsman/model.rb +2 -1
- data/lib/draftsman/version.rb +1 -1
- data/spec/dummy/config/environments/test.rb +7 -1
- data/spec/dummy/db/migrate/20110208155312_set_up_test_tables.rb +6 -6
- data/spec/dummy/db/migrate/20150408234937_add_only_children.rb +1 -1
- data/spec/dummy/db/schema.rb +10 -0
- data/spec/support/silence_serialized_attributes_deprecation.rb +16 -0
- metadata +5 -5
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 194254f680cbf4f16b35d8752db70015373258af
|
4
|
+
data.tar.gz: e098a3b022b8f4524b0475f13019402ff8e4b567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d91dd1b999f3e32d1fd53e2eed6426bedd09b9cf4e009dbdf14bec090d4b1860023e605d8911f0452fe36cdd906c8a7e65a5ee9c403be5b3ad90a871a46d8ffa
|
7
|
+
data.tar.gz: cfad2c03e91eaaabac18e36cc98d83cf570beba41d8ca7aa55d076bce6e12965f08473dc24147cf15d0f9fc0b9c0b1deaf28980229e64fad1cada389a07ae6c7
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.3.7 - November 4, 2015
|
4
|
+
|
5
|
+
- [@bdunham](https://github.com/bdunham)
|
6
|
+
[Fixed](https://github.com/liveeditor/draftsman/commit/3610087a319fd203684146bb1d37bf0e41276743) -
|
7
|
+
Prevented double require of model definition
|
8
|
+
- [@chrisdpeters](https://github.com/chrisdpeters)
|
9
|
+
[Fixed](https://github.com/liveeditor/draftsman/commit/ec2edf45700a3bea8cfac6f9facbc8ef6c7f9f54)
|
10
|
+
[#36](https://github.com/liveeditor/draftsman/issues/36) -
|
11
|
+
Fails miserably with foreign keys
|
12
|
+
- [@dpaluy](https://github.com/dpaluy)
|
13
|
+
[Fixed](https://github.com/dpaluy/draftsman/blob/afce35b3985c79760176f31710c11a77b1201f0e/config/initializers/draftsman.rb)
|
14
|
+
[#33](https://github.com/liveeditor/draftsman/issues/33) -
|
15
|
+
SerializedAttributes is deprecated in Rails 4.2.x, and will be removed in Rails 5
|
16
|
+
- [@chrisdpeters](https://github.com/chrisdpeters)
|
17
|
+
[Fixed](https://github.com/liveeditor/draftsman/commit/adc2843105e8fcf34d714557e82cf3f24942dbcb) -
|
18
|
+
Fix `serve_static_assets` deprecation warning
|
19
|
+
|
3
20
|
## 0.3.6 - August 16, 2015
|
4
21
|
|
5
22
|
- [@chrisdpeters](https://github.com/chrisdpeters)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Draftsman v0.3.
|
1
|
+
# Draftsman v0.3.7 (alpha)
|
2
2
|
|
3
3
|
Draftsman is a Ruby gem that lets you create draft versions of your database records. If you're developing a system in
|
4
4
|
need of simple drafts or a publishing approval queue, then Draftsman just might be what you need.
|
@@ -50,7 +50,7 @@ Works well with Rails, Sinatra, or any other application that depends on ActiveR
|
|
50
50
|
Add Draftsman to your `Gemfile`.
|
51
51
|
|
52
52
|
```ruby
|
53
|
-
gem 'draftsman', '0.3.
|
53
|
+
gem 'draftsman', '0.3.7'
|
54
54
|
```
|
55
55
|
|
56
56
|
Or if you want to grab the latest from `master`:
|
data/lib/draftsman/draft.rb
CHANGED
@@ -211,7 +211,9 @@ class Draftsman::Draft < ActiveRecord::Base
|
|
211
211
|
reify_previous_draft.reify
|
212
212
|
elsif !self.object.nil?
|
213
213
|
# This appears to be necessary if for some reason the draft's model hasn't been loaded (such as when done in the console).
|
214
|
-
|
214
|
+
unless defined? self.item_type
|
215
|
+
require self.item_type.underscore
|
216
|
+
end
|
215
217
|
|
216
218
|
model = item.reload
|
217
219
|
|
data/lib/draftsman/model.rb
CHANGED
@@ -297,9 +297,10 @@ module Draftsman
|
|
297
297
|
self.save
|
298
298
|
# Destroy the draft if this record has changed back to the original record
|
299
299
|
elsif changed_to_original_for_draft?
|
300
|
-
send(self.class.draft_association_name)
|
300
|
+
nilified_draft = send(self.class.draft_association_name)
|
301
301
|
send "#{self.class.draft_association_name}_id=", nil
|
302
302
|
self.save
|
303
|
+
nilified_draft.destroy
|
303
304
|
# Save a draft if record is changed notably
|
304
305
|
elsif changed_notably_for_draft?
|
305
306
|
data = {
|
data/lib/draftsman/version.rb
CHANGED
@@ -13,7 +13,13 @@ Dummy::Application.configure do
|
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance
|
16
|
-
|
16
|
+
if ::ActiveRecord::VERSION::STRING < '4.2'
|
17
|
+
config.serve_static_assets = true
|
18
|
+
# Rails 4.2 deprecates this in favor of `serve_static_files`.
|
19
|
+
else
|
20
|
+
config.serve_static_files = true
|
21
|
+
end
|
22
|
+
|
17
23
|
config.static_cache_control = "public, max-age=3600"
|
18
24
|
|
19
25
|
# Show full error reports and disable caching
|
@@ -20,7 +20,7 @@ class SetUpTestTables < ActiveRecord::Migration
|
|
20
20
|
|
21
21
|
create_table :vanillas, :force => true do |t|
|
22
22
|
t.string :name
|
23
|
-
t.references :draft
|
23
|
+
t.references :draft, :foreign_key => true
|
24
24
|
t.datetime :published_at
|
25
25
|
t.timestamps
|
26
26
|
end
|
@@ -28,7 +28,7 @@ class SetUpTestTables < ActiveRecord::Migration
|
|
28
28
|
create_table :trashables, :force => true do |t|
|
29
29
|
t.string :name
|
30
30
|
t.string :title, :null => true
|
31
|
-
t.references :draft
|
31
|
+
t.references :draft, :foreign_key => true
|
32
32
|
t.datetime :published_at
|
33
33
|
t.datetime :trashed_at
|
34
34
|
t.timestamps
|
@@ -44,14 +44,14 @@ class SetUpTestTables < ActiveRecord::Migration
|
|
44
44
|
create_table :whitelisters, :force => true do |t|
|
45
45
|
t.string :name
|
46
46
|
t.string :ignored
|
47
|
-
t.references :draft
|
47
|
+
t.references :draft, :foreign_key => true
|
48
48
|
t.datetime :published_at
|
49
49
|
t.timestamps
|
50
50
|
end
|
51
51
|
|
52
52
|
create_table :parents, :force => true do |t|
|
53
53
|
t.string :name
|
54
|
-
t.references :draft
|
54
|
+
t.references :draft, :foreign_key => true
|
55
55
|
t.datetime :trashed_at
|
56
56
|
t.datetime :published_at
|
57
57
|
t.timestamps
|
@@ -60,7 +60,7 @@ class SetUpTestTables < ActiveRecord::Migration
|
|
60
60
|
create_table :children, :force => true do |t|
|
61
61
|
t.string :name
|
62
62
|
t.references :parent
|
63
|
-
t.references :draft
|
63
|
+
t.references :draft, :foreign_key => true
|
64
64
|
t.datetime :trashed_at
|
65
65
|
t.datetime :published_at
|
66
66
|
t.timestamps
|
@@ -75,7 +75,7 @@ class SetUpTestTables < ActiveRecord::Migration
|
|
75
75
|
create_table :skippers, :force => true do |t|
|
76
76
|
t.string :name
|
77
77
|
t.string :skip_me
|
78
|
-
t.references :draft
|
78
|
+
t.references :draft, :foreign_key => true
|
79
79
|
t.datetime :trashed_at
|
80
80
|
t.datetime :published_at
|
81
81
|
t.timestamps
|
@@ -3,7 +3,7 @@ class AddOnlyChildren < ActiveRecord::Migration
|
|
3
3
|
create_table :only_children, :force => true do |t|
|
4
4
|
t.string :name
|
5
5
|
t.references :parent
|
6
|
-
t.references :draft
|
6
|
+
t.references :draft, :foreign_key => true
|
7
7
|
t.datetime :trashed_at
|
8
8
|
t.datetime :published_at
|
9
9
|
t.timestamps
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -13,6 +13,9 @@
|
|
13
13
|
|
14
14
|
ActiveRecord::Schema.define(version: 20150408234937) do
|
15
15
|
|
16
|
+
# These are extensions that must be enabled in order to support this database
|
17
|
+
enable_extension "plpgsql"
|
18
|
+
|
16
19
|
create_table "bastards", force: :cascade do |t|
|
17
20
|
t.string "name"
|
18
21
|
t.integer "parent_id"
|
@@ -109,4 +112,11 @@ ActiveRecord::Schema.define(version: 20150408234937) do
|
|
109
112
|
t.datetime "updated_at"
|
110
113
|
end
|
111
114
|
|
115
|
+
add_foreign_key "children", "drafts"
|
116
|
+
add_foreign_key "only_children", "drafts"
|
117
|
+
add_foreign_key "parents", "drafts"
|
118
|
+
add_foreign_key "skippers", "drafts"
|
119
|
+
add_foreign_key "trashables", "drafts"
|
120
|
+
add_foreign_key "vanillas", "drafts"
|
121
|
+
add_foreign_key "whitelisters", "drafts"
|
112
122
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# SerializedAttributes is deprecated in Rails 4.2.x, and will be removed in
|
2
|
+
# Rails 5. Draftsman spews a ton of deprecation warnings about this issue.
|
3
|
+
#
|
4
|
+
# More info: https://github.com/airblade/paper_trail/issues/416
|
5
|
+
#
|
6
|
+
# TODO: when migrating to Rails 5, remove this initializer
|
7
|
+
|
8
|
+
if Draftsman::VERSION.to_f < 1.0
|
9
|
+
current_behavior = ActiveSupport::Deprecation.behavior
|
10
|
+
ActiveSupport::Deprecation.behavior = lambda do |message, callstack|
|
11
|
+
return if message =~ /`serialized_attributes` is deprecated without replacement/ && callstack.any? { |m| m =~ /draftsman/ }
|
12
|
+
Array.wrap(current_behavior).each { |behavior| behavior.call(message, callstack) }
|
13
|
+
end
|
14
|
+
else
|
15
|
+
warn 'FIXME: Draftsman initializer to suppress deprecation warnings can be safely removed.'
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draftsman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Peters
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -115,8 +115,6 @@ extra_rdoc_files: []
|
|
115
115
|
files:
|
116
116
|
- ".gitignore"
|
117
117
|
- ".rspec"
|
118
|
-
- ".ruby-gemset"
|
119
|
-
- ".ruby-version"
|
120
118
|
- CHANGELOG.md
|
121
119
|
- Gemfile
|
122
120
|
- LICENSE
|
@@ -200,6 +198,7 @@ files:
|
|
200
198
|
- spec/models/vanilla_spec.rb
|
201
199
|
- spec/models/whitelister_spec.rb
|
202
200
|
- spec/spec_helper.rb
|
201
|
+
- spec/support/silence_serialized_attributes_deprecation.rb
|
203
202
|
homepage: https://github.com/liveeditor/draftsman
|
204
203
|
licenses:
|
205
204
|
- MIT
|
@@ -220,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
219
|
version: '0'
|
221
220
|
requirements: []
|
222
221
|
rubyforge_project:
|
223
|
-
rubygems_version: 2.4.
|
222
|
+
rubygems_version: 2.4.5.1
|
224
223
|
signing_key:
|
225
224
|
specification_version: 4
|
226
225
|
summary: Create draft versions of your ActiveRecord models' data. Works with Ruby
|
@@ -286,3 +285,4 @@ test_files:
|
|
286
285
|
- spec/models/vanilla_spec.rb
|
287
286
|
- spec/models/whitelister_spec.rb
|
288
287
|
- spec/spec_helper.rb
|
288
|
+
- spec/support/silence_serialized_attributes_deprecation.rb
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
draftsman
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.2.1
|