Class: StaticSync::Config
- Inherits:
-
Hash
- Object
- Hash
- StaticSync::Config
- Defined in:
- lib/static_sync/config.rb
Instance Method Summary collapse
- #cache ⇒ Object
- #gzip ⇒ Object
- #ignored ⇒ Object
- #load(path = '.static') ⇒ Object
- #log ⇒ Object
- #remote ⇒ Object
- #source ⇒ Object
- #storage ⇒ Object
- #target ⇒ Object
Instance Method Details
#cache ⇒ Object
10 11 12 |
# File 'lib/static_sync/config.rb', line 10 def cache self.fetch('cache', {}) end |
#gzip ⇒ Object
36 37 38 |
# File 'lib/static_sync/config.rb', line 36 def gzip self.fetch('gzip', true) end |
#ignored ⇒ Object
40 41 42 |
# File 'lib/static_sync/config.rb', line 40 def ignored self['ignored'] end |
#load(path = '.static') ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/static_sync/config.rb', line 44 def load(path = '.static') content = '{}' begin content = File.read(path) rescue # Loading config from file is not mandatory. end self.replace(YAML.load(ERB.new(content).result)) self end |
#log ⇒ Object
6 7 8 |
# File 'lib/static_sync/config.rb', line 6 def log self.fetch('log', true) end |
#remote ⇒ Object
14 15 16 |
# File 'lib/static_sync/config.rb', line 14 def remote self.fetch('remote', {}) end |
#source ⇒ Object
18 19 20 |
# File 'lib/static_sync/config.rb', line 18 def source self.fetch('local', {})['directory'] end |
#storage ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/static_sync/config.rb', line 26 def storage Fog::Storage.new({ :persistent => true, :provider => self.remote['provider'], :region => self.remote['region'], :aws_access_key_id => self.remote['username'], :aws_secret_access_key => self.remote['password'] }) end |
#target ⇒ Object
22 23 24 |
# File 'lib/static_sync/config.rb', line 22 def target self.remote['directory'] end |