draftsman 0.3.3 → 0.3.4

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
2
  SHA1:
3
- metadata.gz: e7c171351b9d3dbd76bc30ae5385e99a771c9e52
4
- data.tar.gz: b59f30aeed82d65392097f6e2d9cd2cb275420f1
3
+ metadata.gz: b38f2627f56beadc10e01b0a07b9484ba4fd9d92
4
+ data.tar.gz: 98cefed36490f43ce3416ede00b2bfb1ef11b28d
5
5
  SHA512:
6
- metadata.gz: f1cefc9d992c9de7e485a29b1c5affd5f0bd4580a901346f7234bdce2cdc87143fde506b72b23da237daa6913c28f04c6787435e45b5afbbd3b2b51ec619ae8a
7
- data.tar.gz: a43b06c0e6d444559e988efe34368c2e86aa642992193b7b72a970cbfc978719fc39701a5eb20d11bdb73d12867098f2aa5239b9edc8fb441d51fbd0e2d4edb8
6
+ metadata.gz: 60d3bbe5dfb13262fc1075dc987726aaa671affda4c467360353d609722206ed86fadf0fff7c4a3351b4d4593a3cebf39f45e1fb4c9920ce30661d1e2d7d5dd5
7
+ data.tar.gz: 3f8c96b231067ad01510a80a4c973ed594e7fc5f5d4069b2fa511774cae571d368becbf730e54c4a4f771166fef2513498febc64db05135340bfdaa2c831e61c
data/.gitignore CHANGED
@@ -5,6 +5,7 @@ pkg/*
5
5
  ._*
6
6
  .idea/
7
7
  .redcar/
8
+ bin/
8
9
  spec/dummy/tmp/
9
10
  spec/dummy/db/*.sqlite3
10
11
  spec/dummy/log/*.log
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.3.4 - May 21, 2015
4
+
5
+ - [@npafundi](https://github.com/npafundi)
6
+ [Fixed](https://github.com/liveeditor/draftsman/pull/21)
7
+ [#13](https://github.com/liveeditor/draftsman/issues/13) -
8
+ LoadError when trying to run migrations
9
+ - [@npafundi](https://github.com/npafundi)
10
+ [Fixed](https://github.com/liveeditor/draftsman/pull/23)
11
+ [#22](https://github.com/liveeditor/draftsman/issues/22) -
12
+ Exception on draft_destroy when has_one association is nil
13
+ - [@chrisdpeters](https://github.com/chrisdpeters)
14
+ [Fixed](https://github.com/liveeditor/draftsman/commit/32b13375f4e50bafc3b4516d731d2fcf51a5fb2b)
15
+ [#24](https://github.com/liveeditor/draftsman/issues/24) -
16
+ Stack too deep: Error when running `bundle exec rails c` in app including draftsman
17
+
3
18
  ## 0.3.3 - April 8, 2015
4
19
 
5
20
  - Fixed regression [#18](https://github.com/liveeditor/draftsman/pull/19) - Exception when destroying drafts
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Draftsman v0.3.3 (alpha)
1
+ # Draftsman v0.3.4 (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.
@@ -259,11 +259,12 @@ module Draftsman
259
259
  dependent_associations.each do |association|
260
260
 
261
261
  if association.klass.draftable? && association.options.has_key?(:dependent) && association.options[:dependent] == :destroy
262
- dependents = association.macro == :has_one ? [self.send(association.name)] : self.send(association.name)
262
+ dependents = self.send(association.name)
263
+ dependents = [dependents] if (dependents && association.macro == :has_one)
263
264
 
264
265
  dependents.each do |dependent|
265
266
  dependent.draft_destroy unless dependent.draft? && dependent.send(dependent.class.draft_association_name).destroy?
266
- end
267
+ end if dependents
267
268
  end
268
269
  end
269
270
  end
@@ -1,3 +1,3 @@
1
1
  module Draftsman
2
- VERSION = '0.3.3'
2
+ VERSION = '0.3.4'
3
3
  end
@@ -0,0 +1,4 @@
1
+ class OnlyChild < ActiveRecord::Base
2
+ has_drafts
3
+ belongs_to :parent
4
+ end
@@ -2,4 +2,5 @@ class Parent < ActiveRecord::Base
2
2
  has_drafts
3
3
  has_many :children, :dependent => :destroy
4
4
  has_many :bastards, :dependent => :destroy
5
+ has_one :only_child, :dependent => :destroy
5
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
 
3
3
  # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
5
5
 
6
6
  require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,16 @@
1
+ class AddOnlyChildren < ActiveRecord::Migration
2
+ def up
3
+ create_table :only_children, :force => true do |t|
4
+ t.string :name
5
+ t.references :parent
6
+ t.references :draft
7
+ t.datetime :trashed_at
8
+ t.datetime :published_at
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def down
14
+ drop_table :only_children
15
+ end
16
+ end
@@ -11,20 +11,16 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20110208155312) do
14
+ ActiveRecord::Schema.define(version: 20150408234937) do
15
15
 
16
- create_table "bastards", force: true do |t|
16
+ create_table "bastards", force: :cascade do |t|
17
17
  t.string "name"
18
18
  t.integer "parent_id"
19
19
  t.datetime "created_at"
20
20
  t.datetime "updated_at"
21
21
  end
22
22
 
23
- create_table "change_hoarders", force: true do |t|
24
- t.integer "draft_id"
25
- end
26
-
27
- create_table "children", force: true do |t|
23
+ create_table "children", force: :cascade do |t|
28
24
  t.string "name"
29
25
  t.integer "parent_id"
30
26
  t.integer "draft_id"
@@ -34,16 +30,7 @@ ActiveRecord::Schema.define(version: 20110208155312) do
34
30
  t.datetime "updated_at"
35
31
  end
36
32
 
37
- create_table "clingy_parents", force: true do |t|
38
- t.string "name"
39
- t.integer "draft_id"
40
- t.datetime "trashed_at"
41
- t.datetime "published_at"
42
- t.datetime "created_at"
43
- t.datetime "updated_at"
44
- end
45
-
46
- create_table "draft_as_sketches", force: true do |t|
33
+ create_table "draft_as_sketches", force: :cascade do |t|
47
34
  t.string "name"
48
35
  t.integer "sketch_id"
49
36
  t.datetime "published_at"
@@ -51,17 +38,7 @@ ActiveRecord::Schema.define(version: 20110208155312) do
51
38
  t.datetime "updated_at"
52
39
  end
53
40
 
54
- create_table "draft_dependencies", force: true do |t|
55
- t.integer "draft_id", null: false
56
- t.integer "dependency_id", null: false
57
- end
58
-
59
- create_table "draft_dependents", force: true do |t|
60
- t.integer "draft_id", null: false
61
- t.integer "dependent_id", null: false
62
- end
63
-
64
- create_table "drafts", force: true do |t|
41
+ create_table "drafts", force: :cascade do |t|
65
42
  t.string "item_type"
66
43
  t.integer "item_id"
67
44
  t.string "event", null: false
@@ -76,18 +53,8 @@ ActiveRecord::Schema.define(version: 20110208155312) do
76
53
  t.string "user_agent"
77
54
  end
78
55
 
79
- create_table "hopeless_children", force: true do |t|
56
+ create_table "only_children", force: :cascade do |t|
80
57
  t.string "name"
81
- t.integer "clingy_parent_id"
82
- t.integer "draft_id"
83
- t.datetime "trashed_at"
84
- t.datetime "published_at"
85
- t.datetime "created_at"
86
- t.datetime "updated_at"
87
- end
88
-
89
- create_table "mortgages", force: true do |t|
90
- t.float "amount"
91
58
  t.integer "parent_id"
92
59
  t.integer "draft_id"
93
60
  t.datetime "trashed_at"
@@ -96,7 +63,7 @@ ActiveRecord::Schema.define(version: 20110208155312) do
96
63
  t.datetime "updated_at"
97
64
  end
98
65
 
99
- create_table "parents", force: true do |t|
66
+ create_table "parents", force: :cascade do |t|
100
67
  t.string "name"
101
68
  t.integer "draft_id"
102
69
  t.datetime "trashed_at"
@@ -105,7 +72,7 @@ ActiveRecord::Schema.define(version: 20110208155312) do
105
72
  t.datetime "updated_at"
106
73
  end
107
74
 
108
- create_table "skippers", force: true do |t|
75
+ create_table "skippers", force: :cascade do |t|
109
76
  t.string "name"
110
77
  t.string "skip_me"
111
78
  t.integer "draft_id"
@@ -115,7 +82,7 @@ ActiveRecord::Schema.define(version: 20110208155312) do
115
82
  t.datetime "updated_at"
116
83
  end
117
84
 
118
- create_table "trashables", force: true do |t|
85
+ create_table "trashables", force: :cascade do |t|
119
86
  t.string "name"
120
87
  t.string "title"
121
88
  t.integer "draft_id"
@@ -125,7 +92,7 @@ ActiveRecord::Schema.define(version: 20110208155312) do
125
92
  t.datetime "updated_at"
126
93
  end
127
94
 
128
- create_table "vanillas", force: true do |t|
95
+ create_table "vanillas", force: :cascade do |t|
129
96
  t.string "name"
130
97
  t.integer "draft_id"
131
98
  t.datetime "published_at"
@@ -133,7 +100,7 @@ ActiveRecord::Schema.define(version: 20110208155312) do
133
100
  t.datetime "updated_at"
134
101
  end
135
102
 
136
- create_table "whitelisters", force: true do |t|
103
+ create_table "whitelisters", force: :cascade do |t|
137
104
  t.string "name"
138
105
  t.string "ignored"
139
106
  t.integer "draft_id"
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.3
4
+ version: 0.3.4
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-04-08 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -109,18 +109,7 @@ dependencies:
109
109
  description: Create draft versions of your ActiveRecord models' data. Works with Ruby
110
110
  on Rails and Sinatra.
111
111
  email: chris@minimalorange.com
112
- executables:
113
- - bundler
114
- - erubis
115
- - htmldiff
116
- - ldiff
117
- - nokogiri
118
- - rackup
119
- - rails
120
- - rake
121
- - rspec
122
- - thor
123
- - tilt
112
+ executables: []
124
113
  extensions: []
125
114
  extra_rdoc_files: []
126
115
  files:
@@ -133,17 +122,6 @@ files:
133
122
  - LICENSE
134
123
  - README.md
135
124
  - Rakefile
136
- - bin/bundler
137
- - bin/erubis
138
- - bin/htmldiff
139
- - bin/ldiff
140
- - bin/nokogiri
141
- - bin/rackup
142
- - bin/rails
143
- - bin/rake
144
- - bin/rspec
145
- - bin/thor
146
- - bin/tilt
147
125
  - draftsman.gemspec
148
126
  - lib/draftsman.rb
149
127
  - lib/draftsman/config.rb
@@ -179,6 +157,7 @@ files:
179
157
  - spec/dummy/app/mailers/.gitkeep
180
158
  - spec/dummy/app/models/bastard.rb
181
159
  - spec/dummy/app/models/child.rb
160
+ - spec/dummy/app/models/only_child.rb
182
161
  - spec/dummy/app/models/parent.rb
183
162
  - spec/dummy/app/models/skipper.rb
184
163
  - spec/dummy/app/models/trashable.rb
@@ -202,6 +181,7 @@ files:
202
181
  - spec/dummy/config/locales/en.yml
203
182
  - spec/dummy/config/routes.rb
204
183
  - spec/dummy/db/migrate/20110208155312_set_up_test_tables.rb
184
+ - spec/dummy/db/migrate/20150408234937_add_only_children.rb
205
185
  - spec/dummy/db/schema.rb
206
186
  - spec/dummy/db/seeds.rb
207
187
  - spec/dummy/lib/assets/.gitkeep
@@ -263,6 +243,7 @@ test_files:
263
243
  - spec/dummy/app/mailers/.gitkeep
264
244
  - spec/dummy/app/models/bastard.rb
265
245
  - spec/dummy/app/models/child.rb
246
+ - spec/dummy/app/models/only_child.rb
266
247
  - spec/dummy/app/models/parent.rb
267
248
  - spec/dummy/app/models/skipper.rb
268
249
  - spec/dummy/app/models/trashable.rb
@@ -286,6 +267,7 @@ test_files:
286
267
  - spec/dummy/config/locales/en.yml
287
268
  - spec/dummy/config/routes.rb
288
269
  - spec/dummy/db/migrate/20110208155312_set_up_test_tables.rb
270
+ - spec/dummy/db/migrate/20150408234937_add_only_children.rb
289
271
  - spec/dummy/db/schema.rb
290
272
  - spec/dummy/db/seeds.rb
291
273
  - spec/dummy/lib/assets/.gitkeep
data/bin/bundler DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'bundler' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('bundler', 'bundler')
data/bin/erubis DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'erubis' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('draftsman', 'erubis')
data/bin/htmldiff DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'htmldiff' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('draftsman', 'htmldiff')
data/bin/ldiff DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'ldiff' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('draftsman', 'ldiff')
data/bin/nokogiri DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'nokogiri' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('draftsman', 'nokogiri')
data/bin/rackup DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'rackup' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('draftsman', 'rackup')
data/bin/rails DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'rails' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('railties', 'rails')
data/bin/rake DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'rake' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('draftsman', 'rake')
data/bin/rspec DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'rspec' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('rspec-core', 'rspec')
data/bin/thor DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'thor' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('thor', 'thor')
data/bin/tilt DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'tilt' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('tilt', 'tilt')