fir-cli 1.1.5 → 1.1.7
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 +4 -4
- data/.codeclimate.yml +8 -0
- data/.gitignore +1 -0
- data/CHANGELOG +10 -0
- data/README.md +43 -11
- data/Rakefile +3 -3
- data/fir-cli.gemspec +7 -3
- data/lib/fir/api.yml +11 -5
- data/lib/fir/cli.rb +39 -8
- data/lib/fir/patches/concern.rb +144 -0
- data/lib/fir/patches/native_patch.rb +19 -0
- data/lib/fir/patches.rb +1 -1
- data/lib/fir/util/build.rb +101 -60
- data/lib/fir/util/config.rb +35 -0
- data/lib/fir/util/http.rb +49 -0
- data/lib/fir/util/info.rb +6 -3
- data/lib/fir/util/login.rb +1 -0
- data/lib/fir/util/mapping.rb +65 -0
- data/lib/fir/util/me.rb +7 -6
- data/lib/fir/util/parser.rb +157 -0
- data/lib/fir/util/publish.rb +83 -64
- data/lib/fir/util.rb +34 -12
- data/lib/fir/version.rb +1 -1
- data/lib/fir.rb +0 -78
- data/test/build_ipa_test.rb +9 -0
- data/test/cases/test_apk.apk +0 -0
- data/test/cases/test_apk_txt +1 -0
- data/test/cases/test_ipa_dsym +0 -0
- data/test/info_test.rb +39 -0
- data/test/login_test.rb +12 -0
- data/test/mapping_test.rb +15 -0
- data/test/me_test.rb +17 -0
- data/test/publish_test.rb +14 -0
- data/test/test_helper.rb +49 -0
- metadata +48 -9
- data/lib/fir/patches/bin/pngcrush +0 -0
- data/lib/fir/patches/parser_patch.rb +0 -169
- data/test/fir_cli_test.rb +0 -88
@@ -1,169 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Parser
|
4
|
-
|
5
|
-
class << self
|
6
|
-
|
7
|
-
def png_bin
|
8
|
-
@png_bin ||= File.expand_path("../bin/pngcrush", __FILE__)
|
9
|
-
end
|
10
|
-
|
11
|
-
def uncrush_icon crushed_icon_path, uncrushed_icon_path
|
12
|
-
system("#{png_bin} -revert-iphone-optimizations #{crushed_icon_path} #{uncrushed_icon_path} &> /dev/null")
|
13
|
-
end
|
14
|
-
|
15
|
-
def crush_icon uncrushed_icon_path, crushed_icon_path
|
16
|
-
system("#{png_bin} -iphone #{uncrushed_icon_path} #{crushed_icon_path} &> /dev/null")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class IPA
|
21
|
-
|
22
|
-
def initialize(path)
|
23
|
-
@path = path
|
24
|
-
end
|
25
|
-
|
26
|
-
def app
|
27
|
-
@app ||= App.new(app_path)
|
28
|
-
end
|
29
|
-
|
30
|
-
def app_path
|
31
|
-
@app_path ||= Dir.glob(File.join(contents, 'Payload', '*.app')).first
|
32
|
-
end
|
33
|
-
|
34
|
-
def cleanup
|
35
|
-
return unless @contents
|
36
|
-
FileUtils.rm_rf(@contents)
|
37
|
-
@contents = nil
|
38
|
-
end
|
39
|
-
|
40
|
-
def metadata
|
41
|
-
return unless has_metadata?
|
42
|
-
@metadata ||= CFPropertyList.native_types(CFPropertyList::List.new(file: metadata_path).value)
|
43
|
-
end
|
44
|
-
|
45
|
-
def has_metadata?
|
46
|
-
File.file? metadata_path
|
47
|
-
end
|
48
|
-
|
49
|
-
def metadata_path
|
50
|
-
@metadata_path ||= File.join(@contents, 'iTunesMetadata.plist')
|
51
|
-
end
|
52
|
-
|
53
|
-
def release_type
|
54
|
-
has_metadata? ? 'store' : 'adhoc'
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def contents
|
60
|
-
return if @contents
|
61
|
-
@contents = "fir-cli_tmp/ipa_files-#{Time.now.to_i}"
|
62
|
-
|
63
|
-
Zip::File.open(@path) do |zip_file|
|
64
|
-
zip_file.each do |f|
|
65
|
-
f_path = File.join(@contents, f.name)
|
66
|
-
FileUtils.mkdir_p(File.dirname(f_path))
|
67
|
-
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
@contents
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
class App
|
76
|
-
|
77
|
-
def initialize(path)
|
78
|
-
@path = path
|
79
|
-
end
|
80
|
-
|
81
|
-
def info
|
82
|
-
@info ||= CFPropertyList.native_types(
|
83
|
-
CFPropertyList::List.new(file: File.join(@path, 'Info.plist')).value)
|
84
|
-
end
|
85
|
-
|
86
|
-
def name
|
87
|
-
info['CFBundleName']
|
88
|
-
end
|
89
|
-
|
90
|
-
def identifier
|
91
|
-
info['CFBundleIdentifier']
|
92
|
-
end
|
93
|
-
|
94
|
-
def display_name
|
95
|
-
info['CFBundleDisplayName']
|
96
|
-
end
|
97
|
-
|
98
|
-
def version
|
99
|
-
info['CFBundleVersion']
|
100
|
-
end
|
101
|
-
|
102
|
-
def short_version
|
103
|
-
info['CFBundleShortVersionString']
|
104
|
-
end
|
105
|
-
|
106
|
-
def icons
|
107
|
-
@icons ||= begin
|
108
|
-
icons = []
|
109
|
-
info['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'].each do |name|
|
110
|
-
icons << get_image(name)
|
111
|
-
icons << get_image("#{name}@2x")
|
112
|
-
end
|
113
|
-
icons.delete_if { |i| !i }
|
114
|
-
rescue NoMethodError
|
115
|
-
[]
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def mobileprovision
|
120
|
-
return unless has_mobileprovision?
|
121
|
-
return @mobileprovision if @mobileprovision
|
122
|
-
|
123
|
-
cmd = "security cms -D -i \"#{mobileprovision_path}\""
|
124
|
-
begin
|
125
|
-
@mobileprovision = CFPropertyList.native_types(CFPropertyList::List.new(data: `#{cmd}`).value)
|
126
|
-
rescue CFFormatError
|
127
|
-
@mobileprovision = {}
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
def has_mobileprovision?
|
132
|
-
File.file? mobileprovision_path
|
133
|
-
end
|
134
|
-
|
135
|
-
def mobileprovision_path
|
136
|
-
@mobileprovision_path ||= File.join(@path, 'embedded.mobileprovision')
|
137
|
-
end
|
138
|
-
|
139
|
-
def hide_developer_certificates
|
140
|
-
mobileprovision.delete('DeveloperCertificates') if has_mobileprovision?
|
141
|
-
end
|
142
|
-
|
143
|
-
def devices
|
144
|
-
mobileprovision['ProvisionedDevices'] if has_mobileprovision?
|
145
|
-
end
|
146
|
-
|
147
|
-
def distribution_name
|
148
|
-
"#{mobileprovision['Name']} - #{mobileprovision['TeamName']}" if has_mobileprovision?
|
149
|
-
end
|
150
|
-
|
151
|
-
def release_type
|
152
|
-
if has_mobileprovision?
|
153
|
-
if devices
|
154
|
-
'adhoc'
|
155
|
-
else
|
156
|
-
'inhouse'
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
private
|
162
|
-
|
163
|
-
def get_image name
|
164
|
-
path = File.join(@path, "#{name}.png")
|
165
|
-
return nil unless File.exist?(path)
|
166
|
-
path
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
data/test/fir_cli_test.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'fir'
|
5
|
-
|
6
|
-
class Minitest::Test
|
7
|
-
|
8
|
-
def default_token
|
9
|
-
'2dd8a99ef9d19c540bb583624b939960'
|
10
|
-
end
|
11
|
-
|
12
|
-
def default_email
|
13
|
-
'fir-cli_test@fir.im'
|
14
|
-
end
|
15
|
-
|
16
|
-
def default_apk
|
17
|
-
File.expand_path('../cases', __FILE__) + '/test_apk.apk'
|
18
|
-
end
|
19
|
-
|
20
|
-
def default_ipa
|
21
|
-
File.expand_path('../cases', __FILE__) + '/test_ipa.ipa'
|
22
|
-
end
|
23
|
-
|
24
|
-
def default_device_udid
|
25
|
-
"cf8b87e3f469d7b185fd64c057778aecbc2017a6"
|
26
|
-
end
|
27
|
-
|
28
|
-
def default_distribution_name
|
29
|
-
'iOSTeam Provisioning Profile: im.fir.* - Fly It Remotely LLC.'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class LoginTest < Minitest::Test
|
34
|
-
|
35
|
-
def test_login
|
36
|
-
user_info = FIR.fetch_user_info(default_token)
|
37
|
-
|
38
|
-
assert_equal default_email, user_info.fetch(:email, '')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class MeTest < Minitest::Test
|
43
|
-
|
44
|
-
def test_me
|
45
|
-
user_info = FIR.fetch_user_info(default_token)
|
46
|
-
|
47
|
-
FIR.write_config(email: user_info.fetch(:email, ''), token: default_token)
|
48
|
-
FIR.reload_config
|
49
|
-
|
50
|
-
me_info = FIR.fetch_user_info(FIR.current_token)
|
51
|
-
|
52
|
-
assert_equal default_email, me_info.fetch(:email, '')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class InfoTest < Minitest::Test
|
57
|
-
|
58
|
-
def test_apk_info
|
59
|
-
info = FIR.apk_info(default_apk, true)
|
60
|
-
|
61
|
-
assert_equal 'android', info[:type]
|
62
|
-
assert_equal 'im.fir.sdk.test', info[:identifier]
|
63
|
-
assert_equal 'TestCrash', info[:name]
|
64
|
-
assert_equal '3', info[:build]
|
65
|
-
assert_equal '3.0', info[:version]
|
66
|
-
|
67
|
-
assert_equal true, File.exist?(info[:icons].first)
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_ipa_info
|
71
|
-
info = FIR.ipa_info(default_ipa, true)
|
72
|
-
|
73
|
-
assert_equal 'ios', info[:type]
|
74
|
-
assert_equal 'im.fir.build-ipa', info[:identifier]
|
75
|
-
assert_equal 'build_ipa', info[:name]
|
76
|
-
assert_equal '1', info[:build]
|
77
|
-
assert_equal '1.0', info[:version]
|
78
|
-
|
79
|
-
# Only for OSX
|
80
|
-
# assert_equal nil, info[:display_name]
|
81
|
-
# assert_equal default_device_udid, info[:devices].first
|
82
|
-
# assert_equal 'adhoc', info[:release_type]
|
83
|
-
# assert_equal default_distribution_name, info[:distribution_name]
|
84
|
-
|
85
|
-
assert_equal true, info[:plist].is_a?(Hash)
|
86
|
-
assert_equal true, info[:mobileprovision].is_a?(Hash)
|
87
|
-
end
|
88
|
-
end
|