Sha256: 599b6325801407fbc9882639e57a1561164551e6a21a8285ebb4fd07bb1f690a

Contents?: true

Size: 939 Bytes

Versions: 12

Compression:

Stored size: 939 Bytes

Contents

module Locomotive::Wagon

  class SyncSiteCommand < PullSiteCommand

    include Locomotive::Wagon::BaseConcern

    def _sync
      attributes = current_site.attributes.slice('name', 'timezone', 'seo_title', 'meta_keywords', 'meta_description', 'robots_txt', 'metafields', 'sections_content')

      locales.each_with_index do |locale, index|
        if index == 0
          transform_in_default_locale(attributes, locale)
        else
          add_other_locale(attributes, locale)
        end
      end if locales.size > 1

      decode_metafields(attributes)
      decode_sections_content(attributes)

      write_to_file(site_filepath, replace_asset_urls(JSON.neat_generate(attributes, {
        sort: true, short: false, padding: 1, object_padding: 1, after_colon: 1, after_comma: 1, wrap: 20, aligned: false
      })))
    end

    protected

    def site_filepath
      File.join('data', env.to_s, 'site.json')
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
locomotivecms_wagon-3.2.0.alpha2 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.2.0.alpha1 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.1.1 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.1.0 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.1.0.beta1 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.0.5 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.0.4 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.0.3 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.0.2 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.0.0 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.0.0.rc0 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb
locomotivecms_wagon-3.0.0.beta2 lib/locomotive/wagon/commands/sync_sub_commands/sync_site_command.rb