deploygate 0.6.7 → 0.8.2

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
- SHA256:
3
- metadata.gz: 683c37a3388ad0e42e4fdb860fe3cc7d705831fa912bee34f415fb5dbda634bc
4
- data.tar.gz: d8c5c1f552dc84cb7ade0c76cdcd20ff0b6f438048c1c714c5211f17e5336917
2
+ SHA1:
3
+ metadata.gz: 152c8d51b8026027e006abf851587d585ea1e9db
4
+ data.tar.gz: a2ecbe04a60241e3bace5f4a71ca21cb2b720d68
5
5
  SHA512:
6
- metadata.gz: a602970427fef7d236d40914d948f5aafc9a4404d52c514b0859c1aa4ad3647408814eaa8c80d215ed46cc07b57ef9f406be9f543b2a9615886bb09ed76ae101
7
- data.tar.gz: 7e1ac49b8bd8d8549a9ce45857ff9252b3249d2d367d0d1dad3e632ccebbde77b80857da76ddfdb333752cd8c7c72b73b09b0dab03511d454c182ad2e193dbe6
6
+ metadata.gz: d3753c438e061fe68140654852dc2dab3de06e69647f5b4771f6159fd448232c6735b36520f6334f38a21b0cfb62ef8d711173f906d896a5165afe6cc5a8c23f
7
+ data.tar.gz: 0275cdfea85a1c763406aaf0650c37e30e01c3d1311037f52fa297896b7d248842bf41c1de26dd413118c78237c8a075951fd2f904b6d990474a6f1589d6a587
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.4.5
@@ -3,9 +3,13 @@ env:
3
3
  global:
4
4
  secure: gGY+C54Cfp082o5Oaf6tZqzfOlXsWSMcVNvTpoOgMfJGsHo//d9t/si9Bn1pFaFyjJedW+IcC0pt+FcKVCDgnsUaL0Y0HT/ZsGkV8k7vv9F5nbHOde4nk189Sr2HtHR3wdr7KaMh2/DialisnqllxgzxA/wRLfHKsjqRsjWUw/VWL5E7Z734mzpTGE2mVJNRj02/cs0Y/izZgdi6wrt4lEZfxE3jS+QkJZHMjGNfcwvH26whU6oX1PiJ4o5xl0Rr8Q8xav3wbtTCcOJNPSeMkkiH5sSXuqrjI6kgwvjlByKhyg2Ws0GvZLxAfTml+Vo5po1uWsohdZJaJcEhd4GsGfbMZWCFuBP2mCE+gVmkkMeJxRKnWoi6NotgPmqG1JWlzGngDB/hJ4wuuh+swa0KJvZGiMEJ5P3GNydCybEPOsk1Ww+lUkXRHxD+/LW03EkxMd5LA3He/nYXz3pWCYA6qcFgrYMmq+3ozjSaQr+1d/Iu14Awv5+cwCltPfl5bERDno0jc0TdSs/7qplAL/efpjBsP7DkGE5r521gg8mIiXx509jU08i9S60SXiw0RBnYyjE5SzlsiOqaFdJxVygDGcDIAA/GTefLHO9i3SinZHFS6jr3Xi/vpOIc7Jz4W2Jmuqv+CJP4gspPoAxdWOE/QipTt0Jv4kCMf7dJwd9jaRc=
5
5
  rvm:
6
- - 2.2.0
6
+ - 2.4
7
+ - 2.5
8
+ - 2.6
9
+ - 2.7
7
10
  before_install:
8
- - gem install bundler
11
+ - gem install bundler -v 2.1.4
12
+ install: BUNDLER_VERSION=2.1.4 bundle install --jobs=3 --retry=3
9
13
  script:
10
14
  - bundle exec rake
11
15
  deploy:
@@ -16,5 +20,6 @@ deploy:
16
20
  on:
17
21
  tags: true
18
22
  repo: DeployGate/deploygate-cli
23
+ rvm: 2.4
19
24
  after_deploy:
