fir-cli 1.2.5 → 1.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65f2f42e7fc9ae3c427e46dfa310f8164ff68e76
4
- data.tar.gz: 7d7e364838e109822188fc66c11d2a58e6061c67
3
+ metadata.gz: 5f48c14176fce237d55a83aec0c5b3c4435218fa
4
+ data.tar.gz: 11d59615e787d455342963f7acebb1d622ec0752
5
5
  SHA512:
6
- metadata.gz: 3f764673c175d9286070bbc01999316ac8faba57d416e6f7120fb397a8a822dd07da8a9bce31226f0f7ba303d625fc0fa04f7ec1d5304e7181302cd34c5edd09
7
- data.tar.gz: 95d7454fd3c5cc4788eea5bfc7506aac3ba7271347e1f1e40715f0d9ca5fecc5f667209229d95e6ad767a76ec512eee5724c725347f7114b3c3fb228d4fe31f3
6
+ metadata.gz: 79404fa3ae49d5eeac17d98c07565f260b0d9661bca12d7de07b0688575e0b40f0cfd9bbfa07e018a4d405c07677df9bba7cd050fdfcfcf2dcecee8f0148e628
7
+ data.tar.gz: 89874e9aaa92023046bdd504150a2e6e07a5d868252410f1069d37ecc9beeae72017e47b17d3234c5c3a2d79455d70fd6f2f90373c5924ae763464ed2725298c
data/CHANGELOG CHANGED
@@ -1,5 +1,10 @@
1
1
  ## 更新记录
2
2
 
3
+ ### fir-cli 1.2.6
4
+ - 增加导出二维码功能
5
+ - 使用 `fir p <app file path> -Q`
6
+ - 或者 `fir bi(ba) <project dir> -p -Q` 即可导出当前 app 的二维码图片
7
+
3
8
  ### fir-cli 1.2.5
4
9
  - 修正解析 ipa 时候 `NoMethodError` 异常
5
10
 
data/fir-cli.gemspec CHANGED
@@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
27
27
  /_/ /___/_/ |_| \____/_____/___/
28
28
 
29
29
  ## 更新记录
30
- ### fir-cli 1.2.5
31
- - 修正 `build_apk` 无法找到 apk 的 bug
32
- - build 完毕后, ipa apk 均以 $name-$version-Build-$build 形式命名
33
- - 修正解析 ipa 时候 NoMethodError 异常
30
+ ### fir-cli 1.2.6
31
+ - 增加导出二维码功能
32
+ - 使用 `fir p <app file path> -Q`
33
+ - 或者 `fir bi(ba) <project dir> -p -Q` 即可导出当前 app 的二维码图片
34
34
  - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源
35
35
  - 欢迎 fork, issue 和 pull request
36
36
  )
@@ -44,4 +44,5 @@ Gem::Specification.new do |spec|
44
44
  spec.add_dependency 'CFPropertyList', '~> 2.3'
45
45
  spec.add_dependency 'rest-client', '~> 1.7'
46
46
  spec.add_dependency 'ruby_android', '~> 0.7'
47
+ spec.add_dependency 'rqrcode', '~> 0.7'
47
48
  end
data/lib/fir/cli.rb CHANGED
@@ -16,11 +16,11 @@ module FIR
16
16
 
17
17
  Example:
18
18
 
19
- $ fir bi <project dir> [-C <configuration>] [-t <target name>] [-o <ipa output dir>] [settings] [-c <changelog>] [-p -T <your api token>]
19
+ $ fir bi <project dir> [-C <configuration>] [-t <target name>] [-o <ipa output dir>] [settings] [-c <changelog>] [-p -Q -T <your api token>]
20
20
 
21
- $ fir bi <project dir> [-c <changelog> -P <bughd project id> -M -p -T <your api token>]
21
+ $ fir bi <project dir> [-c <changelog> -P <bughd project id> -M -p -Q -T <your api token>]
22
22
 
23
- $ fir bi <workspace dir> -w -S <scheme name> [-C <configuration>] [-t <target name>] [-o <ipa output dir>] [settings] [-c <changelog>] [-p -T <your api token>]
23
+ $ fir bi <workspace dir> -w -S <scheme name> [-C <configuration>] [-t <target name>] [-o <ipa output dir>] [settings] [-c <changelog>] [-p -Q -T <your api token>]
24
24
  LONGDESC
