Class: SyncFog::SyncFogAssets
- Inherits:
-
Object
- Object
- SyncFog::SyncFogAssets
- Defined in:
- lib/sync_fog/sync_fog_assets.rb
Instance Method Summary collapse
-
#filter_zip(files) ⇒ Object
Helper.
-
#initialize ⇒ SyncFogAssets
constructor
A new instance of SyncFogAssets.
- #list(dir = ".") ⇒ Object
Constructor Details
#initialize ⇒ SyncFogAssets
Returns a new instance of SyncFogAssets.
9 10 11 |
# File 'lib/sync_fog/sync_fog_assets.rb', line 9 def initialize end |
Instance Method Details
#filter_zip(files) ⇒ Object
Helper
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sync_fog/sync_fog_assets.rb', line 28 def filter_zip(files) files_copy = [] files_strings = files.map{|f| f.to_s} files.each do |file| # remove files which have an gz equivalent unless File.extname(file) != ".gz" && files_strings.include?( "#{file.to_s}.gz" ) files_copy << file end end files_copy end |
#list(dir = ".") ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sync_fog/sync_fog_assets.rb', line 13 def list(dir=".") root_path = Pathname.new File.('..',dir) # one dir up files = [] Dir.glob("#{dir}/**/*") do |file| path = Pathname.new file files << path.relative_path_from(root_path) unless %w(. ..).include?(file) end SyncFog.configuration.use_gzip ? filter_zip(files) : files end |