deploygate 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjgxYTY1MzAxYWExNTlhMTJhNDdkMTZlZTQwMjcxNWZhYTIyYWY1Nw==
4
+ YzM2OGRjMTVmYWJmODU1YTc0MDI3MzZjNTIwMDMyOThhNjNmMGQ1OQ==
5
5
  data.tar.gz: !binary |-
6
- Mjc2MjA3YzZjZDJhMWJhYzVmYmIzNGFjYmUxMWIxYzk0YjQyZTYyOQ==
6
+ ZWZmMTNjMzA0YmY0YmI0NjEwZjgzOWEyZjk4YmExYmZjNTg3ZjE1Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDUwM2Y0NjYxOGZhOTQ3NjRjOWYwNTBjOTM5ZDJlN2I3YzE4Y2E2MmRkZjg5
10
- MGQyMGJjYjJhYmI1NDZjNWE4OTM0ZWYyNDQ4NmJiZjRhNmM5NTBkNGZkNTAz
11
- NzYzMTdiMmEyMTAyMDJkMmVkOWQ5ZDRjZjJmM2RiZDQwNWM2NmE=
9
+ NzY5MDBhZjU4NDliNzM4NDg0Yjg4NDE0NWZhYjFiYTE0ZjIyMWZmODZjNzY2
10
+ NGU2MThmNjVmNDhmMDMwMmM0NTFhY2Y4Y2RjOGI0ZjYxMTQ3MTRkODI5MmZm
11
+ ZGNhNzczMmNmMjE1NTM5YzMzY2ZlY2JkZjliMmZiNDFhZGM3ZjA=
12
12
  data.tar.gz: !binary |-