20
25
  - 'curl -X POST --data-urlencode "payload={\"text\": \"Released a deploygate gem in <https://rubygems.org/gems/deploygate/|RubyGems>\"}" $SLACK_URL'
data/README.md CHANGED
@@ -1,8 +1,15 @@
1
1
  # deploygate-cli
2
+
2
3
  [![Gem Version](https://badge.fury.io/rb/deploygate.svg)](https://badge.fury.io/rb/deploygate)
3
4
  [![Build Status](https://travis-ci.org/DeployGate/deploygate-cli.svg?branch=master)](https://travis-ci.org/DeployGate/deploygate-cli)
4
5
 
5
- A command-line interface for DeployGate
6
+ dg: A command-line interface for DeployGate
7
+
8
+ ## Requirements
9
+
10
+ *dg* runs with a minimal set of requirements.
11
+
12
+ - Ruby 2.4+ (Depends on [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/))
6
13
 
7
14
  ## Installation
8
15
 
@@ -42,7 +49,7 @@ $ dg deploy [Android/iOS project path]
42
49
 
43
50
  ## License
44
51
 
45
- Copyright (C) 2015 DeployGate All rights reserved.
52
+ Copyright (C) 2015- DeployGate All rights reserved.
46
53
 
47
54
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
48
55
 
@@ -1,12 +1,13 @@
1
1
  ---
2
2
  en:
3
+ errors:
4
+ check_update_failure: 'Checking update failed'
3
5
  command_builder:
4
6
  name: 'dg'
5
7
  description: 'Control DeployGate from your terminal.'
6
8
  login:
7
9
  description: 'Log in to DeployGate'
8
10
  terminal: 'Login in terminal'
9
- error: 'Commands::Login Error: %{e}'
10
11
  deploy:
11
12
  description: 'Build and upload a new build'
12
13
  message: 'Build description message'
@@ -16,14 +17,12 @@ en:
16
17
  scheme: 'Set Xcode build scheme (iOS app only)'
17
18
  open: 'Open a browser after the build uploaded (OS X only)'
18
19
  disable_notify: 'Disable email notification (iOS app only)'
19
- error: 'Commands::Deploy Error: %{e}'
20
20
  add_devices:
21
21
  description: 'Register devices to your Apple Developer account and refresh your provisioning profile. (iOS only) By default, it automatically finds new devices added to your application on DeployGate and ask you which device to register. You can also specify which device to register via command line options.'
22
22
  user: 'Owner user or organization name'
23
23
  udid: 'UDID to be registered'
24
24
  device_name: 'Device name to be registered'
25
25
  distribution_key: 'If you also want to update distribution page, set the last part of the URL of the page'
26
- error: 'Commands::AddDevices Error: %{e}'
27
26
  server:
28
27
  description: 'Start the add-devices server. When added new device automatically run add-devices command.'
29
28
  connecting: 'Connecting...'
@@ -32,17 +31,15 @@ en:
32
31
  finish_build: 'add-devices completed successfully.'
33
32
  logout:
34
33
  description: 'Log out current session'
35
- error: 'Commands::Logout Error: %{e}'
36
34
  config:
37
35
  description: "Configure login session of `dg` command. Usually, the session automatically created on the installation process so you don't need to use this command."
38
36
  json: 'Set output format to JSON'
39
37
  name: 'DeployGate user name'
40
38
  token: 'DeployGate API token'
41
- error: 'Commands::Config Error: %{e}'
42
39
  error_handling:
43
40
  message: 'Error: %{message}'
44
- agree: 'Do you want to report this issue on GitHub? (y/n) '
45
- please_open: 'Please open GitHub issue: %{url}'
41
+ agree: 'Do you want to this error report to DeployGate? (y/n) '
42
+ thanks: 'Thank you feedback! We will improve based on it.'
46
43
  show_update_message: |
47
44
  #################################################################
48
45
  # %{gem_name} %{latest_version} is available. You are on %{current_version}.
@@ -147,27 +144,21 @@ en:
147
144
  choice: '%{team_name} %{team_id}'
148
145
  check_local_certificates:
149
146
  not_local_install_certificate:
150
- error_message: 'Error: No applicable iPhone Distribution certificate found on your Mac.'
147
+ error_message: 'Error: No applicable iPhone Distribution or Apple Distribution certificate found on your Mac.'
151
148
  note: |
152
- No "iPhone Distribution" certificate and/or corresponding private key installed locally.
149
+ No "iPhone Distribution" or "Apple Distribution" certificate and/or corresponding private key installed locally.
153
150
  To sign your application code, make sure you have installed them and available in your Keychain.
154
151
 
155
152
  See also: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html
156
153
  conflict_certificate:
157
154
  error_message: 'Error: Too many certificates found.'
158
155
  note: |
159
- You have more than one "iPhone Distribution" certificate installed on your Mac.
156
+ You have more than one "iPhone Distribution" or "Apple Distribution" certificate installed on your Mac.
160
157
  Please remove other unnecessary certificates from your Keychain.
161
158
  clean_provisioning_profiles:
162
159
  start: 'Cleaning local Provisioning Profiles...'
163
160
  delete: 'Delete %{path}'
164
161
  finish: 'Finish cleaning local Provisionig Profiles'
165
- analyze:
166
- target_bundle_identifier:
167
- prompt: |
168
- Please input your app bundle identifier
169
- Example: com.example.ios
170
- ask: 'Enter your app bundle identifier: '
171
162
  ios:
172
163
  build:
173
164
  error:
@@ -182,5 +173,5 @@ en:
182
173
  Note: Your password will be stored to your Keychain and never be sent to DeployGate.
183
174
  email: 'Email: '
184
175
  provisioning_profile:
185
- not_installed_certificate_error: 'No iPhone Distribution Certificate associated with private key was found in local Keychain'
176
+ not_installed_certificate_error: 'No iPhone Distribution or Apple Distribution Certificate associated with private key was found in local Keychain'
186
177
  not_exist_uuid_provisioning_profile_error: 'No provisioning profile found for the specified UUID (%{uuid})'
@@ -20,12 +20,11 @@ dg installed! To get started fast:
20
20
 
21
21
  POST_INSTALL_MESSAGE
22
22
 
23
- spec.add_runtime_dependency 'json', '~> 1.8'
23
+ spec.add_runtime_dependency 'json', '~> 2.0'
24
24
  spec.add_runtime_dependency 'httpclient', '~> 2.8'
25
25
  spec.add_runtime_dependency 'commander', '~> 4.4'
26
26
  spec.add_runtime_dependency 'plist', '~> 3.1'
27
- spec.add_runtime_dependency 'xcodeproj', '~> 1.5.1'
28
- spec.add_runtime_dependency 'github_issue_request', '~> 0.1'
27
+ spec.add_runtime_dependency 'xcodeproj', '~> 1.7'
29
28
  spec.add_runtime_dependency 'highline', '~> 1.7'
30
29
  spec.add_runtime_dependency 'uuid', '~> 2.3'
31
30
  spec.add_runtime_dependency 'gem_update_checker', '~> 0.2'
@@ -36,11 +35,12 @@ POST_INSTALL_MESSAGE
36
35
  spec.add_runtime_dependency 'net-ping', '~> 2.0'
37
36
  spec.add_runtime_dependency 'socket.io-client-simple', '~> 1.2'
38
37
  spec.add_runtime_dependency 'workers', '~> 0.6'
38
+ spec.add_runtime_dependency 'sentry-raven', '~> 2.8'
39
39
 
40
40
  # ios build
41
- spec.add_runtime_dependency 'fastlane', '~> 2.57.2'
41
+ spec.add_runtime_dependency 'fastlane', '~> 2.148.1'
42
42
 
43
- spec.add_development_dependency 'bundler', '~> 1.13'
43
+ spec.add_development_dependency 'bundler', '>= 2.1.4', '< 3.0'
44
44
  spec.add_development_dependency 'rake', '~> 12.0'
45
45
  spec.add_development_dependency 'rspec', '~> 3.5'
46
46
  spec.add_development_dependency 'webmock', '~> 2.3'
@@ -1,3 +1,4 @@
1
+ require "resolv-replace"
1
2
  require "commander"
2
3
  require "json"
3
4
  require "httpclient"
@@ -6,11 +7,11 @@ require "rbconfig"
6
7
  require "openssl"
7
8
  require "plist"
8
9
  require "find"
9
- require "github_issue_request"
10
10
  require "highline"
11
11
  require "uuid"
12
12
  require "gem_update_checker"
13
13
  require "active_support/core_ext/time"
14
+ require "active_support/core_ext/hash"
14
15
  require "locale"
15
16
  require "tempfile"
16
17
  require "open3"
@@ -21,6 +22,7 @@ require "webrick"
21
22
  require "net/ping"
22
23
  require "socket.io-client-simple"
23
24
  require "workers"
25
+ require "sentry-raven"
24
26
 
25
27
  require "i18n"
26
28
  I18n.load_path = Dir[File.join(File.dirname(__FILE__), '../config/locales/*.yml')]
@@ -34,7 +36,7 @@ require "xcodeproj"
34
36
  module DeployGate
35
37
  end
36
38
 
37
- require "deploygate/not_issue_error"
39
+ require "deploygate/raven_ignore_exception"
38
40
  require "deploygate/api/v1/base"
39
41
  require "deploygate/api/v1/session"
40
42
  require "deploygate/api/v1/push"
@@ -55,6 +57,7 @@ require "deploygate/config/cache_version"
55
57
  require "deploygate/session"
56
58
  require "deploygate/deploy"
57
59
  require "deploygate/project"
60
+ require "deploygate/raven_ignore_exception"
58
61
  require "deploygate/user"
59
62
  require "deploygate/browser_login"
60
63
  require "deploygate/add_devices_server"
@@ -1,8 +1,7 @@
1
1
  module DeployGate
2
2
  class AddDevicesServer
3
3
 
4
- def start(token, owner_name, bundle_id, distribution_key, args, options)
5
- DeployGate::Xcode::MemberCenter.instance
4
+ def start(token, owner_name, bundle_id, distribution_key, member_center, args, options)
6
5
  options.server = false
7
6
 
8
7
  puts I18n.t('command_builder.add_devices.server.connecting')
@@ -15,7 +14,7 @@ module DeployGate
15
14
  raise res[:message]
16
15
  end
17
16
 
18
- websocket_setup(server, bundle_id, push_token, action, args, options) do |socket|
17
+ websocket_setup(server, bundle_id, push_token, action, member_center, args, options) do |socket|
19
18
  puts HighLine.color(I18n.t('command_builder.add_devices.server.start'), HighLine::GREEN)
20
19
 
21
20
  Workers::PeriodicTimer.new(60) do
@@ -33,12 +32,12 @@ module DeployGate
33
32
  end
34
33
  end
35
34
 
36
- def self.build(pool, bunlde_id, iphones, args, options)
35
+ def self.build(pool, bunlde_id, iphones, member_center, args, options)
37
36
  iphones.reject! { |iphone| iphone['is_registered'] } # remove udids if already registered
38
37
  devices = iphones.map do |iphone|
39
38
  udid = iphone['udid']
40
39
  device_name= iphone['device_name']
41
- DeployGate::Xcode::MemberCenters::Device.new(udid, '', device_name)
40
+ DeployGate::Xcode::MemberCenters::Device.new(udid, '', device_name, member_center)
42
41
  end
43
42
  return if devices.empty?
44
43
 
@@ -53,7 +52,7 @@ module DeployGate
53
52
 
54
53
  private
55
54
 
56
- def websocket_setup(server, bundle_id, push_token, target_action, args, options, &block)
55
+ def websocket_setup(server, bundle_id, push_token, target_action, member_center, args, options, &block)
57
56
  socket = SocketIO::Client::Simple.connect server
58
57
  socket.on :connect do
59
58
  socket.emit :subscribe, push_token
@@ -72,7 +71,7 @@ module DeployGate
72
71
  data = JSON.parse(push_data['data'])
73
72
 
74
73
  iphones = data['iphones']
75
- DeployGate::AddDevicesServer.build(pool, bundle_id, iphones, args, options)
74
+ DeployGate::AddDevicesServer.build(pool, bundle_id, iphones, member_center, args, options)
76
75
  end
77
76
  end
78
77
  end
@@ -45,7 +45,11 @@ module DeployGate
45
45
  private
46
46
 
47
47
  def client
48
- HTTPClient.new(:agent_name => "dg/#{DeployGate::VERSION}")
48
+ timeout = 60 * 5 # 5 minutes
49
+ HTTPClient.new(agent_name: "dg/#{DeployGate::VERSION}").tap do |c|
50
+ c.receive_timeout = timeout
51
+ c.send_timeout = timeout
52
+ end
49
53
  end
50
54
 
51
55
  def headers
@@ -3,7 +3,7 @@ module DeployGate
3
3
  include Commander::Methods
4
4
  attr_reader :arguments
5
5
 
6
- class NotInternetConnectionError < DeployGate::NotIssueError
6
+ class NotInternetConnectionError < DeployGate::RavenIgnoreException
7
7
  end
8
8
 
9
9
  PING_URL = 'https://deploygate.com'
@@ -15,6 +15,13 @@ module DeployGate
15
15
  CONFIG = 'config'
16
16
 
17
17
  def setup
18
+ # sentry config
19
+ Raven.configure do |config|
20
+ config.dsn = 'https://e0b4dda8fe2049a7b0d98c6d2759e067@sentry.io/1371610'
21
+ config.logger = Raven::Logger.new('/dev/null') # hide sentry log
22
+ config.excluded_exceptions = Raven::Configuration::IGNORE_DEFAULT + [DeployGate::RavenIgnoreException.name]
23
+ end
24
+
18
25
  # set Ctrl-C trap
19
26
  Signal.trap(:INT){
20
27
  puts ''
@@ -27,14 +34,13 @@ module DeployGate
27
34
  exit
28
35
  end
29
36
 
30
- # check update
31
- GithubIssueRequest::Url.config('deploygate', 'deploygate-cli')
32
37
  check_update()
33
38
  end
34
39
 
35
40
  def run
36
41
  setup()
37
42
 
43
+ program :help_paging, false
38
44
  program :name, I18n.t('command_builder.name')
39
45
  program :version, VERSION
40
46
  program :description, I18n.t('command_builder.description')
@@ -49,7 +55,7 @@ module DeployGate
49
55
  Commands::Login.run(args, options)
50
56
  rescue => e
51
57
  error_handling(LOGIN, e)
52
- raise e
58
+ exit 1
53
59
  end
54
60
  end
55
61
  end
@@ -70,7 +76,7 @@ module DeployGate
70
76
  Commands::Deploy.run(args, options)
71
77
  rescue => e
72
78
  error_handling(DEPLOY, e)
73
- raise e
79
+ exit 1
74
80
  end
75
81
  end
76
82
  end
@@ -91,7 +97,7 @@ module DeployGate
91
97
  Commands::AddDevices.run(args, options)
92
98
  rescue => e
93
99
  error_handling(ADD_DEVICES, e)
94
- raise e
100
+ exit 1
95
101
  end
96
102
  end
97
103
  end
@@ -104,7 +110,7 @@ module DeployGate
104
110
  Commands::Logout.run
105
111
  rescue => e
106
112
  error_handling(LOGOUT, e)
107
- raise e
113
+ exit 1
108
114
  end
109
115
  end
110
116
  end
@@ -120,7 +126,7 @@ module DeployGate
120
126
  Commands::Config.run(args, options)
121
127
  rescue => e
122
128
  error_handling(CONFIG, e)
123
- raise e
129
+ exit 1
124
130
  end
125
131
  end
126
132
  end
@@ -128,62 +134,54 @@ module DeployGate
128
134
  run!
129
135
  end
130
136
 
137
+ # @param [String] command
131
138
  # @param [Exception] error
132
- # @return [String]
133
- def create_error_issue_body(error)
134
- return <<EOF
135
-
136
- # Status
137
- deploygate-cli ver #{DeployGate::VERSION}
139
+ def error_handling(command, error)
140
+ STDERR.puts HighLine.color(I18n.t('command_builder.error_handling.message', message: error.message), HighLine::RED)
141
+ return if ENV['CI'] # When run ci server
142
+ return if error.kind_of?(DeployGate::RavenIgnoreException)
138
143
 
139
- # Error message
140
- #{error.message}
144
+ dg_version = DeployGate::VERSION
145
+ tags = {
146
+ command: command,
147
+ dg_version: dg_version
148
+ }
149
+ version = Gym::Xcode.xcode_version
150
+ tags[:xcode_version] = version if version.present?
141
151
 
142
- # Backtrace
143
- ```
144
- #{error.backtrace.join("\n")}
145
- ```
146
- EOF
152
+ puts ''
153
+ puts error_report(error, dg_version, version)
154
+ if HighLine.agree(I18n.t('command_builder.error_handling.agree')) {|q| q.default = "y"}
155
+ tags = {
156
+ command: command,
157
+ dg_version: DeployGate::VERSION
158
+ }
159
+ version = Gym::Xcode.xcode_version
160
+ tags[:xcode_version] = version if version.present?
161
+
162
+ Raven.capture_exception(error, tags: tags)
163
+ puts HighLine.color(I18n.t('command_builder.error_handling.thanks'), HighLine::GREEN)
164
+ end
147
165
  end
148
166
 
149
- # @param [Symbol] command
150
- # @param [Exception] error
151
- # @return [String]
152
- def create_issue_url(command, error)
153
- title = case command
154
- when LOGIN
155
- I18n.t('command_builder.login.error', e: error.class)
156
- when LOGOUT
157
- I18n.t('command_builder.logout.error', e: error.class)
158
- when DEPLOY
159
- I18n.t('command_builder.deploy.error', e: error.class)
160
- when ADD_DEVICES
161
- I18n.t('command_builder.add_devices.error', e: error.class)
162
- when CONFIG
163
- I18n.t('command_builder.config.error', e: error.class)
164
- end
165
-
166
- options = {
167
- :title => title,
168
- :body => create_error_issue_body(error),
169
- }
170
- GithubIssueRequest::Url.new(options).to_s
171
- end
167
+ def error_report(error, dg_version, xcode_version)
168
+ meta_info = "dg version: #{dg_version}"
169
+ meta_info += "\nXcode version: #{xcode_version}" if xcode_version.present?
172
170
 
173
- # @param [Symbol] command
174
- # @param [Exception] error
175
- def error_handling(command, error)
176
- STDERR.puts HighLine.color(I18n.t('command_builder.error_handling.message', message: error.message), HighLine::RED)
171
+ backtrace = error.backtrace.take(5).join("\n")
172
+ backtrace += "\nand more ..." if error.backtrace.count > 5
177
173
 
178
- return if ENV['CI'] # When run ci server
179
- return if error.kind_of?(DeployGate::NotIssueError)
180
- puts ''
181
- if HighLine.agree(I18n.t('command_builder.error_handling.agree')) {|q| q.default = "n"}
182
- url = create_issue_url(command, error)
183
- puts I18n.t('command_builder.error_handling.please_open', url: url)
184
- system('open', url) if Commands::Deploy::Push.openable?
185
- end
186
- puts ''
174
+ <<EOF
175
+ ------------------------
176
+ DeployGate Error Report
177
+
178
+ Title: #{error}
179
+ #{meta_info}
180
+
181
+ Stack trace:
182
+ #{backtrace}
183
+ ------------------------
184
+ EOF
187
185
  end
188
186
 
189
187
  # @return [void]
@@ -205,6 +203,8 @@ EOF
205
203
  else
206
204
  request_gem_update_checker
207
205
  end
206
+ rescue => e
207
+ STDERR.puts I18n.t('errors.check_update_failure')
208
208
  end
209
209
 
210
210
  # @return [void]