ios_dev_tools 0.1.3 → 0.1.4
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 +7 -0
- data/bin/ios_tool +13 -0
- data/lib/ios_dev_tools.rb +8 -2
- data/lib/ios_dev_tools/commands/help.rb +131 -0
- data/lib/ios_dev_tools/commands/pack.rb +22 -0
- data/lib/ios_dev_tools/commands/sign.rb +139 -0
- data/lib/ios_dev_tools/commands/tool.rb +122 -0
- data/lib/ios_dev_tools/commands/verify.rb +22 -0
- data/lib/ios_dev_tools/{application_bundle.rb → model/application_bundle.rb} +2 -17
- data/lib/ios_dev_tools/model/info_plist.rb +50 -0
- data/lib/ios_dev_tools/{provisioning_profile.rb → model/provisioning_profile.rb} +0 -0
- data/lib/ios_dev_tools/version.rb +1 -1
- data/test/test_application_bundle.rb +12 -0
- data/test/test_info_plist.rb +23 -0
- metadata +37 -42
- data/bin/ios_sign +0 -126
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6583165243e7d6849595618aeb25b5bd5b1256ad
|
4
|
+
data.tar.gz: 94e721d32ac5b1d4d3b6d489cbd6c1a9e7aa6d68
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c5ba1b2f24e34e3312c2fed7acde878a77736390952c4eba3ad806cdee64d1fbe8c7d988220456e805e4ffe7a3fa62bbd29c3c6dfee1019f4e10bdd6e001407
|
7
|
+
data.tar.gz: 4bd46e0131e5ee9d1f430e9098c45ebb35292d08998eb5794f1dd1423bc3df05391792a8521a5f889e75041065b2cbac094010d3d54e78d14618b2671f001355
|
data/bin/ios_tool
ADDED
data/lib/ios_dev_tools.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
|
2
2
|
module IOSDevTools
|
3
3
|
|
4
|
-
autoload :ApplicationBundle, 'ios_dev_tools/application_bundle'
|
5
|
-
autoload :ProvisioningProfile, 'ios_dev_tools/provisioning_profile'
|
6
4
|
autoload :VERSION, 'ios_dev_tools/version'
|
5
|
+
autoload :ApplicationBundle, 'ios_dev_tools/model/application_bundle'
|
6
|
+
autoload :ProvisioningProfile, 'ios_dev_tools/model/provisioning_profile'
|
7
|
+
autoload :InfoPlist, 'ios_dev_tools/model/info_plist'
|
8
|
+
autoload :Pack, 'ios_dev_tools/commands/pack'
|
9
|
+
autoload :Sign, 'ios_dev_tools/commands/sign'
|
10
|
+
autoload :Verify, 'ios_dev_tools/commands/verify'
|
11
|
+
autoload :Tool, 'ios_dev_tools/commands/tool'
|
12
|
+
autoload :Help, 'ios_dev_tools/commands/help'
|
7
13
|
|
8
14
|
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
#
|
4
|
+
#
|
5
|
+
module IOSDevTools
|
6
|
+
|
7
|
+
require 'optparse'
|
8
|
+
|
9
|
+
#
|
10
|
+
#
|
11
|
+
#
|
12
|
+
class Help
|
13
|
+
|
14
|
+
#
|
15
|
+
#
|
16
|
+
#
|
17
|
+
def self.create_with_args cmd_line_arguments
|
18
|
+
|
19
|
+
options=parse_options cmd_line_arguments
|
20
|
+
return Help.new options
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
#
|
26
|
+
#
|
27
|
+
def self.parse_options(args)
|
28
|
+
|
29
|
+
options={}
|
30
|
+
options[:help_option]=args[0]
|
31
|
+
|
32
|
+
return options
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
#
|
37
|
+
#
|
38
|
+
def initialize options
|
39
|
+
|
40
|
+
@options=options
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
#
|
46
|
+
#
|
47
|
+
def execute
|
48
|
+
|
49
|
+
Help.display_banner
|
50
|
+
|
51
|
+
if not @options[:help_option]
|
52
|
+
# no option give, display generic help
|
53
|
+
display_generic_help
|
54
|
+
elsif @options[:help_option]=="commands"
|
55
|
+
# list of commands requested
|
56
|
+
display_available_commands
|
57
|
+
else
|
58
|
+
# command specific help requested
|
59
|
+
command_name=@options[:help_option]
|
60
|
+
if not Tool.valid_command_name? command_name
|
61
|
+
display_unknown_command command_name
|
62
|
+
else
|
63
|
+
display_command_specific_help command_name
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
#
|
70
|
+
#
|
71
|
+
def display_unknown_command command_name
|
72
|
+
puts "
|
73
|
+
ERROR: Unknown command: #{command_name}
|
74
|
+
"
|
75
|
+
display_generic_help
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
#
|
80
|
+
#
|
81
|
+
def self.display_banner
|
82
|
+
puts "iOS Development Tools v.#{VERSION}
|
83
|
+
|
84
|
+
"
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
#
|
89
|
+
#
|
90
|
+
def display_available_commands
|
91
|
+
puts "
|
92
|
+
Available commands:
|
93
|
+
|
94
|
+
sign - sign application bundle/archive
|
95
|
+
verify - verify application bundle/archive
|
96
|
+
pack - pack application bundle into archive
|
97
|
+
|
98
|
+
Execute following command to see command specific help
|
99
|
+
|
100
|
+
ios_tool help [COMMAND NAME]
|
101
|
+
"
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
#
|
107
|
+
#
|
108
|
+
def display_generic_help
|
109
|
+
puts "
|
110
|
+
|
111
|
+
TODO: ios_tool help
|
112
|
+
|
113
|
+
|
114
|
+
help commands - displays available commands
|
115
|
+
help [COMMAND NAME] - displays command specific help
|
116
|
+
|
117
|
+
|
118
|
+
"
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
#
|
123
|
+
#
|
124
|
+
#
|
125
|
+
def display_command_specific_help command_name
|
126
|
+
command_class=Tool.command_name_to_class command_name
|
127
|
+
command_class.display_help
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module IOSDevTools
|
3
|
+
|
4
|
+
class Pack
|
5
|
+
|
6
|
+
def self.create_with_args cmd_line_arguments
|
7
|
+
Pack.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.display_help
|
11
|
+
|
12
|
+
puts "
|
13
|
+
TODO: 'pack' command help
|
14
|
+
"
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
puts "TODO: execute"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
|
2
|
+
module IOSDevTools
|
3
|
+
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
class Sign
|
7
|
+
|
8
|
+
def self.create_with_args cmd_line_arguments
|
9
|
+
|
10
|
+
options=parse_options cmd_line_arguments
|
11
|
+
|
12
|
+
return Sign.new options
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize options
|
16
|
+
|
17
|
+
@options=options
|
18
|
+
@be_verbose=(options[:verbose]!=nil)
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.display_help
|
23
|
+
|
24
|
+
Sign.parse_options ["-h"]
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
def verbose_msg message
|
29
|
+
|
30
|
+
puts message if @be_verbose
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def error_msg message
|
35
|
+
|
36
|
+
puts "\nERROR:\t#{message}\n"
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
def execute
|
41
|
+
|
42
|
+
verbose_msg "Passed options:\n#{@options.inspect}"
|
43
|
+
|
44
|
+
begin
|
45
|
+
provisioning_profile=IOSDevTools::ProvisioningProfile.new @options[:profile_location]
|
46
|
+
application_bundle=IOSDevTools::ApplicationBundle.new @options[:input_file] do |ab|
|
47
|
+
ab.temp_folder=options[:temp_folder]
|
48
|
+
end
|
49
|
+
rescue => error
|
50
|
+
error_msg error
|
51
|
+
exit 1
|
52
|
+
end
|
53
|
+
|
54
|
+
new_bundle_id = @options[:bundle_id]
|
55
|
+
new_bundle_id ||= application_bundle.bundle_id
|
56
|
+
|
57
|
+
if not provisioning_profile.is_compatible_with_bundle_id new_bundle_id
|
58
|
+
error_msg "Provisioning profile identifier [#{provisioning_profile.application_identifier}] is not compatible with bundle identifier [#{new_bundle_id}]\n \
|
59
|
+
\tMaybe you should use -b switch to overwrite the bundle identifier?"
|
60
|
+
exit 1
|
61
|
+
end
|
62
|
+
|
63
|
+
application_bundle.bundle_id = new_bundle_id
|
64
|
+
application_bundle.set_provisioning_profile provisioning_profile.profile_location
|
65
|
+
application_bundle.sign_with_identity @options[:identity]
|
66
|
+
application_bundle.package_to_ipa @options[:output_ipa]
|
67
|
+
|
68
|
+
puts "\nApplication archive created and signed: #{options[:output_ipa]}"
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.parse_options(args)
|
73
|
+
|
74
|
+
options = Hash.new
|
75
|
+
OptionParser.new do |opts|
|
76
|
+
|
77
|
+
opts.banner = "Usage:
|
78
|
+
ios_tool sign -i \"iPhone Distribution: Name\" -p path/to/profile -o output/ipa/file [options] inputIpa"
|
79
|
+
|
80
|
+
opts.separator ""
|
81
|
+
opts.separator "Options:"
|
82
|
+
|
83
|
+
opts.on("-p", "--profile PATH_TO_PROFILE", "Path to profile") do |profile_location|
|
84
|
+
options[:profile_location] = profile_location
|
85
|
+
end
|
86
|
+
|
87
|
+
opts.on("-b", "--bundle-id [BUNDLE_IDENTIFIER]", "Bundle identifier") do |bundle_id|
|
88
|
+
options[:bundle_id] = bundle_id
|
89
|
+
end
|
90
|
+
|
91
|
+
opts.on("-o", "--output OUTPUT_IPA_FILE", "Output ipa archive") do |output_ipa|
|
92
|
+
options[:output_ipa] = output_ipa
|
93
|
+
end
|
94
|
+
|
95
|
+
opts.on("-i", "--identity IDENTITY", "Identity") do |identity|
|
96
|
+
options[:identity] = identity
|
97
|
+
end
|
98
|
+
|
99
|
+
opts.on("-t", "--temp [TEMP_FOLDER]", "Temporary folder location") do |temp_folder|
|
100
|
+
options[:temp_folder] = temp_folder
|
101
|
+
end
|
102
|
+
|
103
|
+
opts.separator ""
|
104
|
+
opts.separator "Common options:"
|
105
|
+
|
106
|
+
opts.on("-v", "--verbose", "Run verbosely") do |v|
|
107
|
+
options[:verbose] = v
|
108
|
+
end
|
109
|
+
|
110
|
+
opts.on("--version", "Show version and exit") do |v|
|
111
|
+
puts "Version: #{IOSDevTools::VERSION}"
|
112
|
+
exit
|
113
|
+
end
|
114
|
+
|
115
|
+
# No argument, shows at tail. This will print an options summary.
|
116
|
+
# Try it and see!
|
117
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
118
|
+
puts opts
|
119
|
+
exit
|
120
|
+
end
|
121
|
+
|
122
|
+
end.parse!(args)
|
123
|
+
|
124
|
+
options[:input_file]=ARGV[0]
|
125
|
+
mandatory=[options[:profile_location],options[:identity],options[:output_ipa],options[:input_file]]
|
126
|
+
expected_number=mandatory.count
|
127
|
+
real_number=mandatory.compact.count
|
128
|
+
if expected_number != real_number
|
129
|
+
# one of mandatory switches is missing
|
130
|
+
# display help and exit
|
131
|
+
parse_options ["-h"]
|
132
|
+
end
|
133
|
+
|
134
|
+
return options
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
|
2
|
+
module IOSDevTools
|
3
|
+
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
class Tool
|
7
|
+
|
8
|
+
def process_cmd_line_args cmd_line_arguments
|
9
|
+
|
10
|
+
command_name=cmd_line_arguments[0]
|
11
|
+
|
12
|
+
if not command_name or command_name=="-h" or command_name=="--help"
|
13
|
+
command_name="help"
|
14
|
+
end
|
15
|
+
|
16
|
+
if not Tool.valid_command_name? command_name
|
17
|
+
puts "Unknown command"
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
# create class definition
|
22
|
+
command_class=Tool.command_name_to_class command_name
|
23
|
+
|
24
|
+
# NOTE:shift argument array to loose first element which is command name
|
25
|
+
# the command is already recognised and is not needed any more
|
26
|
+
# this simplifies options parsing inside commands
|
27
|
+
ARGV.shift
|
28
|
+
|
29
|
+
# use common factory method to create the command
|
30
|
+
command=command_class.create_with_args ARGV
|
31
|
+
# execute the command if created
|
32
|
+
command.execute if command
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.valid_command_name? command_name
|
37
|
+
|
38
|
+
valid_commands=["sign", "pack", "verify", "help"]
|
39
|
+
return valid_commands.include? command_name
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.command_name_to_class command_name
|
44
|
+
# convert snake case to camel case
|
45
|
+
c=command_name.gsub(/(?<=_|^)(\w)/){$1.upcase}.gsub(/(?:_)(\w)/,'\1')
|
46
|
+
# create class definition
|
47
|
+
command_class=nil
|
48
|
+
begin
|
49
|
+
command_class=Object.const_get("IOSDevTools::#{c}")
|
50
|
+
rescue NameError,e
|
51
|
+
end
|
52
|
+
return command_class
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.parse_options(args)
|
56
|
+
|
57
|
+
options = Hash.new
|
58
|
+
OptionParser.new do |opts|
|
59
|
+
|
60
|
+
opts.banner = "Usage:
|
61
|
+
ios_tool sign -i \"iPhone Distribution: Name\" -p path/to/profile -o output/ipa/file [options] inputIpa"
|
62
|
+
|
63
|
+
opts.separator ""
|
64
|
+
opts.separator "Options:"
|
65
|
+
|
66
|
+
opts.on("-p", "--profile PATH_TO_PROFILE", "Path to profile") do |profile_location|
|
67
|
+
options[:profile_location] = profile_location
|
68
|
+
end
|
69
|
+
|
70
|
+
opts.on("-b", "--bundle-id [BUNDLE_IDENTIFIER]", "Bundle identifier") do |bundle_id|
|
71
|
+
options[:bundle_id] = bundle_id
|
72
|
+
end
|
73
|
+
|
74
|
+
opts.on("-o", "--output OUTPUT_IPA_FILE", "Output ipa archive") do |output_ipa|
|
75
|
+
options[:output_ipa] = output_ipa
|
76
|
+
end
|
77
|
+
|
78
|
+
opts.on("-i", "--identity IDENTITY", "Identity") do |identity|
|
79
|
+
options[:identity] = identity
|
80
|
+
end
|
81
|
+
|
82
|
+
opts.on("-t", "--temp [TEMP_FOLDER]", "Temporary folder location") do |temp_folder|
|
83
|
+
options[:temp_folder] = temp_folder
|
84
|
+
end
|
85
|
+
|
86
|
+
opts.separator ""
|
87
|
+
opts.separator "Common options:"
|
88
|
+
|
89
|
+
opts.on("-v", "--verbose", "Run verbosely") do |v|
|
90
|
+
options[:verbose] = v
|
91
|
+
end
|
92
|
+
|
93
|
+
opts.on("--version", "Show version and exit") do |v|
|
94
|
+
puts "Version: #{IOSDevTools::VERSION}"
|
95
|
+
exit
|
96
|
+
end
|
97
|
+
|
98
|
+
# No argument, shows at tail. This will print an options summary.
|
99
|
+
# Try it and see!
|
100
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
101
|
+
puts opts
|
102
|
+
exit
|
103
|
+
end
|
104
|
+
|
105
|
+
end.parse!(args)
|
106
|
+
|
107
|
+
options[:input_file]=ARGV[0]
|
108
|
+
mandatory=[options[:profile_location],options[:identity],options[:output_ipa],options[:input_file]]
|
109
|
+
expected_number=mandatory.count
|
110
|
+
real_number=mandatory.compact.count
|
111
|
+
if expected_number != real_number
|
112
|
+
# one of mandatory switches is missing
|
113
|
+
# display help and exit
|
114
|
+
parse_options ["-h"]
|
115
|
+
end
|
116
|
+
|
117
|
+
return options
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module IOSDevTools
|
3
|
+
|
4
|
+
class Verify
|
5
|
+
|
6
|
+
def self.create_with_args cmd_line_arguments
|
7
|
+
Verify.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.display_help
|
11
|
+
|
12
|
+
puts "
|
13
|
+
TODO: 'verify' command help
|
14
|
+
"
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
puts "TODO: execute"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -15,6 +15,7 @@ module IOSDevTools
|
|
15
15
|
attr_accessor :temp_folder
|
16
16
|
attr_accessor :plist_buddy_cmd
|
17
17
|
attr_accessor :application_name
|
18
|
+
attr_accessor :info_plist
|
18
19
|
|
19
20
|
def initialize file_or_folder_location
|
20
21
|
|
@@ -30,7 +31,6 @@ module IOSDevTools
|
|
30
31
|
|
31
32
|
@src_location=file_or_folder_location
|
32
33
|
@temp_folder||="temp"
|
33
|
-
@plist_buddy_cmd||="/usr/libexec/PlistBuddy"
|
34
34
|
|
35
35
|
if not @is_application_folder
|
36
36
|
# wipe out temp folder
|
@@ -44,26 +44,11 @@ module IOSDevTools
|
|
44
44
|
end
|
45
45
|
|
46
46
|
@application_name=Pathname.new(@location).basename
|
47
|
+
@info_plist=InfoPlist.new "#{@location}/Info.plist"
|
47
48
|
|
48
49
|
end
|
49
50
|
|
50
|
-
def display_name
|
51
|
-
`#{@plist_buddy_cmd} -c "Print :CFBundleDisplayName" "#{@location}/Info.plist"`.strip
|
52
|
-
end
|
53
|
-
|
54
|
-
def display_name= new_name
|
55
|
-
return if not new_name
|
56
|
-
`#{@plist_buddy_cmd} -c "Set :CFBundleDisplayName #{new_name}" "#{@location}/Info.plist"`
|
57
|
-
end
|
58
51
|
|
59
|
-
def bundle_id
|
60
|
-
`#{@plist_buddy_cmd} -c "Print :CFBundleIdentifier" "#{@location}/Info.plist"`.strip
|
61
|
-
end
|
62
|
-
|
63
|
-
def bundle_id= new_bundle_id
|
64
|
-
return if not new_bundle_id
|
65
|
-
`#{@plist_buddy_cmd} -c "Set :CFBundleIdentifier #{new_bundle_id}" "#{@location}/Info.plist"`
|
66
|
-
end
|
67
52
|
|
68
53
|
def set_provisioning_profile new_provisioning_profile_location
|
69
54
|
return if not new_provisioning_profile_location
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module IOSDevTools
|
2
|
+
|
3
|
+
#
|
4
|
+
#
|
5
|
+
#
|
6
|
+
class InfoPlist
|
7
|
+
|
8
|
+
attr_accessor :info_plist_file_path
|
9
|
+
attr_accessor :plist_buddy_cmd
|
10
|
+
|
11
|
+
def initialize info_plist_file_path
|
12
|
+
|
13
|
+
@info_plist_file_path=info_plist_file_path
|
14
|
+
|
15
|
+
yield self if block_given?
|
16
|
+
|
17
|
+
@plist_buddy_cmd||="/usr/libexec/PlistBuddy"
|
18
|
+
|
19
|
+
raise "Property list file \"#{info_plist_file_path}\" doesn't exist" if not File.exists? @info_plist_file_path
|
20
|
+
raise "Plist editor \"#{info_plist_file_path}\" doesn't exist" if not File.exists? @plist_buddy_cmd
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_property property_id, property_value
|
25
|
+
return if not property_id or not property_value
|
26
|
+
`#{@plist_buddy_cmd} -c "Set :#{property_id} #{new_name}" "#{@info_plist_file_path}"`
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_property property_id
|
30
|
+
`#{@plist_buddy_cmd} -c "Print :#{property_id}" "#{@info_plist_file_path}"`.strip
|
31
|
+
end
|
32
|
+
|
33
|
+
def display_name
|
34
|
+
get_property "CFBundleDisplayName"
|
35
|
+
end
|
36
|
+
|
37
|
+
def display_name= new_name
|
38
|
+
set_property "CFBundleDisplayName", new_name
|
39
|
+
end
|
40
|
+
|
41
|
+
def bundle_id
|
42
|
+
get_property "CFBundleIdentifier"
|
43
|
+
end
|
44
|
+
|
45
|
+
def bundle_id= new_bundle_id
|
46
|
+
set_property "CFBundleIdentifier", new_bundle_id
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
File without changes
|
@@ -3,6 +3,18 @@ require 'ios_dev_tools'
|
|
3
3
|
|
4
4
|
class ApplicationBundleTest < Test::Unit::TestCase
|
5
5
|
|
6
|
+
def test_create_with_app_folder
|
7
|
+
|
8
|
+
app_bundle=IOSDevTools::ApplicationBundle.new "test_resources/DummyApp.app"
|
9
|
+
|
10
|
+
assert_not_nil app_bundle
|
11
|
+
info_plist=app_bundle.info_plist
|
12
|
+
assert_not_nil info_plist
|
13
|
+
assert_equal "Dummy Bundle", app_bundle.info_plist.display_name
|
14
|
+
assert_equal "com.csquirrel.dummy.bundle", app_bundle.info_plist.bundle_id
|
15
|
+
|
16
|
+
end
|
17
|
+
|
6
18
|
def test_create_with_not_existing_folder
|
7
19
|
|
8
20
|
assert_raise RuntimeError do
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'ios_dev_tools'
|
3
|
+
|
4
|
+
class ApplicationBundleTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_create_with_file
|
7
|
+
|
8
|
+
info_plist=IOSDevTools::InfoPlist.new "test_resources/DummyApp.app/Info.plist"
|
9
|
+
|
10
|
+
assert_equal "Dummy Bundle", info_plist.display_name
|
11
|
+
assert_equal "com.csquirrel.dummy.bundle", info_plist.bundle_id
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_create_with_not_existing_file
|
16
|
+
|
17
|
+
assert_raise RuntimeError do
|
18
|
+
IOSDevTools::ApplicationBundle.new "dummy.file.plist"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
metadata
CHANGED
@@ -1,66 +1,61 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ios_dev_tools
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 3
|
9
|
-
version: 0.1.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Marcin Maciukiewicz
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2013-12-28 00:00:00 +00:00
|
18
|
-
default_executable:
|
11
|
+
date: 2013-12-28 00:00:00.000000000 Z
|
19
12
|
dependencies: []
|
20
|
-
|
21
13
|
description: Set of ruby wrappers around iOS dev tasks
|
22
14
|
email: mm@csquirrel.com
|
23
|
-
executables:
|
24
|
-
-
|
15
|
+
executables:
|
16
|
+
- ios_tool
|
25
17
|
extensions: []
|
26
|
-
|
27
18
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
files:
|
19
|
+
files:
|
30
20
|
- lib/ios_dev_tools.rb
|
31
|
-
- lib/ios_dev_tools/
|
32
|
-
- lib/ios_dev_tools/
|
21
|
+
- lib/ios_dev_tools/commands/help.rb
|
22
|
+
- lib/ios_dev_tools/commands/pack.rb
|
23
|
+
- lib/ios_dev_tools/commands/sign.rb
|
24
|
+
- lib/ios_dev_tools/commands/tool.rb
|
25
|
+
- lib/ios_dev_tools/commands/verify.rb
|
26
|
+
- lib/ios_dev_tools/model/application_bundle.rb
|
27
|
+
- lib/ios_dev_tools/model/info_plist.rb
|
28
|
+
- lib/ios_dev_tools/model/provisioning_profile.rb
|
33
29
|
- lib/ios_dev_tools/version.rb
|
34
|
-
|
30
|
+
- test/test_application_bundle.rb
|
31
|
+
- test/test_info_plist.rb
|
32
|
+
- test/test_provisioning_profile.rb
|
33
|
+
- bin/ios_tool
|
35
34
|
homepage: https://github.com/cSquirrel/ios-dev-tools
|
36
|
-
licenses:
|
35
|
+
licenses:
|
37
36
|
- MIT
|
37
|
+
metadata: {}
|
38
38
|
post_install_message:
|
39
39
|
rdoc_options: []
|
40
|
-
|
41
|
-
require_paths:
|
40
|
+
require_paths:
|
42
41
|
- lib
|
43
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
segments:
|
55
|
-
- 0
|
56
|
-
version: "0"
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
57
52
|
requirements: []
|
58
|
-
|
59
53
|
rubyforge_project: nowarning
|
60
|
-
rubygems_version:
|
54
|
+
rubygems_version: 2.0.3
|
61
55
|
signing_key:
|
62
|
-
specification_version:
|
56
|
+
specification_version: 4
|
63
57
|
summary: iOS Dev Tools
|
64
|
-
test_files:
|
58
|
+
test_files:
|
65
59
|
- test/test_application_bundle.rb
|
60
|
+
- test/test_info_plist.rb
|
66
61
|
- test/test_provisioning_profile.rb
|
data/bin/ios_sign
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'ios_dev_tools'
|
7
|
-
rescue LoadError
|
8
|
-
require 'rubygems'
|
9
|
-
require 'ios_dev_tools'
|
10
|
-
end
|
11
|
-
|
12
|
-
$be_verbose=false
|
13
|
-
|
14
|
-
def verbose_msg message
|
15
|
-
|
16
|
-
puts message if $be_verbose
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
def error_msg message
|
21
|
-
|
22
|
-
puts "\nERROR:\t#{message}\n"
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
def parse_options(args)
|
27
|
-
|
28
|
-
options = Hash.new
|
29
|
-
OptionParser.new do |opts|
|
30
|
-
|
31
|
-
opts.banner = "Usage: ios_sign -i \"iPhone Distribution: Name\" -p path/to/profile -o output/ipa/file [options] inputIpa"
|
32
|
-
|
33
|
-
opts.separator ""
|
34
|
-
opts.separator "Options:"
|
35
|
-
|
36
|
-
opts.on("-p", "--profile PATH_TO_PROFILE", "Path to profile") do |profile_location|
|
37
|
-
options[:profile_location] = profile_location
|
38
|
-
end
|
39
|
-
|
40
|
-
opts.on("-b", "--bundle-id [BUNDLE_IDENTIFIER]", "Bundle identifier") do |bundle_id|
|
41
|
-
options[:bundle_id] = bundle_id
|
42
|
-
end
|
43
|
-
|
44
|
-
opts.on("-o", "--output OUTPUT_IPA_FILE", "Output ipa archive") do |output_ipa|
|
45
|
-
options[:output_ipa] = output_ipa
|
46
|
-
end
|
47
|
-
|
48
|
-
opts.on("-i", "--identity IDENTITY", "Identity") do |identity|
|
49
|
-
options[:identity] = identity
|
50
|
-
end
|
51
|
-
|
52
|
-
opts.on("-t", "--temp [TEMP_FOLDER]", "Temporary folder location") do |temp_folder|
|
53
|
-
options[:temp_folder] = temp_folder
|
54
|
-
end
|
55
|
-
|
56
|
-
opts.separator ""
|
57
|
-
opts.separator "Common options:"
|
58
|
-
|
59
|
-
opts.on("-v", "--verbose", "Run verbosely") do |v|
|
60
|
-
options[:verbose] = v
|
61
|
-
end
|
62
|
-
|
63
|
-
opts.on("--version", "Show version and exit") do |v|
|
64
|
-
puts "Version: #{IOSDevTools::VERSION}"
|
65
|
-
exit
|
66
|
-
end
|
67
|
-
|
68
|
-
# No argument, shows at tail. This will print an options summary.
|
69
|
-
# Try it and see!
|
70
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
71
|
-
puts opts
|
72
|
-
exit
|
73
|
-
end
|
74
|
-
|
75
|
-
end.parse!(args)
|
76
|
-
|
77
|
-
options[:input_file]=ARGV[0]
|
78
|
-
mandatory=[options[:profile_location],options[:identity],options[:output_ipa],options[:input_file]]
|
79
|
-
expected_number=mandatory.count
|
80
|
-
real_number=mandatory.compact.count
|
81
|
-
if expected_number != real_number
|
82
|
-
# one of mandatory switches is missing
|
83
|
-
# display help and exit
|
84
|
-
parse_options ["-h"]
|
85
|
-
end
|
86
|
-
|
87
|
-
$be_verbose=(options[:verbose]!=nil)
|
88
|
-
|
89
|
-
return options
|
90
|
-
end
|
91
|
-
|
92
|
-
def main
|
93
|
-
|
94
|
-
options=parse_options ARGV
|
95
|
-
|
96
|
-
verbose_msg "Passed options:\n#{options.inspect}"
|
97
|
-
|
98
|
-
begin
|
99
|
-
provisioning_profile=IOSDevTools::ProvisioningProfile.new options[:profile_location]
|
100
|
-
application_bundle=IOSDevTools::ApplicationBundle.new options[:input_file] do |ab|
|
101
|
-
ab.temp_folder=options[:temp_folder]
|
102
|
-
end
|
103
|
-
rescue => error
|
104
|
-
error_msg error
|
105
|
-
exit 1
|
106
|
-
end
|
107
|
-
|
108
|
-
new_bundle_id = options[:bundle_id]
|
109
|
-
new_bundle_id ||= application_bundle.bundle_id
|
110
|
-
|
111
|
-
if not provisioning_profile.is_compatible_with_bundle_id new_bundle_id
|
112
|
-
error_msg "Provisioning profile identifier [#{provisioning_profile.application_identifier}] is not compatible with bundle identifier [#{new_bundle_id}]\n \
|
113
|
-
\tMaybe you should use -b switch to overwrite the bundle identifier?"
|
114
|
-
exit 1
|
115
|
-
end
|
116
|
-
|
117
|
-
application_bundle.bundle_id = new_bundle_id
|
118
|
-
application_bundle.set_provisioning_profile provisioning_profile.profile_location
|
119
|
-
application_bundle.sign_with_identity options[:identity]
|
120
|
-
application_bundle.package_to_ipa options[:output_ipa]
|
121
|
-
|
122
|
-
puts "\nApplication archive created and signed: #{options[:output_ipa]}"
|
123
|
-
|
124
|
-
end
|
125
|
-
|
126
|
-
main
|