fir-cli 0.2.3.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +13 -82
  3. data/CHANGELOG +36 -0
  4. data/Gemfile +3 -1
  5. data/LICENSE.txt +1 -1
  6. data/README.md +83 -103
  7. data/Rakefile +1 -0
  8. data/bin/fir +9 -11
  9. data/fir-cli.gemspec +47 -26
  10. data/lib/fir/api.yml +5 -0
  11. data/lib/fir/cli.rb +107 -0
  12. data/lib/fir/patches/bin/pngcrush +0 -0
  13. data/lib/fir/patches/native_patch.rb +199 -0
  14. data/lib/fir/patches/os_patch.rb +22 -0
  15. data/lib/fir/patches/parser_patch.rb +165 -0
  16. data/lib/fir/patches.rb +5 -0
  17. data/lib/fir/util/build.rb +158 -0
  18. data/lib/fir/util/info.rb +79 -0
  19. data/lib/fir/util/login.rb +17 -0
  20. data/lib/fir/util/publish.rb +103 -0
  21. data/lib/fir/util.rb +45 -0
  22. data/lib/fir/version.rb +5 -0
  23. data/lib/fir-cli.rb +3 -0
  24. data/lib/fir.rb +87 -0
  25. data/lib/fir_cli.rb +3 -0
  26. metadata +57 -109
  27. data/Gemfile.lock +0 -45
  28. data/fir-cli.rb +0 -27
  29. data/lib/fir-cli/version.rb +0 -5
  30. data/lib/fir-cli-commands/00-info.rb +0 -17
  31. data/lib/fir-cli-commands/00-login.rb +0 -30
  32. data/lib/fir-cli-commands/00-profile.rb +0 -31
  33. data/lib/fir-cli-commands/00-upgrade.rb +0 -15
  34. data/lib/fir-cli-commands/00-version.rb +0 -10
  35. data/lib/fir-cli-commands/01-config.rb +0 -17
  36. data/lib/fir-cli-commands/100-resign_codesign.rb +0 -59
  37. data/lib/fir-cli-commands/100-resign_tapbeta.rb +0 -85
  38. data/lib/fir-cli-commands/101-resign.rb +0 -26
  39. data/lib/fir-cli-commands/11-publish.rb +0 -73
  40. data/lib/fir-cli-commands/12-build_ipa.rb +0 -153
  41. data/lib/fir-cli.chk.rb +0 -33
  42. data/lib/fir-cli.core.rb +0 -96
  43. data/lib/fir-cli.fir.rb +0 -49
  44. data/lib/fir-cli.opt.rb +0 -35
  45. data/lib/fir-cli.output.rb +0 -55
  46. data/lib/fir-cli.utils.rb +0 -108
  47. data/lib/lagunitas.ext.rb +0 -56
  48. data/lib/lagunitas.patch.rb +0 -51
  49. data/lib/user_config.patch.rb +0 -10
