deploygate 0.8.3 → 0.8.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
  SHA256:
3
- metadata.gz: 785a1c89bea29d385d1bedb4deaeb9ce8148a5de83aaef2fbe889bb7b062c174
4
- data.tar.gz: 4c939c3a624ef686da3ce629b82ff445b59fcbf1267e887c55e5feed468d71fe
3
+ metadata.gz: a067b187ce090f469740902b25df05047db95908131057a995481c4a023b11bd
4
+ data.tar.gz: 8d67c1abb0a90436120bdfd45e0831b9002a7b2089c46a3d42cd3ac7d985143c
5
5
  SHA512:
6
- metadata.gz: 37644e62c47447cb9f6c9c0c974a0f9ffe6dc33ad67fc6399af8058bc6e50e0cc924f0526627a3a3a135202b8af251d3a6a90e268150126547266cb30bbbc6dc
7
- data.tar.gz: f9460ac50d4e6c34ae5560cd4ea7de5cfb82c6ac5b3d8952e5681826a3bcbbe4abfddce7ed1f078a322a2c1739c0c11576b2f970a176a00a7ec4443abe8489af
6
+ metadata.gz: 7a10f3ec84688ac65572f3ffb77a70f231436ae8222a6d2c7534a6e5cfa126eca71b4c8f2319ca8f7583c4257ae90896605b093af69dbcdc353e70f667307303
7
+ data.tar.gz: e5abc3793a771f2c1ac96cbaa875a80ab47e665993c7f4a77790f45c983ab557fe4d94345e34d03c9b2ad2ecbfada109bc6e2cacc50881c983da038c54740745
@@ -2,6 +2,7 @@
2
2
  en:
3
3
  errors:
4
4
  check_update_failure: 'Checking update failed'
5
+ account_not_found_error: 'Your account was not found. Please create it from https://deploygate.com'
5
6
  command_builder:
6
7
  name: 'dg'
7
8
  description: 'Control DeployGate from your terminal.'
@@ -95,7 +96,7 @@ en:
95
96
  $ dg login
96
97
  print_login_user: 'User name: %{name}'
97
98
  login:
98
- start_login_or_create_account:
99
+ start_login:
99
100
  welcome: 'Welcome to DeployGate!'
100
101
  email: 'Email: '
101
102
  check_account: 'Checking for your account...'
@@ -105,28 +106,6 @@ en:
105
106
  Could not log in to DeployGate.
106
107
  Please try again.
107
108
  success: 'Hello %{name}!'
108
- create_account:
109
- prompt: "Looks new to DeployGate. Let's set up your account, just choose your user name and password."
110
- creating: 'Creating your account... '
111
- error: |
112
- Could not create your account.
113
- Please try again.
114
- success: 'done! Your account has been set up successfully.'
115
- input_new_account_name:
116
- input_user_name: 'Username: '
117
- checking: 'Checking for availability... '
118
- already_used_user_name: 'Sorry, %{user_name} was already taken. Please try again.'
119
- success: 'Good, %{user_name} is available.'
120
- input_new_account_password:
121
- input_password: 'Password: '
122
- input_same_password: 'Type the same password: '
123
- error: "Passwords didn't match. Please type again."
124
- check_terms:
125
- terms_url: 'Terms of Service: https://deploygate.com/terms'
126
- privacy_url: 'Privacy Policy: https://deploygate.com/terms/privacy'
127
- note: "DeployGate properly manages your account information under GDPR, Japan's Personal Information Protection Act and our Privacy Policy."
128
- text: 'I agree to the Terms of Service and Privacy Policy (y/n) '
129
- error: 'You must agree to the Terms of Service and Privacy Policy.'
130
109
  logout:
131
110
  success: |
132
111
  Logout success!
@@ -6,30 +6,6 @@ module DeployGate
6
6
  ENDPOINT = '/users'
7
7
 
8
8
  class << self