13
- MmYxMTUwMzYwZmY1NzFjZTNjYzYzODJlMTg4NjZjZTRhYTgyZjBhYmQ0YzIx
14
- YTVmMDNkZGExNjA1OGFhZjA3M2ZkYTBhZjhjNTM2Y2ZlNjc0MjQ2MjIwOGIz
15
- YmJhNWQ5MThmMjg4ZmE0OTYyZTJjZWE3YzU0YjY5NjZiNzhkNmY=
13
+ NzVkMWE5ZTdkNWI4NzQ1NTM5MDg2MjlkZmM1MGFlNTMzMzBkYjBkZjZlMzNi
14
+ Yzg5NmQxOTM4MGM1ZjQ2MzA3Nzc5Nzg3YWJhNGE2M2E2MWRjNzAzM2ZiNjIy
15
+ NmRjMTVlZjZhMzIyZjc5ZDI1ZWY5YzFlMWQ4YjFjODEzY2JkZTg=
@@ -0,0 +1,41 @@
1
+ internal_locale: en
2
+ base_locale: en
3
+ locales:
4
+ - en
5
+ data:
6
+ adapter: I18n::Tasks::Data::FileSystem
7
+ read:
8
+ - config/locales/%{locale}.yml
9
+ write:
10
+ - config/locales/%{locale}.yml
11
+ search:
12
+ scanner: I18n::Tasks::Scanners::PatternWithScopeScanner
13
+ relative_roots:
14
+ - lib/deploygate
15
+ paths:
16
+ - lib/
17
+ exclude:
18
+ - "*.jpg"
19
+ - "*.png"
20
+ - "*.gif"
21
+ - "*.svg"
22
+ - "*.ico"
23
+ - "*.eot"
24
+ - "*.otf"
25
+ - "*.ttf"
26
+ - "*.woff"
27
+ - "*.woff2"
28
+ - "*.pdf"
29
+ - "*.css"
30
+ - "*.sass"
31
+ - "*.scss"
32
+ - "*.less"
33
+ - "*.yml"
34
+ - "*.json"
35
+ ignore_lines:
36
+ rb: "^\\s*#(?!\\si18n-tasks-use)"
37
+ opal: "^\\s*#(?!\\si18n-tasks-use)"
38
+ haml: "^\\s*-\\s*#(?!\\si18n-tasks-use)"
39
+ slim: "^\\s*(?:-#|/)(?!\\si18n-tasks-use)"
40
+ coffee: "^\\s*#(?!\\si18n-tasks-use)"
41
+ erb: "^\\s*<%\\s*#(?!\\si18n-tasks-use)"
@@ -0,0 +1,162 @@
1
+ ---
2
+ en:
3
+ command_builder:
4
+ name: 'dg'
5
+ description: 'Control DeployGate from your terminal.'
6
+ login:
7
+ description: 'Log in to DeployGate'
8
+ error: 'Commands::Login Error: %{e}'
9
+ deploy:
10
+ description: 'Build and upload a new build'
11
+ message: 'Build description message'
12
+ user: 'User or organization name of app owner'
13
+ distribution_key: 'If you also want to update distribution page, set the last part of the URL of the page'
14
+ open: 'Open a browser after the build uploaded (OS X only)'
15
+ disable_notify: 'Disable email notification (iOS app only)'
16
+ error: 'Commands::Deploy Error: %{e}'
17
+ add_devices:
18
+ 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.'
19
+ user: 'Owner user or organization name'
20
+ udid: 'UDID to be registered'
21
+ device_name: 'Device name to be registered'
22
+ error: 'Commands::AddDevices Error: %{e}'
23
+ logout:
24
+ description: 'Log out current session'
25
+ error: 'Commands::Logout Error: %{e}'
26
+ config:
27
+ 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."
28
+ json: 'Set output format to JSON'
29
+ name: 'DeployGate user name'
30
+ token: 'DeployGate API token'
31
+ error: 'Commands::Config Error: %{e}'
32
+ error_handling:
33
+ agree: 'Do you want to report this issue on GitHub? (y/n) '
34
+ please_open: 'Please open GitHub issue: %{url}'
35
+ show_update_message: |
36
+ #################################################################
37
+ # %{gem_name} %{latest_version} is available. You are on %{current_version}.
38
+ # It is recommended to use the latest version.
39
+ # You can update it by running 'gem update %{gem_name}'.
40
+ #################################################################
41
+ commands:
42
+ deploy:
43
+ build:
44
+ print_no_target: |
45
+ No deploy target found.
46
+ Please run dg on the root directory of Android/iOS project or specify .apk/.ipa file to deploy.
47
+ push:
48
+ upload:
49
+ loading: 'Uploading to %{owner}..'
50
+ upload_error: 'failed'
51
+ upload_success:
52
+ done: 'done'
53
+ data_message: |
54
+ Name: %{application_name}
55
+ Owner: %{owner_name}
56
+ Package: %{package_name}
57
+ Revision: %{revision}
58
+ URL: %{web_url}
59
+ add_devices:
60
+ input_udid: 'Enter UDID: '
61
+ input_device_name: 'Set device name: '
62
+ device_register_confirm: 'A device will be registered as the contents above. Is it OK? (y/n) '
63
+ select_devices:
64
+ device_info: 'Device [%{device}]'
65
+ agree: 'Do you want to add this device? (y/n) '
66
+ success_registered_device: 'Device [%{device}] successfully registered.'
67
+ not_device: 'No device found to be registered'
68
+ ios_only_command: 'This command is only for iOS project'
69
+ unknown_application:
70
+ data: |
71
+ Owner: %{owner}
72
+ Bundle identifier: %{bundle_id}
73
+ message: 'Application is not registered on DeployGate'
74
+ unknown_user: 'The specified user does not exist on DeployGate.'
75
+ config:
76
+ print_login_failed:
77
+ message: 'Login failed'
78
+ note: 'Please check your user name and API token.'
79
+ print_not_login:
80
+ message: 'No user logged in'
81
+ note: |
82
+ Please login to DeployGate by running:
83
+ $ dg login
84
+ print_login_user: 'User name: %{name}'
85
+ login:
86
+ start_login_or_create_account:
87
+ welcome: 'Welcome to DeployGate!'
88
+ email: 'Email: '
89
+ check_account: 'Checking for your account...'
90
+ input_password: 'Password: '
91
+ start:
92
+ login_error: |
93
+ Could not log in to DeployGate.
94
+ Please try again.
95
+ success: 'Hello %{name}!'
96
+ create_account:
97
+ prompt: "Looks new to DeployGate. Let's set up your account, just choose your user name and password."
98
+ creating: 'Creating your account... '
99
+ error: |
100
+ Could not create your account.
101
+ Please try again.
102
+ success: 'done! Your account has been set up successfully.'
103
+ input_new_account_name:
104
+ input_user_name: 'Username: '
105
+ checking: 'Checking for availability... '
106
+ already_used_user_name: 'Sorry, %{user_name} was already taken. Please try again.'
107
+ success: 'Good, %{user_name} is available.'
108
+ input_new_account_password:
109
+ input_password: 'Password: '
110
+ input_same_password: 'Type the same password: '
111
+ error: "Passwords didn't match. Please type again."
112
+ logout:
113
+ success: |
114
+ Logout success!
115
+ Goodbye! :)
116
+ xcode:
117
+ export:
118
+ create_provisioning:
119
+ created: 'App ID %{identifier} was created'
120
+ error:
121
+ failed_to_create:
122
+ app_id: 'Error: Failed to create App ID'
123
+ provisioning_profile: 'Error: Failed to create provisioning profile'
124
+ select_teams:
125
+ prompt: 'Please select a team'
126
+ choice: '%{team_id} %{team_name}'
127
+ check_local_certificates:
128
+ not_local_install_certificate:
129
+ error_message: 'Error: No applicable iPhone Distribution certificate found on your Mac.'
130
+ note: |
131
+ No "iPhone Distribution" certificate and/or corresponding private key installed locally.
132
+ To sign your application code, make sure you have installed them and available in your Keychain.
133
+
134
+ See also: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html
135
+ conflict_certificate:
136
+ error_message: 'Error: Too many certificates found.'
137
+ note: |
138
+ You have more than one "iPhone Distribution" certificate installed on your Mac.
139
+ Please remove other unnecessary certificates from your Keychain.
140
+ clean_provisioning_profiles:
141
+ start: 'Cleaning local Provisioning Profiles...'
142
+ delete: 'Delete %{path}'
143
+ finish: 'Finish cleaning local Provisionig Profiles'
144
+ analyze:
145
+ target_bundle_identifier:
146
+ prompt: |
147
+ Please input your app bundle identifier
148
+ Example: com.example.ios
149
+ ask: 'Enter your app bundle identifier: '
150
+ ios:
151
+ build:
152
+ error:
153
+ use_xcode: 'Current Xcode used to build: %{use_xcode_path} (via xcode-select)'
154
+ member_center:
155
+ input_email:
156
+ prompt: |
157
+ Please enter your email and password for Apple Developer Center
158
+ to set up/download provisioning profile automatically so you can
159
+ export the app without any extra steps.
160
+
161
+ Note: Your password will be stored to your Keychain and never be sent to DeployGate.
162
+ email: 'Email: '
data/deploygate.gemspec CHANGED
@@ -23,7 +23,6 @@ POST_INSTALL_MESSAGE
23
23
  spec.add_dependency 'json', '~> 1.8.2'