@@ -0,0 +1,103 @@
1
+ # encoding: utf-8
2
+
3
+ module FIR
4
+ module Publish
5
+
6
+ def publish *args, options
7
+ file_path = File.absolute_path(args.first.to_s)
8
+ token = options[:token] || current_token
9
+ changelog = options[:changelog].to_s
10
+
11
+ check_supported_file file_path
12
+ check_token_cannot_be_blank token
13
+ fetch_user_info(token)
14
+
15
+ logger.info "Publishing app......."
16
+ logger_info_dividing_line
17
+
18
+ file_type = File.extname(file_path).delete('.')
19
+ app_info = send("#{file_type}_info", file_path, true)
20
+ uploading_info = fetch_uploading_info(app_info, token)
21
+
22
+ app_id = uploading_info[:id]
23
+ bundle_app = uploading_info[:bundle][:pkg]
24
+ bundle_icon = uploading_info[:bundle][:icon]
25
+
26
+ unless app_info[:icons].empty?
27
+ large_icon_path = app_info[:icons].max_by { |f| File.size(f) }
28
+ uncrushed_icon_path = convert_icon(large_icon_path)
29
+ upload_app_icon(bundle_icon, uncrushed_icon_path)
30
+ end
31
+
32
+ uploaded_info = upload_app_file(bundle_app, file_path)
33
+ version_id = uploaded_info[:versionOid]
34
+ short = options[:short].blank? ? uploading_info[:short] : options[:short]
35
+
36
+ update_app_info(app_id, name: app_info[:name],
37
+ short: short,
38
+ token: token,
39
+ source: 'fir-cli')
40
+ update_app_version_info(version_id, version: app_info[:version],
41
+ versionShort: app_info[:short_version],
42
+ devices: app_info[:devices],
43
+ release_type: app_info[:release_type],
44
+ changelog: changelog,
45
+ token: token)
46
+ published_app_info = fetch_app_info(app_id, token)
47
+
48
+ logger_info_dividing_line
49
+ logger.info "Published succeed: #{api[:base_url]}/#{published_app_info[:short]}"
50
+ end
51
+
52
+ private
53
+
54
+ def convert_icon origin_path
55
+ logger.info "Converting app's icon......"
56
+ output_path = Tempfile.new('uncrushed_icon.png').path
57
+ Parser.uncrush_icon(origin_path, output_path)
58
+ File.size(output_path) == 0 ? origin_path : output_path
59
+ end
60
+
61
+ def upload_app_icon bundle_icon, icon_path
62
+ logger.info "Uploading app's icon......"
63
+ hash = {
64
+ key: bundle_icon[:key],
65
+ token: bundle_icon[:token],
66
+ file: File.new(icon_path, 'rb')
67
+ }
68
+ post bundle_icon[:url], hash, 'multipart/form-data'
69
+ end
70
+
71
+ def upload_app_file bundle_app, file_path
72
+ logger.info "Uploading app......"
73
+ hash = {
74
+ key: bundle_app[:key],
75
+ token: bundle_app[:token],
76
+ file: File.new(file_path, 'rb')
77
+ }
78
+ post bundle_app[:url], hash, 'multipart/form-data'
79
+ end
80
+
81
+ def update_app_info id, hash
82
+ logger.info "Updating app info......"
83
+ put api[:app_url] + "/#{id}?#{URI.encode_www_form hash}", hash
84
+ end
85
+
86
+ def update_app_version_info id, hash
87
+ logger.info "Updating app's version info......"
88
+ put api[:version_url] + "/#{id}/complete?#{URI.encode_www_form hash}", hash
89
+ put api[:version_url] + "/#{id}?#{URI.encode_www_form hash}", hash
90
+ end
91
+
92
+ def fetch_uploading_info app_info, token
93
+ logger.info "Fetching #{app_info[:identifier]}@FIR.im uploading info......"
94
+ get api[:uploading_info_url] + "/#{app_info[:identifier]}", type: app_info[:type],
95
+ token: token
96
+ end
97
+
98
+ def fetch_app_info id, token
99
+ logger.info "Fetch app info from FIR.im"
100
+ get api[:app_url] + "/#{id}", token: token
101
+ end
102
+ end
103
+ end
data/lib/fir/util.rb ADDED
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative './util/login'
4
+ require_relative './util/info'
5
+ require_relative './util/build'
6
+ require_relative './util/publish'
7
+
8
+ module FIR
9
+ module Util
10
+
11
+ def self.included base
12
+ base.extend ClassMethods
13
+ base.extend Login
14
+ base.extend Info
15
+ base.extend Build
16
+ base.extend Publish
17
+ end
18
+
19
+ module ClassMethods
20
+
21
+ def fetch_user_info token
22
+ get api[:me_url], token: token
23
+ end
24
+
25
+ def check_supported_file path
26
+ unless File.file?(path) || APP_FILE_TYPE.include?(File.extname(path))
27
+ logger.error "File does not exist or unsupported file type"
28
+ exit 1
29
+ end
30
+ end
31
+
32
+ def check_token_cannot_be_blank token
33
+ if token.blank?
34
+ logger.error "Token can't be blank"
35
+ exit 1
36
+ end
37
+ end
38
+
39
+ def logger_info_dividing_line
40
+ logger.info "✈ -------------------------------------------- ✈"
41
+ end
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ module FIR
4
+ VERSION = "1.0.0"
5
+ end
data/lib/fir-cli.rb ADDED
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+ # This file exists for backward compatbility with require 'fir-cli'
3
+ require_relative './fir'
data/lib/fir.rb ADDED
@@ -0,0 +1,87 @@
1
+ # encoding: utf-8
2
+
3
+ require 'thor'
4
+ require 'logger'
5
+ require 'yaml'
6
+ require 'rest-client'
7
+ require 'json'
8
+ require 'securerandom'
9
+ require 'fileutils'
10
+ require 'cfpropertylist'
11
+ require 'tempfile'
12
+
13
+ # TODO: remove rescue when https://github.com/tajchert/ruby_apk/pull/4 merged
14
+ begin
15
+ require 'ruby_android'
16
+ rescue LoadError
17
+ require 'ruby_apk'
18
+ end
19
+
20
+ require 'fir/patches'
21
+ require 'fir/util'
22
+ require 'fir/version'
23
+ require 'fir/cli'
24
+
25
+ module FIR
26
+ CONFIG_PATH = "#{ENV['HOME']}/.fir-cli"
27
+ API_YML_PATH = "#{File.dirname(__FILE__)}/fir/api.yml"
28
+ APP_FILE_TYPE = %w(.ipa .apk).freeze
29
+
30
+ include Util
31
+
32
+ class << self
33
+ attr_accessor :logger, :api, :config
34
+
35
+ def api
36
+ @api ||= YAML.load_file(API_YML_PATH).symbolize_keys
37
+ end
38
+
39
+ def config
40
+ @config ||= YAML.load_file(CONFIG_PATH).symbolize_keys if File.exist?(CONFIG_PATH)
41
+ end
42
+
43
+ def reload_config
44
+ @config = YAML.load_file(CONFIG_PATH).symbolize_keys
45
+ end
46
+
47
+ def write_config hash
48
+ File.open(CONFIG_PATH, 'w+') { |f| f << YAML.dump(hash) }
49
+ end
50
+
51
+ def current_token
52
+ @token ||= config[:token] if config
53
+ end
54
+
55
+ def get url, params = {}
56
+ begin
57
+ res = RestClient.get(url, params: params)
58
+ rescue RestClient::Exception => e
59
+ logger.error e.response
60
+ exit 1
61
+ end
62
+ JSON.parse(res.body, symbolize_names: true)
63
+ end
64
+
65
+ def post url, query, content_type = :json
66
+ begin
67
+ res = RestClient.post(url, query, { content_type: content_type })
68
+ rescue RestClient::Exception => e
69
+ logger.error e.response
70
+ exit 1
71
+ end
72
+ JSON.parse(res.body, symbolize_names: true)
73
+ end
74
+
75
+ def put url, query, content_type = :json
76
+ begin
77
+ res = RestClient.put(url, query, { content_type: content_type })
78
+ rescue RestClient::Exception => e
79
+ logger.error e.response
80
+ exit 1
81
+ end
82
+ JSON.parse(res.body, symbolize_names: true)
83
+ end
84
+
85
+ alias_method :☠, :exit
86
+ end
87
+ end
data/lib/fir_cli.rb ADDED
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+ # This file exists for backward compatbility with require 'fir_cli'
3
+ require_relative './fir'
metadata CHANGED
@@ -1,65 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fir-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - FIR.im
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: lagunitas
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 0.0.1
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 0.0.1
27
- - !ruby/object:Gem::Dependency
28
- name: user_config
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 0.0.4
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 0.0.4
41
- - !ruby/object:Gem::Dependency
42
- name: pngdefry
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 0.1.1
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 0.1.1
55
- - !ruby/object:Gem::Dependency
56
- name: rest-client
14
+ name: bundler
57
15
  requirement: !ruby/object:Gem::Requirement
