Class: Phase::IPA::EnterpriseDeployment
- Inherits:
-
Object
- Object
- Phase::IPA::EnterpriseDeployment
- Includes:
- Util::Console
- Defined in:
- lib/phase/kit/ipa/enterprise_deployment.rb
Instance Attribute Summary collapse
-
#apps ⇒ Object
readonly
Returns the value of attribute apps.
-
#aws ⇒ Object
readonly
Returns the value of attribute aws.
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#file_paths ⇒ Object
readonly
Returns the value of attribute file_paths.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #copy_ipa!(app) ⇒ Object
-
#initialize(version, *filenames) ⇒ EnterpriseDeployment
constructor
A new instance of EnterpriseDeployment.
- #run! ⇒ Object
- #upload!(app) ⇒ Object
- #write_manifest! ⇒ Object
- #write_plist!(app) ⇒ Object
Methods included from Util::Console
Constructor Details
#initialize(version, *filenames) ⇒ EnterpriseDeployment
Returns a new instance of EnterpriseDeployment.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 8 def initialize(version, *filenames) @version = version @file_paths = filenames.map do |name| ::Dir.glob( ::File.(name) ) end @file_paths.flatten! @file_paths.uniq! @aws = ::Fog::Storage::AWS.new(region: Phase.config.aws_region) @bucket = aws.directories.get(Phase.config.ipa_bucket_name) @prefix = ::Pathname.new(Phase.config.ipa_directory_prefix) @apps = [] end |
Instance Attribute Details
#apps ⇒ Object (readonly)
Returns the value of attribute apps.
6 7 8 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 6 def apps @apps end |
#aws ⇒ Object (readonly)
Returns the value of attribute aws.
6 7 8 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 6 def aws @aws end |
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
6 7 8 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 6 def bucket @bucket end |
#file_paths ⇒ Object (readonly)
Returns the value of attribute file_paths.
6 7 8 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 6 def file_paths @file_paths end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
6 7 8 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 6 def prefix @prefix end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 6 def version @version end |
Instance Method Details
#copy_ipa!(app) ⇒ Object
66 67 68 69 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 66 def copy_ipa!(app) log "#{app.name}: copying .ipa" ::FileUtils.cp(app.qualified_path, ipa_path(app)) end |
#run! ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 24 def run! ::FileUtils.mkdir(version) rescue nil @apps = file_paths.map do |path| app = App.new(path, version) write_plist!(app) copy_ipa!(app) upload!(app) log "...done" log "" app end write_manifest! end |
#upload!(app) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 71 def upload!(app) ipa = bucket.files.new({ key: prefix.join(app.ipa_filename), body: ::File.open(ipa_path(app)), acl: "public-read" }) plist = bucket.files.new({ key: prefix.join(app.plist_filename), body: ::File.open(plist_path(app)), acl: "public-read" }) log "#{app.name}: uploading .ipa" ipa.save log "#{app.name}: uploading .plist" plist.save end |
#write_manifest! ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 42 def write_manifest! log "writing manifest" manifest_path = ::File.join(::Dir.pwd, version, "manifest.txt") ::File.open(manifest_path, 'w') do |file| apps.each do |app| url = [ "itms-services://?action=download-manifest&url=https://s3.amazonaws.com", bucket.key, prefix, app.plist_filename ].join("/") file << url file << "\n" end end end |
#write_plist!(app) ⇒ Object
61 62 63 64 |
# File 'lib/phase/kit/ipa/enterprise_deployment.rb', line 61 def write_plist!(app) log "#{app.name}: writing .plist" ::File.open(plist_path(app), 'w') { |file| file << app.plist_xml } end |