24
24
  spec.add_dependency 'httpclient', '~> 2.2.5'
25
25
  spec.add_dependency 'commander', '~> 4.3.5'
26
- spec.add_dependency 'color_echo', '~> 2.0.1'
27
26
  spec.add_dependency 'plist', '~> 3.1.0'
28
27
  spec.add_dependency 'xcodeproj', '~> 0.28.2'
29
28
  spec.add_dependency 'github_issue_request', '~> 0.0.2'
@@ -31,6 +30,7 @@ POST_INSTALL_MESSAGE
31
30
  spec.add_dependency 'uuid', '~> 2.3.8'
32
31
  spec.add_dependency 'gem_update_checker', '~> 0.2.0'
33
32
  spec.add_dependency 'activesupport', '~> 4.2.4'
33
+ spec.add_dependency 'i18n'
34
34
 
35
35
  # ios build
36
36
  spec.add_dependency 'gym', '~> 1.0.0'
@@ -42,6 +42,7 @@ POST_INSTALL_MESSAGE
42
42
  spec.add_development_dependency "rake"
43
43
  spec.add_development_dependency "rspec", "~> 3.3.0"
44
44
  spec.add_development_dependency "webmock", "~> 1.21.0"
45
+ spec.add_development_dependency "i18n-tasks"
45
46
 
46
47
  spec.files = `git ls-files`.split($/)
47
48
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
data/lib/deploygate.rb CHANGED
@@ -3,7 +3,6 @@ require "json"
3
3
  require "httpclient"
4
4
  require "io/console"
5
5
  require "rbconfig"
6
- require "color_echo"
7
6
  require "openssl"
8
7
  require "plist"
9
8
  require "find"
@@ -18,6 +17,9 @@ require "open3"
18
17
  require "open-uri"
19
18
  require "rexml/document"
20
19
 
20
+ require "i18n"
21
+ I18n.load_path = Dir[File.join(File.dirname(__FILE__), '../config/locales/*.yml')]
22
+
21
23
  # ios build
22
24
  require "gym"
23
25
  require "spaceship"
@@ -31,10 +33,12 @@ require "deploygate/api/v1/base"
31
33
  require "deploygate/api/v1/session"
32
34
  require "deploygate/api/v1/push"
33
35
  require "deploygate/api/v1/user"
36
+ require "deploygate/api/v1/users/app"
34
37
  require "deploygate/command_builder"
35
38
  require "deploygate/commands/login"
36
39
  require "deploygate/commands/logout"
37
40
  require "deploygate/commands/config"
41
+ require "deploygate/commands/add_devices"
38
42
  require "deploygate/commands/deploy"
39
43
  require "deploygate/commands/deploy/push"
40
44
  require "deploygate/commands/deploy/build"
@@ -45,12 +49,10 @@ require "deploygate/session"
45
49
  require "deploygate/deploy"
46
50
  require "deploygate/project"
47
51
  require "deploygate/user"
48
- require "deploygate/message/error"
49
- require "deploygate/message/success"
50
- require "deploygate/message/warning"
51
52
  require "deploygate/xcode/member_center"
52
53
  require "deploygate/xcode/member_centers/app"
53
54
  require "deploygate/xcode/member_centers/provisioning_profile"
55
+ require "deploygate/xcode/member_centers/device"
54
56
  require "deploygate/xcode/export"
55
57
  require "deploygate/xcode/analyze"
56
58
  require "deploygate/xcode/ios"
@@ -0,0 +1,39 @@
1
+ module DeployGate
2
+ module API
3
+ module V1
4
+ module Users
5
+ class App
6
+ ENDPOINT = "/users/%s/platforms/%s/apps/%s"
7
+
8
+ class << self
9
+ def not_provisioned_udids(token, name, package_name, platform = 'ios')
10
+ res = Base.new(token).get("#{sprintf(ENDPOINT, name, platform, package_name)}/udids", {})
11
+
12
+ udids_results = {
13
+ :error => res['error'],
14
+ :message => res['because']
15
+ }
16
+
17
+ results = res['results']
18
+ unless results.nil?
19
+ results.reject!{|r| r['is_provisioned']}
20
+
21
+ udids_results[:results] =
22
+ results.map do |result|
23
+ {
24
+ :udid => result['udid'],
25
+ :user_name => result['user_name'],
26
+ :device_name => result['device_name'],
27
+ :is_provisioned => result['is_provisioned']
28
+ }
29
+ end
30
+ end
31
+
32
+ udids_results
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -4,21 +4,26 @@ module DeployGate
4
4
  attr_reader :arguments
5
5
 
6
6
  def run
7
+ Signal.trap(:INT){
8
+ puts ''
9
+ exit 0
10
+ }
11
+
7
12
  GithubIssueRequest::Url.config('deploygate', 'deploygate-cli')
8
13
  check_update()
9
14
 
10
- program :name, 'dg'
15
+ program :name, I18n.t('command_builder.name')
11
16
  program :version, VERSION
12
- program :description, 'You can control to DeployGate in your terminal.'
17
+ program :description, I18n.t('command_builder.description')
13
18
 
14
19
  command :login do |c|
15
20
  c.syntax = 'dg login'
16
- c.description = 'DeployGate login command'
21
+ c.description = I18n.t('command_builder.login.description')
17
22
  c.action do |args, options|
18
23
  begin
19
24
  Commands::Login.run
20
25
  rescue => e
21
- error_handling("Commands::Login Error: #{e.class}", create_error_issue_body(e))
26
+ error_handling(I18n.t('command_builder.login.error', e: e.class), create_error_issue_body(e))
22
27
  raise e
23
28
  end
24
29
  end
@@ -26,32 +31,49 @@ module DeployGate
26
31
 
27
32
  command :deploy do |c|
28
33
  c.syntax = 'dg deploy /path/to/app'
29
- c.description = 'upload to deploygate'
30
- c.option '--message STRING', String, 'release message'
31
- c.option '--user STRING', String, 'owner name or group name'
32
- c.option '--distribution-key STRING', String, 'update distribution key'
33
- c.option '--open', 'open browser (OSX only)'
34
- c.option '--disable_notify', 'disable notify via email (iOS app only)'
34
+ c.description = I18n.t('command_builder.deploy.description')
35
+ c.option '--message STRING', String, I18n.t('command_builder.deploy.message')
36
+ c.option '--user STRING', String, I18n.t('command_builder.deploy.user')
37
+ c.option '--distribution-key STRING', String, I18n.t('command_builder.deploy.distribution_key')
38
+ c.option '--open', I18n.t('command_builder.deploy.open')
39
+ c.option '--disable_notify', I18n.t('command_builder.deploy.disable_notify')
35
40
  c.action do |args, options|
