modalfields 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -187,6 +187,7 @@ module ModalFields
187
187
  # changes can be easily reviewed.
188
188
  def update(modify=true)
189
189
  dbmodels.each do |model, file|
190
+ next if file.nil?
190
191
  new_fields, modified_fields, deleted_fields, deleted_model = diff(model)
191
192
  unless new_fields.empty? && modified_fields.empty? && deleted_fields.empty?
192
193
  pre, start_fields, fields, end_fields, post = split_model_file(file)
@@ -223,7 +224,7 @@ module ModalFields
223
224
  dbmodels.each do |model, file|
224
225
  new_fields, modified_fields, deleted_fields, deleted_model = diff(model)
225
226
  unless new_fields.empty? && modified_fields.empty? && deleted_fields.empty?
226
- rel_file = file.sub(/\A#{Rails.root}/,'')
227
+ rel_file = file && file.sub(/\A#{Rails.root}/,'')
227
228
  puts "#{model} (#{rel_file}):"
228
229
  puts " (deleted)" if deleted_model
229
230
  [['+',new_fields],['*',modified_fields],['-',deleted_fields]].each do |prefix, fields|
@@ -243,7 +244,7 @@ module ModalFields
243
244
  unless new_fields.empty? && modified_fields.empty? && deleted_fields.empty?
244
245
  up << "\n"
245
246
  down << "\n"
246
- rel_file = file.sub(/\A#{Rails.root}/,'')
247
+ rel_file = file && file.sub(/\A#{Rails.root}/,'')
247
248
  if deleted_model && modified_fields.empty? && new_fields.empty?
248
249
  up << " create_table #{model.table_name.to_sym.inspect} do |t|\n"
249
250
  deleted_fields.each do |field|
@@ -318,6 +319,7 @@ module ModalFields
318
319
  .map{|f| [File.basename(f).chomp(".rb").camelize.constantize, f]}\
319
320
  .select{|c,f| has_table(c)}\
320
321
  .reject{|c,f| has_table(c.superclass)}
322
+ models += ActiveRecord::Base.send(:subclasses).reject{|c| c.name.starts_with?('CGI::') || !has_table(c) || has_table(c.superclass)}
321
323
  models.uniq
322
324
  end
323
325
 
data/modalfields.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "modalfields"
8
- s.version = "1.2.1"
8
+ s.version = "1.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Javier Goizueta"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modalfields
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -214,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
214
  version: '0'
215
215
  segments:
216
216
  - 0
217
- hash: -3564766831830068922
217
+ hash: 1098194892061652516
218
218
  required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  none: false
220
220
  requirements: