fir-cli 1.1.7 → 1.1.8

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: 246352dde6de24af1e32a1e0128bcb520526537f
4
- data.tar.gz: 5321f7bfdf10cb2863cdeefd6bc01c898e7e9b7d
3
+ metadata.gz: 0c92eba76896df79468053134c355bdfbb0d2031
4
+ data.tar.gz: 38284b8643672070bc2078f6f05800b97c6c10bb
5
5
  SHA512:
6
- metadata.gz: 9f94e52edcbd93b3f2f9e75368722bc40ff64f54a3b07bf1bf9040e721cd2ec98beedbaa1fc959b60b63eef76126b3482509e3b9d2d2b5d2a95154a2bc5c984a
7
- data.tar.gz: 8a4e0a531bdb8a1e32a4724838479f7cf613198d1cb86e24826cb2a16b02125f04080bf7f5950f87706ef0eb80579fb4a503bc3d01c464c5b25a7468a184cf46
6
+ metadata.gz: 7541e7985bc256321aa403f2969bdaaa2c7623542ab22b87b5bcfc0774efefbc31ac903b9165cef26aaf5a79dc70b514677865885047061630893e1aa31bfeaa
7
+ data.tar.gz: f10503990d06c2d513e268284ce376c52ff8c12e67f43f9eed3967ee16dc6721512b4ac3d2ac4432046f5c670f6d225452d283c812af500a3e2e9ab2edd52f0d
data/.gitignore CHANGED
@@ -8,7 +8,7 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /fir-cli_tmp/
11
- /test/build_project/
11
+ /test/projects
12
12
  *.bundle
13
13
  *.so
14
14
  *.o
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  ## 更新记录
2
2
 
3
+ ### FIR-CLI 1.1.8
4
+ - 支持 gradle 打包 apk 文件并自动上传至 fir.im, `fir build_apk(alias ba)`
5
+ - `fir ba <project dir> [-o <apk output dir> -c <changelog> -p -T <your api token>]`
6
+
3
7
  ### FIR-CLI 1.1.7
4
8
  - 增加符号表上传指令, `fir mapping(alias m)`
5
9
  - 有一下三种方式上传符号表(目前已经支持 dSYM 和 txt 两种格式的符号表文件上传)
data/README.md CHANGED
@@ -115,7 +115,7 @@ $ fir build_ipa path/to/project -o path/to/output
115
115
  ### 复杂一点
116
116
 
117
117
  ```shell
118
- $ fir b path/to/workspace -o path/to/output -w -C Release -t allTargets GCC_PREPROCESSOR_DEFINITIONS="FOO=bar"
118
+ $ fir bi path/to/workspace -o path/to/output -w -C Release -t allTargets GCC_PREPROCESSOR_DEFINITIONS="FOO=bar"
119
119
  ```
120
120
 
121
121
  该指令在指向的目录中,找到第一个 workspace 文件,对其进行编译。使用 `Release` 设置,编译策略为 `allTargets`,同时设置了预编译参数 `FOO`。
@@ -123,8 +123,15 @@ $ fir b path/to/workspace -o path/to/output -w -C Release -t allTargets GCC_PREP
123
123
  ### 编译用 CocoaPods 做依赖管理的 .ipa包
124
124
 
125
125
  ```shell
126
- $ fir b path/to/workspace -w -S <scheme name>
126
+ $ fir bi path/to/workspace -w -S <scheme name>
127
127
  ```
128
+
129
+ ### 编译用 Gradle 打包 apk
130
+
131
+ ```shell
132
+ $ fir ba path/to/project
133
+ ```
134
+
128
135
  ### 一步, 从源代码到 FIR.im
129
136
  > 只需要输入 -p -T
130
137
 
data/fir-cli.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  /_/ /___/_/ |_| \____/_____/___/
29
29
 
30
30
  ## 更新记录
31
- ### FIR-CLI 1.1.7
31
+ ### FIR-CLI 1.1.8
32
32
  - 完全兼容新版 API ✔
33
33
  - 请使用新版 API Token
34
34
  - 新版 API Token 查看地址: `http://fir.im/user/info`
@@ -37,7 +37,9 @@ Gem::Specification.new do |spec|
37
37
  - 1. 指定 version 和 build 上传: `fir m <mapping file path> -P <bughd project id> -v <app version> -b <app build> -T <your api token>`
38
38
  - 2. 在 publish 的时候自动上传: `fir p <app file path> -m <mapping file path> -P <bughd project id> -T <your api token>`
39
39
  - 3. 在 build_ipa 的时候自动上传: `fir b <project dir> -P <bughd project id> -M -p -T <your api token>`
