silo_manager 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/silo_manager +42 -13
- metadata +4 -4
data/bin/silo_manager
CHANGED
@@ -9,7 +9,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '../lib/options'))
|
|
9
9
|
# Multi-Tenant User Attributes #
|
10
10
|
################################
|
11
11
|
MTU_ATTRS = ['authsrcid:integer:required', 'user-name:string:required',
|
12
|
-
'full-name:string:required', 'email:string:optional', 'password:string:
|
12
|
+
'full-name:string:required', 'email:string:optional', 'password:string:required', 'enabled:boolean:required',
|
13
13
|
'superuser:boolean:required']
|
14
14
|
|
15
15
|
SILO_ACCESS_ATTRS = ['all-groups:boolean:required', 'all-sites:boolean:required', 'default-silo:boolean:required',
|
@@ -49,20 +49,27 @@ ORG_ATTRS = ['url:string:required', 'company:string:required', 'email-address:st
|
|
49
49
|
|
50
50
|
#-------------------------------------------------------------------------
|
51
51
|
#-------------------------------------------------------------------------
|
52
|
-
def get_integer_input name, return_main=false
|
52
|
+
def get_integer_input name, return_main=false, required
|
53
53
|
integer_inputed = false
|
54
54
|
while !integer_inputed
|
55
55
|
puts "Enter an integer value for #{name}:"
|
56
56
|
begin
|
57
57
|
input = gets.chomp
|
58
58
|
if return_main and input =~ /:main/i
|
59
|
+
return :main
|
60
|
+
end
|
61
|
+
|
62
|
+
if input.empty? and required
|
63
|
+
puts 'Input is required'
|
64
|
+
next
|
65
|
+
elsif input.empty?
|
59
66
|
return nil
|
60
67
|
end
|
61
68
|
|
62
69
|
begin
|
63
70
|
input = Integer input
|
64
71
|
integer_inputed = true
|
65
|
-
rescue Exception
|
72
|
+
rescue Exception
|
66
73
|
puts "Invalid input"
|
67
74
|
end
|
68
75
|
end
|
@@ -72,24 +79,42 @@ end
|
|
72
79
|
|
73
80
|
#-------------------------------------------------------------------------
|
74
81
|
#-------------------------------------------------------------------------
|
75
|
-
def get_string_input name, return_main=false
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
82
|
+
def get_string_input name, return_main=false, required
|
83
|
+
success = false
|
84
|
+
while !success
|
85
|
+
puts "Enter an string value for #{name}:"
|
86
|
+
input = gets.chomp
|
87
|
+
if return_main and input =~ /:main/i
|
88
|
+
return :main
|
89
|
+
end
|
90
|
+
|
91
|
+
if input.empty? and required
|
92
|
+
puts 'Input is required'
|
93
|
+
next
|
94
|
+
elsif input.empty?
|
95
|
+
return nil
|
96
|
+
end
|
97
|
+
success = true
|
80
98
|
end
|
81
99
|
input
|
82
100
|
end
|
83
101
|
|
84
102
|
#-------------------------------------------------------------------------
|
85
103
|
#-------------------------------------------------------------------------
|
86
|
-
def get_boolean_input name='', return_main=false
|
104
|
+
def get_boolean_input name='', return_main=false, required
|
87
105
|
boolean_inputed = false
|
88
106
|
while !boolean_inputed
|
89
107
|
puts "Enter a boolean value (true/1 or false/0) for #{name}:"
|
90
108
|
begin
|
91
109
|
input = gets.chomp
|
92
110
|
if return_main and input =~ /:main/i
|
111
|
+
return :main
|
112
|
+
end
|
113
|
+
|
114
|
+
if input.empty? and required
|
115
|
+
puts 'Input is required'
|
116
|
+
next
|
117
|
+
elsif input.empty?
|
93
118
|
return nil
|
94
119
|
end
|
95
120
|
|
@@ -118,17 +143,21 @@ def process_attrs attrs, title
|
|
118
143
|
attrs.each do |attr|
|
119
144
|
parts = attr.split ":"
|
120
145
|
name = parts[0] + " (#{parts[2]})"
|
146
|
+
required = ('required'.eql? parts[2])
|
121
147
|
case parts[1]
|
122
148
|
when /boolean/
|
123
|
-
input = get_boolean_input name, true
|
149
|
+
input = get_boolean_input name, true, required
|
124
150
|
when /integer/
|
125
|
-
input = get_integer_input name, true
|
151
|
+
input = get_integer_input name, true, required
|
126
152
|
when /string/
|
127
|
-
input = get_string_input name, true
|
153
|
+
input = get_string_input name, true, required
|
128
154
|
end
|
129
155
|
|
130
|
-
if input
|
156
|
+
if input == :main
|
131
157
|
return nil
|
158
|
+
elsif input.nil?
|
159
|
+
# don't add the entry
|
160
|
+
next
|
132
161
|
else
|
133
162
|
input_hash[parts[0]] = input
|
134
163
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: silo_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-07 00:00:00.000000000 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nexpose
|
17
|
-
requirement: &
|
17
|
+
requirement: &24015192 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: 0.0.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *24015192
|
26
26
|
description: ! ' This is a tool is used to provide CRUD silo operations.
|
27
27
|
|
28
28
|
'
|