58
16
  requirements:
59
17
  - - "~>"
60
18
  - !ruby/object:Gem::Version
61
19
  version: '1.7'
62
- type: :runtime
20
+ type: :development
63
21
  prerelease: false
64
22
  version_requirements: !ruby/object:Gem::Requirement
65
23
  requirements:
@@ -67,83 +25,69 @@ dependencies:
67
25
  - !ruby/object:Gem::Version
68
26
  version: '1.7'
69
27
  - !ruby/object:Gem::Dependency
70
- name: paint
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.9'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.9'
83
- - !ruby/object:Gem::Dependency
84
- name: thor
28
+ name: rake
85
29
  requirement: !ruby/object:Gem::Requirement
86
30
  requirements:
87
31
  - - "~>"
88
32
  - !ruby/object:Gem::Version
89
- version: '0.19'
90
- type: :runtime
33
+ version: '10.0'
34
+ type: :development
91
35
  prerelease: false
92
36
  version_requirements: !ruby/object:Gem::Requirement
93
37
  requirements:
94
38
  - - "~>"
95
39
  - !ruby/object:Gem::Version
96
- version: '0.19'
40
+ version: '10.0'
97
41
  - !ruby/object:Gem::Dependency
98
- name: ruby_apk
42
+ name: pry
99
43
  requirement: !ruby/object:Gem::Requirement
