omt-cli 1.6.3 → 1.6.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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +8 -0
  3. data/.gitignore +24 -0
  4. data/.travis.yml +31 -0
  5. data/CHANGELOG +188 -0
  6. data/Gemfile +11 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +35 -0
  9. data/Rakefile +10 -0
  10. data/bin/console +11 -0
  11. data/bin/fir +14 -0
  12. data/bin/setup +7 -0
  13. data/doc/build_apk.md +42 -0
  14. data/doc/build_ipa.md +66 -0
  15. data/doc/help.md +34 -0
  16. data/doc/info.md +44 -0
  17. data/doc/install.md +65 -0
  18. data/doc/login.md +19 -0
  19. data/doc/mapping.md +22 -0
  20. data/doc/publish.md +35 -0
  21. data/doc/upgrade.md +7 -0
  22. data/lib/fir.rb +28 -0
  23. data/lib/fir/api.yml +13 -0
  24. data/lib/fir/api.yml.bak +13 -0
  25. data/lib/fir/cli.rb +195 -0
  26. data/lib/fir/patches.rb +10 -0
  27. data/lib/fir/patches/blank.rb +131 -0
  28. data/lib/fir/patches/concern.rb +146 -0
  29. data/lib/fir/patches/default_headers.rb +9 -0
  30. data/lib/fir/patches/hash.rb +79 -0
  31. data/lib/fir/patches/instance_variables.rb +30 -0
  32. data/lib/fir/patches/native_patch.rb +28 -0
  33. data/lib/fir/patches/os_patch.rb +28 -0
  34. data/lib/fir/patches/try.rb +102 -0
  35. data/lib/fir/util.rb +87 -0
  36. data/lib/fir/util/build_apk.rb +76 -0
  37. data/lib/fir/util/build_common.rb +93 -0
  38. data/lib/fir/util/build_ipa.rb +240 -0
  39. data/lib/fir/util/config.rb +42 -0
  40. data/lib/fir/util/http.rb +30 -0
  41. data/lib/fir/util/info.rb +39 -0
  42. data/lib/fir/util/login.rb +18 -0
  43. data/lib/fir/util/mapping.rb +98 -0
  44. data/lib/fir/util/me.rb +19 -0
  45. data/lib/fir/util/parser/apk.rb +43 -0
  46. data/lib/fir/util/parser/bin/pngcrush +0 -0
  47. data/lib/fir/util/parser/common.rb +24 -0
  48. data/lib/fir/util/parser/ipa.rb +188 -0
  49. data/lib/fir/util/parser/pngcrush.rb +23 -0
  50. data/lib/fir/util/publish.rb +106 -0
  51. data/lib/fir/util/publish.rb.bak +185 -0
  52. data/lib/fir/version.rb +5 -0
  53. data/lib/fir/xcode_wrapper.sh +29 -0
  54. data/lib/omt-cli.rb +3 -0
  55. data/lib/omt_cli.rb +3 -0
  56. data/omt-cli.gemspec +48 -0
  57. data/test/build_ipa_test.rb +17 -0
  58. data/test/cases/test_apk.apk +0 -0
  59. data/test/cases/test_apk_txt +1 -0
  60. data/test/cases/test_ipa.ipa +0 -0
  61. data/test/cases/test_ipa_dsym +0 -0
  62. data/test/info_test.rb +36 -0
  63. data/test/login_test.rb +12 -0
  64. data/test/mapping_test.rb +18 -0
  65. data/test/me_test.rb +17 -0
  66. data/test/publish_test.rb +44 -0
  67. data/test/test_helper.rb +98 -0
  68. metadata +84 -4
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ class LoginTest < Minitest::Test
4
+
5
+ def test_login
6
+ user_info = FIR.fetch_user_info(default_token)
7
+
8
+ assert_equal default_email, user_info.fetch(:email, '')
9
+
10
+ assert FIR.login(default_token)
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+
3
+ class MappingTest < Minitest::Test
4
+
5
+ def test_mapping
6
+ options = {
7
+ token: default_token,
8
+ version: '1.1',
9
+ build: '1'
10
+ }
11
+
12
+ if ENV['MAPPING_TEST']
13
+ assert FIR.mapping(default_dsym_mapping, options.merge(proj: default_bughd_project_ios_id))
14
+ assert FIR.mapping(default_txt_mapping, options.merge(proj: default_bughd_project_android_id))
15
+ assert FIR.mapping(bigger_txt_mapping, options.merge(proj: default_bughd_project_android_id))
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ class MeTest < Minitest::Test
4
+
5
+ def test_me
6
+ user_info = FIR.fetch_user_info(default_token)
7
+
8
+ FIR.write_config(email: user_info.fetch(:email, ''), token: default_token)
9
+ FIR.reload_config
10
+
11
+ me_info = FIR.fetch_user_info(FIR.current_token)
12
+
13
+ assert_equal default_email, me_info.fetch(:email, '')
14
+
15
+ assert FIR.me
16
+ end
17
+ end
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ class PublishTest < Minitest::Test
4
+
5
+ def setup
6
+ @options = {
7
+ token: default_token,
8
+ changelog: "test from fir-cli #{Time.now.to_i}"
9
+ }
10
+ end
11
+
12
+ def test_simple_publish
13
+ assert FIR.publish(default_ipa, @options)
14
+ assert FIR.publish(default_apk, @options)
15
+ end
16
+
17
+ def test_update_app_info
18
+ short = SecureRandom.hex[3..9]
19
+ is_opened = (rand(100) % 2) == 0
20
+
21
+ update_info = { short: short, open: is_opened }
22
+ FIR.publish(default_ipa, @options.merge(update_info))
23
+
24
+ info = FIR.fetch_app_info
25
+
26
+ assert_equal short, info[:short]
27
+ assert_equal is_opened, info[:is_opened]
28
+ end
29
+
30
+ def test_update_app_passwd
31
+ short = SecureRandom.hex[3..9]
32
+ is_opened = (rand(100) % 2) == 0
33
+ passwd = SecureRandom.hex[0..9]
34
+
35
+ update_info = { short: short, password: passwd, open: is_opened }
36
+ FIR.publish(default_ipa, @options.merge(update_info))
37
+
38
+ info = FIR.fetch_app_info
39
+
40
+ assert_equal short, info[:short]
41
+ assert_equal passwd, info[:passwd]
42
+ assert_equal false, info[:is_opened]
43
+ end
44
+ end
@@ -0,0 +1,98 @@
1
+ # encoding: utf-8
2
+
3
+ # CodeClimate::TestReporter.start
4
+ require 'codeclimate-test-reporter'
5
+ require 'simplecov'
6
+ SimpleCov.start
7
+
8
+
9
+ require 'minitest/autorun'
10
+ require 'ostruct'
11
+ require 'securerandom'
12
+ require 'fir'
13
+
14
+ FIR.logger = Logger.new(STDOUT)
15
+
16
+ class Minitest::Test
17
+
18
+ def default_token
19
+ '2dd8a99ef9d19c540bb583624b939960'
20
+ end
21
+
22
+ def default_email
23
+ 'fir-cli_test@fir.im'
24
+ end
25
+
26
+ def default_apk
27
+ File.expand_path('../cases', __FILE__) + '/test_apk.apk'
28
+ end
29
+
30
+ def default_ipa
31
+ File.expand_path('../cases', __FILE__) + '/test_ipa.ipa'
32
+ end
33
+
34
+ def default_ipa_project
35
+ File.expand_path('../projects', __FILE__) + '/ipa'
36
+ end
37
+
38
+ def default_apk_project
39
+ File.expand_path('../projects', __FILE__) + '/apk'
40
+ end
41
+
42
+ def default_ipa_git_url
43
+ 'git@github.com:NaixSpirit/build_ipa_example.git'
44
+ end
45
+
46
+ def default_apk_git_url
47
+ 'git@github.com:NaixSpirit/build_apk_example.git'
48
+ end
49
+
50
+ def default_bughd_project_ios_id
51
+ '55bb2839692d647a46000004'
52
+ end
53
+
54
+ def default_bughd_project_android_id
55
+ '55be454a692d351278000002'
56
+ end
57
+
58
+ def default_dsym_mapping
59
+ File.expand_path('../cases', __FILE__) + '/test_ipa_dsym'
60
+ end
61
+
62
+ def default_txt_mapping
63
+ File.expand_path('../cases', __FILE__) + '/test_apk_txt'
64
+ end
65
+
66
+ def bigger_txt_mapping
67
+ File.expand_path('../projects', __FILE__) + '/biggggger.txt'
68
+ end
69
+
70
+ def default_device_udid
71
+ 'cf8b87e3f469d7b185fd64c057778aecbc2017a6'
72
+ end
73
+
74
+ def default_distribution_name
75
+ 'iOSTeam Provisioning Profile: im.fir.* - Fly It Remotely LLC.'
76
+ end
77
+
78
+ end
79
+
80
+
81
+ # 跑完测试之后再发结果到Codelimate
82
+ # 测试CODECLIMATE_REPO_TOKEN: c454b9a54151b3ed3e18949279aec49d6a25bf507706815f99a919f1c01679ed
83
+ Minitest.after_run do
84
+ COVERAGE_FILE = "coverage/.resultset.json".freeze
85
+ if (repo_token = ENV["CODECLIMATE_REPO_TOKEN"]) && !repo_token.empty?
86
+ if File.exist?(COVERAGE_FILE)
87
+ begin
88
+ results = JSON.parse(File.read(COVERAGE_FILE))
89
+ rescue JSON::ParserError => e
90
+ $stderr.puts "Error encountered while parsing #{COVERAGE_FILE}: #{e}"
91
+ end
92
+
93
+ CodeClimate::TestReporter.run(results)
94
+ else
95
+ $stderr.puts "Coverage results not found"
96
+ end
97
+ end
98
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omt-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaixSpirit
@@ -153,10 +153,79 @@ dependencies:
153
153
  description: fir.im command tool, support iOS and Android
