Sha256: bb5b649a031919cca221d45fdf1edbc86cd4ec606d3f71f8bade19ecb3e2a170

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

module Locomotive
  module Steam
    module Adapters
      module Filesystem
        module YAMLLoaders

          class Site

            include Adapters::Filesystem::YAMLLoader

            def load(scope)
              attributes = _load(File.join(site_path, 'config', 'site.yml'))

              (attributes[:domains] ||= []).concat(%w(0.0.0.0 localhost))

              attributes[:picture] = File.expand_path(File.join(site_path, 'icon.png'))

              attributes[:metafields_schema] = load_metafields_schema

              attributes.merge!(load_from_env)

              [attributes]
            end

            private

            def load_from_env
              return {} if env == :local

              safe_json_load(File.join(site_path, 'data', env.to_s, 'site.json')).symbolize_keys
            end

            def load_metafields_schema
              _load(File.join(site_path, 'config', 'metafields_schema.yml'))
            end

          end

        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locomotivecms_steam-1.5.0.rc0 lib/locomotive/steam/adapters/filesystem/yaml_loaders/site.rb
locomotivecms_steam-1.5.0.beta3 lib/locomotive/steam/adapters/filesystem/yaml_loaders/site.rb
locomotivecms_steam-1.5.0.beta2 lib/locomotive/steam/adapters/filesystem/yaml_loaders/site.rb