vzcdn 0.1.8 → 0.1.9
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/README.md +1 -1
- data/lib/command.rb +22 -7
- data/lib/vzcdn/version.rb +1 -1
- data/lib/zone.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a57e7a8b331b7ded73bccae8a4d2fccc3640ab6
|
|
4
|
+
data.tar.gz: 5442f2e2e84bf6df14f05b498eee315f9bbe2dc0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0f7424dd530ce0dbf3f53221510dfdc4a5522bc4a9feb1d730d6ab0452b5a4bc411d07b9c1268f8aa4e25af8fd8d4020281add0561f9b358e9ef2a6f5a4c8199
|
|
7
|
+
data.tar.gz: 3d8dbc180663af1207657cc9fdd7f14b27f1d39b5adf0817b2fbf5e21e88bfe738ac7c1bdb8e1c077074f601b9db6f483c3856c6a68093ff26621eda4b8cdeaa
|
data/README.md
CHANGED
data/lib/command.rb
CHANGED
|
@@ -50,15 +50,30 @@ class Command
|
|
|
50
50
|
raise CancelExecution
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
def get_args_used(usage, args_used)
|
|
54
|
+
line = usage
|
|
55
|
+
re = /<(?<argname>[[:alnum:]-]+)>/
|
|
56
|
+
while m = re.match(line)
|
|
57
|
+
argname = m[:argname]
|
|
58
|
+
unless args_used.include? argname
|
|
59
|
+
args_used << argname
|
|
60
|
+
end
|
|
61
|
+
line = line[m.end(0)..-1]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
53
65
|
def show_help
|
|
54
66
|
puts "#{@name} - #{@desc}"
|
|
55
|
-
puts "Usage:"
|
|
67
|
+
puts "Usage:"
|
|
68
|
+
args_used = [ ]
|
|
56
69
|
@flows.each { |flow|
|
|
57
70
|
puts " #{@name} #{flow.usage_string}"
|
|
71
|
+
get_args_used(flow.usage_string, args_used)
|
|
58
72
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
if (args_used.length > 0)
|
|
74
|
+
puts "Where:"
|
|
75
|
+
args_used.each { |name|
|
|
76
|
+
arg = @cellhash[name]
|
|
62
77
|
choice = ""
|
|
63
78
|
if arg.validator.class == String
|
|
64
79
|
error, ignore = arg.validate?("asdf", nil)
|
|
@@ -68,10 +83,10 @@ class Command
|
|
|
68
83
|
elsif arg.validator.class == Hash
|
|
69
84
|
choice = " - value from #{arg.validator.keys}"
|
|
70
85
|
end
|
|
71
|
-
|
|
86
|
+
|
|
72
87
|
puts " #{arg.name} : #{arg.desc}#{choice}"
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
}
|
|
89
|
+
end
|
|
75
90
|
end
|
|
76
91
|
|
|
77
92
|
def add_arg(name, desc, validator)
|
data/lib/vzcdn/version.rb
CHANGED
data/lib/zone.rb
CHANGED
|
@@ -65,7 +65,7 @@ class ZoneCreate < Command
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def create_flows
|
|
68
|
-
add_flow_from_usage("<name> <status> [comment] [type
|
|
68
|
+
add_flow_from_usage("<name> <status> [<comment>] [<type>='Primary']")
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def execute(arghash, rest)
|
|
@@ -77,7 +77,7 @@ class ZoneCreate < Command
|
|
|
77
77
|
comment = arghash["comment"]
|
|
78
78
|
comment = "" if comment.nil?
|
|
79
79
|
type = arghash["type"]
|
|
80
|
-
|
|
80
|
+
dputs "name = #{name}, comment=#{comment}, status=#{status}, type=#{type}"
|
|
81
81
|
zone = { "Comment" => comment, "DomainName" => name, "Status" => status, "ZoneType" => type, "Records" => {"A" => [] } }
|
|
82
82
|
puts "creating zone on server"
|
|
83
83
|
Route.do.add_zone(zone)
|
|
@@ -159,6 +159,7 @@ class Zone < Command
|
|
|
159
159
|
def write_zone_file(zone, hide_dup = false)
|
|
160
160
|
basename = local_filename(zone)
|
|
161
161
|
if hide_dup
|
|
162
|
+
mk_config_dir("zones")
|
|
162
163
|
file_name = config_file("zones", basename)
|
|
163
164
|
File.delete(file_name) if File.exists?(file_name)
|
|
164
165
|
File.open(file_name, "w").write(JSON.pretty_generate zone)
|