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.



58
59
60
61
62
63
64
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 58

def initialize(from, to = from)
  self.from = from
  self.to   = to
  self.site = Comfy::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.



53
54
55
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 53

def from
  @from
end

#pathObject

Returns the value of attribute path.



53
54
55
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 53

def path
  @path
end

#siteObject

Returns the value of attribute site.



53
54
55
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 53

def site
  @site
end

#toObject

Returns the value of attribute to.



53
54
55
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 53

def to
  @to
end

Instance Method Details

#export!Object



71
72
73
74
75
76
77
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 71

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



66
67
68
69
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 66

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