40
- - https://github.com/FIRHQ/fir-cli
40
+ - 支持 gradle 打包 apk 文件并自动上传至 fir.im, `fir build_apk(alias ba)`
41
+ - `fir ba <project dir> [-o <apk output dir> -c <changelog> -p -T <your api token>]`
42
+ - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源, 欢迎 fork, issue 和 pull request
41
43
  )
42
44
 
43
45
  spec.add_development_dependency "bundler", "~> 1.7"
data/lib/fir/cli.rb CHANGED
@@ -8,7 +8,7 @@ module FIR
8
8
  class_option :quiet, type: :boolean, aliases: "-q", desc: "Silence commands"
9
9
  class_option :help, type: :boolean, aliases: "-h", desc: "Show this help message and quit"
10
10
 
11
- desc "build_ipa BUILD_DIR [options] [settings]", "Build iOS app (alias: 'b')."
11
+ desc "build_ipa BUILD_DIR [options] [settings]", "Build iOS app (alias: 'bi')."
12
12
  long_desc <<-LONGDESC
13
13
  `build_ipa` command will auto build your project/workspace to an ipa package
14
14
  and it also can auto publish your built ipa to FIR.im if use `-p` option.
@@ -16,13 +16,13 @@ module FIR
16
16
 
17
17
  Example:
18
18
 
19
- $ fir b <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 -T <your api token>]
20
20
 
21
- $ fir b <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 -T <your api token>]
22
22
 
23
- $ fir b <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 -T <your api token>]
24
24
  LONGDESC
25
- map ["b", "build"] => :build_ipa
25
+ map ["b", "bi"] => :build_ipa
26
26
  method_option :workspace, type: :boolean, aliases: "-w", desc: "true/false if build workspace"
27
27
  method_option :scheme, type: :string, aliases: "-S", desc: "Set the scheme NAME if build workspace"
28
28
  method_option :configuration, type: :string, aliases: "-C", desc: "Use the build configuration NAME for building each target"
@@ -40,6 +40,27 @@ module FIR
40
40
  FIR.build_ipa(*args, options)
41
41
  end
42
42
 
43
+ desc "build_apk BUILD_DIR", "Build Android app (alias: 'ba')."
44
+ long_desc <<-LONGDESC
45
+ `build_apk` command will auto build your project to an apk package
46
+ and it also can auto publish your built apk to FIR.im if use `-p` option.
47
+ Internally, it use `gradle` to accomplish these things, use `gradle --help` to get more information.
48
+
49
+ Example:
50
+
51
+ $ fir ba <project dir> [-o <apk output dir> -c <changelog> -p -T <your api token>]
52
+ LONGDESC
53
+ map ["ba"] => :build_apk
54
+ method_option :output, type: :string, aliases: "-o", desc: "APK output path, the default is: BUILD_DIR/build/outputs/apk"
55
+ method_option :publish, type: :boolean, aliases: "-p", desc: "true/false if publish to FIR.im"
56
+ method_option :short, type: :string, aliases: "-s", desc: "Set custom short link if publish to FIR.im"
57
+ method_option :changelog, type: :string, aliases: "-c", desc: "Set changelog if publish to FIR.im"
58
+ def build_apk *args
59
+ prepare :build_apk
60
+
61
+ FIR.build_apk(*args, options)
62
+ end
63
+
43
64
  desc "info APP_FILE_PATH", "Show iOS/Android app's info, support ipa/apk file (aliases: 'i')."
44
65
  map "i" => :info
45
66
  method_option :all, type: :boolean, aliases: "-a", desc: "Show all information in application"
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ module FIR
4
+ module BuildApk
5
+
6
+ def build_apk *args, options
7
+ initialize_build_common_options(args, options)
8
+
9
+ Dir.chdir(@build_dir)
10
+
11
+ @build_cmd = initialize_apk_build_cmd(args, options)
12
+ @output_path = options[:output].blank? ? "#{@build_dir}/build/outputs/apk" : File.absolute_path(options[:output].to_s)
13
+
14
+ logger_info_and_run_build_command
15
+
16
+ @builded_app_path ||= Dir[@output_path].find { |i| i =~ /release/ }
17
+ @builded_app_path ||= Dir["#{@output_path}/*.apk"].first
18
+
19
+ publish_build_app if options.publish?
20
+
21
+ logger_info_blank_line
22
+ end
23
+
24
+ private
25
+
26
+ def initialize_apk_build_cmd args, options
27
+ check_build_gradle_exist
28
+
29
+ apk_build_cmd = "gradle clean;gradle build"
30
+ apk_build_cmd
31
+ end
32
+
33
+ def check_build_gradle_exist
34
+ unless File.exist?("#{@build_dir}/build.gradle")
35
+ logger.error "The build.gradle is not exit, please use gradle and edit"
36
+ exit 1
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ module FIR
4
+ module BuildCommon
5
+
6
+ def initialize_build_common_options args, options
7
+ if args.first.blank? || !File.exist?(args.first)
8
+ @build_dir = Dir.pwd
9
+ else
10
+ @build_dir = File.absolute_path(args.shift.to_s) # pop the first param
11
+ end
12
+
13
+ @token = options[:token] || current_token
14
+ @changelog = options[:changelog].to_s
15
+ @short = options[:short].to_s
16
+ @proj = options[:proj].to_s
17
+ end
18
+
19
+ def publish_build_app
20
+ logger_info_blank_line
21
+ publish @builded_app_path, short: @short,
22
+ changelog: @changelog,
23
+ token: @token
24
+ end
25
+
26
+ def logger_info_and_run_build_command
27
+ puts @build_cmd if $DEBUG
28
+
29
+ logger.info "Building......"
30
+ logger_info_dividing_line
31
+
32
+ logger.info `#{@build_cmd}`
33
+ end
34
+ end
35
+ end
@@ -1,45 +1,25 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- module Build
4
+ module BuildIpa
5
5
 
