Sha256: 93fb0c773132b13976375ba26fa1e7c92e6813663d097de7576767df0b7e0a3d

Contents?: true

Size: 1.24 KB

Versions: 22

Compression:

Stored size: 1.24 KB

Contents

require_relative_all 'repositories'

module Locomotive
  module Steam

    class Repositories

      include Morphine

      attr_accessor_initialize :current_site, :locale, :configuration

      register :adapter do
        build_adapter(configuration.adapter)
      end

      register :site do
        SiteRepository.new(adapter, nil, locale)
      end

      register :page do
        PageRepository.new(adapter, current_site, locale)
      end

      register :snippet do
        SnippetRepository.new(adapter, current_site, locale)
      end

      register :content_type do
        ContentTypeRepository.new(adapter, current_site, locale)
      end

      register :content_entry do
        ContentEntryRepository.new(adapter, current_site, locale, content_type)
      end

      register :theme_asset do
        ThemeAssetRepository.new(adapter, current_site, locale)
      end

      register :translation do
        TranslationRepository.new(adapter, current_site, locale)
      end

      def build_adapter(options)
        name = ((options || {})[:name] || :filesystem).to_s
        require_relative "adapters/#{name.downcase}"
        klass = "Locomotive::Steam::#{name.camelize}Adapter".constantize
        klass.new(options)
      end

    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
locomotivecms_steam-1.1.2 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.2.1 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.2.0 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.2.0.rc3 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.2.0.rc2 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.2.0.rc1 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.2.0.beta1 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.1.1 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.1.0 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.1.0.rc3 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.1.0.rc2 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.1.0.rc1 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.0.1 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.0.0 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.0.0.rc10 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.0.0.rc9 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.0.0.rc8 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.0.0.rc6 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.0.0.rc4 lib/locomotive/steam/repositories.rb
locomotivecms_steam-1.0.0.rc3 lib/locomotive/steam/repositories.rb