briar 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +9 -9
- data/README.md +15 -17
- data/bin/briar +94 -55
- data/bin/briar_helpers.rb +18 -5
- data/bin/briar_resign.rb +272 -0
- data/briar.gemspec +3 -6
- data/cucumber.yml.example +20 -3
- data/features/step_definitions/briar_core_steps.rb +1 -1
- data/features/step_definitions/control/button_steps.rb +1 -1
- data/features/step_definitions/control/slider_steps.rb +2 -0
- data/features/step_definitions/email_steps.rb +12 -12
- data/features/step_definitions/keyboard_steps.rb +1 -0
- data/features/step_definitions/label_steps.rb +1 -1
- data/features/step_definitions/picker/date_picker_steps.rb +22 -3
- data/features/step_definitions/table_steps.rb +17 -6
- data/features/step_definitions/text_view_steps.rb +4 -10
- data/lib/briar.rb +10 -1
- data/lib/briar/alerts_and_sheets/action_sheet.rb +2 -2
- data/lib/briar/alerts_and_sheets/alert_view.rb +78 -19
- data/lib/briar/bars/navbar.rb +56 -20
- data/lib/briar/briar_core.rb +80 -9
- data/lib/briar/control/button.rb +16 -19
- data/lib/briar/email.rb +88 -30
- data/lib/briar/keyboard.rb +40 -40
- data/lib/briar/label.rb +1 -3
- data/lib/briar/picker/date_picker.rb +9 -1
- data/lib/briar/picker/date_picker_manipulation.rb +2 -2
- data/lib/briar/table.rb +56 -25
- data/lib/briar/text_field.rb +6 -4
- data/lib/briar/text_view.rb +33 -8
- data/lib/briar/version.rb +1 -1
- metadata +6 -34
- data/install-calabash-framework.sh.example +0 -10
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGUwMTZlM2YwODZmMTIwMzI3YjBiYWIzYjcwNGRiYjcxMzRmNjQ2NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
YjM4NWExMzEyNGU3Nzk3MWFlZjdhYmRkYTg5ZWExOWFhNzZjODA5MA==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGQ3NmUzYTQwY2M0YzU4Y2Q0OThhMDIzYWVlNzU0NTA5MDZlOWIxYmQ4OWQz
|
10
|
+
YzQ3YmI1NDg3OWRiMGRlYjQ5ZmRkODU0MmViMDE4YWNkMTg5NWRhYTZjZmI0
|
11
|
+
NmE5MzNhMGVmNDc3YTE5YjdiMmZkYjZhOTc0NmY1YWM3MDM5Njc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTNhNGQ1OTg3NjFlNmMzNGI3NjBiOWUwZDE1MzZjNmZhYmI3ODc1MDUzNGVk
|
14
|
+
Yzg2NDNmZTFhNzU2ODFmMmNmNTVmMDYwOWNjNGJkYjZlOGMzZTRjZTMzNTVl
|
15
|
+
YWIzMWE5MjkzMDIwYzNlNWYwMjhlMjYyOTU2YTY1NThkNjc1MTQ=
|
data/README.md
CHANGED
@@ -1,30 +1,28 @@
|
|
1
1
|
# Briar
|
2
2
|
|
3
|
-
extends
|
4
|
-
elements like tables and
|
3
|
+
extends the steps defined in [calabash-ios](https://github.com/calabash/calabash-ios.git) to help
|
4
|
+
your write cucumber Scenarios that interact with complex ui elements like tables, pickers, and sliders.
|
5
5
|
|
6
|
-
briar is not trying to provide steps that will work for every project
|
7
|
-
- it is neccessary that every project develop its own venacular.
|
8
|
-
instead, briar provides a library [lib] of ruby methods to build
|
9
|
-
application-specific steps from. the steps in the features directory
|
10
|
-
are meant to be examples of what briar can offer.
|
6
|
+
### WARNING: briar is not trying to provide steps that will work for every project
|
11
7
|
|
12
|
-
|
8
|
+
Every project should cultivate its own [venacular](http://en.wikipedia.org/wiki/Vernacular) -
|
9
|
+
a shared language between developers, clients, and users. the steps that briar provides
|
10
|
+
are not meant to be dropped into into your projects (although they can be). briar provides a
|
11
|
+
library [lib] of ruby methods to build application-specific steps from. the steps in the features
|
12
|
+
directory are meant to be examples of what briar can offer.
|
13
13
|
|
14
|
-
to see briar in action,
|
15
|
-
https://github.com/jmoody/briar-ios-example
|
14
|
+
to see briar in action, take a look at https://github.com/jmoody/briar-ios-example
|
16
15
|
|
17
16
|
### motivation
|
18
17
|
|
19
|
-
DRY: i have several ios projects that use calabash-cucumber and i
|
20
|
-
|
18
|
+
DRY: i have several ios projects that use calabash-cucumber and i found i was rewriting lots of steps
|
19
|
+
and supporting code.
|
21
20
|
|
22
21
|
## version numbers
|
23
22
|
|
24
|
-
i will try my best to follow http://semver.org/ when naming the
|
25
|
-
versions.
|
23
|
+
i will try my best to follow http://semver.org/ when naming the versions.
|
26
24
|
|
27
|
-
## Why briar?
|
25
|
+
## Why call it briar?
|
28
26
|
|
29
27
|
* http://en.wikipedia.org/wiki/Smoking_pipe_(tobacco)#Calabash
|
30
28
|
* http://en.wikipedia.org/wiki/Smoking_pipe_(tobacco)#Briar
|
@@ -34,8 +32,8 @@ versions.
|
|
34
32
|
getting closer to stability
|
35
33
|
|
36
34
|
* there are still major problems with date picking
|
37
|
-
*
|
38
|
-
|
35
|
+
* can now run tests on lesspainful! woot!
|
36
|
+
* there are lot's of wait_for_animation calls that should be replaced with wait_for methods
|
39
37
|
|
40
38
|
## Usage
|
41
39
|
|
data/bin/briar
CHANGED
@@ -4,16 +4,100 @@ require 'find'
|
|
4
4
|
|
5
5
|
|
6
6
|
require File.join(File.dirname(__FILE__), 'briar_helpers')
|
7
|
+
require File.join(File.dirname(__FILE__), 'briar_resign')
|
7
8
|
|
8
9
|
if ARGV.length == 0
|
9
10
|
print_usage
|
10
11
|
exit 0
|
11
12
|
end
|
12
13
|
|
14
|
+
if ARGV.length == 2
|
15
|
+
arg1 = ARGV[0]
|
16
|
+
unless arg1 == BRIAR_CMD_INSTALL
|
17
|
+
print_usage
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
allowed = [BRIAR_INSTALL_GEM, BRIAR_INSTALL_CALABASH_GEM, BRIAR_INSTALL_CALABASH_SERVER]
|
21
|
+
arg2 = ARGV[1]
|
22
|
+
unless allowed.include?(arg2)
|
23
|
+
print_usage
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
|
27
|
+
if arg2 == BRIAR_INSTALL_GEM
|
28
|
+
|
29
|
+
puts 'will install briar gem'
|
30
|
+
gem_dir = "#{ENV['HOME']}/git/briar"
|
31
|
+
unless File.exists?(gem_dir)
|
32
|
+
puts "expected gem '#{gem_dir}' - cannot install the briar gem"
|
33
|
+
exit 1
|
34
|
+
end
|
35
|
+
system("cd #{gem_dir}; rake install")
|
36
|
+
exit 0
|
37
|
+
elsif arg2 == BRIAR_INSTALL_CALABASH_GEM
|
38
|
+
|
39
|
+
puts 'will install calabash-cucumber gem'
|
40
|
+
gem_dir = "#{ENV['HOME']}/git/calabash-ios/calabash-cucumber"
|
41
|
+
unless File.exists?(gem_dir)
|
42
|
+
puts "expected gem '#{gem_dir}' - cannot install the calabash-cucumber gem"
|
43
|
+
exit 1
|
44
|
+
end
|
45
|
+
system("cd #{gem_dir}; rake install")
|
46
|
+
exit 0
|
47
|
+
elsif arg2 == BRIAR_INSTALL_CALABASH_SERVER
|
48
|
+
|
49
|
+
puts 'will install calabash-ios server'
|
50
|
+
cal_framework = 'calabash.framework'
|
51
|
+
unless File.exists?(cal_framework)
|
52
|
+
puts "expected '#{cal_framework}' to be in the local directory."
|
53
|
+
puts "run this command in the directory that contins '#{cal_framework}'"
|
54
|
+
exit 1
|
55
|
+
end
|
56
|
+
|
57
|
+
gem_dir = "#{ENV['HOME']}/git/calabash-ios/calabash-cucumber"
|
58
|
+
unless File.exists?(gem_dir)
|
59
|
+
puts "expected gem '#{gem_dir}' - cannot install the calabash server"
|
60
|
+
exit 1
|
61
|
+
end
|
62
|
+
|
63
|
+
server_dir = "#{ENV['HOME']}/git/calabash-ios-server"
|
64
|
+
unless File.exists?(server_dir)
|
65
|
+
puts "expected calabash-ios server to be in dir '#{server_dir}'"
|
66
|
+
puts "will not be able run '#{gem_dir}/rake build_server'"
|
67
|
+
exit 1
|
68
|
+
end
|
69
|
+
|
70
|
+
version_file = File.read("#{server_dir}/calabash/Classes/FranklyServer/Routes/LPVersionRoute.h")
|
71
|
+
tokens = version_file.split(/define kLPCALABASHVERSION/)
|
72
|
+
line = tokens[1].split("\n").first
|
73
|
+
version = line.tr('^A-Za-z0-9.\-\_', '')
|
74
|
+
|
75
|
+
puts "building calabash server using 'rake build_server'"
|
76
|
+
system("cd #{gem_dir}; rake build_server")
|
77
|
+
puts 'remove old cal simulator targets'
|
78
|
+
system('briar rm-cal-targets')
|
79
|
+
puts 'copying new framework to ./'
|
80
|
+
system("cp #{gem_dir}/staticlib/#{cal_framework}.zip ./")
|
81
|
+
puts 'removing old framework'
|
82
|
+
system("rm -rf #{cal_framework}")
|
83
|
+
puts 'unzipping new framework'
|
84
|
+
system("unzip #{cal_framework}.zip")
|
85
|
+
puts 'cleaning up'
|
86
|
+
system("rm -rf #{cal_framework}.zip")
|
87
|
+
puts "installed new server version '#{version}'"
|
88
|
+
|
89
|
+
exit 0
|
90
|
+
end
|
91
|
+
puts 'fell through install conditional'
|
92
|
+
exit 1
|
93
|
+
end
|
94
|
+
|
13
95
|
cmd = ARGV.shift
|
14
96
|
if cmd == 'help'
|
15
97
|
print_usage
|
16
98
|
exit 0
|
99
|
+
elsif cmd == BRIAR_VERSION_CMD
|
100
|
+
puts "#{Briar::VERSION}"
|
17
101
|
elsif cmd == BRIAR_RM_CAL_TARGETS
|
18
102
|
puts 'quiting the simulator'
|
19
103
|
`/usr/bin/osascript -e 'tell application "iPhone Simulator" to quit'`
|
@@ -39,63 +123,18 @@ elsif cmd == BRIAR_RM_CAL_TARGETS
|
|
39
123
|
end
|
40
124
|
|
41
125
|
elsif cmd == BRIAR_INSTALL_CALABASH_GEM
|
42
|
-
puts '
|
43
|
-
|
44
|
-
unless File.exists?(gem_dir)
|
45
|
-
puts "expected gem '#{gem_dir}' - cannot install the calabash-cucumber gem"
|
46
|
-
exit 1
|
47
|
-
end
|
48
|
-
system("cd #{gem_dir}; rake install")
|
49
|
-
|
126
|
+
puts "use 'briar install calabash-gem'"
|
127
|
+
exit 1
|
50
128
|
elsif cmd == BRIAR_INSTALL_GEM
|
51
|
-
|
52
|
-
|
53
|
-
unless File.exists?(gem_dir)
|
54
|
-
puts "expected gem '#{gem_dir}' - cannot install the briar gem"
|
55
|
-
exit 1
|
56
|
-
end
|
57
|
-
system("cd #{gem_dir}; rake install")
|
58
|
-
|
129
|
+
puts "use 'briar install gem'"
|
130
|
+
exit 1
|
59
131
|
elsif cmd == BRIAR_INSTALL_CALABASH_SERVER
|
60
|
-
puts '
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
gem_dir = "#{ENV['HOME']}/git/calabash-ios/calabash-cucumber"
|
69
|
-
unless File.exists?(gem_dir)
|
70
|
-
puts "expected gem '#{gem_dir}' - cannot install the calabash server"
|
71
|
-
exit 1
|
72
|
-
end
|
73
|
-
|
74
|
-
server_dir = "#{ENV['HOME']}/git/calabash-ios-server"
|
75
|
-
unless File.exists?(server_dir)
|
76
|
-
puts "expected calabash-ios server to be in dir '#{server_dir}'"
|
77
|
-
puts "will not be able run '#{gem_dir}/rake build_server'"
|
78
|
-
exit 1
|
79
|
-
end
|
80
|
-
|
81
|
-
version_file = File.read("#{server_dir}/calabash/Classes/FranklyServer/Routes/LPVersionRoute.h")
|
82
|
-
tokens = version_file.split(/define kLPCALABASHVERSION/)
|
83
|
-
line = tokens[1].split("\n").first
|
84
|
-
version = line.tr('^A-Za-z0-9.\-\_', '')
|
85
|
-
|
86
|
-
puts "building calabash server using 'rake build_server'"
|
87
|
-
system("cd #{gem_dir}; rake build_server")
|
88
|
-
puts 'remove old cal simulator targets'
|
89
|
-
system('briar rm-cal-targets')
|
90
|
-
puts 'copying new framework to ./'
|
91
|
-
system("cp #{gem_dir}/staticlib/#{cal_framework}.zip ./")
|
92
|
-
puts 'removing old framework'
|
93
|
-
system("rm -rf #{cal_framework}")
|
94
|
-
puts 'unzipping new framework'
|
95
|
-
system("unzip #{cal_framework}.zip")
|
96
|
-
puts 'cleaning up'
|
97
|
-
system("rm -rf #{cal_framework}.zip")
|
98
|
-
puts "installed new server version '#{version}'"
|
132
|
+
puts "use 'briar install calabash-server'"
|
133
|
+
exit 1
|
134
|
+
elsif cmd == BRIAR_RESIGN_IPA
|
135
|
+
puts 'will resign'
|
136
|
+
briar_resign(ARGV)
|
137
|
+
exit 0
|
99
138
|
else
|
100
139
|
print_usage
|
101
140
|
exit 1
|
data/bin/briar_helpers.rb
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
require 'briar'
|
2
2
|
|
3
3
|
BRIAR_RM_CAL_TARGETS='rm-cal-targets'
|
4
|
-
BRIAR_INSTALL_CALABASH_GEM='
|
5
|
-
BRIAR_INSTALL_CALABASH_SERVER='
|
4
|
+
BRIAR_INSTALL_CALABASH_GEM='calabash-gem'
|
5
|
+
BRIAR_INSTALL_CALABASH_SERVER='calabash-server'
|
6
6
|
BRIAR_INSTALL_GEM='gem'
|
7
|
+
BRIAR_RESIGN_IPA='resign'
|
8
|
+
BRIAR_VERSION_CMD='version'
|
9
|
+
|
10
|
+
BRIAR_CMD_INSTALL='install'
|
11
|
+
|
7
12
|
|
8
13
|
def print_usage
|
9
14
|
puts <<EOF
|
10
15
|
briar #{Briar::VERSION}
|
11
16
|
|
17
|
+
briar #{BRIAR_VERSION_CMD}
|
18
|
+
print the current briar version
|
19
|
+
|
12
20
|
briar #{BRIAR_RM_CAL_TARGETS}
|
13
21
|
WARN: this is a destructive operation!
|
14
22
|
* deletes all *-cal targets from simulator
|
@@ -17,16 +25,19 @@ def print_usage
|
|
17
25
|
targets and deletes the enclosing directory. useful for clearing out old
|
18
26
|
calabash targets when the framework needs to be updated.
|
19
27
|
|
20
|
-
briar #{
|
28
|
+
briar #{BRIAR_CMD_INSTALL} { gem | calabash-gem | calabash-server }
|
29
|
+
subcommand to perform various installation tasks
|
30
|
+
|
31
|
+
briar #{BRIAR_CMD_INSTALL} #{BRIAR_INSTALL_GEM}
|
21
32
|
looks for ~/git/briar and runs 'rake install'. useful for developing and
|
22
33
|
testing the briar gem
|
23
34
|
|
24
|
-
briar #{BRIAR_INSTALL_CALABASH_GEM}
|
35
|
+
briar #{BRIAR_CMD_INSTALL} #{BRIAR_INSTALL_CALABASH_GEM}
|
25
36
|
looks for ~/git/calabash-ios/calabash-cucumber directory and runs
|
26
37
|
'rake install' to install the calabash-cucumber gem. useful for developing
|
27
38
|
and testing the calabash-cucumber gem.
|
28
39
|
|
29
|
-
briar #{BRIAR_INSTALL_CALABASH_SERVER}
|
40
|
+
briar #{BRIAR_CMD_INSTALL} #{BRIAR_INSTALL_CALABASH_SERVER}
|
30
41
|
WARN: this is a destructive operation!
|
31
42
|
* replaces calabash.framework in current directory
|
32
43
|
* deletes all *-cal targets from simulator
|
@@ -36,5 +47,7 @@ def print_usage
|
|
36
47
|
'rake rake build_server', removes all *-cal targets from simulator, and
|
37
48
|
replaces calabash.framework in local directory. useful for developing and
|
38
49
|
testing the calabash-ios-server.
|
50
|
+
|
51
|
+
briar: #{BRIAR_RESIGN_IPA} (experimental)
|
39
52
|
EOF
|
40
53
|
end
|
data/bin/briar_resign.rb
ADDED
@@ -0,0 +1,272 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'CFPropertyList'
|
5
|
+
require 'rexml/document'
|
6
|
+
require 'tmpdir'
|
7
|
+
require 'find'
|
8
|
+
|
9
|
+
def msg(title, &block)
|
10
|
+
puts "\n" + '-'*10 + title + '-'*10
|
11
|
+
block.call
|
12
|
+
puts '-'*10 + '-------' + '-'*10 + "\n"
|
13
|
+
end
|
14
|
+
|
15
|
+
def briar_resign(args)
|
16
|
+
if args.length != 4
|
17
|
+
msg('Usage') do
|
18
|
+
puts 'briar resign </path/to/your.ipa> </path/to/your.mobileprovision> <wildcard-prefix> <signing-identity>'
|
19
|
+
end
|
20
|
+
exit 1
|
21
|
+
end
|
22
|
+
|
23
|
+
ipa = args[0]
|
24
|
+
unless ipa.end_with?('.ipa')
|
25
|
+
msg('Error') do
|
26
|
+
puts 'first arg must be an ipa'
|
27
|
+
end
|
28
|
+
exit 1
|
29
|
+
end
|
30
|
+
|
31
|
+
unless File.exist? ipa
|
32
|
+
msg('Error') do
|
33
|
+
puts ".ipa must exist at path '#{ipa}'"
|
34
|
+
end
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
mobile_prov = args[1]
|
39
|
+
unless mobile_prov.end_with?('.mobileprovision')
|
40
|
+
msg('Error') do
|
41
|
+
puts 'second arg must be a path to a mobileprovision'
|
42
|
+
end
|
43
|
+
exit 1
|
44
|
+
end
|
45
|
+
|
46
|
+
unless File.exist? mobile_prov
|
47
|
+
msg('Error') do
|
48
|
+
puts "'#{mobile_prov}' must exist at path"
|
49
|
+
end
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
|
53
|
+
wildcard = args[2]
|
54
|
+
unless wildcard.length == 10
|
55
|
+
msg 'error' do
|
56
|
+
puts "'#{wildcard}' must have 10 characters eg 'RWTD8QPG2C'"
|
57
|
+
end
|
58
|
+
exit 1
|
59
|
+
end
|
60
|
+
|
61
|
+
unless system("grep #{wildcard} #{mobile_prov}")
|
62
|
+
msg 'error' do
|
63
|
+
puts "could not find wildcard '#{wildcard}' in '#{mobile_prov}'"
|
64
|
+
end
|
65
|
+
exit 1
|
66
|
+
end
|
67
|
+
|
68
|
+
signing_id = args[3]
|
69
|
+
msg ('Info') do
|
70
|
+
puts "will resign with identity '#{signing_id}'"
|
71
|
+
end
|
72
|
+
|
73
|
+
resign_ipa({ipa:ipa, provision:mobile_prov, id:signing_id, wildcard:wildcard})
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
def resign_ipa(options)
|
78
|
+
work_dir = 'resigned'
|
79
|
+
ipa = File.join(work_dir, File.basename(options[:ipa]))
|
80
|
+
mp = File.join(work_dir, File.basename(options[:provision]))
|
81
|
+
|
82
|
+
puts 'INFO: making a directory to put the resigned ipa in'
|
83
|
+
if File.exist? work_dir
|
84
|
+
puts "INFO: found an existing work directory at '#{work_dir}' - removing it"
|
85
|
+
unless system("rm -rf #{work_dir}")
|
86
|
+
msg 'Error' do
|
87
|
+
puts "could not remove existing work dir '#{work_dir}'"
|
88
|
+
end
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
unless system("mkdir #{work_dir}")
|
94
|
+
msg 'Error' do
|
95
|
+
puts "could not create a work directory '#{work_dir}'"
|
96
|
+
end
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
|
100
|
+
puts "INFO: copying assets to '#{work_dir}'"
|
101
|
+
unless system("cp #{options[:ipa]} #{ipa}")
|
102
|
+
msg 'Error' do
|
103
|
+
puts "could not copy '#{options[:ipa]}' to '#{ipa}'"
|
104
|
+
end
|
105
|
+
exit 1
|
106
|
+
end
|
107
|
+
|
108
|
+
unless system("cp #{options[:provision]} #{mp}")
|
109
|
+
msg 'Error' do
|
110
|
+
puts "could not copy #{options[:provision]} to #{mp}"
|
111
|
+
end
|
112
|
+
exit 1
|
113
|
+
end
|
114
|
+
|
115
|
+
puts "unzipping '#{ipa}'"
|
116
|
+
unless system("unzip -qq #{ipa} -d #{work_dir}")
|
117
|
+
msg ('Error') do
|
118
|
+
puts "could not unzip -qq #{ipa} to '#{work_dir}'"
|
119
|
+
end
|
120
|
+
exit 1
|
121
|
+
end
|
122
|
+
|
123
|
+
payload_dir = "#{work_dir}/Payload"
|
124
|
+
unless File.directory?(payload_dir)
|
125
|
+
msg 'error' do
|
126
|
+
puts "Did not find a 'Payload' directory inside .ipa"
|
127
|
+
end
|
128
|
+
exit 1
|
129
|
+
end
|
130
|
+
|
131
|
+
app_path = Dir.foreach(payload_dir).find { |x| /.*\.app/.match(x) }
|
132
|
+
|
133
|
+
abs_app_path = "#{payload_dir}/#{app_path}"
|
134
|
+
puts "INFO: found app at '#{abs_app_path}'"
|
135
|
+
|
136
|
+
|
137
|
+
info_plist = Dir.foreach(abs_app_path).find { |x| /^Info\.plist$/.match(x) }
|
138
|
+
|
139
|
+
if info_plist.nil?
|
140
|
+
msg 'error' do
|
141
|
+
puts 'could not find an *-Info.plist file'
|
142
|
+
end
|
143
|
+
exit 1
|
144
|
+
end
|
145
|
+
|
146
|
+
info_plist_path = "#{abs_app_path}/#{info_plist}"
|
147
|
+
puts "INFO: found info plist at '#{info_plist_path}'"
|
148
|
+
|
149
|
+
|
150
|
+
mp_id = File.basename(mp, '.mobileprovision')
|
151
|
+
puts "INFO: found mobile provision id '#{mp_id}'"
|
152
|
+
|
153
|
+
puts "INFO: replacing embedded.mobileprovision with '#{mp}'"
|
154
|
+
|
155
|
+
unless system("cp \"#{mp}\" \"#{abs_app_path}/embedded.mobileprovision\"")
|
156
|
+
msg 'error' do
|
157
|
+
puts "could not cp '#{mp}' to '#{abs_app_path}/embedded.mobileprovision'"
|
158
|
+
end
|
159
|
+
exit 1
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
plist = CFPropertyList::List.new(:file => info_plist_path)
|
164
|
+
data = CFPropertyList.native_types(plist.value)
|
165
|
+
|
166
|
+
if data.nil? or !data.is_a? Hash
|
167
|
+
msg 'error' do
|
168
|
+
puts "Unable to parse binary plist: #{info_plist_path}"
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
puts "INFO: parsed plist at '#{info_plist_path}'"
|
173
|
+
|
174
|
+
app_id = data['CFBundleIdentifier']
|
175
|
+
|
176
|
+
unless app_id
|
177
|
+
msg 'error' do
|
178
|
+
puts "Unable to find CFBundleIdentifier in plist '#{data}'"
|
179
|
+
end
|
180
|
+
exit 1
|
181
|
+
end
|
182
|
+
|
183
|
+
puts "INFO: found bundle identifier '#{app_id}'"
|
184
|
+
|
185
|
+
|
186
|
+
bundle_exec = data['CFBundleExecutable']
|
187
|
+
|
188
|
+
unless bundle_exec
|
189
|
+
msg 'error' do
|
190
|
+
puts "unable to find CFBundleExecutable in plist '#{data}'"
|
191
|
+
end
|
192
|
+
exit 1
|
193
|
+
end
|
194
|
+
|
195
|
+
puts "INFO: found bundle executable '#{bundle_exec}'"
|
196
|
+
|
197
|
+
appname = app_path.split('.app')[0]
|
198
|
+
|
199
|
+
puts "INFO: found appname '#{appname}'"
|
200
|
+
|
201
|
+
wildcard = options[:wildcard]
|
202
|
+
puts "INFO: creating new entitlements with '#{wildcard}'"
|
203
|
+
ios_entitlements_path = File.join(work_dir, 'new-entitlements.plist')
|
204
|
+
File.open(ios_entitlements_path, 'a+') do |file|
|
205
|
+
file.puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
206
|
+
file.puts "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
|
207
|
+
file.puts "<plist version=\"1.0\">"
|
208
|
+
file.puts '<dict>'
|
209
|
+
file.puts ' <key>application-identifier</key>'
|
210
|
+
file.puts " <string>#{wildcard}.#{app_id}</string>"
|
211
|
+
file.puts ' <key>keychain-access-groups</key>'
|
212
|
+
file.puts ' <array>'
|
213
|
+
file.puts " <string>#{wildcard}.#{app_id}</string>"
|
214
|
+
file.puts ' </array>'
|
215
|
+
file.puts ' <key>get-task-allow</key>'
|
216
|
+
file.puts ' <true/>'
|
217
|
+
file.puts '</dict>'
|
218
|
+
file.puts '</plist>'
|
219
|
+
end
|
220
|
+
|
221
|
+
# did _not_ work
|
222
|
+
#entitlements = CFPropertyList::List.new(:file => ios_entitlements_path)
|
223
|
+
#data = CFPropertyList.native_types(entitlements.value)
|
224
|
+
#data['application-identifier']= "#{wildcard}.#{app_id}"
|
225
|
+
#data['keychain-access-groups']=["#{wildcard}.#{app_id}"]
|
226
|
+
#data['get-task-allow'] = true
|
227
|
+
#
|
228
|
+
#
|
229
|
+
#plist = CFPropertyList::List.new
|
230
|
+
#plist.value = CFPropertyList.guess(data)
|
231
|
+
#plist.save(ios_entitlements_path, CFPropertyList::List::FORMAT_XML)
|
232
|
+
#puts "INFO: saved new entitlements to '#{ios_entitlements_path}'"
|
233
|
+
|
234
|
+
sign_cmd = "codesign -f -s \"#{options[:id]}\" -vv \"#{abs_app_path}\" --entitlements \"#{ios_entitlements_path}\""
|
235
|
+
puts "INFO: signing with '#{sign_cmd}'"
|
236
|
+
|
237
|
+
unless system(sign_cmd)
|
238
|
+
msg 'error' do
|
239
|
+
puts 'could not sign application'
|
240
|
+
end
|
241
|
+
exit 1
|
242
|
+
end
|
243
|
+
|
244
|
+
unless system("rm -rf '#{ipa}'")
|
245
|
+
msg 'error' do
|
246
|
+
puts "could not remove the old ipa at '#{ipa}'"
|
247
|
+
end
|
248
|
+
exit 1
|
249
|
+
end
|
250
|
+
|
251
|
+
puts 'INFO: zipping up Payload'
|
252
|
+
|
253
|
+
FileUtils.cd(work_dir) do
|
254
|
+
|
255
|
+
unless system("zip -qr #{File.basename(options[:ipa])} Payload")
|
256
|
+
msg 'error' do
|
257
|
+
puts "could not zip '#{File.basename(options[:ipa])}' from 'Payload'"
|
258
|
+
end
|
259
|
+
exit 1
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
|
264
|
+
puts "INFO: finished signing '#{ipa}'"
|
265
|
+
|
266
|
+
|
267
|
+
system("open #{work_dir}")
|
268
|
+
|
269
|
+
|
270
|
+
end
|
271
|
+
|
272
|
+
|