Module: SyncFog
- Defined in:
- lib/sync_fog/version.rb,
lib/sync_fog.rb,
lib/sync_fog/configuration.rb,
lib/sync_fog/sync_fog_assets.rb,
lib/sync_fog/sync_fog_upload.rb,
lib/sync_fog/sync_fog_railtie.rb
Overview
Defined Under Namespace
Classes: Configuration, InstallGenerator, SyncFogAssets, SyncFogRailtie, SyncFogUpload
Constant Summary
collapse
- VERSION =
"0.2.2"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
15
16
17
|
# File 'lib/sync_fog.rb', line 15
def self.configuration
@configuration ||= Configuration.new
end
|
19
20
21
|
# File 'lib/sync_fog.rb', line 19
def self.configure
yield(configuration) if block_given?
end
|
.sync ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/sync_fog.rb', line 23
def self.sync
return unless SyncFog.configuration.hook_enabled
p "SyncFog: -- started syncing"
container_name = SyncFog.configuration.fog_directory
source_dir = SyncFog.configuration.source_dir
p "SyncFog: -- source directory is: #{source_dir}"
fog_uploader = SyncFogUpload.new( container_name, SyncFog.configuration.fog_credentials )
files = SyncFogAssets.new.list( source_dir )
p "SyncFog: -- #{files.count} files found"
p "SyncFog: -- uploading"
root_path = Pathname.new File.expand_path('..',source_dir) fog_uploader.upload( files, root_path )
p "SyncFog: -- cleaning up old files"
fog_uploader.clean_remote( files )
p "SyncFog: -- public url: #{fog_uploader.public_url}"
p "SyncFog: -- done"
end
|