6
6
  def build_ipa *args, options
7
- # check build environment and make build cmd
8
- check_osx
9
-
10
- if args.first.blank? || !File.exist?(args.first)
11
- @build_dir = Dir.pwd
12
- else
13
- @build_dir = File.absolute_path(args.shift.to_s) # pop the first param
14
- end
15
-
16
- @token = options[:token] || current_token
17
- @changelog = options[:changelog].to_s
18
- @short = options[:short].to_s
19
- @proj = options[:proj].to_s
7
+ initialize_build_common_options(args, options)
20
8
 
21
9
  @build_tmp_dir = Dir.mktmpdir
22
10
  @output_path = options[:output].blank? ? "#{@build_dir}/fir_build_ipa" : File.absolute_path(options[:output].to_s)
23
- @ipa_build_cmd = initialize_ipa_build_cmd(args, options)
24
-
25
- puts @ipa_build_cmd if $DEBUG
11
+ @build_cmd = initialize_ipa_build_cmd(args, options)
26
12
 
27
- logger.info "Building......"
28
- logger_info_dividing_line
29
-
30
- logger.info `#{@ipa_build_cmd}`
13
+ logger_info_and_run_build_command
31
14
 
32
15
  output_ipa
33
-
34
- publish_build_ipa if options.publish?
35
- upload_build_mapping_file if options.mapping?
16
+ @builded_app_path = Dir["#{@output_path}/*.ipa"].first
17
+ publish_build_app if options.publish?
18
+ upload_build_dsym_mapping_file if options.mapping?
36
19
 
37
20
  logger_info_blank_line
38
21
  end
39
22
 
40
- def build_apk *args, options
41
- end
42
-
43
23
  private
44
24
 
45
25
  def initialize_ipa_build_cmd args, options
@@ -98,17 +78,10 @@ module FIR
98
78
  logger.info "Build Success"
99
79
  end
100
80
 
101
- def publish_build_ipa
102
- logger_info_blank_line
103
- publish Dir["#{@output_path}/*.ipa"].first, short: @short,
104
- changelog: @changelog,
105
- token: @token
106
- end
107
-
108
- def upload_build_mapping_file
81
+ def upload_build_dsym_mapping_file
109
82
  logger_info_blank_line
110
83
 
111
- @app_info = ipa_info(Dir["#{@output_path}/*.ipa"].first)
84
+ @app_info = ipa_info(@builded_app_path)
112
85
  @mapping_file = Dir["#{@output_path}/*.dSYM/Contents/Resources/DWARF/*"].first
113
86
 
114
87
  mapping @mapping_file, proj: @proj,
@@ -128,13 +101,6 @@ module FIR
128
101
  hash
129
102
  end
130
103
 
131
- def check_osx
132
- unless OS.mac?
133
- logger.error "Unsupported OS type, `build_ipa` only support for OSX"
134
- exit 1
135
- end
136
- end
137
-
138
104
  def check_and_find_ios_project path
139
105
  unless File.exist?(path)
140
106
  logger.error "The first param BUILD_DIR must be a xcodeproj directory"
data/lib/fir/util.rb CHANGED
@@ -6,7 +6,9 @@ require_relative './util/parser'
6
6
  require_relative './util/login'
7
7
  require_relative './util/me'
8
8
  require_relative './util/info'
9
- require_relative './util/build'
9
+ require_relative './util/build_common'
10
+ require_relative './util/build_ipa'
11
+ require_relative './util/build_apk'
10
12
  require_relative './util/publish'
11
13
  require_relative './util/mapping'
12
14
 
@@ -20,7 +22,9 @@ module FIR
20
22
  include FIR::Login
21
23
  include FIR::Me