9
- # @param [String] name
10
- # @param [String] email
11
- # @param [String] password
12
- # @param [String] locale
13
- # @return [Hash]
14
- def create(name, email, password, locale = 'en')
15
- res = Base.new().post(ENDPOINT, {:name => name, :email => email, :password => password, :locale => locale})
16
-
17
- user_create_results = {
18
- :error => res['error'],
19
- :message => res['because']
20
- }
21
-
22
- results = res['results']
23
- unless results.nil?
24
- user_create_results.merge!({
25
- :name => results['user']['name'],
26
- :token => results['api_token']
27
- })
28
- end
29
-
30
- user_create_results
31
- end
32
-
33
9
  # @param [String] name
34
10
  # @param [String] email
35
11
  # @return [Boolean]
@@ -11,7 +11,7 @@ module DeployGate
11
11
 
12
12
  session = DeployGate::Session.new
13
13
  unless session.login?
14
- Login.start_login_or_create_account()
14
+ Login.start_login()
15
15
  session = DeployGate::Session.new()
16
16
  end
17
17
 
@@ -13,7 +13,7 @@ module DeployGate
13
13
  def upload(args, options)
14
14
  session = DeployGate::Session.new()
15
15
  unless session.login?
16
- Login.start_login_or_create_account()
16
+ Login.start_login()
17
17
  session = DeployGate::Session.new()
18
18
  end
19
19
 
@@ -6,7 +6,7 @@ module DeployGate
6
6
  # @param [Array] args
7
7
  # @param [Commander::Command::Options] options
8
8
  def run(args, options)
9
- Login.start_login_or_create_account() unless DeployGate::Session.new.login?
9
+ Login.start_login() unless DeployGate::Session.new.login?
10
10
 
11
11
  # push or build(android/ios)
12
12
  args.push(Dir.pwd) if args.empty?
@@ -1,6 +1,8 @@
1
1
  module DeployGate
2
2
  module Commands
3
3
  class Login
4
+ class AccountNotFoundError < DeployGate::RavenIgnoreException; end
5
+
4
6
  class << self
5
7
 
6
8
  # @return [void]
@@ -8,31 +10,32 @@ module DeployGate
8
10
  welcome()
9
11
 
10
12
  if options.terminal
11
- start_login_or_create_account()
13
+ start_login()
12
14
  else
13
15
  DeployGate::BrowserLogin.new().start()
14
16
  end
15
17
  end
16
18
 
17
19
  def welcome
18
- puts I18n.t('commands.login.start_login_or_create_account.welcome')
20
+ puts I18n.t('commands.login.start_login.welcome')
19
21
  print_deploygate_aa()
20
22
  end
21
23
 
22
24
  # @return [void]
23
- def start_login_or_create_account
25
+ # @raise [AccountNotFoundError] emailに一致するUserが存在しないとき
26
+ def start_login
24
27
  puts ''
25
- email = ask(I18n.t('commands.login.start_login_or_create_account.email'))
28
+ email = ask(I18n.t('commands.login.start_login.email'))
26
29
 
27
30
  puts ''
28
- puts I18n.t('commands.login.start_login_or_create_account.check_account')
31
+ puts I18n.t('commands.login.start_login.check_account')
29
32
  if DeployGate::User.registered?('', email)
30
33
  puts ''
31
- password = input_password(I18n.t('commands.login.start_login_or_create_account.input_password'))
34
+ password = input_password(I18n.t('commands.login.start_login.input_password'))
32
35
  puts ''
33
36
  start(email, password)
34
37
  else
35
- create_account(email)
38
+ raise AccountNotFoundError, HighLine.color(I18n.t('errors.account_not_found_error'))
36
39
  end
37
40
  end
38
41
 
@@ -56,69 +59,6 @@ module DeployGate
56
59
  puts HighLine.color(I18n.t('commands.login.start.success', name: session.name), HighLine::GREEN)
57
60
  end
58
61
 