25
25
  map ['b', 'bi'] => :build_ipa
26
26
  method_option :workspace, type: :boolean, aliases: '-w', desc: 'true/false if build workspace'
@@ -32,6 +32,7 @@ module FIR
32
32
  method_option :publish, type: :boolean, aliases: '-p', desc: 'true/false if publish to fir.im'
33
33
  method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link if publish to fir.im'
34
34
  method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog if publish to fir.im'
35
+ method_option :qrcode, type: :boolean, aliases: '-Q', desc: 'Generate qrcode'
35
36
  method_option :mapping, type: :boolean, aliases: '-M', desc: 'true/false if upload app mapping file to BugHD.com'
36
37
  method_option :proj, type: :string, aliases: '-P', desc: 'Project id in BugHD.com if upload app mapping file'
37
38
  def build_ipa(*args)
@@ -48,13 +49,14 @@ module FIR
48
49
 
49
50
  Example:
50
51
 
51
- $ fir ba <project dir> [-o <apk output dir> -c <changelog> -p -T <your api token>]
52
+ $ fir ba <project dir> [-o <apk output dir> -c <changelog> -p -Q -T <your api token>]
52
53
  LONGDESC
53
54
  map ['ba'] => :build_apk
54
55
  method_option :output, type: :string, aliases: '-o', desc: 'APK output path, the default is: BUILD_DIR/build/outputs/apk'
55
56
  method_option :publish, type: :boolean, aliases: '-p', desc: 'true/false if publish to fir.im'
56
57
  method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link if publish to fir.im'
57
58
  method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog if publish to fir.im'
59
+ method_option :qrcode, type: :boolean, aliases: '-Q', desc: 'Generate qrcode'
58
60
  def build_apk(*args)
59
61
  prepare :build_apk
60
62
 
@@ -76,15 +78,16 @@ module FIR
76
78
 
77
79
  Example:
78
80
 
79
- $ fir p <app file path> [-c <changelog> -s <custom short link> -T <your api token>]
81
+ $ fir p <app file path> [-c <changelog> -s <custom short link> -Q -T <your api token>]
80
82
 
81
- $ fir p <app file path> [-c <changelog> -s <custom short link> -m <mapping file path> -P <bughd project id> -T <your api token>]
83
+ $ fir p <app file path> [-c <changelog> -s <custom short link> -m <mapping file path> -P <bughd project id> -Q -T <your api token>]
82
84
  LONGDESC
83
85
  map 'p' => :publish
84
- method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link'
85
- method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog'
86
- method_option :mappingfile, type: :string, aliases: '-m', desc: 'App mapping file'
87
- method_option :proj, type: :string, aliases: '-P', desc: 'Project id in BugHD.com if upload app mapping file'
86
+ method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link'
87
+ method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog'
88
+ method_option :qrcode, type: :boolean, aliases: '-Q', desc: 'Generate qrcode'
89
+ method_option :mappingfile, type: :string, aliases: '-m', desc: 'App mapping file'
90
+ method_option :proj, type: :string, aliases: '-P', desc: 'Project id in BugHD.com if upload app mapping file'
88
91
  def publish(*args)
89
92
  prepare :publish
90
93
 
@@ -4,12 +4,13 @@ module FIR
4
4
  module BuildCommon
5
5
 
6
6
  def initialize_build_common_options(args, options)
7
- @build_dir = initialize_build_dir(args)
8
- @output_path = initialize_output_path(options)
9
- @token = options[:token] || current_token
10
- @changelog = options[:changelog].to_s
11
- @short = options[:short].to_s
12
- @proj = options[:proj].to_s
7
+ @build_dir = initialize_build_dir(args)
8
+ @output_path = initialize_output_path(options)
9
+ @token = options[:token] || current_token
10
+ @changelog = options[:changelog].to_s
11
+ @short = options[:short].to_s
12
+ @proj = options[:proj].to_s
13
+ @export_qrcode = options[:qrcode]
13
14
  end
14
15
 
15
16
  def initialize_build_dir(args)
@@ -34,7 +35,8 @@ module FIR
34
35
  logger_info_blank_line
35
36
  publish @builded_app_path, short: @short,
36
37
  changelog: @changelog,
