app42 0.6.0 → 0.6.1
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/RELEASE.md +5 -0
- data/lib/app42/base/constants.rb +3 -2
- data/lib/app42/base/help.rb +69 -8
- data/lib/app42/base/message.rb +3 -2
- data/lib/app42/base/shell.rb +4 -1
- data/lib/app42/base/util.rb +14 -0
- data/lib/app42/command/app.rb +36 -0
- data/lib/app42/command/base.rb +50 -0
- data/lib/app42/command/client.rb +10 -1
- data/lib/app42/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: b563b365eec3cf93e1160c083f5cc4f22b04b5e2
|
4
|
+
data.tar.gz: 78e962500cb7d379345e94b2f3594c774a89b17f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 916f535b002c643f889b1d7e90394d09df490b29213b05cf31c72042aacc10905cd852da210a51eafa5b5ac25ccd726ca5f78528eaccfec46a16b7336d92c100
|
7
|
+
data.tar.gz: d84f0c05d59cd4a3f432cd818159bd305f4f43bf82a586b2943d460fe2206a2bdf5c99e84dd5010846394a4cc02da9028092fa7efc0ff68fd9e9462cc7e860d0
|
data/RELEASE.md
CHANGED
data/lib/app42/base/constants.rb
CHANGED
@@ -28,8 +28,9 @@ module App42
|
|
28
28
|
DATABASE_NAME_NOT_ALLOWED = %w(mysql couchdb mongodb postgresql database sql)
|
29
29
|
|
30
30
|
# regex for special character
|
31
|
-
SPECIAL
|
32
|
-
REGEX
|
31
|
+
SPECIAL = "?<>',?[]}{=-)(*&^%$#`~{}@ .+!_/"
|
32
|
+
REGEX = /[#{SPECIAL.gsub(/./){|char| "\\#{char}"}}]/
|
33
|
+
URL_REGEX = /(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/
|
33
34
|
|
34
35
|
# regex for special character (Database Name)
|
35
36
|
DBNAME_SPECIAL = "?<>',?[]}{=-)(*&^%$#`~{}@ .+!/"
|
data/lib/app42/base/help.rb
CHANGED
@@ -45,6 +45,9 @@ module App42
|
|
45
45
|
appInfo # Show meta information of the application
|
46
46
|
appState # Show current state of the application
|
47
47
|
logs # Returns the log file URL(s) for the application
|
48
|
+
addCustomURL # Add a custom URL to an app
|
49
|
+
removeCustomURL # Remove a custom URL from an app
|
50
|
+
customURLInfo # List all custom URLs of an app
|
48
51
|
|
49
52
|
Services
|
50
53
|
createService # Creates a new service e.g. MySQL, MongoDB, CouchDB, PostgreSQL etc.
|
@@ -1092,10 +1095,9 @@ Example:
|
|
1092
1095
|
$app42 upgradeBPaaS
|
1093
1096
|
Enter Setup Name: demo
|
1094
1097
|
|
1095
|
-
1:
|
1096
|
-
2:
|
1097
|
-
|
1098
|
-
Select Flavour [Light]: 2
|
1098
|
+
1: Medium
|
1099
|
+
2: Heavy
|
1100
|
+
Select Flavour [Medium]: 2
|
1099
1101
|
|
1100
1102
|
Upgrading Setup... OK
|
1101
1103
|
|
@@ -1208,10 +1210,9 @@ Example:
|
|
1208
1210
|
$app42 upgradeWordPress
|
1209
1211
|
Enter Setup Name: demo
|
1210
1212
|
|
1211
|
-
1:
|
1212
|
-
2:
|
1213
|
-
|
1214
|
-
Select Flavour [Light]: 2
|
1213
|
+
1: Medium
|
1214
|
+
2: Heavy
|
1215
|
+
Select Flavour [Medium]: 2
|
1215
1216
|
|
1216
1217
|
Upgrading Setup... OK
|
1217
1218
|
|
@@ -1306,6 +1307,66 @@ Example:
|
|
1306
1307
|
DESC
|
1307
1308
|
end
|
1308
1309
|
|
1310
|
+
def addcustomurl
|
1311
|
+
print <<-DESC
|
1312
|
+
Usage:
|
1313
|
+
app42 addCustomURL
|
1314
|
+
|
1315
|
+
Add a custom URL to an app
|
1316
|
+
|
1317
|
+
Example:
|
1318
|
+
$app42 addCustomURL
|
1319
|
+
Enter App Name: demo
|
1320
|
+
|
1321
|
+
Enter Custom URL: http://test.naveengoswami.com
|
1322
|
+
|
1323
|
+
Adding Custom URL To Application demo... OK
|
1324
|
+
Custom URL added successfully.
|
1325
|
+
|
1326
|
+
DESC
|
1327
|
+
end
|
1328
|
+
|
1329
|
+
def removecustomurl
|
1330
|
+
print <<-DESC
|
1331
|
+
Usage:
|
1332
|
+
app42 removeCustomURL
|
1333
|
+
|
1334
|
+
Remove a custom URL from an app
|
1335
|
+
|
1336
|
+
Example:
|
1337
|
+
$ app42 removeCustomURL
|
1338
|
+
Enter App Name: demo
|
1339
|
+
|
1340
|
+
Enter Custom URL: http://test.naveengoswami.com
|
1341
|
+
|
1342
|
+
Removing Custom URL... OK
|
1343
|
+
Custom URL deleted successfully.
|
1344
|
+
|
1345
|
+
DESC
|
1346
|
+
end
|
1347
|
+
|
1348
|
+
def customurlinfo
|
1349
|
+
print <<-DESC
|
1350
|
+
Usage:
|
1351
|
+
app42 customURLInfo
|
1352
|
+
|
1353
|
+
List all custom URLs of an app
|
1354
|
+
|
1355
|
+
Example:
|
1356
|
+
$app42 customURLInfo
|
1357
|
+
Enter App Name: demo
|
1358
|
+
|
1359
|
+
+----------+-----------------------+-------------------------------+
|
1360
|
+
| === testPhp Custome URLs Details === |
|
1361
|
+
+----------+-----------------------+-------------------------------+
|
1362
|
+
| App Name | Created On | Url |
|
1363
|
+
+-------------+-----------------------+----------------------------+
|
1364
|
+
| demo | 2014-01-27 06:35:55.0 | http://test.naveengoswami.com |
|
1365
|
+
+----------+-----------------------+-------------------------------+
|
1366
|
+
|
1367
|
+
DESC
|
1368
|
+
end
|
1369
|
+
|
1309
1370
|
def version
|
1310
1371
|
print <<-DESC
|
1311
1372
|
Usage:
|
data/lib/app42/base/message.rb
CHANGED
@@ -13,6 +13,7 @@ module Message
|
|
13
13
|
MORE_THAN_ONE_BINARY = "More than one binary exists at the specified location. Please choose one."
|
14
14
|
NO_BINARY = "No binary exists at the specified location."
|
15
15
|
NO_APP = "No App found."
|
16
|
+
NO_CUSTOM_URLS = "No Custom URLs found."
|
16
17
|
WAIT_FOR_WHILE = "Please be patient... This process may take a while to complete."
|
17
18
|
LATEST_S_WAIT = "\nOperation is in progress, Please wait..."
|
18
19
|
LATEST_S_INTERRUPT = "\nYour request is being processed. Please check the request status after sometime."
|
@@ -37,6 +38,6 @@ module Message
|
|
37
38
|
BAD_RESPONSE_ERROR = "Received bad HTTP response from"
|
38
39
|
|
39
40
|
# BPaaS and WordPress
|
40
|
-
HIGHLY_CONF = "
|
41
|
-
LOW_CONF = "
|
41
|
+
HIGHLY_CONF = "You are already at highest configuration."
|
42
|
+
LOW_CONF = "You are already at lowest configuration."
|
42
43
|
end
|
data/lib/app42/base/shell.rb
CHANGED
data/lib/app42/base/util.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "interact"
|
2
|
+
require 'uri'
|
2
3
|
require "ipaddress"
|
3
4
|
|
4
5
|
module App42
|
@@ -297,6 +298,19 @@ module App42
|
|
297
298
|
end
|
298
299
|
end
|
299
300
|
|
301
|
+
# Check whether +URL+ is valid OR not
|
302
|
+
# +URL+ should start with +http+ and +https+
|
303
|
+
# And should not contain any special character
|
304
|
+
def validate_url url
|
305
|
+
# Using the URI module distributed with Ruby, We can write own URL_REGEX(defined in constant.rb) too.
|
306
|
+
unless url =~ /^#{URI::regexp}$/
|
307
|
+
message "The provided URL (#{url}) is either not valid or contains white space and special character.", true, 'red'
|
308
|
+
return false
|
309
|
+
else
|
310
|
+
return url
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
300
314
|
# Check whether +uploadbackup+ path is valid OR not
|
301
315
|
# predefined extension are allowed only like .sql, .zip, .dump etc
|
302
316
|
def validate_upload_backup_path path
|
data/lib/app42/command/app.rb
CHANGED
@@ -244,6 +244,42 @@ module App42
|
|
244
244
|
puts table
|
245
245
|
end
|
246
246
|
|
247
|
+
# Add custom URL to app
|
248
|
+
def add_custom_url
|
249
|
+
@options[:name] = get_app_name if @options[:name].nil?
|
250
|
+
custom_url = get_custom_url if is_app_exist? @options[:name]
|
251
|
+
costom_url_res = costom_url_operation "addcustomurl", @options[:name], custom_url
|
252
|
+
exit! if costom_url_res
|
253
|
+
end
|
254
|
+
|
255
|
+
# Remove custom URL of app
|
256
|
+
def remove_custom_url
|
257
|
+
@options[:name] = get_app_name if @options[:name].nil?
|
258
|
+
custom_url = get_custom_url if is_app_exist? @options[:name]
|
259
|
+
costom_url_res = costom_url_operation "removecustomurl", @options[:name], custom_url
|
260
|
+
exit! if costom_url_res
|
261
|
+
end
|
262
|
+
|
263
|
+
# List all custom urls of apps
|
264
|
+
def urls
|
265
|
+
@options[:name] = get_app_name if @options[:name].nil?
|
266
|
+
|
267
|
+
rows, rows_header_final, rows_header = [], [], nil
|
268
|
+
custom_url_info = custom_url_information @options[:name]
|
269
|
+
if custom_url_info && custom_url_info['urls']
|
270
|
+
custom_url_info['urls'].each do |e|
|
271
|
+
rows_header = e.keys
|
272
|
+
rows << e.values
|
273
|
+
end
|
274
|
+
|
275
|
+
rows_header.map { |e| rows_header_final << camel_case_to_whitespace(e) }
|
276
|
+
|
277
|
+
table = Terminal::Table.new :title => Paint["=== #{@options[:name]} Custome URLs Details ===", :green], :headings => rows_header_final, :rows => rows
|
278
|
+
puts table
|
279
|
+
end
|
280
|
+
|
281
|
+
end
|
282
|
+
|
247
283
|
end
|
248
284
|
end
|
249
285
|
end
|
data/lib/app42/command/base.rb
CHANGED
@@ -90,6 +90,13 @@ module App42
|
|
90
90
|
valid_app_name ? (return valid_app_name) : get_app_name
|
91
91
|
end
|
92
92
|
|
93
|
+
# Ask custom URL from user and validate
|
94
|
+
def get_custom_url
|
95
|
+
url = input "Enter Custom URL", [], true
|
96
|
+
valid_url = validate_url url.strip
|
97
|
+
valid_url ? (return valid_url) : get_custom_url
|
98
|
+
end
|
99
|
+
|
93
100
|
# Ask wordpress name from user and
|
94
101
|
# will wait for user response (user will enter wordpress name)
|
95
102
|
def get_wordpress_name
|
@@ -743,6 +750,49 @@ module App42
|
|
743
750
|
end
|
744
751
|
end
|
745
752
|
|
753
|
+
# Custom operation will take placed like add, remove etc.
|
754
|
+
# expect +what+ as operation, +app_name+ as application name and +url+ custom url.
|
755
|
+
def costom_url_operation what, app_name, url
|
756
|
+
begin
|
757
|
+
if what.to_s == 'addcustomurl'
|
758
|
+
response = with_progress(Paint[ "Adding Custom URL To Application #{app_name}", :yellow]) do |s|
|
759
|
+
body = {'app42' => {"request"=> {
|
760
|
+
"appName" => app_name,
|
761
|
+
"url" => url
|
762
|
+
}}}.to_json
|
763
|
+
query_params = params
|
764
|
+
query_params.store('body', body)
|
765
|
+
build_post_request body, query_params, "app", "customurl"
|
766
|
+
end
|
767
|
+
else
|
768
|
+
response = with_progress(Paint[ "Removing Custom URL", :yellow]) do |s|
|
769
|
+
query_params = params
|
770
|
+
query_params.store('appName', app_name)
|
771
|
+
query_params.store('url', url)
|
772
|
+
build_delete_request query_params, "app", "customurl"
|
773
|
+
end
|
774
|
+
end
|
775
|
+
|
776
|
+
response['success'] ? (print Paint["#{response['message']}\n", :green]) : (message "#{response['message']}", true, 'red')
|
777
|
+
rescue Interrupt
|
778
|
+
puts Paint[" Command cancelled.", :red]
|
779
|
+
exit!
|
780
|
+
end
|
781
|
+
end
|
782
|
+
|
783
|
+
# Get custom URL details
|
784
|
+
def custom_url_information app_name
|
785
|
+
query_params = params
|
786
|
+
query_params.store('appName', app_name)
|
787
|
+
begin
|
788
|
+
response = build_get_request query_params, "app/customurl", nil
|
789
|
+
rescue Exception => e
|
790
|
+
puts e
|
791
|
+
exit!
|
792
|
+
end
|
793
|
+
return response
|
794
|
+
end
|
795
|
+
|
746
796
|
# create service and get all relevant service information post service creation.
|
747
797
|
#
|
748
798
|
# ==== Parameters
|
data/lib/app42/command/client.rb
CHANGED
@@ -286,7 +286,16 @@ module App42
|
|
286
286
|
set_cmd(:wordpress, :wordpresssetups)
|
287
287
|
|
288
288
|
when 'wordpressinfo'
|
289
|
-
set_cmd(:wordpress, :info)
|
289
|
+
set_cmd(:wordpress, :info)
|
290
|
+
|
291
|
+
when 'addcustomurl'
|
292
|
+
set_cmd(:app, :add_custom_url)
|
293
|
+
|
294
|
+
when 'removecustomurl'
|
295
|
+
set_cmd(:app, :remove_custom_url)
|
296
|
+
|
297
|
+
when 'customurlinfo'
|
298
|
+
set_cmd(:app, :urls)
|
290
299
|
|
291
300
|
else
|
292
301
|
puts Paint["app42: Unknown command [#{action}]", :red]
|
data/lib/app42/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app42
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShepHertz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|