fir-cli 1.1.2 → 1.1.4

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: e4dadc3c8317c2bfcccbf19e81602551715437e6
4
- data.tar.gz: 55dd33294782a6e08832cff2e3b2cf6843c59be8
3
+ metadata.gz: 7bae17900d51069bd8719fdb6c23258955512965
4
+ data.tar.gz: 8d5be267862b9978e0da3c51a1740dab1143e3fa
5
5
  SHA512:
6
- metadata.gz: 78523c9c30c19604b95ea0514a677c2297b78901561ea9323c6e7aa2c5bdad28cbd4f8f22b36aada563fcb949f8899c11d1a774f51dbd85c61b101670d5830e8
7
- data.tar.gz: a5d4c2b47d02280ad3c67be1604bf4da70d194e119dffb08c98278fa25f413fdfebec0f0d78390ec9bdab7e7f50c22b0193428de75d19a3824f699e765b753da
6
+ metadata.gz: 309af7c8868108104451bc0a3e8f162083cc7bf35be9cfaa111658a87b669ada8477c60d4b5e96e8e3940fec909b9d73f74bb29f9b91c72e68b331d31d4067b2
7
+ data.tar.gz: 61e5bac2993c08e132bc97f96361d39f74dfcf30edceb318bddb4d47e608842224c66a7ec039fda4b05ab2519e3c105c085f2877c1621732cd448063aaf97641
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /fir-cli_tmp/
10
11
  *.bundle
11
12
  *.so
12
13
  *.o
data/.travis.yml ADDED
@@ -0,0 +1,23 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1
6
+ - 2.2
7
+ - ruby-head
8
+ - rbx-2
9
+ - jruby
10
+ - jruby-head
11
+
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: ruby-head
15
+ - rvm: jruby-head
16
+ - rvm: rbx-2
17
+ notifications:
18
+ recipients:
19
+ - hxy@fir.im
20
+
21
+ branches:
22
+ only:
23
+ - master
data/CHANGELOG CHANGED
@@ -1,4 +1,11 @@
1
1
  ## 更新记录
2
+
3
+ ### FIR-CLI 1.1.4
4
+ - 增加 `fir me` 指令查看当前登录用户
5
+
6
+ ### FIR-CLI 1.1.3
7
+ - 增加 Travis.ci
8
+
2
9
  ### FIR-CLI 1.1.1
3
10
  - android app 不转换 icon
4
11
 
data/README.md CHANGED
@@ -2,6 +2,8 @@ FIR.im CLI
2
2
  ---
3
3
 