22
24
  include FIR::Info
23
- include FIR::Build
25
+ include FIR::BuildCommon
26
+ include FIR::BuildIpa
27
+ include FIR::BuildApk
24
28
  include FIR::Publish
25
29
  include FIR::Mapping
26
30
 
data/lib/fir/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = "1.1.7"
4
+ VERSION = "1.1.8"
5
5
  end
@@ -1,9 +1,14 @@
1
1
  # encoding: utf-8
2
2
 
3
- class BuildIpaTest < Minitest::Test
3
+ class BuildAppTest < Minitest::Test
4
4
 
5
- def test_build_ipa
6
- # Only for OSX
7
- assert true
5
+ def test_build_app
6
+ if ENV['TEST_BUILD']
7
+ options = OpenStruct.new
8
+ options.send("publish?=", true)
9
+
10
+ assert FIR.build_ipa(default_ipa_project, options)
11
+ assert FIR.build_apk(default_apk_project, options)
12
+ end
8
13
  end
9
14
  end
data/test/mapping_test.rb CHANGED
@@ -9,7 +9,9 @@ class MappingTest < Minitest::Test
9
9
  build: '1'
10
10
  }
11
11
 
12
- assert FIR.mapping(default_dsym_mapping, options.merge(proj: default_bughd_project_ios_id))
13
- assert FIR.mapping(default_txt_mapping, options.merge(proj: default_bughd_project_android_id))
12
+ if ENV['TEST_MAPPING']
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
+ end
14
16
  end
15
17
  end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'minitest/autorun'
4
+ require 'ostruct'
4
5
  require 'fir'
5
6
 
6
7
  FIR.logger = Logger.new(STDOUT)
@@ -23,6 +24,14 @@ class Minitest::Test
23
24
  File.expand_path('../cases', __FILE__) + '/test_ipa.ipa'
24
25
  end
25
26
 
27
+ def default_ipa_project
28
+ File.expand_path('../projects', __FILE__) + '/ipa'
29
+ end
30
+
31
+ def default_apk_project
32
+ File.expand_path('../projects', __FILE__) + '/apk'
33
+ end
34
+
26
35
  def default_bughd_project_ios_id
27
36
  '55bb2839692d647a46000004'
28
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fir-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - FIR.im
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-03 00:00:00.000000000 Z
12
+ date: 2015-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -150,7 +150,9 @@ files:
150
150
  - lib/fir/patches/native_patch.rb
151
151
  - lib/fir/patches/os_patch.rb
152
152
  - lib/fir/util.rb
153
- - lib/fir/util/build.rb
153
+ - lib/fir/util/build_apk.rb
154
+ - lib/fir/util/build_common.rb
155
+ - lib/fir/util/build_ipa.rb
154
156
  - lib/fir/util/config.rb
155
157
  - lib/fir/util/http.rb
156
158
  - lib/fir/util/info.rb
@@ -179,14 +181,16 @@ metadata: {}
179
181
  post_install_message: "\n ______________ ________ ____\n /
180
182
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
181
183
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
182
- \ ## 更新记录\n ### FIR-CLI 1.1.7\n - 完全兼容新版 API ✔\n - 请使用新版 API Token\n - 新版 API
184
+ \ ## 更新记录\n ### FIR-CLI 1.1.8\n - 完全兼容新版 API ✔\n - 请使用新版 API Token\n - 新版 API
183
185
  Token 查看地址: `http://fir.im/user/info`\n - 增加符号表上传指令, `fir mapping(alias m)`\n -
184
186
  有以下三种方式上传符号表(目前已经支持 dSYM 和 txt 两种格式的符号表文件上传)\n - 1. 指定 version 和 build 上传: `fir
185
187
  m <mapping file path> -P <bughd project id> -v <app version> -b <app build> -T <your
186
188
  api token>`\n - 2. 在 publish 的时候自动上传: `fir p <app file path> -m <mapping file
187
189
  path> -P <bughd project id> -T <your api token>`\n - 3. 在 build_ipa 的时候自动上传:
188
- `fir b <project dir> -P <bughd project id> -M -p -T <your api token>`\n - https://github.com/FIRHQ/fir-cli\n
189
- \ "
190
+ `fir b <project dir> -P <bughd project id> -M -p -T <your api token>`\n - 支持 gradle
191
+ 打包 apk 文件并自动上传至 fir.im, `fir build_apk(alias ba)`\n - `fir ba <project dir> [-o
192
+ <apk output dir> -c <changelog> -p -T <your api token>]`\n - [fir-cli](https://github.com/FIRHQ/fir-cli)
193
+ 已经开源, 欢迎 fork, issue 和 pull request\n "
190
194
  rdoc_options: []
191
195
  require_paths:
192
196
  - lib