Class: Locomotive::Mounter::Reader::FileSystem::SiteReader

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/mounter/reader/file_system/site_reader.rb

Instance Attribute Summary

Attributes inherited from Base

#items, #runner

Instance Method Summary collapse

Methods inherited from Base

#initialize, #mounting_point

Constructor Details

This class inherits a constructor from Locomotive::Mounter::Reader::FileSystem::Base

Instance Method Details

#readObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/locomotive/mounter/reader/file_system/site_reader.rb', line 8

def read
  config_path = File.join(self.runner.path, 'config', 'site.yml')

  site = self.read_yaml(config_path)

  # set the default locale first
  Locomotive::Mounter.locale = site['locales'].first.to_sym rescue Locomotive::Mounter.locale

  Locomotive::Mounter::Models::Site.new(site).tap do |_site|
   # set the time zone for the next Time operations (UTC by default)
   Time.zone = ActiveSupport::TimeZone.new(_site.timezone || 'UTC')
  end
end