100
44
  requirements:
101
45
  - - "~>"
102
46
  - !ruby/object:Gem::Version
103
- version: '0.7'
104
- type: :runtime
47
+ version: '0.11'
48
+ type: :development
105
49
  prerelease: false
106
50
  version_requirements: !ruby/object:Gem::Requirement
107
51
  requirements:
108
52
  - - "~>"
109
53
  - !ruby/object:Gem::Version
110
- version: '0.7'
54
+ version: '0.11'
111
55
  - !ruby/object:Gem::Dependency
112
- name: highline
56
+ name: thor
113
57
  requirement: !ruby/object:Gem::Requirement
114
58
  requirements:
115
59
  - - "~>"
116
60
  - !ruby/object:Gem::Version
117
- version: '1.6'
61
+ version: '0.19'
118
62
  type: :runtime
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
65
  requirements:
122
66
  - - "~>"
123
67
  - !ruby/object:Gem::Version
124
- version: '1.6'
68
+ version: '0.19'
125
69
  - !ruby/object:Gem::Dependency
126
- name: rubyzip
70
+ name: CFPropertyList
127
71
  requirement: !ruby/object:Gem::Requirement
128
72
  requirements:
129
73
  - - "~>"
130
74
  - !ruby/object:Gem::Version
131
- version: 0.9.9
75
+ version: '2.3'
132
76
  type: :runtime
133
77
  prerelease: false
134
78
  version_requirements: !ruby/object:Gem::Requirement
135
79
  requirements:
136
80
  - - "~>"
137
81
  - !ruby/object:Gem::Version
138
- version: 0.9.9
82
+ version: '2.3'
139
83
  - !ruby/object:Gem::Dependency
140
- name: bundler
84
+ name: rest-client
141
85
  requirement: !ruby/object:Gem::Requirement
142
86
  requirements:
143
87
  - - "~>"
144
88
  - !ruby/object:Gem::Version
145
89
  version: '1.7'
146
- type: :development
90
+ type: :runtime
147
91
  prerelease: false
148
92
  version_requirements: !ruby/object:Gem::Requirement
149
93
  requirements:
@@ -151,64 +95,67 @@ dependencies:
151
95
  - !ruby/object:Gem::Version
152
96
  version: '1.7'
153
97
  - !ruby/object:Gem::Dependency
154
- name: rake
98
+ name: ruby_android
155
99
  requirement: !ruby/object:Gem::Requirement
156
100
  requirements:
157
101
  - - "~>"
158
102
  - !ruby/object:Gem::Version
159
- version: '10.0'
160
- type: :development
103
+ version: '0.7'
104
+ type: :runtime
161
105
  prerelease: false
162
106
  version_requirements: !ruby/object:Gem::Requirement
163
107
  requirements:
164
108
  - - "~>"
165
109
  - !ruby/object:Gem::Version
166
- version: '10.0'
167
- description: FIR.im 命令行工具,支持 ios android
168
- email: fir-cli@fir.im
110
+ version: '0.7'
111
+ description: FIR.im command tool, support iOS and Android
112
+ email:
113
+ - dev@fir.im
169
114
  executables:
170
115
  - fir
171
116
  extensions: []
172
117
  extra_rdoc_files: []
173
118
  files:
174
119
  - ".gitignore"
120
+ - CHANGELOG
175
121
  - Gemfile
176
- - Gemfile.lock
177
122
  - LICENSE.txt
178
123
  - README.md
124
+ - Rakefile
179
125
  - bin/fir
180
126
  - fir-cli.gemspec
