Class: Shippy::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/shippy/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Builder

Returns a new instance of Builder.



9
10
11
12
# File 'lib/shippy/builder.rb', line 9

def initialize(app)
  @app = app
  @archive_path = "/tmp/v#{Time.now.to_i}.tar.gz"
end

Instance Attribute Details

#archive_path ⇒ Object (readonly)

Returns the value of attribute archive_path.



7
8
9
# File 'lib/shippy/builder.rb', line 7

def archive_path
  @archive_path
end

Instance Method Details

#archive ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/shippy/builder.rb', line 18

def archive
  FileUtils.cd("builds/apps") do
    File.open(@archive_path, "wb") do |file|
      zlib = Zlib::GzipWriter.new(file)
      Minitar.pack(@app.name, zlib)
    end
  end
  @archive_path
end

#cleanup ⇒ Object



28
29
30
# File 'lib/shippy/builder.rb', line 28

def cleanup
  FileUtils.rm_f(@archive_path)
end

#compile ⇒ Object



14
15
16
# File 'lib/shippy/builder.rb', line 14

def compile
  Shippy::Compiler.new(@app, config: SHIPPY.config).compile
end