Class: IOSBox::Deploy::Deployer
- Inherits:
-
Object
- Object
- IOSBox::Deploy::Deployer
- Defined in:
- lib/ios-box/deploy.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#iosbox ⇒ Object
readonly
Returns the value of attribute iosbox.
Instance Method Summary collapse
- #create_dsym(path) ⇒ Object
- #create_ipa(path) ⇒ Object
-
#initialize(iosbox) ⇒ Deployer
constructor
A new instance of Deployer.
- #notify(opts) ⇒ Object
Constructor Details
#initialize(iosbox) ⇒ Deployer
Returns a new instance of Deployer.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ios-box/deploy.rb', line 11 def initialize(iosbox) @iosbox = iosbox if iosbox.config.growl begin require 'ruby_gntp' @growl = GNTP.new("ios-box") @growl.register({:notifications => [ {:name => "Deployment Succeeded", :enabled => true}, {:name => "Deployment Failed", :enabled => true}, ]}) rescue LoadError iosbox.config.growl = false puts "Please install ruby_gntp gem if you want to enable Growl notifications." end end end |
Instance Attribute Details
#iosbox ⇒ Object (readonly)
Returns the value of attribute iosbox.
9 10 11 |
# File 'lib/ios-box/deploy.rb', line 9 def iosbox @iosbox end |
Instance Method Details
#create_dsym(path) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/ios-box/deploy.rb', line 67 def create_dsym(path) puts "Creating Zipped dSYM from path #{path}..." # Check for missing plist raise "Archive info.plist is missing" unless File.exists?(File.join(path, "Info.plist")) pl = Plist::parse_xml(File.join(path, "Info.plist")) raise "Invalid XCArchive version" unless pl['ArchiveVersion'] == 1 app_path = pl['ApplicationProperties']['ApplicationPath'] app_name = File.basename(app_path) dsym_name = File.join(path, "dSYMs", "#{app_name}.dSYM.zip") if File.exists?(dsym_name) File.unlink(dsym_name) end Zip::ZipFile.open(dsym_name, Zip::ZipFile::CREATE) do |zip| dsym_path = File.join(path, "dSYMs") puts "Path #{dsym_path}" Dir["#{File.join(dsym_path, "#{app_name}.dSYM")}/**/*"].each do |entry| e_name = entry.gsub(/#{dsym_path}\//, '') zip.add e_name, entry end end dsym_name end |
#create_ipa(path) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ios-box/deploy.rb', line 40 def create_ipa(path) puts "Creating IPA from path #{path}..." # Check for missing plist raise "Archive info.plist is missing" unless File.exists?(File.join(path, "Info.plist")) pl = Plist::parse_xml(File.join(path, "Info.plist")) raise "Invalid XCArchive version" unless pl['ArchiveVersion'] == 1 app_path = pl['ApplicationProperties']['ApplicationPath'] app_name = File.basename(app_path, File.extname(app_path)) ipa_name = File.join(path, "Products", "#{app_name}.ipa") puts "Compressing #{app_path}" if File.exists?(ipa_name) File.unlink(ipa_name) end Zip::ZipFile.open(ipa_name, Zip::ZipFile::CREATE) do |zip| Dir["#{File.join(path, "Products", app_path)}/**/*"].each do |entry| e_name = entry.gsub(/#{File.join(path, "Products", app_path)}\//, '') e_name = "Payload/#{app_name}.app/#{e_name}" zip.add e_name, entry end end ipa_name end |
#notify(opts) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/ios-box/deploy.rb', line 30 def notify(opts) return unless iosbox.config.growl @growl.notify( :name => opts[:name], :title => opts[:title], :text => opts[:text] || opts[:error] ) end |