Class: SproutPunk::Builds::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/sproutpunk/builds.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Build

Returns a new instance of Build.



12
13
14
15
16
17
# File 'lib/sproutpunk/builds.rb', line 12

def initialize(name)
  super
  @name = name
  @config = Builds.config
  Dir.chdir(SproutPunk.config.root_directory)
end

Instance Method Details

#cert_executable(name) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/sproutpunk/builds.rb', line 63

def cert_executable(name)
  exe = FlashSDK::ADT.new

  cert = @config["certs"][name].dup

  exe.certificate = true
  exe.cn = 'SelfCertificate'
  exe.key_type = '2048-RSA'
  exe.pfx_file = cert["file"]
  exe.password = File.read(cert["password"]).to_s.strip

  exe
end

#executeObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/sproutpunk/builds.rb', line 19

def execute
  build_data = @config["packages"][@name]

  pack_exe = package_executable(@name)
  swf_exe  = swf_executable(build_data["swf"])
  cert_exe = cert_executable(build_data["cert"])

  swf_exe.execute
  cert_exe.execute
  pack_exe.execute
end

#package_executable(name) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/sproutpunk/builds.rb', line 31

def package_executable(name)
  exe = FlashSDK::ADT.new

  package = @config["packages"][@name].dup
  cert    = @config["certs"][package.delete("cert")]
  swf     = package.delete "swf"

  package.each do |k, v|
    exe.send("#{k}=", v)
  end

  exe.keystore = cert["file"]
  exe.storepass = File.read(cert["password"]).to_s.strip
  exe.included_files << "bin/#{swf}.swf"

  exe
end

#swf_executable(name) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sproutpunk/builds.rb', line 49

def swf_executable(name)
  exe = FlashSDK::MXMLC.new

  swf = @config["swfs"][name].dup

  swf.each do |k, v|
    exe.send("#{k}=", v)
  end

  exe.output = "bin/#{name}.swf"

  exe
end