fir-cli 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47d1e0ac63ead35ff04149c8c471bb20818006c6
4
- data.tar.gz: 9aebd79f93f24e5411b837d4999df922cb7abb3e
3
+ metadata.gz: 83fa44d61b04246a7a2402bdca1eff4b99aef2ce
4
+ data.tar.gz: b7e1b903ce095e4d99b312c70a984a5b0df4751a
5
5
  SHA512:
6
- metadata.gz: 61af691a4a071fd07c68b3b5029d4a7ef95a25736aab7ff6b08b7bc3d0dc18721584434b6b8f100185a8805d31ae753a923991dba1d184bbcd23d6c420936b04
7
- data.tar.gz: 329ffbcfdacf5bc61b348c9dfa80978c1af63da95fc867d83e1559c5f7ddd619b32a430daa7694041cb47922a71eff296d555eac22aac34a416a95ea9ffe8b3b
6
+ metadata.gz: 4ceb95e406746dce90890a6271a29c357a1fac046df4c192fc28a85c9164ab76777f7d739dbb1b9e46e50752be8cf8d58c93245378f653a292c49064613cc314
7
+ data.tar.gz: ccd0ed1f05ed39ff3a2573f325c8c69b54defb2943293c1eef84e3710d1e1d8b6d6f9b8ffbc66e291beb7b4c5feade1f97f11b71cb27c1a1d96c01275057cedf
data/.gitignore CHANGED
@@ -19,3 +19,5 @@ mkmf.log
19
19
  Gemfile.lock
20
20
  .DS_Store