181
- - fir-cli.rb
182
- - lib/fir-cli-commands/00-info.rb
183
- - lib/fir-cli-commands/00-login.rb
184
- - lib/fir-cli-commands/00-profile.rb
185
- - lib/fir-cli-commands/00-upgrade.rb
186
- - lib/fir-cli-commands/00-version.rb
187
- - lib/fir-cli-commands/01-config.rb
188
- - lib/fir-cli-commands/100-resign_codesign.rb
189
- - lib/fir-cli-commands/100-resign_tapbeta.rb
190
- - lib/fir-cli-commands/101-resign.rb
191
- - lib/fir-cli-commands/11-publish.rb
192
- - lib/fir-cli-commands/12-build_ipa.rb
193
- - lib/fir-cli.chk.rb
194
- - lib/fir-cli.core.rb
195
- - lib/fir-cli.fir.rb
196
- - lib/fir-cli.opt.rb
197
- - lib/fir-cli.output.rb
198
- - lib/fir-cli.utils.rb
199
- - lib/fir-cli/version.rb
200
- - lib/lagunitas.ext.rb
201
- - lib/lagunitas.patch.rb
202
- - lib/user_config.patch.rb
203
- homepage: http://blog.fir.im/2014/fir-cli
127
+ - lib/fir-cli.rb
128
+ - lib/fir.rb
129
+ - lib/fir/api.yml
130
+ - lib/fir/cli.rb
131
+ - lib/fir/patches.rb
132
+ - lib/fir/patches/bin/pngcrush
133
+ - lib/fir/patches/native_patch.rb
134
+ - lib/fir/patches/os_patch.rb
135
+ - lib/fir/patches/parser_patch.rb
136
+ - lib/fir/util.rb
137
+ - lib/fir/util/build.rb
138
+ - lib/fir/util/info.rb
139
+ - lib/fir/util/login.rb
140
+ - lib/fir/util/publish.rb
141
+ - lib/fir/version.rb
142
+ - lib/fir_cli.rb
143
+ homepage: http://blog.fir.im/2014/fir_cli
204
144
  licenses:
205
145
  - GPLv3
206
146
  metadata: {}
207
- post_install_message:
147
+ post_install_message: "\n ______________ ________ ____\n /
148
+ ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
149
+ /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
150
+ \ ## 更新记录\n ### FIR-CLI 1.0.0\n - 重大重构\n - 优化启动及运行速度\n - 增加各指令的 alias\n - 增加全局参数,
151
+ -T, -L, -V, -q, -h, 分别为 token, log, verbose, quite, help 参数\n - 增加输入 log\n - 修正部分系统安装失败问题\n
152
+ \ - 修正部分服务器安装出现编码失败问题\n - 重写 ipa 解析器, 去除 `miniz.c`, 增加 pngcrash\n - build_ipa
153
+ 增加默认 build 路径, `fir b` 则默认 build 当前路径\n - build_ipa 增加输出 dSYM 符号表文件\n - build_ipa
154
+ 增加输出 xcodebuild 的信息\n - 去掉输出信息颜色, 方便查看 log\n - 简化 --verbose 参数, 简化为 `--verbose
155
+ --no-verbose`, 默认输出为 INFO\n "
208
156
  rdoc_options: []
209
157
  require_paths:
210
158
  - lib
211
- - "./"
212
159
  required_ruby_version: !ruby/object:Gem::Requirement
213
160
  requirements:
214
161
  - - ">="
@@ -224,5 +171,6 @@ rubyforge_project:
224
171
  rubygems_version: 2.4.2
225
172
  signing_key:
226
173
  specification_version: 4
227
- summary: FIR.im 命令行工具
174
+ summary: FIR.im command tool
228
175
  test_files: []