59
- # @param [String] email
60
- # @return [void]
61
- def create_account(email)
62
- puts I18n.t('commands.login.create_account.prompt')
63
- puts ''
64
-
65
- name = input_new_account_name()
66
- puts ''
67
-
68
- password = input_new_account_password()
69
- puts ''
70
-
71
- unless check_terms
72
- puts HighLine.color(I18n.t('commands.login.check_terms.error'), HighLine::RED)
73
- exit 1
74
- end
75
-
76
- print I18n.t('commands.login.create_account.creating')
77
- if DeployGate::User.create(name, email, password).nil?
78
- puts HighLine.color(I18n.t('commands.login.create_account.error'), HighLine::RED)
79
- raise 'User create error'
80
- else
81
- puts HighLine.color(I18n.t('commands.login.create_account.success'), HighLine::GREEN)
82
- start(email, password)
83
- end
84
- end
85
-
86
- # @return [String]
87
- def input_new_account_name
88
- user_name = ask(I18n.t('commands.login.input_new_account_name.input_user_name'))
89
- print I18n.t('commands.login.input_new_account_name.checking')
90
-
91
- if DeployGate::User.registered?(user_name, '')
92
- puts HighLine.color(I18n.t('commands.login.input_new_account_name.already_used_user_name', user_name: user_name), HighLine::RED)
93
- return input_new_account_name()
94
- else
95
- puts HighLine.color(I18n.t('commands.login.input_new_account_name.success', user_name: user_name), HighLine::GREEN)
96
- return user_name
97
- end
98
- end
99
-
100
- # @return [String]
101
- def input_new_account_password
102
- password = input_password(I18n.t('commands.login.input_new_account_password.input_password'))
103
- secound_password = input_password(I18n.t('commands.login.input_new_account_password.input_same_password'))
104
-
105
- if password == secound_password
106
- return password
107
- else
108
- puts HighLine.color(I18n.t('commands.login.input_new_account_password.error'), HighLine::RED)
109
- return input_new_account_password()
110
- end
111
- end
112
-
113
- # @return [boolean]
114
- def check_terms
115
- puts I18n.t('commands.login.check_terms.terms_url')
116
- puts I18n.t('commands.login.check_terms.privacy_url')
117
- puts I18n.t('commands.login.check_terms.note')
118
- puts ''
119
- HighLine.agree(I18n.t('commands.login.check_terms.text')) {|q| q.default = "n"}
120
- end
121
-
122
62
  # @return [String]
123
63
  def input_password(message)
124
64
  ask(message) { |q| q.echo = "*" }
@@ -8,17 +8,6 @@ module DeployGate
8
8
  @name = name
9
9
  end
10
10
 
11
- # @param [String] name
12
- # @param [String] email
13
- # @param [String] password
14
- # @return [DeployGate::User]
15
- def self.create(name, email, password)
16
- locale = Locale.current.language
17
- results = DeployGate::API::V1::User.create(name, email, password, locale)
18
- return if results[:error]
19
- DeployGate::User.new(results[:name])
20
- end
21
-
22
11
  # @param [String] name
23
12
  # @param [String] email
24
13
  # @return [Boolean]
@@ -1,3 +1,3 @@
1
1
  module DeployGate
2
- VERSION = '0.8.3'
2
+ VERSION = '0.8.4'
3
3
  end
@@ -1,31 +1,4 @@
1
1
  describe DeployGate::API::V1::User do
2
- describe "#create" do
3
- it "success" do
4
- name = 'test'
5
- email = 'email'
6
- password = 'password'
7
- token = 'token'
8
- response = {
9
- :error => false,
10
- :because => '',
11
- :results => {
12
- :user => {:name => name},
13
- :api_token => token
14
- }
15
- }
16
- stub_request(:post, "#{API_ENDPOINT}/users").
17
- to_return(:body => response.to_json)
18
-
19
- results = DeployGate::API::V1::User.create(name, email, password)
20
- expect(results).to eq({
21
- :error => response[:error],
22
- :message => response[:because],
23
- :name => name,
24
- :token => token
25
- })
26
- end
27
- end
28
-
29
2
  describe "#registered?" do
30
3
  it "registered" do
31
4
  name = 'test'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploygate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - deploygate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-30 00:00:00.000000000 Z
11
+ date: 2022-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json