4
4
  [![Join the chat at https://gitter.im/FIRHQ/fir-cli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/FIRHQ/fir-cli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
+ ![Build Status Images](https://travis-ci.org/FIRHQ/fir-cli.svg)
6
+
5
7
  > FIR.im CLI 可以通过指令查看, 上传, 编译应用
6
8
 
7
9
  ## 使用入门
@@ -10,7 +12,19 @@ FIR.im CLI
10
12
  FIR.im CLI 使用 Ruby 构建,只要安装相应 ruby gem 即可:
11
13
 
12
14
  ```shell
13
- $ sudo gem install fir-cli --no-ri --no-rdoc
15
+ $ sudo gem install fir-cli
16
+ ```
17
+
18
+ 如果出现无法安装的现象, 请先升级下系统自带的 gem 包后再执行命令安装 fir-cli
19
+
20
+ ```shell
21
+ sudo gem update --system
22
+ ```
23
+
24
+ 如果出现无法安装的现象, 请先升级下系统自带的 gem 包后再执行命令安装 fir-cli
25
+
26
+ ```shell
27
+ sudo gem update --system
14
28
  ```
15
29
 
16
30
  安装后,你可以在命令行执行指令
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ desc "Run the tests."
4
+ task :test do
5
+ $: << "lib" << "test"
6
+ Dir["test/*_test.rb"].each { |f| require f[5..-1] }
7
+ end
8
+
9
+ task :default => :test
10
+
data/fir-cli.gemspec CHANGED
@@ -28,16 +28,17 @@ Gem::Specification.new do |spec|
28
28
  /_/ /___/_/ |_| \____/_____/___/
29
29
 
30
30
  ## 更新记录
31
- ### FIR-CLI 1.1.2
31
+ ### FIR-CLI 1.1.4
32
32
  - 完全兼容新版 API ✔
33
33
  - 请使用新版 API Token
34
34
  - 新版 API Token 查看地址: `http://fir.im/user/info`
35
+ - 增加 `fir me` 指令查看当前登录用户
35
36
  - https://github.com/FIRHQ/fir-cli
36
37
  )
37
38
 
38
39
  spec.add_development_dependency "bundler", "~> 1.7"
39
40
  spec.add_development_dependency "rake", "~> 10.0"
40
- spec.add_development_dependency "pry", "~> 0.11"
41
+ spec.add_development_dependency "minitest", "~> 5.7"
41
42
 
42
43
  spec.add_dependency "thor", "~> 0.19"
43
44
  spec.add_dependency "CFPropertyList", "~> 2.3"
data/lib/fir/cli.rb CHANGED
@@ -64,6 +64,14 @@ module FIR
64
64
  FIR.login(token)
65
65
  end
66
66
 
67
+ desc "me", "Show current user info if user is logined (aliases: 'm')."
68
+ map "m" => :me
69
+ def me *args
70
+ prepare :me
71
+
72
+ FIR.me
73
+ end
74
+
67
75
  desc "upgrade", "Upgrade FIR-CLI and quit (aliases: u)."
68
76
  map "u" => :upgrade
69
77
  def upgrade
data/lib/fir/util/info.rb CHANGED
@@ -27,8 +27,8 @@ module FIR
27
27
  identifier: app.identifier,
28
28
  name: app.name,
29
29
  display_name: app.display_name,
30
- build: app.version,
31
- version: app.short_version,
30
+ build: app.version.to_s,
31
+ version: app.short_version.to_s,
32
32
  devices: app.devices,
33
33
  release_type: app.release_type || ipa.release_type,
34
34
  distribution_name: app.distribution_name
@@ -58,8 +58,8 @@ module FIR
58
58
  type: 'android',
59
59
  identifier: apk.manifest.package_name,
60
60
  name: apk.label,
61
- build: apk.manifest.version_code,
62
- version: apk.manifest.version_name
61
+ build: apk.manifest.version_code.to_s,
62
+ version: apk.manifest.version_name.to_s
63
63
  }
64
64
 
65
65
  # apk.icon is a hash, { icon_name: icon_data }
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+
3
+ module FIR
4
+ module Me
5
+
6
+ def me
7
+ check_logined
8
+
9
+ if user_info = fetch_user_info(current_token)
10
+ email = user_info.fetch(:email, '')
11
+ name = user_info.fetch(:name, '')
12
+
13
+ logger.info "Login succeed, current user's email: #{email}"
14
+ logger.info "Login succeed, current user's name: #{name}"
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/fir/util.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require_relative './util/login'
4
+ require_relative './util/me'
4
5
  require_relative './util/info'
5
6
  require_relative './util/build'
6
7
  require_relative './util/publish'
@@ -11,6 +12,7 @@ module FIR
11
12
  def self.included base
12
13
  base.extend ClassMethods
13
14
  base.extend Login
15
+ base.extend Me
14
16
  base.extend Info
15
17
  base.extend Build
16
18
  base.extend Publish
@@ -36,6 +38,13 @@ module FIR
36
38
  end
37
39
  end
38
40
 
41
+ def check_logined
42
+ if current_token.blank?
43
+ logger.error "Please use `fir login` first"
44
+ exit 1
45
+ end
46
+ end
47
+
39
48
  def logger_info_dividing_line
40
49
  logger.info "✈ -------------------------------------------- ✈"
41
50
  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.1.2"
4
+ VERSION = "1.1.4"
5
5
  end
Binary file
Binary file
@@ -0,0 +1,88 @@
1
+ # encoding: utf-8
2
+
3
+ require 'minitest/autorun'
4
+ require 'fir'
5
+
6
+ class Minitest::Test
7
+
8
+ def default_token
9
+ '2dd8a99ef9d19c540bb583624b939960'
10
+ end
11
+
12
+ def default_email
13
+ 'fir-cli_test@fir.im'
14
+ end
15
+
16
+ def default_apk
17
+ File.expand_path('../cases', __FILE__) + '/test_apk.apk'
18
+ end
19
+
20
+ def default_ipa
21
+ File.expand_path('../cases', __FILE__) + '/test_ipa.ipa'
22
+ end
23
+
24
+ def default_device_udid
25
+ "cf8b87e3f469d7b185fd64c057778aecbc2017a6"
26
+ end
27
+
28
+ def default_distribution_name
29
+ 'iOSTeam Provisioning Profile: im.fir.* - Fly It Remotely LLC.'
30
+ end
31
+ end
32
+
33
+ class LoginTest < Minitest::Test
34
+
35
+ def test_login
36
+ user_info = FIR.fetch_user_info(default_token)
37
+
38
+ assert_equal default_email, user_info.fetch(:email, '')
39
+ end
40
+ end
41
+
42
+ class MeTest < Minitest::Test
43
+
44
+ def test_me
45
+ user_info = FIR.fetch_user_info(default_token)
46
+
47
+ FIR.write_config(email: user_info.fetch(:email, ''), token: default_token)
48
+ FIR.reload_config
49
+
50
+ me_info = FIR.fetch_user_info(FIR.current_token)
51
+
52
+ assert_equal default_email, me_info.fetch(:email, '')
53
+ end
54
+ end
55
+
56
+ class InfoTest < Minitest::Test
57
+
58
+ def test_apk_info
59
+ info = FIR.apk_info(default_apk, true)
60
+
61
+ assert_equal 'android', info[:type]
62
+ assert_equal 'im.fir.sdk.test', info[:identifier]
63
+ assert_equal 'TestCrash', info[:name]
64
+ assert_equal '3', info[:build]
65
+ assert_equal '3.0', info[:version]
66
+
67
+ assert_equal true, File.exist?(info[:icons].first)
68
+ end
69
+
70
+ def test_ipa_info
71
+ info = FIR.ipa_info(default_ipa, true)
72
+
73
+ assert_equal 'ios', info[:type]
74
+ assert_equal 'im.fir.build-ipa', info[:identifier]
75
+ assert_equal 'build_ipa', info[:name]
76
+ assert_equal '1', info[:build]
77
+ assert_equal '1.0', info[:version]
78
+
79
+ # Only for OSX
80
+ # assert_equal nil, info[:display_name]
81
+ # assert_equal default_device_udid, info[:devices].first
82
+ # assert_equal 'adhoc', info[:release_type]
83
+ # assert_equal default_distribution_name, info[:distribution_name]
84
+
85
+ assert_equal true, info[:plist].is_a?(Hash)
86
+ assert_equal true, info[:mobileprovision].is_a?(Hash)
87
+ end
88
+ 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.2
4
+ version: 1.1.4
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-07-17 00:00:00.000000000 Z
12
+ date: 2015-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -40,19 +40,19 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '10.0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: pry
43
+ name: minitest
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0.11'
48
+ version: '5.7'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0.11'
55
+ version: '5.7'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: thor
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -118,6 +118,7 @@ extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
120
120
  - ".gitignore"
121
+ - ".travis.yml"
121
122
  - CHANGELOG
122
123
  - Gemfile
123
124
  - LICENSE.txt
@@ -138,9 +139,13 @@ files:
138
139
  - lib/fir/util/build.rb
139
140
  - lib/fir/util/info.rb
140
141
  - lib/fir/util/login.rb
142
+ - lib/fir/util/me.rb
141
143
  - lib/fir/util/publish.rb
142
144
  - lib/fir/version.rb
143
145
  - lib/fir_cli.rb
146
+ - test/cases/test_apk.apk
147
+ - test/cases/test_ipa.ipa
148
+ - test/fir_cli_test.rb
144
149
  homepage: http://blog.fir.im/fir_cli
145
150
  licenses:
146
151
  - MIT
@@ -148,8 +153,9 @@ metadata: {}
148
153
  post_install_message: "\n ______________ ________ ____\n /
149
154
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
150
155
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
151
- \ ## 更新记录\n ### FIR-CLI 1.1.2\n - 完全兼容新版 API ✔\n - 请使用新版 API Token\n - 新版 API
152
- Token 查看地址: `http://fir.im/user/info`\n - https://github.com/FIRHQ/fir-cli\n "
156
+ \ ## 更新记录\n ### FIR-CLI 1.1.4\n - 完全兼容新版 API ✔\n - 请使用新版 API Token\n - 新版 API
157
+ Token 查看地址: `http://fir.im/user/info`\n - 增加 `fir me` 指令查看当前登录用户\n - https://github.com/FIRHQ/fir-cli\n
158
+ \ "
153
159
  rdoc_options: []
154
160
  require_paths:
155
161
  - lib
@@ -169,4 +175,7 @@ rubygems_version: 2.4.7
169
175
  signing_key:
170
176
  specification_version: 4
171
177
  summary: FIR.im command tool
172
- test_files: []
178
+ test_files:
179
+ - test/cases/test_apk.apk
180
+ - test/cases/test_ipa.ipa
181
+ - test/fir_cli_test.rb