capistrano-harrow 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/capistrano/harrow/api.rb +5 -1
- data/lib/capistrano/harrow/installer.rb +41 -26
- data/lib/capistrano/harrow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7348d2fff68dd4c25e1c96fd59de412db7058f73
|
4
|
+
data.tar.gz: 1ed8bd7185262d7c0501cadf7f7af095d158489b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23e220496e00e4ad0877cf7346aa306cc1f586f122c7eb25c50bf83fe67654271b83a3c0ab3f5964fbe8fe5d9cb3a107929a4bd809dfd7682cf5fca9de088cc4
|
7
|
+
data.tar.gz: 418470ac85cf41759192517462757521e527817d542cc4456b3c34a23a3a6008c416808754942feba56ac365ca1deaef800bf3dad48abf3e56e98a5b5f1289ad
|
@@ -35,7 +35,11 @@ module Capistrano
|
|
35
35
|
|
36
36
|
case response
|
37
37
|
when Net::HTTPSuccess
|
38
|
-
|
38
|
+
parsed_body = ::JSON.parse(response.body, symbolize_names: true)
|
39
|
+
is_participating = parsed_body.delete(:participating)
|
40
|
+
return false unless is_participating
|
41
|
+
|
42
|
+
return parsed_body
|
39
43
|
end
|
40
44
|
|
41
45
|
false
|
@@ -65,10 +65,7 @@ For this repository with the URL:
|
|
65
65
|
%<repository_url>s
|
66
66
|
|
67
67
|
},
|
68
|
-
|
69
|
-
|
70
|
-
def self.preinstall_message
|
71
|
-
%q{
|
68
|
+
preinstall: %q{
|
72
69
|
- Free for small projects!
|
73
70
|
|
74
71
|
- Test, deploy and collaborate online easily
|
@@ -80,11 +77,16 @@ For this repository with the URL:
|
|
80
77
|
- Works seamlessly for PHP, Node.js, Ansible, Python, Go,
|
81
78
|
Capistrano and more!
|
82
79
|
|
83
|
-
}
|
80
|
+
},
|
81
|
+
|
82
|
+
}
|
83
|
+
|
84
|
+
def message(tag, format_data)
|
85
|
+
sprintf(@messages.fetch(tag, tag.to_s), format_data)
|
84
86
|
end
|
85
87
|
|
86
|
-
def
|
87
|
-
|
88
|
+
def prompt(tag)
|
89
|
+
@prompts.fetch(tag, tag.to_s)
|
88
90
|
end
|
89
91
|
|
90
92
|
def initialize(params={ui: UI::TTY, api: API, config: Config::Git})
|
@@ -93,18 +95,22 @@ For this repository with the URL:
|
|
93
95
|
@api = params.fetch(:api)
|
94
96
|
@quit = false
|
95
97
|
@password = nil
|
98
|
+
update_message_catalog!({messages: MESSAGES,
|
99
|
+
prompts: PROMPTS})
|
96
100
|
end
|
97
101
|
|
98
102
|
def install!
|
99
103
|
return if @config.disabled?
|
100
104
|
return if @config.installed?
|
101
|
-
|
105
|
+
messages = @api.participating?(signup_data)
|
106
|
+
return unless messages
|
107
|
+
update_message_catalog!(messages)
|
102
108
|
|
103
109
|
@ui.show Banner.new.to_s
|
104
|
-
@ui.show
|
110
|
+
@ui.show message(:preinstall, {})
|
105
111
|
|
106
112
|
begin
|
107
|
-
if @ui.prompt(
|
113
|
+
if @ui.prompt(prompt(:want_install)).downcase == 'no'
|
108
114
|
quit!
|
109
115
|
return
|
110
116
|
end
|
@@ -116,16 +122,16 @@ For this repository with the URL:
|
|
116
122
|
data = signup_data
|
117
123
|
if data[:email].to_s.empty? or data[:name].to_s.empty?
|
118
124
|
begin
|
119
|
-
data[:name] = @ui.prompt(
|
120
|
-
data[:email] = @ui.prompt(
|
125
|
+
data[:name] = @ui.prompt(prompt(:enter_name), [])
|
126
|
+
data[:email] = @ui.prompt(prompt(:enter_email), [])
|
121
127
|
rescue UI::TimeoutError
|
122
128
|
quit!("timeout")
|
123
129
|
end
|
124
130
|
end
|
125
131
|
|
126
|
-
@ui.show
|
132
|
+
@ui.show message(:signup_data, data)
|
127
133
|
unless data[:repository_url].to_s.empty?
|
128
|
-
@ui.show
|
134
|
+
@ui.show message(:repository, data)
|
129
135
|
end
|
130
136
|
|
131
137
|
@password = prompt_password!
|
@@ -152,7 +158,7 @@ For this repository with the URL:
|
|
152
158
|
end
|
153
159
|
|
154
160
|
@quit = true
|
155
|
-
@ui.show(
|
161
|
+
@ui.show(message(:aborting,{reason: reason}))
|
156
162
|
end
|
157
163
|
|
158
164
|
def quit?
|
@@ -168,21 +174,21 @@ For this repository with the URL:
|
|
168
174
|
@config.organization_uuid = response_data[:organization_uuid]
|
169
175
|
if response_data.fetch(:reason, 'ok') == 'invalid'
|
170
176
|
if response_data.fetch(:errors, {}).fetch(:email, []).first == 'not_unique'
|
171
|
-
@ui.show
|
177
|
+
@ui.show message(:existing_account_found, {})
|
172
178
|
return :account_exists
|
173
179
|
else
|
174
|
-
@ui.show
|
180
|
+
@ui.show message(:api_fatal_error, {})
|
175
181
|
return response_data
|
176
182
|
end
|
177
183
|
else
|
178
|
-
@ui.show
|
184
|
+
@ui.show message(:installation_successful, response_data)
|
179
185
|
return :signed_up
|
180
186
|
end
|
181
187
|
rescue API::NetworkError
|
182
|
-
@ui.show
|
188
|
+
@ui.show message(:api_network_error, {})
|
183
189
|
should_retry = false
|
184
190
|
begin
|
185
|
-
if @ui.prompt(
|
191
|
+
if @ui.prompt(prompt(:retry_request), [:no, :yes]) == :yes
|
186
192
|
should_retry = true
|
187
193
|
end
|
188
194
|
rescue UI::TimeoutError
|
@@ -192,10 +198,10 @@ For this repository with the URL:
|
|
192
198
|
|
193
199
|
retry if should_retry
|
194
200
|
rescue API::ProtocolError
|
195
|
-
quit!
|
201
|
+
quit! message(:api_protocol_error, {})
|
196
202
|
return
|
197
203
|
rescue API::FatalError
|
198
|
-
quit!
|
204
|
+
quit! message(:api_fatal_error, {})
|
199
205
|
return
|
200
206
|
end
|
201
207
|
end
|
@@ -203,22 +209,31 @@ For this repository with the URL:
|
|
203
209
|
def prompt_password!
|
204
210
|
tries = 3
|
205
211
|
while tries > 0
|
206
|
-
password = @ui.prompt_password(
|
207
|
-
confirmed_password = @ui.prompt_password(
|
212
|
+
password = @ui.prompt_password(prompt(:enter_password))
|
213
|
+
confirmed_password = @ui.prompt_password(prompt(:confirm_password))
|
208
214
|
|
209
215
|
|
210
216
|
if password == confirmed_password && password.to_s.length >= 10
|
211
217
|
return password
|
212
218
|
elsif password.to_s.length < 10
|
213
|
-
@ui.show
|
219
|
+
@ui.show message(:password_too_short, {})
|
214
220
|
else
|
215
|
-
@ui.show
|
221
|
+
@ui.show message(:password_mismatch, {})
|
216
222
|
end
|
217
223
|
|
218
224
|
tries = tries - 1
|
219
225
|
end
|
220
226
|
end
|
221
227
|
|
228
|
+
def update_message_catalog!(new_messages)
|
229
|
+
return unless new_messages.respond_to? :fetch
|
230
|
+
@messages = {} unless @messages
|
231
|
+
@prompts = {} unless @prompts
|
232
|
+
|
233
|
+
@messages.merge!(new_messages.fetch(:messages, {}))
|
234
|
+
@prompts.merge!(new_messages.fetch(:prompts, {}))
|
235
|
+
end
|
236
|
+
|
222
237
|
end
|
223
238
|
end
|
224
239
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-harrow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Hambley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|