Class: Locomotive::Mounter::Writer::Api::SnippetsWriter
- Defined in:
- lib/locomotive/mounter/writer/api/snippets_writer.rb
Overview
Push snippets to a remote LocomotiveCMS engine.
The force option is not used.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #prepare ⇒ Object
-
#write ⇒ Object
Write all the snippets to the remote destination.
Methods inherited from Base
#absolute_path, #data?, #each_locale, #get, #initialize, #path_to_file, #post, #put, #replace_content_assets!, #safe_attributes
Constructor Details
This class inherits a constructor from Locomotive::Mounter::Writer::Api::Base
Instance Method Details
#prepare ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/locomotive/mounter/writer/api/snippets_writer.rb', line 12 def prepare super # set the unique identifier to each local snippet self.get(:snippets, nil, true).each do |attributes| snippet = self.snippets[attributes['slug']] snippet._id = attributes['id'] if snippet end end |
#write ⇒ Object
Write all the snippets to the remote destination
24 25 26 27 28 29 30 |
# File 'lib/locomotive/mounter/writer/api/snippets_writer.rb', line 24 def write self.each_locale do |locale| self.output_locale self.snippets.values.each { |snippet| self.write_snippet(snippet) } end end |