Class: Raykit::Zip

Inherits:
Object
  • Object
show all
Defined in:
lib/raykit/zip.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Zip

Returns a new instance of Zip.



10
11
12
13
14
15
16
# File 'lib/raykit/zip.rb', line 10

def initialize(filename)
  @filename = filename
  @source_dir = Dir.pwd
  @include_globs = []
  @exclude_globs = []
  self
end

Instance Method Details

#exclude_glob(glob) ⇒ Object



28
29
30
31
# File 'lib/raykit/zip.rb', line 28

def exclude_glob(glob)
  @exclude_globs << glob
  self
end

#include_glob(glob) ⇒ Object



23
24
25
26
# File 'lib/raykit/zip.rb', line 23

def include_glob(glob)
  @include_globs << glob
  self
end

#source_dir(dir) ⇒ Object



18
19
20
21
# File 'lib/raykit/zip.rb', line 18

def source_dir(dir)
  @source_dir = dir
  self
end

#zipObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/raykit/zip.rb', line 33

def zip
  path = File.dirname(@filename)
  FileUtils.mkdir_p(path) unless Dir.exist?(path)

  Dir.chdir(@source_dir) do
    include_files = []
    @include_globs.each do |include_glob|
    end
  end
end