Class: Tidy::AirPackager

Inherits:
Object
  • Object
show all
Defined in:
lib/tidy/air_packager.rb

Class Method Summary collapse

Class Method Details

.package(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/tidy/air_packager.rb', line 3

def self.package(options = {})
  id = options[:id]
  files = options[:files] || []
  certificate=options[:certificate] || "../config/air_cert.pfx"
  password = options[:password] || "secret"
  
  FileUtils.mkdir_p("../releases")
  Dir.chdir "bin" do
    certificate_command = "adt -certificate -cn SelfSigned 1024-RSA #{certificate} #{password}"
    unless File.exists?(certificate)
    	puts `#{certificate_command}`
    end
    package_command= "adt -package -storetype pkcs12 -keystore #{certificate} -storepass #{password} ../../releases/#{id}.air #{id}.axml #{id}.swf #{files.join(' ')}"
    puts `#{package_command}`
  end
  unless options[:do_not_launch]
   unless RUBY_PLATFORM =~ /linux/
    `open ../releases/#{id}.air`
  else
	  `gnome-open ../releases/#{id}.air`
  end
	  end
end