176
+ has_rdoc:
data/Gemfile.lock DELETED
@@ -1,45 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- fir-cli (0.2.1.1)
5
- highline (~> 1.6)
6
- lagunitas (= 0.0.1)
7
- paint (~> 0.9)
8
- pngdefry (= 0.1.1)
9
- rest-client (~> 1.7)
10
- ruby_apk (~> 0.7)
11
- rubyzip (~> 0.9.9)
12
- thor (~> 0.19)
13
- user_config (= 0.0.4)
14
-
15
- GEM
16
- remote: https://ruby.taobao.org/
17
- specs:
18
- CFPropertyList (2.3.0)
19
- highline (1.6.21)
20
- lagunitas (0.0.1)
21
- CFPropertyList
22
- pngdefry (>= 0.1.0)
23
- zip
24
- mime-types (2.4.3)
25
- netrc (0.10.2)
26
- paint (0.9.0)
27
- pngdefry (0.1.1)
28
- rake (10.4.2)
29
- rest-client (1.7.2)
30
- mime-types (>= 1.16, < 3.0)
31
- netrc (~> 0.7)
32
- ruby_apk (0.7.1)
33
- rubyzip (< 1.0.0)
34
- rubyzip (0.9.9)
35
- thor (0.19.1)
36
- user_config (0.0.4)
37
- zip (2.0.2)
38
-
39
- PLATFORMS
40
- ruby
41
-
42
- DEPENDENCIES
43
- bundler (~> 1.7)
44
- fir-cli!
45
- rake (~> 10.0)
data/fir-cli.rb DELETED
@@ -1,27 +0,0 @@
1
- require 'rubygems'
2
- require 'uri'
3
- require 'json'
4
- require 'pathname'
5
- require 'tempfile'
6
- require 'securerandom'
7
-
8
- require 'thor'
9
- require 'paint'
10
- require 'pngdefry'
11
- require 'user_config'
12
- require 'rest_client'
13
- require 'lagunitas'
14
- require 'ruby_apk'
15
- require 'highline/import'
16
-
17
- require 'zip'
18
- require 'zip/zip'
19
-
20
-
21
- module Fir
22
- class Cli < Thor; end
23
- end
24
-
25
- Dir[File.dirname(__FILE__) + '/lib/fir-cli/*.rb'].each { |f| require f }
26
- Dir[File.dirname(__FILE__) + '/lib/*.rb'].each { |f| require f }
27
- Dir[File.dirname(__FILE__) + '/lib/fir-cli-commands/*.rb'].each { |f| require f }
@@ -1,5 +0,0 @@
1
- module Fir
2
- class Cli
3
- VERSION = '0.2.3.1'
4
- end
5
- end
@@ -1,17 +0,0 @@
1
- # coding: utf-8
2
- module Fir
3
- class Cli
4
- desc 'info APP_FILE_PATH', '获取应用文件的信息(支持 ipa 文件和 apk 文件)'
5
- option :all, :aliases => '-a', :desc => '显示全部应用信息', :type => :boolean
6
- option :fir, :aliases => '-f', :desc => '显示托管在 fir.im 的应用信息', :type => :boolean
7
- output_options
8
- def info(path)
9
- app = _info path, options[:all]
10
- app.each { |i| _puts "#{Paint[i[0].to_s.rjust(18), :blue]} #{i[1]}" }
11
- if options[:fir]
12
- fir_app = _fir_info app[:identifier], app[:type]
13
- fir_app.each { |i| _puts "#{Paint[i[0].to_s.rjust(18), :blue]} #{i[1]}" }
14
- end
15
- end
16
- end
17
- end
@@ -1,30 +0,0 @@
1
- # coding: utf-8
2
- module Fir
3
- class Cli
4
- desc 'login', '登录'
5
- output_options
6
- def login
7
- token = _prompt_secret('输入你的用户 token:')
8
- if token.empty?
9
- _puts_require_token
10
- _exit
11
- end
12
- user = _user token
13
- if !user
14
- _puts_invalid_token
15
- _exit
16
- end
17
- if _opt_token && _opt_token != token
18
- _puts "> 已登陆用户: #{_opt_token}"
19
- _puts "> 替换为用户: #{token}"
20
- end
21
- if user[:email]
22
- _puts "> 设置用户邮件地址为: #{user[:email]}"
23
- @config['email'] = user[:email]
24
- end
25
- @config['token'] = token
26
- @config.save
27
- _puts "> 当前登陆用户为:#{token}"
28
- end
29
- end
30
- end
@@ -1,31 +0,0 @@
1
- # coding: utf-8
2
- module Fir
3
- class Cli
4
- desc 'profile', '切换配置文件'
5
- option :delete, :aliases => '-d', :desc => '删除指定的配置文件', :type => :boolean
6
- output_options
7
- def profile(prof)
8
- if prof == 'global'
9
- _puts '! 不能使用 global 作为配置文件名'
10
- _exit
11
- end
12
- prof = "#{prof}.yaml"
13
- if options[:delete]
14
- _puts "> 正在删除配置文件:#{prof}"
15
- @uconfig.delete prof
16
- else
17
- if _profile == prof
18
- _puts "! #{Paint["你正在使用该配置:#{prof}", :red]}"
19
- _exit
20
- end
21
- _puts "> 正在使用配置文件:#{_profile}"
22
- _puts "> 即将替换为:#{prof}"
23
- @global_config['profile'] = prof
24
- @global_config.save
25
- _load_config
26
- _puts "> 已替换为:#{prof}"
27
- config
28
- end
29
- end
30
- end
31
- end