Class: ComfortableMexicanSofa::Fixture::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/comfortable_mexican_sofa/fixture.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to = from) ⇒ Exporter

Returns a new instance of Exporter.



55
56
57
58
59
60
61
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 55

def initialize(from, to = from)
  self.from = from
  self.to   = to
  self.site = Cms::Site.where(:identifier => from).first!
  dir = self.class.name.split('::')[2].downcase.pluralize
  self.path = ::File.join(ComfortableMexicanSofa.config.fixtures_path, to, dir)
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



50
51
52
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 50

def from
  @from
end

#pathObject

Returns the value of attribute path.



50
51
52
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 50

def path
  @path
end

#siteObject

Returns the value of attribute site.



50
51
52
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 50

def site
  @site
end

#toObject

Returns the value of attribute to.



50
51
52
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 50

def to
  @to
end

Instance Method Details

#export!Object



68
69
70
71
72
73
74
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 68

def export!
  ComfortableMexicanSofa::Fixture::File::Exporter.new(    from, to).export!
  ComfortableMexicanSofa::Fixture::Category::Exporter.new(from, to).export!
  ComfortableMexicanSofa::Fixture::Layout::Exporter.new(  from, to).export!
  ComfortableMexicanSofa::Fixture::Page::Exporter.new(    from, to).export!
  ComfortableMexicanSofa::Fixture::Snippet::Exporter.new( from, to).export!
end

#prepare_folder!(path) ⇒ Object



63
64
65
66
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 63

def prepare_folder!(path)
  FileUtils.rm_rf(path)
  FileUtils.mkdir_p(path)
end