busbar-cli 1.8.0 → 1.8.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2991308835ad10b6f952cfb29275432342d34202
|
4
|
+
data.tar.gz: 56007ff812c2aef4e908dba4268f76f0fad78e64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0e31754a613a99eefdfaefa94b891b26b7847855dc668ce5bfae4fa682dc60862811b0bf5d14d17b3e971f83671c28919a504b0e46072a0fce38b80a9a296c9
|
7
|
+
data.tar.gz: e4a327eaa52ff7c70d09d93f870b431057c933d31d068b9c07ff02ce89a8869646414c80a986061f425f19ea682e83b4c0876e59fe5768f5a59e8e509e1d9f97
|
@@ -50,6 +50,10 @@ module Commands
|
|
50
50
|
aliases: '-f',
|
51
51
|
desc: 'Create the busbar config using an external file'
|
52
52
|
|
53
|
+
option :url,
|
54
|
+
aliases: '-u',
|
55
|
+
desc: 'Create the busbar config using an external URL'
|
56
|
+
|
53
57
|
def busbar_setup
|
54
58
|
if options.keys.count > 1
|
55
59
|
puts
|
@@ -108,6 +112,21 @@ module Commands
|
|
108
112
|
end
|
109
113
|
Services::BusbarConfig.write_from_file(options.file)
|
110
114
|
|
115
|
+
elsif options.url?
|
116
|
+
if File.file?(BUSBAR_CONFIG_FILE_PATH)
|
117
|
+
thor_ask = Thor::Shell::Basic.new
|
118
|
+
puts
|
119
|
+
puts 'Busbar config file already exists with the content bellow:'
|
120
|
+
puts
|
121
|
+
Services::BusbarConfig.current
|
122
|
+
puts
|
123
|
+
overwrite_existing = thor_ask.ask('Overwrite it',
|
124
|
+
default: 'Yes',
|
125
|
+
limited_to: %w(Yes No))
|
126
|
+
exit(0) if overwrite_existing == 'No'
|
127
|
+
end
|
128
|
+
Services::BusbarConfig.write_from_url(options.url)
|
129
|
+
|
111
130
|
else
|
112
131
|
Services::BusbarConfig.current
|
113
132
|
puts
|
@@ -4,7 +4,7 @@ require 'busbar_cli/config/version'
|
|
4
4
|
# Constants
|
5
5
|
## Hardcoded
|
6
6
|
BUSBAR_LOCAL_FOLDER = "#{ENV['HOME']}/.busbar".freeze
|
7
|
-
BUSBAR_CONFIG_FILE_PATH = "#{BUSBAR_LOCAL_FOLDER}/config".freeze
|
7
|
+
BUSBAR_CONFIG_FILE_PATH = "#{BUSBAR_LOCAL_FOLDER}/busbar.config".freeze
|
8
8
|
|
9
9
|
KUBECTL_LOCAL_FOLDER = "#{ENV['HOME']}/.kube".freeze
|
10
10
|
KUBECTL_LOCAL_BIN_FOLDER = "#{KUBECTL_LOCAL_FOLDER}/bin".freeze
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Version Variables
|
2
2
|
VERSION = '1.8'.freeze
|
3
|
-
BUSBAR_PATCH_VERSION = '
|
3
|
+
BUSBAR_PATCH_VERSION = '1'.freeze
|
4
4
|
KUBECTL_PATCH_VERSION = '5'.freeze
|
5
5
|
BUSBAR_VERSION = "#{VERSION}.#{BUSBAR_PATCH_VERSION}".freeze
|
6
6
|
KUBECTL_VERSION = "#{VERSION}.#{KUBECTL_PATCH_VERSION}".freeze
|
@@ -35,6 +35,16 @@ module Services
|
|
35
35
|
write_from_file(file_path)
|
36
36
|
current
|
37
37
|
|
38
|
+
elsif (ARGV[selector_position] == '-u') || (ARGV[selector_position] == '--url') || \
|
39
|
+
(ARGV[selector_position] =~ /--url.*$/)
|
40
|
+
url = if ARGV[selector_position].include?('=')
|
41
|
+
ARGV[selector_position].split('=')[1]
|
42
|
+
else
|
43
|
+
ARGV[selector_position + 1]
|
44
|
+
end
|
45
|
+
write_from_url(url)
|
46
|
+
current
|
47
|
+
|
38
48
|
else
|
39
49
|
puts
|
40
50
|
puts 'Busbar Config file not found!'
|
@@ -42,6 +52,7 @@ module Services
|
|
42
52
|
puts 'Current Options:'
|
43
53
|
puts ' -a, [--i-set-all] # Set all configuration keys interactivelly'
|
44
54
|
puts ' -f, [--file=FILE] # Create the busbar config using an external file'
|
55
|
+
puts ' -u, [--url=URL] # Create the busbar config using an external URL'
|
45
56
|
puts
|
46
57
|
end
|
47
58
|
exit(0)
|
@@ -77,6 +88,13 @@ module Services
|
|
77
88
|
FileUtils.copy(File.expand_path(file_path), BUSBAR_CONFIG_FILE_PATH)
|
78
89
|
end
|
79
90
|
|
91
|
+
def write_from_url(url)
|
92
|
+
response = Net::HTTP.get(URI(url))
|
93
|
+
open(BUSBAR_CONFIG_FILE_PATH, 'wb') do |file|
|
94
|
+
file.write(response)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
80
98
|
def interactive_set(config_key)
|
81
99
|
return unless Helpers::BusbarConfig::CONFIG_OPTIONS.key? config_key.to_sym
|
82
100
|
|