Class: Locomotive::Wagon::SyncPagesCommand
- Inherits:
-
PullPagesCommand
- Object
- Struct
- PullBaseCommand
- PullPagesCommand
- Locomotive::Wagon::SyncPagesCommand
- Includes:
- BaseConcern
- Defined in:
- lib/locomotive/wagon/commands/sync_sub_commands/sync_pages_command.rb
Constant Summary
Constants included from AssetsConcern
Instance Attribute Summary
Attributes inherited from PullPagesCommand
Attributes inherited from PullBaseCommand
#api_client, #current_site, #env, #path
Instance Method Summary collapse
Methods included from BaseConcern
#instrument_base_name, #resource_name, #sync
Methods inherited from PullPagesCommand
Methods inherited from PullBaseCommand
#_pull_with_timezone, #clean_attributes, #default_locale, #dump, #instrument, #instrument_base_name, #is_default_locale?, #locales, #pull, pull, #reset_file, #resource_name, #write_to_file
Methods included from AssetsConcern
#replace_asset_urls, #replace_asset_urls_in_hash
Instance Method Details
#write_page(page, locale = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/locomotive/wagon/commands/sync_sub_commands/sync_pages_command.rb', line 9 def write_page(page, locale = nil) instrument :writing, label: "#{page.fullpath} (#{locale})" filepath = data_path(page, locale) return if page.fullpath =~ /^layouts(\/.*)?$/ attributes = { id: page._id, title: page.title, slug: page.slug, handle: page.handle, listed: page.listed, published: page.published, position: page.position, fullpath: @fullpaths[page._id] } if page.redirect_url.present? attributes.merge!({ redirect_url: page.redirect_url }) else attributes.merge!({ sections_content: sections_content(page), sections_dropzone_content: sections_dropzone_content(page), editable_elements: editable_elements_attributes(page), seo_title: page.seo_title, meta_description: page., meta_keywords: page. }) attributes[:raw_template] = page.template if page.handle.blank? end write_to_file(filepath, replace_asset_urls(JSON.neat_generate(attributes))) instrument :write_with_success end |