ios3 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 980c78c66d35c5d6cfafa3e02dc073edeeb97789
4
- data.tar.gz: d9913c1ae6fca8df6912e794ea2bffa841d4e50d
3
+ metadata.gz: 536bc416bc465597e011b5a9b9ac9280eeeec2af
4
+ data.tar.gz: 595319f5f524835995387b1e7635e509097214d0
5
5
  SHA512:
6
- metadata.gz: f1e4ee433ac0c4416499681527cd896e3f4d6b5fdad17fc057e0da77195d7fe656166abdcaa156834311eecf1b7b60a323a1ca591bf0a98e16fb8b6228ea0a72
7
- data.tar.gz: 07ccacbc9d4ba0380b58c116528fee382f060eaf8c14f5059b9ce62ebad9a8d115a3283d952a73ac5b711cd4142bb9369dca842384b0a2412c622962a001798a
6
+ metadata.gz: 783630c8ebb78adf59b6dbf2178ae15b8eea29bd00ac865cefed3bed177fea0b03e6be53ca29580298ec823943dd4e7c03cf342ba8032c0ff89313c56dc2da8c
7
+ data.tar.gz: 8b401536761069a2bbc3dc53812413c6635d8824d2ea09057523a60726077cebc639b62fec4d07c33b2a57093491f3d01270137ec999369b00b34ac6f3be3348
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'commander/import'
4
+
5
+ require 'ios3'
6
+
7
+ # Ios3::CLI.run(ARGV)
8
+ program :version, Ios3::VERSION
9
+ program :description, 'Build and distribute iOS apps (.ipa files)'
10
+
11
+ require 'ios3/s3'
@@ -0,0 +1,73 @@
1
+ require 'optparse'
2
+
3
+ module Ios3
4
+ module CLI
5
+ module Options
6
+
7
+ def self.parse!(args)
8
+ options = {}
9
+ optparse = OptionParser.new do |opts|
10
+ opts.banner = "Usage: ios3 [options]"
11
+
12
+ options[:preserve_ipa] = false
13
+ opts.on( '-p', '--preserve-ipa', 'Leave a copy of the .ipa file in the current directory' ) do
14
+ options[:preserve_ipa] = true
15
+ end
16
+
17
+ options[:preserve_manifest] = false
18
+ opts.on( '-m', '--preserve-manifest', 'Leave a copy of the manifest.plist file in the current directory' ) do
19
+ options[:preserve_manifest] = true
20
+ end
21
+
22
+ opts.on( '-h', '--help', 'Display this screen' ) do
23
+ puts opts
24
+ exit
25
+ end
26
+ end
27
+ begin
28
+ optparse.parse!(args)
29
+ rescue
30
+ puts $!
31
+ puts optparse
32
+ exit
33
+ end
34
+
35
+ options
36
+ end
37
+ end
38
+
39
+ # How the whole thing gets started
40
+ def self.run(args)
41
+ unless File.exist?('Rakefile')
42
+ help! "Run on root directoy of RubyMotion project."
43
+ end
44
+
45
+ puts "HELP!!!"
46
+ options = Options.parse!(ARGV)
47
+
48
+ puts options
49
+
50
+
51
+ ios3file = closest_ios3file(Dir.pwd)
52
+ if (ios3file)
53
+ Dir.chdir(File.dirname(ios3file))
54
+ ios3::DSL.load(ios3file, options)
55
+ else
56
+ # puts "Cannot find ios3file"
57
+ say_error "Cannot find ios3file"
58
+ end
59
+ end
60
+
61
+ def self.closest_ios3file(dir)
62
+ file_name = File.join(dir, 'ios3file')
63
+ if File.exists?(file_name)
64
+ file_name
65
+ elsif dir == '/'
66
+ nil
67
+ else
68
+ closest_ios3file(File.expand_path(File.join(dir, '..')))
69
+ end
70
+ end
71
+
72
+ end
73
+ end
@@ -0,0 +1,167 @@
1
+ require 'aws-sdk'
2
+
3
+ # Workflow
4
+ # Add gem to Gemfile or gem install
5
+ # $ ios3 manifest
6
+ # Creates a Manifest File from the template
7
+ # $ ios3 upload
8
+ # Uploads the Manifest and the .ipa from the RubyMotion build
9
+
10
+ # First step is to upload the .ipa
11
+ # After the ipa is uploaded then we can know the url of the ipa on S3 and put that in the manifest
12
+ # Then we can upload the manifest
13
+
14
+ # What info do I need from the user?
15
+ # Bucket to upload to
16
+ # Path within Bucket to upload to # this should be automatically /ios3/CFBundleName_underscores/CFBundleVersion
17
+ #
18
+ # # What do I need from the Filesystem?
19
+ # AWSKEY
20
+ # AWSSECRET
21
+ # AWSREGION
22
+ # CFBundleVersion # 1.0.0
23
+ # CFBundleIdentifier # com.humanswithkids.Blog
24
+ # CFBundleName
25
+
26
+ module S3
27
+ class Client
28
+ def initialize(access_key_id, secret_access_key, region)
29
+ @s3 = AWS::S3.new(:access_key_id => access_key_id,
30
+ :secret_access_key => secret_access_key,
31
+ :region => region)
32
+ end
33
+
34
+ def upload_build(ipa, options)
35
+ # path = expand_path_with_substitutions_from_ipa_plist(ipa, options[:path]) if options[:path]
36
+
37
+ # @s3.buckets.create(options[:bucket]) if options[:create]
38
+
39
+ bucket = @s3.buckets[options[:bucket]]
40
+
41
+ files = []
42
+ files << ipa
43
+ # files << options[:dsym] if options[:dsym]
44
+ files.each do |file|
45
+ basename = File.basename(file)
46
+ key = path ? File.join(path, basename) : basename
47
+ File.open(file) do |descriptor|
48
+ bucket.objects.create(key, descriptor, :acl => options[:acl])
49
+ end
50
+ end
51
+ end
52
+
53
+ # private
54
+ #
55
+ # def expand_path_with_substitutions_from_ipa_plist(ipa, path)
56
+ # substitutions = path.scan(/\{CFBundle[^}]+\}/)
57
+ # return path if substitutions.empty?
58
+ #
59
+ # Dir.mktmpdir do |dir|
60
+ # system "unzip -q #{ipa} -d #{dir} 2> /dev/null"
61
+ #
62
+ # plist = Dir["#{dir}/**/*.app/Info.plist"].last
63
+ #
64
+ # substitutions.uniq.each do |substitution|
65
+ # key = substitution[1...-1]
66
+ # value = Shenzhen::PlistBuddy.print(plist, key)
67
+ #
68
+ # path.gsub!(Regexp.new(substitution), value) if value
69
+ # end
70
+ # end
71
+ #
72
+ # return path
73
+ # end
74
+ end
75
+ end
76
+
77
+ # command :'manifest' do |c|
78
+ # c.syntax = "ios3 manifest [options]"
79
+ # escaped_ipa_url - can we get this from RubyMotion /build/iPhoneOS-8.0-Release/{app_name}.ipa
80
+ # bundle_identifier
81
+ # app_version
82
+ # app_name
83
+ #
84
+ # end
85
+
86
+ command :'upload' do |c|
87
+ c.syntax = "ios3 upload [options]"
88
+ c.summary = "Distribute an .ipa file over Amazon S3"
89
+ c.description = ""
90
+
91
+ c.example '', '$ ios3 upload -f ./file.ipa -a accesskeyid --bucket bucket-name'
92
+
93
+ c.option '-b', '--bucket BUCKET', "S3 bucket"
94
+
95
+ c.action do |args, options|
96
+
97
+ determine_ipa!
98
+ say_error "Missing or unspecified .ipa file" and abort unless @ipa and File.exist?(@ipa)
99
+
100
+ determine_access_key_id!
101
+ say_error "Missing AWS Access Key ID" and abort unless @access_key_id
102
+
103
+ determine_secret_access_key!
104
+ say_error "Missing AWS Secret Access Key" and abort unless @secret_access_key
105
+
106
+ determine_bucket! unless @bucket = options.bucket
107
+ say_error "Missing bucket" and abort unless @bucket
108
+
109
+ determine_region!
110
+
111
+ determine_acl!
112
+
113
+ determine_path!
114
+
115
+ client = S3::Client.new(@access_key_id, @secret_access_key, @region)
116
+
117
+ begin
118
+ client.upload_build @ipa, {:bucket => @bucket, :acl => @acl, :path => @path}
119
+ say_ok "Build successfully uploaded to S3"
120
+ rescue => exception
121
+ say_error "Error while uploading to S3: #{exception}"
122
+ end
123
+ end
124
+
125
+ private
126
+
127
+ def determine_ipa!
128
+ unless File.exist?('Rakefile')
129
+ say_error "Run on root directoy of RubyMotion project."
130
+ end
131
+
132
+ # select *.ipa in Release directory.
133
+ @ipa = Dir.glob("./build/{iPhoneOS}*-Release/*.{ipa}").first
134
+ unless @ipa
135
+ say_error "Can't find *.ipa. First, need to create archive file with `rake archive:distribution'."
136
+ end
137
+ @ipa
138
+ end
139
+
140
+ def determine_access_key_id!
141
+ @access_key_id ||= ENV['AWS_ACCESS_KEY_ID']
142
+ @access_key_id ||= ask "Access Key ID:"
143
+ end
144
+
145
+ def determine_secret_access_key!
146
+ @secret_access_key ||= ENV['AWS_SECRET_ACCESS_KEY']
147
+ @secret_access_key ||= ask "Secret Access Key:"
148
+ end
149
+
150
+ def determine_bucket!
151
+ @bucket ||= ENV['S3_BUCKET']
152
+ @bucket ||= ask "S3 Bucket:"
153
+ end
154
+
155
+ def determine_region!
156
+ @region ||= ENV['AWS_REGION'] || "us-east-1"
157
+ end
158
+
159
+ def determine_acl!
160
+ @acl = "public_read"
161
+ end
162
+
163
+ def determine_path!
164
+ @path = "/ios3/#{cf_bundle_name}/#{cf_bundle_version}"
165
+ @path = ""
166
+ end
167
+ end
@@ -1,3 +1,3 @@
1
1
  module Ios3
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,109 @@
1
+ #
2
+ # Hawkfile
3
+ #
4
+
5
+ #
6
+ # XCode project information - used to configure how your app is built and signed
7
+ #
8
+ # The signing identity to sign your app with. Defaults to 'iPhone Distribution'
9
+ #signing_identity 'iPhone Distribution'
10
+ #
11
+ # The project file to load (this is usually found automatically)
12
+ #project 'SampleProject.xcodeproj'
13
+ #
14
+ # The workspace file to use (like project, this is usually found automatically)
15
+ #workspace 'SampleWorkspace.xcworkspace'
16
+ #
17
+ # The scheme to build (required when building a workspace).
18
+ # Run 'xcodebuild --workspace <workspace> -list' to see available schemes
19
+ #scheme 'SampleApplication'
20
+ #
21
+ # The configuration to build. Defaults to 'Release'
22
+ #configuration 'Release'
23
+
24
+ #
25
+ # AWS Credentials - used to upload your app and associated metadata into S3 so
26
+ # that users can download and install your app
27
+ #
28
+ # Note that if you don't want to check your key material into source control,
29
+ # you can erase the two access key lines from this file and set some environment
30
+ # variables instead. See http://amazon.rubyforge.org/doc/files/README.html for
31
+ # details. Note that the bucket name is always required
32
+ #
33
+ #access_key_id 'AAAAAAAAAAAAAAAAAAAA'
34
+ #secret_access_key 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
35
+ #bucket_name 'mah-bukkit'
36
+ #
37
+ # How many days to wait before deleting the files from S3. Defaults to 30 days
38
+ #delete_after 30
39
+
40
+ #
41
+ # Bundle ID Fix - enable a workaround that causes OTA install to fail on certain
42
+ # ios8 devices. See http://stackoverflow.com/questions/25772664/enterprise-app-update-distribution-on-ios-8
43
+ # for more information. Disabled by default
44
+ #bundle_id_fix false
45
+
46
+ #
47
+ # Vendor name - an optional value to be displayed alongside the app name during
48
+ # the install process
49
+ #
50
+ #vendor_name "ABC Co"
51
+
52
+ #
53
+ # Icon path - the path (relative to this Hawkfile) that a 57x57px PNG formatted
54
+ # app icon can be found, to be used during the app install. This is optional,
55
+ # and if omitted a plain white icon will be used in its stead
56
+ #
57
+ #icon_path 'path/to/icon.png'
58
+
59
+ #
60
+ # Full size icon image path - the path (relative to this Hawkfile) that
61
+ # a 512x512x PNG formatted app icon can be found. to be used during the app
62
+ # install. This is optional, and if omitted a plain white icon will be used in
63
+ # its stead
64
+ #
65
+ #fullsize_image_path 'path/to/fullsize_image.png'
66
+
67
+ #
68
+ # User list - a list of users to send emails to upon successsful upload of a new
69
+ # version of your app. Specified one email address per line, to keep diffs sane
70
+ #
71
+ #user 'alice@example.com'
72
+ #user 'bob@example.com'
73
+ #user 'claire@example.com'
74
+
75
+ #
76
+ # Notification settings - parameters describing the email to be sent out. This
77
+ # email will be opened locally on this machine by invoking a 'mailto:' url. Your
78
+ # default mail application will open, allowing you to review and edit the email
79
+ # before sending it. This is usually a good time to describe changes to the app,
80
+ # or to suggest areas for testing and review.
81
+ #
82
+ # The following tags are allowed for replacement. In addition to these tags, any
83
+ # ERB compliant tags will be replaced as well.
84
+ #
85
+ # <%= app_name %> : The name of the application, taken from the project
86
+ # <%= app_version %> : The current version of the project, taken from the project's
87
+ # Info.plist file
88
+ # <%= repo_version %> : An SCM specific version number taken from the current state
89
+ # of the project
90
+ # <%= webpage_url %> : The url of an S3 hosted page which will redirect the user to
91
+ # install the application when opened on an iOS device
92
+ #
93
+
94
+ email_subject "A new update of <%= app_name %> is available for download"
95
+
96
+ email_body <<EOF
97
+ A new build of <%= app_name %> is ready to install. Click the following link
98
+ on your iOS device to install it:
99
+
100
+ <%= webpage_url %>
101
+
102
+ Please reference '<%= repo_version %>' in any bug reports to help us out.
103
+
104
+ Thanks!
105
+
106
+ --
107
+
108
+ Distributed by hawk [http://github.com/mtrudel/hawk]
109
+ EOF
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>items</key>
6
+ <array>
7
+ <dict>
8
+ <key>assets</key>
9
+ <array>
10
+ <dict>
11
+ <key>kind</key>
12
+ <string>software-package</string>
13
+ <key>url</key>
14
+ <string>https://s3.amazonaws.com/humanswithkids-dev/HWK.ipa</string>
15
+ </dict>
16
+ </array>
17
+ <key>metadata</key>
18
+ <dict>
19
+ <key>bundle-identifier</key>
20
+ <string>com.humanswithkids.Blog</string>
21
+ <key>bundle-version</key>
22
+ <string>1.0.0</string>
23
+ <key>kind</key>
24
+ <string>software</string>
25
+ <key>title</key>
26
+ <string>HWK</string>
27
+ </dict>
28
+ </dict>
29
+ </array>
30
+ </dict>
31
+ </plist>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>items</key>
6
+ <array>
7
+ <dict>
8
+ <key>assets</key>
9
+ <array>
10
+ <dict>
11
+ <key>kind</key>
12
+ <string>software-package</string>
13
+ <key>url</key>
14
+ <string>https://s3.amazonaws.com/humanswithkids-dev/HWK.ipa</string>
15
+ </dict>
16
+ </array>
17
+ <key>metadata</key>
18
+ <dict>
19
+ <key>bundle-identifier</key>
20
+ <string>com.humanswithkids.Blog</string>
21
+ <key>bundle-version</key>
22
+ <string>1.0.0</string>
23
+ <key>kind</key>
24
+ <string>software</string>
25
+ <key>title</key>
26
+ <string>HWK</string>
27
+ </dict>
28
+ </dict>
29
+ </array>
30
+ </dict>
31
+ </plist>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>items</key>
6
+ <array>
7
+ <dict>
8
+ <key>assets</key>
9
+ <array>
10
+ <dict>
11
+ <key>kind</key>
12
+ <string>software-package</string>
13
+ <key>url</key>
14
+ <string><%= escaped_ipa_url %></string>
15
+ </dict>
16
+ </array>
17
+ <key>metadata</key>
18
+ <dict>
19
+ <key>bundle-identifier</key>
20
+ <string><%= bundle_identifier %></string>
21
+ <key>bundle-version</key>
22
+ <string><%= app_version %></string>
23
+ <key>kind</key>
24
+ <string>software</string>
25
+ <key>title</key>
26
+ <string><%= app_name %></string>
27
+ </dict>
28
+ </dict>
29
+ </array>
30
+ </dict>
31
+ </plist>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ios3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Gertig
@@ -56,7 +56,8 @@ description: This tool is focused primarily on apps that have been archived usin
56
56
  RubyMotion.
57
57
  email:
58
58
  - "@gertig"
59
- executables: []
59
+ executables:
60
+ - sthree
60
61
  extensions: []
61
62
  extra_rdoc_files: []
62
63
  files:
@@ -65,9 +66,16 @@ files:
65
66
  - LICENSE.txt
66
67
  - README.md
67
68
  - Rakefile
69
+ - bin/sthree
68
70
  - ios3.gemspec
69
71
  - lib/ios3.rb
72
+ - lib/ios3/cli.rb
73
+ - lib/ios3/s3.rb
70
74
  - lib/ios3/version.rb
75
+ - templates/Ios3file
76
+ - templates/manifest-test.plist
77
+ - templates/manifest-test.plist.erb
78
+ - templates/manifest.plist.erb
71
79
  homepage: http://github.com/gertig/ios3
72
80
  licenses:
73
81
  - MIT