redipress 0.0.4 → 0.0.5
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/redipress/cli/configurations.rb +4 -1
- data/lib/redipress/cli/helper.rb +0 -3
- data/lib/redipress/configuration/base.rb +36 -11
- data/lib/redipress/errors.rb +3 -3
- data/lib/redipress/parameter.rb +37 -2
- data/lib/redipress/ssh.rb +1 -1
- data/lib/redipress/variables.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: 5c2e37489ceb11c694ea9f30235bd11ea7851606
|
4
|
+
data.tar.gz: 3cab0d8cff4698e51f41404e608cd4b14ad12fd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4ee018f270c481ef65b7b41caa97aafd7e40c160919c96a49619ce1466bbb6120f4dedb563625098727257568abe7f7a8c756024e593cbfd46c5abdde3cb18b
|
7
|
+
data.tar.gz: 2f0a25992565743ae1bf9f05d4221fecf1d153a8a607ad5bf920c6e0edfc2a2c0bbfa6966f08446d4e84407d7fd4c04c436ea227dae7ef4ded31bc32a59aafee
|
@@ -174,6 +174,9 @@ module RediPress
|
|
174
174
|
if password
|
175
175
|
# Set the password on the host
|
176
176
|
host.password = password
|
177
|
+
else
|
178
|
+
# Load all ssh keys
|
179
|
+
RediPress::SSHKeys.load_ssh_keys
|
177
180
|
end
|
178
181
|
|
179
182
|
host
|
@@ -232,7 +235,7 @@ module RediPress
|
|
232
235
|
configuration.parameters.each do |parameter|
|
233
236
|
if :text == parameter.type
|
234
237
|
options[parameter.slug] = prompt.ask(" #{parameter.name}:") do |q|
|
235
|
-
q.required(
|
238
|
+
q.required(parameter.required)
|
236
239
|
q.validate(parameter.validation) if parameter.validation
|
237
240
|
q.default(parameter.default) if parameter.default
|
238
241
|
end
|
data/lib/redipress/cli/helper.rb
CHANGED
@@ -23,11 +23,21 @@ module RediPress
|
|
23
23
|
# >> name "Test"
|
24
24
|
# >> end
|
25
25
|
#
|
26
|
-
def name(name
|
27
|
-
|
26
|
+
def name(name)
|
27
|
+
@name = name
|
28
28
|
end
|
29
29
|
|
30
|
-
#
|
30
|
+
# Get the name of the configuration
|
31
|
+
#
|
32
|
+
# Example:
|
33
|
+
# >> configuration.class._name
|
34
|
+
# => "Test"
|
35
|
+
#
|
36
|
+
def _name
|
37
|
+
@name
|
38
|
+
end
|
39
|
+
|
40
|
+
# Add a parameter to the configuration
|
31
41
|
#
|
32
42
|
# Arguments:
|
33
43
|
# slug: (String)
|
@@ -40,16 +50,28 @@ module RediPress
|
|
40
50
|
# >> end
|
41
51
|
# >> end
|
42
52
|
#
|
43
|
-
def parameter(slug
|
53
|
+
def parameter(slug, &block)
|
54
|
+
return nil if slug.nil?
|
55
|
+
|
44
56
|
@parameters ||= []
|
45
57
|
|
46
|
-
return @parameters if slug.
|
58
|
+
return @parameters if @parameters.map { |p| p.slug }.include?(slug)
|
47
59
|
|
48
60
|
parameter = RediPress::Parameter.new(slug)
|
49
61
|
parameter.instance_eval(&block) if block_given?
|
50
62
|
|
51
63
|
@parameters << parameter
|
52
64
|
end
|
65
|
+
|
66
|
+
# Get the array of parameters for the configuration
|
67
|
+
#
|
68
|
+
# Example:
|
69
|
+
# >> configuration.class._parameters
|
70
|
+
# => [#<RediPress::Configuration::Parameter:0x00000000000000>]
|
71
|
+
#
|
72
|
+
def _parameters
|
73
|
+
@parameters
|
74
|
+
end
|
53
75
|
end
|
54
76
|
|
55
77
|
# Get the slug of the configuration
|
@@ -69,17 +91,17 @@ module RediPress
|
|
69
91
|
# => "Test"
|
70
92
|
#
|
71
93
|
def name
|
72
|
-
self.class.
|
94
|
+
self.class._name
|
73
95
|
end
|
74
96
|
|
75
97
|
# Get the parameters for the configuration
|
76
98
|
#
|
77
99
|
# Example:
|
78
100
|
# >> configuration.parameters
|
79
|
-
# =>
|
101
|
+
# => [#<RediPress::Configuration::Parameter:0x00000000000000>]
|
80
102
|
#
|
81
103
|
def parameters
|
82
|
-
self.class.
|
104
|
+
self.class._parameters
|
83
105
|
end
|
84
106
|
|
85
107
|
# Convert the class to a string
|
@@ -117,10 +139,13 @@ module RediPress
|
|
117
139
|
#
|
118
140
|
# Example:
|
119
141
|
# >> configuration.configure(host, options)
|
120
|
-
# =>
|
142
|
+
# => nil
|
143
|
+
#
|
144
|
+
# Raises:
|
145
|
+
# RediPress::ConfigurationNotImplemented: If this method is not overriden
|
121
146
|
#
|
122
147
|
def configure(host, options)
|
123
|
-
raise RediPress::
|
148
|
+
raise RediPress::ConfigurationNotImplemented
|
124
149
|
end
|
125
150
|
|
126
151
|
# Fail with an error
|
@@ -133,7 +158,7 @@ module RediPress
|
|
133
158
|
# => nil
|
134
159
|
#
|
135
160
|
# Raises:
|
136
|
-
# RediPress::ConfigurationFailed: When this
|
161
|
+
# RediPress::ConfigurationFailed: When this method is called
|
137
162
|
#
|
138
163
|
def fail(error)
|
139
164
|
raise RediPress::ConfigurationFailed.new(self, error)
|
data/lib/redipress/errors.rb
CHANGED
@@ -25,11 +25,11 @@ module RediPress
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
# A
|
28
|
+
# A NotImplementedError subclass for when the 'configure' method has not been implemented by a Configuration.
|
29
29
|
#
|
30
|
-
class
|
30
|
+
class ConfigurationNotImplemented < NotImplementedError
|
31
31
|
def to_s
|
32
|
-
"The
|
32
|
+
"The 'configure' method has not been implemented by the configuration."
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/lib/redipress/parameter.rb
CHANGED
@@ -6,22 +6,29 @@ module RediPress
|
|
6
6
|
# This class holds all paramaters required by a configuration.
|
7
7
|
#
|
8
8
|
class Parameter
|
9
|
-
attr_reader :slug, :options
|
9
|
+
attr_reader :slug, :required, :options
|
10
10
|
|
11
11
|
# Setup an instance of the parameters class.
|
12
12
|
#
|
13
|
+
# Arguments:
|
14
|
+
# slug: (String|Symbol)
|
15
|
+
#
|
13
16
|
# Example:
|
14
17
|
# >> RediPress::Parameter.new(:username)
|
15
|
-
# => #<RediPress::Parameter:0x00000000000000
|
18
|
+
# => #<RediPress::Parameter:0x00000000000000>
|
16
19
|
#
|
17
20
|
def initialize(slug)
|
18
21
|
@slug = slug
|
19
22
|
@name = slug.to_s
|
23
|
+
@required = true
|
20
24
|
@type = :text
|
21
25
|
end
|
22
26
|
|
23
27
|
# Set the name of the parameter
|
24
28
|
#
|
29
|
+
# Arguments:
|
30
|
+
# name: (String)
|
31
|
+
#
|
25
32
|
# Example:
|
26
33
|
# >> parameter.name("Username")
|
27
34
|
# => "Username"
|
@@ -30,8 +37,27 @@ module RediPress
|
|
30
37
|
name.nil? ? @name : @name = name
|
31
38
|
end
|
32
39
|
|
40
|
+
# Set the parameter to required
|
41
|
+
#
|
42
|
+
# Available With Types:
|
43
|
+
# :text
|
44
|
+
#
|
45
|
+
# Arguments:
|
46
|
+
# required: (Boolean)
|
47
|
+
#
|
48
|
+
# Example:
|
49
|
+
# >> parameter.required(true)
|
50
|
+
# => true
|
51
|
+
#
|
52
|
+
def required(required = nil)
|
53
|
+
required.nil? ? @required : @required = required
|
54
|
+
end
|
55
|
+
|
33
56
|
# Set the type of the parameter
|
34
57
|
#
|
58
|
+
# Arguments:
|
59
|
+
# type: (Symbol)
|
60
|
+
#
|
35
61
|
# Example:
|
36
62
|
# >> parameter.type(:text)
|
37
63
|
# => :text
|
@@ -45,6 +71,9 @@ module RediPress
|
|
45
71
|
# Available With types:
|
46
72
|
# :text
|
47
73
|
#
|
74
|
+
# Arguments:
|
75
|
+
# default: (String)
|
76
|
+
#
|
48
77
|
# Example:
|
49
78
|
# >> parameter.default('rediwebhosting')
|
50
79
|
# => "rediwebhosting"
|
@@ -58,6 +87,9 @@ module RediPress
|
|
58
87
|
# Available With types:
|
59
88
|
# :text
|
60
89
|
#
|
90
|
+
# Arguments:
|
91
|
+
# validation: (Regex)
|
92
|
+
#
|
61
93
|
# Example:
|
62
94
|
# >> parameter.validation(/^[a-z]{4,}$/)
|
63
95
|
# => /^[a-z]{4,}$/
|
@@ -72,6 +104,9 @@ module RediPress
|
|
72
104
|
# :select
|
73
105
|
# :multi_select
|
74
106
|
#
|
107
|
+
# Arguments:
|
108
|
+
# option: (String)
|
109
|
+
#
|
75
110
|
# Example:
|
76
111
|
# >> parameter.option('rediweb')
|
77
112
|
# => nil
|
data/lib/redipress/ssh.rb
CHANGED
data/lib/redipress/variables.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redipress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rediweb Hosting
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|