36
41
  options.default :message => '', :user => nil, :open => false, 'disable_notify' => false
37
42
  begin
38
43
  Commands::Deploy.run(args, options)
39
44
  rescue => e
40
- error_handling("Commands::Deploy Error: #{e.class}", create_error_issue_body(e))
45
+ error_handling(I18n.t('command_builder.deploy.error', e: e.class), create_error_issue_body(e))
41
46
  raise e
42
47
  end
43
48
  end
44
49
  end
45
50
  alias_command :'push', :deploy
46
51
 
52
+ command 'add-devices' do |c|
53
+ c.syntax = 'dg add-devices'
54
+ c.description = I18n.t('command_builder.add_devices.description')
55
+ c.option '--user STRING', String, I18n.t('command_builder.add_devices.user')
56
+ c.option '--udid STRING', String, I18n.t('command_builder.add_devices.udid')
57
+ c.option '--device-name STRING', String, I18n.t('command_builder.add_devices.device_name')
58
+ c.action do |args, options|
59
+ options.default :user => nil
60
+ begin
61
+ Commands::AddDevices.run(args, options)
62
+ rescue => e
63
+ error_handling(I18n.t('command_builder.add_devices.error', e: e.class), create_error_issue_body(e))
64
+ raise e
65
+ end
66
+ end
67
+ end
68
+
47
69
  command :logout do |c|
48
70
  c.syntax = 'dg logout'
49
- c.description = 'logout'
71
+ c.description = I18n.t('command_builder.logout.description')
50
72
  c.action do |args, options|
51
73
  begin
52
74
  Commands::Logout.run
53
75
  rescue => e
54
- error_handling("Commands::Logout Error: #{e.class}", create_error_issue_body(e))
76
+ error_handling(I18n.t('command_builder.logout.error', e: e.class), create_error_issue_body(e))
55
77
  raise e
56
78
  end
57
79
  end
@@ -59,15 +81,15 @@ module DeployGate
59
81
 
60
82
  command :config do |c|
61
83
  c.syntax = 'dg config'
62
- c.description = 'dg user login config'
63
- c.option '--json', 'output json format'
64
- c.option '--name STRING', String, 'your DeployGate user name'
65
- c.option '--token STRING', String, 'your DeployGate api token'
84
+ c.description = I18n.t('command_builder.config.description')
85
+ c.option '--json', I18n.t('command_builder.config.json')
86
+ c.option '--name STRING', String, I18n.t('command_builder.config.name')
87
+ c.option '--token STRING', String, I18n.t('command_builder.config.token')
66
88
  c.action do |args, options|
67
89
  begin
68
90
  Commands::Config.run(args, options)
69
91
  rescue => e
70
- error_handling("Commands::Config Error: #{e.class}", create_error_issue_body(e))
92
+ error_handling(I18n.t('command_builder.config.error', e: e.class), create_error_issue_body(e))
71
93
  raise e
72
94
  end
73
95
  end
@@ -105,8 +127,8 @@ EOF
105
127
  }
106
128
  url = GithubIssueRequest::Url.new(options).to_s
107
129
  puts ''
108
- if HighLine.agree('Do you want to report this issue on GitHub? (y/n) ') {|q| q.default = "n"}
109
- puts "Please open github issue: #{url}"
130
+ if HighLine.agree(I18n.t('command_builder.error_handling.agree')) {|q| q.default = "n"}
131
+ puts I18n.t('command_builder.error_handling.please_open', url: url)
110
132
  system('open', url) if Commands::Deploy::Push.openable?
111
133
  end
112
134
  puts ''
@@ -154,16 +176,9 @@ EOF
154
176
  def show_update_message(latest_version)
155
177
  gem_name = DeployGate.name.downcase
156
178
  current_version = DeployGate::VERSION
157
- update_message =<<EOF
158
-
159
- #################################################################
160
- # #{gem_name} #{latest_version} is available. You are on #{current_version}.
161
- # It is recommended to use the latest version.
162
- # Update using 'gem update #{gem_name}'.
163
- #################################################################
164
-
165
- EOF
166
- DeployGate::Message::Warning.print(update_message)
179
+ STDERR.puts ''
180
+ STDERR.puts HighLine.color(I18n.t('command_builder.show_update_message', gem_name: gem_name, latest_version: latest_version, current_version: current_version), HighLine::YELLOW)
181
+ STDERR.puts ''
167
182
  end
168
183
  end
169
184
  end