154
154
  email:
155
155
  - neverlandxy.naix@gmail.com
156
- executables: []
156
+ executables:
157
+ - console
158
+ - fir
159
+ - setup
157
160
  extensions: []
158
161
  extra_rdoc_files: []
159
- files: []
162
+ files:
163
+ - ".codeclimate.yml"
164
+ - ".gitignore"
165
+ - ".travis.yml"
166
+ - CHANGELOG
167
+ - Gemfile
168
+ - LICENSE.txt
169
+ - README.md
170
+ - Rakefile
171
+ - bin/console
172
+ - bin/fir
173
+ - bin/setup
174
+ - doc/build_apk.md
175
+ - doc/build_ipa.md
176
+ - doc/help.md
177
+ - doc/info.md
178
+ - doc/install.md
179
+ - doc/login.md
180
+ - doc/mapping.md
181
+ - doc/publish.md
182
+ - doc/upgrade.md
183
+ - lib/fir.rb
184
+ - lib/fir/api.yml
185
+ - lib/fir/api.yml.bak
186
+ - lib/fir/cli.rb
187
+ - lib/fir/patches.rb
188
+ - lib/fir/patches/blank.rb
189
+ - lib/fir/patches/concern.rb
190
+ - lib/fir/patches/default_headers.rb
191
+ - lib/fir/patches/hash.rb
192
+ - lib/fir/patches/instance_variables.rb
193
+ - lib/fir/patches/native_patch.rb
194
+ - lib/fir/patches/os_patch.rb
195
+ - lib/fir/patches/try.rb
196
+ - lib/fir/util.rb
197
+ - lib/fir/util/build_apk.rb
198
+ - lib/fir/util/build_common.rb
199
+ - lib/fir/util/build_ipa.rb
200
+ - lib/fir/util/config.rb
201
+ - lib/fir/util/http.rb
202
+ - lib/fir/util/info.rb
203
+ - lib/fir/util/login.rb
204
+ - lib/fir/util/mapping.rb
205
+ - lib/fir/util/me.rb
206
+ - lib/fir/util/parser/apk.rb
207
+ - lib/fir/util/parser/bin/pngcrush
208
+ - lib/fir/util/parser/common.rb
209
+ - lib/fir/util/parser/ipa.rb
210
+ - lib/fir/util/parser/pngcrush.rb
211
+ - lib/fir/util/publish.rb
212
+ - lib/fir/util/publish.rb.bak
213
+ - lib/fir/version.rb
214
+ - lib/fir/xcode_wrapper.sh
215
+ - lib/omt-cli.rb
216
+ - lib/omt_cli.rb
217
+ - omt-cli.gemspec
218
+ - test/build_ipa_test.rb
219
+ - test/cases/test_apk.apk
220
+ - test/cases/test_apk_txt
221
+ - test/cases/test_ipa.ipa
222
+ - test/cases/test_ipa_dsym
223
+ - test/info_test.rb
224
+ - test/login_test.rb
225
+ - test/mapping_test.rb
226
+ - test/me_test.rb
227
+ - test/publish_test.rb
228
+ - test/test_helper.rb
160
229
  homepage: https://github.com/FIRHQ/fir-cli
161
230
  licenses:
162
231
  - MIT
@@ -186,4 +255,15 @@ rubygems_version: 2.6.13
186
255
  signing_key:
187
256
  specification_version: 4
188
257
  summary: fir.im command tool
189
- test_files: []
258
+ test_files:
259
+ - test/build_ipa_test.rb
260
+ - test/cases/test_apk.apk
261
+ - test/cases/test_apk_txt
262
+ - test/cases/test_ipa.ipa
263
+ - test/cases/test_ipa_dsym
264
+ - test/info_test.rb
265
+ - test/login_test.rb
266
+ - test/mapping_test.rb
267
+ - test/me_test.rb
268
+ - test/publish_test.rb
269
+ - test/test_helper.rb