37
- token: @token
38
+ token: @token,
39
+ qrcode: @export_qrcode
38
40
  end
39
41
 
40
42
  def logger_info_and_run_build_command
@@ -17,7 +17,7 @@ module FIR
17
17
  upload_app
18
18
 
19
19
  logger_info_dividing_line
20
- logger.info "Published succeed: #{fir_api[:domain]}/#{fetch_app_info[:short]}"
20
+ logger_info_app_short_and_qrcode
21
21
 
22
22
  upload_mapping_file_with_publish(options)
23
23
  logger_info_blank_line
@@ -123,14 +123,28 @@ module FIR
123
123
  token: @token
124
124
  end
125
125
 
126
+ def logger_info_app_short_and_qrcode
127
+ short = "#{fir_api[:domain]}/#{fetch_app_info[:short]}"
128
+
129
+ logger.info "Published succeed: #{short}"
130
+
131
+ if @export_qrcode
132
+ qrcode_path = "#{File.dirname(@file_path)}/fir-#{@app_info[:name]}.png"
133
+ FIR.generate_rqrcode(short, qrcode_path)
134
+
135
+ logger.info "Local qrcode file: #{qrcode_path}"
136
+ end
137
+ end
138
+
126
139
  private
127
140
 
128
141
  def initialize_publish_options(args, options)
129
- @file_path = File.absolute_path(args.first.to_s)
130
- @file_type = File.extname(@file_path).delete('.')
131
- @token = options[:token] || current_token
132
- @changelog = options[:changelog].to_s.to_utf8
133
- @short = options[:short].to_s
142
+ @file_path = File.absolute_path(args.first.to_s)
143
+ @file_type = File.extname(@file_path).delete('.')
144
+ @token = options[:token] || current_token
145
+ @changelog = options[:changelog].to_s.to_utf8
146
+ @short = options[:short].to_s
147
+ @export_qrcode = !!options[:qrcode]
134
148
  end
135
149
 
136
150
  def check_supported_file_and_token
data/lib/fir/util.rb CHANGED
@@ -75,6 +75,12 @@ module FIR
75
75
  def logger_info_dividing_line
76
76
  logger.info '✈ -------------------------------------------- ✈'
77
77
  end
78
+
79
+ def generate_rqrcode string, png_file_path
80
+ qrcode = ::RQRCode::QRCode.new(string.to_s)
81
+ qrcode.as_png(size: 500, border_modules: 2, file: png_file_path)
82
+ png_file_path
83
+ end
78
84
  end
79
85
  end
80
86
  end
data/lib/fir/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = '1.2.5'
4
+ VERSION = '1.2.6'
5
5
  end
data/lib/fir.rb CHANGED
@@ -9,6 +9,7 @@ require 'securerandom'
9
9
  require 'fileutils'
10
10
  require 'cfpropertylist'
11
11
  require 'tempfile'
12
+ require 'rqrcode'
12
13
 
13
14
  # TODO: remove rescue when https://github.com/tajchert/ruby_apk/pull/4 merged
14
15
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fir-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaixSpirit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.7'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rqrcode
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.7'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.7'
125
139
  description: fir.im command tool, support iOS and Android
126
140
  email:
127
141
  - dev@fir.im
@@ -182,10 +196,9 @@ metadata: {}
182
196
  post_install_message: "\n ______________ ________ ____\n /
183
197
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
184
198
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
185
- \ ## 更新记录\n ### fir-cli 1.2.5\n - 修正 `build_apk` 无法找到 apk bug\n - build 完毕后,
186
- ipa apk 均以 $name-$version-Build-$build 形式命名\n - 修正解析 ipa 时候 NoMethodError 异常\n
187
- \ - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源\n - 欢迎 fork, issue 和 pull
188
- request\n "
199
+ \ ## 更新记录\n ### fir-cli 1.2.6\n - 增加导出二维码功能\n - 使用 `fir p <app file path> -Q`\n
200
+ \ - 或者 `fir bi(ba) <project dir> -p -Q` 即可导出当前 app 的二维码图片\n - [fir-cli](https://github.com/FIRHQ/fir-cli)
201
+ 已经开源\n - 欢迎 fork, issue 和 pull request\n "
189
202
  rdoc_options: []
190
203
  require_paths:
191
204
  - lib