Class: ComfortableMexicanSofa::Fixture::Exporter
- Inherits:
-
Object
- Object
- ComfortableMexicanSofa::Fixture::Exporter
- Defined in:
- lib/comfortable_mexican_sofa/fixture.rb
Direct Known Subclasses
Category::Exporter, File::Exporter, Layout::Exporter, Page::Exporter, Snippet::Exporter
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#path ⇒ Object
Returns the value of attribute path.
-
#site ⇒ Object
Returns the value of attribute site.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #export! ⇒ Object
-
#initialize(from, to = from) ⇒ Exporter
constructor
A new instance of Exporter.
- #prepare_folder!(path) ⇒ Object
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
#from ⇒ Object
Returns the value of attribute from.
50 51 52 |
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 50 def from @from end |
#path ⇒ Object
Returns the value of attribute path.
50 51 52 |
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 50 def path @path end |
#site ⇒ Object
Returns the value of attribute site.
50 51 52 |
# File 'lib/comfortable_mexican_sofa/fixture.rb', line 50 def site @site end |
#to ⇒ Object
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 |