21
21
  /test/cases/*.png
22
+ /build_apk_example_*
23
+ /build_ipa_example_*
data/CHANGELOG CHANGED
@@ -1,5 +1,8 @@
1
1
  ## 更新记录
2
2
 
3
+ ### fir-cli 1.4.1
4
+ - 支持远程 git 项目打包编译
5
+
3
6
  ### fir-cli 1.4.0
4
7
  - 使用 cli 转换 icon 后不再回调后台 icon 转换器
5
8
 
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ require 'bundler/setup'
5
+ require 'fir'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require 'pry'
11
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/fir-cli.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'fir-cli'
9
9
  spec.version = FIR::VERSION
10
10
  spec.authors = ['NaixSpirit']
11
- spec.email = ['dev@fir.im']
11
+ spec.email = ['neverlandxy.naix@gmail.com']
12
12
  spec.date = Time.now.strftime('%Y-%m-%d')
13
13
  spec.summary = 'fir.im command tool'
14
14
  spec.description = 'fir.im command tool, support iOS and Android'
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
27
27
  /_/ /___/_/ |_| \____/_____/___/
28
28
 
29
29
  ## 更新记录
30
- ### fir-cli 1.4.0
31
- - 使用 cli 转换 icon 后不再回调后台 icon 转换器
32
- - 修正 build 后生成多个 dsym 文件导致上传 bughd 失败的 bug
30
+ ### fir-cli 1.4.1
31
+ - 支持远程 git 项目打包编译, enjoy.
32
+ - `$ fir bi/ba <git ssh url> -B develop -c <changelog> -p`
33
33
  - 详细更新记录, 请查看: https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG
34
34
  - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源
35
35
  - 欢迎 fork, issue 和 pull request
data/lib/fir/cli.rb CHANGED
@@ -20,9 +20,12 @@ module FIR
20
20
 
21
21
  $ fir bi <project dir> [-c <changelog> -P <bughd project id> -M -p -Q -T <your api token>]
22
22
 
23
+ $ fir bi <git ssh url> [-B develop -c <changelog> -P <bughd project id> -M -p -Q -T <your api token>]
24
+
23
25
  $ 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
26
  LONGDESC
25
27
  map ['b', 'bi'] => :build_ipa
28
+ method_option :branch, type: :string, aliases: '-B', desc: 'Set branch if project is a git repo, the default is `master`'
26
29
  method_option :workspace, type: :boolean, aliases: '-w', desc: 'true/false if build workspace'
27
30
  method_option :scheme, type: :string, aliases: '-S', desc: 'Set the scheme NAME if build workspace'
28
31
  method_option :configuration, type: :string, aliases: '-C', desc: 'Use the build configuration NAME for building each target'
@@ -50,8 +53,11 @@ module FIR
50
53
  Example:
51
54
 
52
55
  $ fir ba <project dir> [-o <apk output dir> -c <changelog> -p -Q -T <your api token>]
56
+
57
+ $ fir ba <git ssh url> [-B develop -o <apk output dir> -c <changelog> -p -Q -T <your api token>]
53
58
  LONGDESC
54
59
  map ['ba'] => :build_apk
60
+ method_option :branch, type: :string, aliases: '-B', desc: 'Set branch if project is a git repo, the default is `master`'
55
61
  method_option :output, type: :string, aliases: '-o', desc: 'APK output path, the default is: BUILD_DIR/build/outputs/apk'
56
62
  method_option :publish, type: :boolean, aliases: '-p', desc: 'true/false if publish to fir.im'
57
63
  method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link if publish to fir.im'
@@ -4,7 +4,7 @@ module FIR
4
4
  module BuildCommon
5
5
 
6
6
  def initialize_build_common_options(args, options)
7
- @build_dir = initialize_build_dir(args)
7
+ @build_dir = initialize_build_dir(args, options)
8
8
  @output_path = initialize_output_path(options)
9
9
  @token = options[:token] || current_token
10
10
  @changelog = options[:changelog].to_s
@@ -14,11 +14,30 @@ module FIR
14
14
  @export_qrcode = options[:qrcode]
15
15
  end
16
16
 
17
- def initialize_build_dir(args)
18
- if args.first.blank? || !File.exist?(args.first)
17
+ def initialize_build_dir(args, options)
18
+ build_dir = args.first.to_s
19
+ if File.extname(build_dir) == '.git'
20
+ args.shift && git_clone_build_dir(build_dir, options)
21
+ elsif build_dir.blank? || !File.exist?(build_dir)
19
22
  Dir.pwd
20
23
  else
21
- File.absolute_path(args.shift.to_s) # pop the first param
24
+ args.shift && File.absolute_path(build_dir)
25
+ end
26
+ end
27
+
28
+ def git_clone_build_dir(ssh_url, options)
29
+ repo_name = File.basename(ssh_url, '.git') + "_#{Time.now.strftime('%Y%m%dT%H%M%S')}"
30
+ branch = options[:branch].blank? ? 'master' : options[:branch]
31
+ git_cmd = "git clone --depth=50 --branch=#{branch} #{ssh_url} #{repo_name}"
32
+
33
+ logger.info git_cmd
34
+ logger_info_dividing_line
35
+
36
+ if system(git_cmd)
37
+ File.absolute_path(repo_name)
38
+ else
39
+ logger.error 'Git clone failed'
40
+ exit 1
22
41
  end
23
42
  end
24
43
 
data/lib/fir/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = '1.4.0'
4
+ VERSION = '1.4.1'
5
5
  end
@@ -9,6 +9,9 @@ class BuildAppTest < Minitest::Test
9
9
 
10
10
  assert FIR.build_ipa(default_ipa_project, options)
11
11
  assert FIR.build_apk(default_apk_project, options)
12
+
13
+ assert FIR.build_ipa(default_ipa_git_url, options)
14
+ assert FIR.build_apk(default_apk_git_url, options)
12
15
  end
13
16
  end
14
17
  end
data/test/test_helper.rb CHANGED
@@ -35,6 +35,14 @@ class Minitest::Test
35
35
  File.expand_path('../projects', __FILE__) + '/apk'
36
36
  end
37
37
 
38
+ def default_ipa_git_url
39
+ 'git@github.com:NaixSpirit/build_ipa_example.git'
40
+ end
41
+
42
+ def default_apk_git_url
43
+ 'git@github.com:NaixSpirit/build_apk_example.git'
44
+ end
45
+
38
46
  def default_bughd_project_ios_id
39
47
  '55bb2839692d647a46000004'
40
48
  end
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.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaixSpirit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-12 00:00:00.000000000 Z
11
+ date: 2015-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -138,9 +138,11 @@ dependencies:
138
138
  version: '0.7'
139
139
  description: fir.im command tool, support iOS and Android
140
140
  email:
141
- - dev@fir.im
141
+ - neverlandxy.naix@gmail.com
142
142
  executables:
143
+ - console
143
144
  - fir
145
+ - setup
144
146
  extensions: []
145
147
  extra_rdoc_files: []
146
148
  files:
@@ -153,7 +155,9 @@ files:
153
155
  - LICENSE.txt
154
156
  - README.md
155
157
  - Rakefile
158
+ - bin/console
156
159
  - bin/fir
160
+ - bin/setup
157
161
  - fir-cli.gemspec
158
162
  - lib/fir-cli.rb
159
163
  - lib/fir.rb
@@ -199,8 +203,8 @@ metadata: {}
199
203
  post_install_message: "\n ______________ ________ ____\n /
200
204
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
201
205
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
202
- \ ## 更新记录\n ### fir-cli 1.4.0\n - 使用 cli 转换 icon 后不再回调后台 icon 转换器\n - 修正 build
203
- 后生成多个 dsym 文件导致上传 bughd 失败的 bug\n - 详细更新记录, 请查看: https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG\n
206
+ \ ## 更新记录\n ### fir-cli 1.4.1\n - 支持远程 git 项目打包编译, enjoy.\n - `$ fir bi/ba <git
207
+ ssh url> -B develop -c <changelog> -p`\n - 详细更新记录, 请查看: https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG\n
204
208
  \ - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源\n - 欢迎 fork, issue 和 pull
205
209
  request\n "
206
210
  rdoc_options: []