Class: Locomotive::Mounter::Writer::Api::SiteWriter
- Defined in:
- lib/locomotive/mounter/writer/api/site_writer.rb
Instance Attribute Summary collapse
-
#remote_site ⇒ Object
Returns the value of attribute remote_site.
Attributes inherited from Base
Instance Method Summary collapse
-
#prepare ⇒ Object
Check if the site has to be created before.
-
#write ⇒ Object
Create the site if it does not exist.
Methods inherited from Base
#absolute_path, #data?, #each_locale, #get, #initialize, #path_to_file, #post, #put, #replace_content_assets!
Constructor Details
This class inherits a constructor from Locomotive::Mounter::Writer::Api::Base
Instance Attribute Details
#remote_site ⇒ Object
Returns the value of attribute remote_site.
8 9 10 |
# File 'lib/locomotive/mounter/writer/api/site_writer.rb', line 8 def remote_site @remote_site end |
Instance Method Details
#prepare ⇒ Object
Check if the site has to be created before.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/locomotive/mounter/writer/api/site_writer.rb', line 11 def prepare super self.fetch_site # if self.fetch_site.nil? # Mounter.logger.warn 'The site does not exist. Trying to create it.' # unless self.has_admin_rights? # raise Mounter::WriterException.new('Your account does not own admin rights.') # end # else # self.check_locales # end end |
#write ⇒ Object
Create the site if it does not exist
28 29 30 31 32 33 34 35 36 |
# File 'lib/locomotive/mounter/writer/api/site_writer.rb', line 28 def write if self.site.persisted? self.check_locales! unless self.force? # requirements self.update_site else self.create_site end end |