Class: Occams::Seeds::Layout::Importer

Inherits:
Importer
  • Object
show all
Defined in:
lib/occams/seeds/layout/importer.rb

Instance Attribute Summary

Attributes inherited from Importer

#from, #path, #seed_ids, #site, #to

Instance Method Summary collapse

Constructor Details

#initialize(from, to = from) ⇒ Importer

Returns a new instance of Importer.



5
6
7
8
# File 'lib/occams/seeds/layout/importer.rb', line 5

def initialize(from, to = from)
  super
  self.path = ::File.join(Occams.config.seeds_path, from, 'layouts/')
end

Instance Method Details

#import!(path = self.path, parent = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/occams/seeds/layout/importer.rb', line 10

def import!(path = self.path, parent = nil)
  Dir["#{path}*/"].each do |layout_path|
    import_layout(layout_path, parent)
  end

  # cleaning up
  site.layouts.where('id NOT IN (?)', seed_ids).destroy_all
end