BlueAdmiral 0.0.2 → 0.0.3
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.
- data/BlueAdmiral.gemspec +4 -1
- data/Gemfile +3 -0
- data/Gemfile.lock +2 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/mercury/cli/commands/bootstrap.rb +17 -1
- data/lib/mercury/cli/logger.rb +28 -29
- metadata +23 -12
data/BlueAdmiral.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{BlueAdmiral}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Love"]
|
@@ -58,6 +58,7 @@ Gem::Specification.new do |s|
|
|
58
58
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
59
59
|
s.add_runtime_dependency(%q<cli>, [">= 0"])
|
60
60
|
s.add_runtime_dependency(%q<cri>, [">= 0"])
|
61
|
+
s.add_runtime_dependency(%q<facets>, [">= 0"])
|
61
62
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
62
63
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
|
63
64
|
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
@@ -70,6 +71,7 @@ Gem::Specification.new do |s|
|
|
70
71
|
s.add_dependency(%q<json>, [">= 0"])
|
71
72
|
s.add_dependency(%q<cli>, [">= 0"])
|
72
73
|
s.add_dependency(%q<cri>, [">= 0"])
|
74
|
+
s.add_dependency(%q<facets>, [">= 0"])
|
73
75
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
74
76
|
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
75
77
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
@@ -83,6 +85,7 @@ Gem::Specification.new do |s|
|
|
83
85
|
s.add_dependency(%q<json>, [">= 0"])
|
84
86
|
s.add_dependency(%q<cli>, [">= 0"])
|
85
87
|
s.add_dependency(%q<cri>, [">= 0"])
|
88
|
+
s.add_dependency(%q<facets>, [">= 0"])
|
86
89
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
87
90
|
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
88
91
|
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
data/Gemfile
CHANGED
@@ -22,6 +22,9 @@ gem "json"
|
|
22
22
|
gem "cli"
|
23
23
|
gem "cri"
|
24
24
|
|
25
|
+
# Additional routines for the core classes
|
26
|
+
gem "facets"
|
27
|
+
|
25
28
|
###
|
26
29
|
### Development Gems. All _additional_ gems required by development (as apposed to
|
27
30
|
### production environments). If it is required at run-time, it
|
data/Gemfile.lock
CHANGED
@@ -7,6 +7,7 @@ GEM
|
|
7
7
|
em-synchrony (0.2.0)
|
8
8
|
eventmachine (>= 0.12.9)
|
9
9
|
eventmachine (0.12.10)
|
10
|
+
facets (2.9.1)
|
10
11
|
git (1.2.5)
|
11
12
|
hiredis (0.3.1)
|
12
13
|
jeweler (1.6.0)
|
@@ -35,6 +36,7 @@ DEPENDENCIES
|
|
35
36
|
cli
|
36
37
|
cri
|
37
38
|
em-synchrony
|
39
|
+
facets
|
38
40
|
hiredis (~> 0.3.1)
|
39
41
|
jeweler (~> 1.6.0)
|
40
42
|
json
|
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -79,7 +79,23 @@ module Mercury::CLI::Commands
|
|
79
79
|
|
80
80
|
# Execute the command
|
81
81
|
def run(options, arguments)
|
82
|
-
|
82
|
+
|
83
|
+
# The first thing we need to do is to find the relevant server. So we
|
84
|
+
# check the options and see if they can help
|
85
|
+
unless options[:server].nil? or options[:server].empty? then
|
86
|
+
#
|
87
|
+
else
|
88
|
+
|
89
|
+
# The user has not specified a server, so we will attempt to get one
|
90
|
+
# from the system configuration
|
91
|
+
if File.exists?("/etc/mercury.conf") then
|
92
|
+
#
|
93
|
+
|
94
|
+
# Everything has failed, so we abort
|
95
|
+
else
|
96
|
+
Mercury::CLI::Logger.instance.log_level(:high, :error, "Cannot locate a Mercury server. Either specify the server to connect to using the 'server' option, or create an appropriate configuration file.")
|
97
|
+
end
|
98
|
+
end
|
83
99
|
end
|
84
100
|
|
85
101
|
end
|
data/lib/mercury/cli/logger.rb
CHANGED
@@ -1,19 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
# Copyright (c) 2009 Denis Defreyne, 2010-2011 David Love
|
2
|
+
#
|
3
|
+
# Permission to use, copy, modify, and/or distribute this software for
|
4
|
+
# any purpose with or without fee is hereby granted, provided that the
|
5
|
+
# above copyright notice and this permission notice appear in all copies.
|
6
|
+
#
|
7
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
13
|
+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14
|
+
#
|
15
15
|
|
16
16
|
require 'singleton'
|
17
|
+
require 'facets'
|
17
18
|
|
18
19
|
module Mercury::CLI
|
19
20
|
|
@@ -24,11 +25,9 @@ module Mercury::CLI
|
|
24
25
|
# ANSI console codes (escape sequences) for highlighting particular
|
25
26
|
# log outputs.
|
26
27
|
ACTION_COLORS = {
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:skip => "\e[1m", # bold
|
31
|
-
:'not written' => "\e[1m" # bold
|
28
|
+
:error => "\e[1m" + "\e[31m", # bold + red
|
29
|
+
:warning => "\e[1m" + "\e[33m", # bold + yellow
|
30
|
+
:info => "\e[1m" + "\e[32m", # bold + green
|
32
31
|
}
|
33
32
|
|
34
33
|
include Singleton
|
@@ -47,23 +46,23 @@ module Mercury::CLI
|
|
47
46
|
@color = true
|
48
47
|
end
|
49
48
|
|
50
|
-
# Logs a
|
49
|
+
# Logs a messsage, using appropriate colours to highlight different
|
50
|
+
# levels.
|
51
51
|
#
|
52
52
|
# +level+:: The importance of this action. Can be :high or :low.
|
53
53
|
#
|
54
54
|
# +action+:: The kind of file action. Can be :create, :update or
|
55
55
|
# :identical.
|
56
56
|
#
|
57
|
-
# +
|
58
|
-
def
|
57
|
+
# +message+:: The identifier of the item the action was performed on.
|
58
|
+
def log_level(level, action, message)
|
59
59
|
log(
|
60
60
|
level,
|
61
|
-
'%s%12s%s %s
|
61
|
+
'%s%12s%s: %s' % [
|
62
62
|
color? ? ACTION_COLORS[action.to_sym] : '',
|
63
|
-
action,
|
63
|
+
action.capitalize,
|
64
64
|
color? ? "\e[0m" : '',
|
65
|
-
|
66
|
-
identifier
|
65
|
+
message.word_wrap(60).indent(15).lstrip
|
67
66
|
]
|
68
67
|
)
|
69
68
|
end
|
@@ -72,16 +71,16 @@ module Mercury::CLI
|
|
72
71
|
#
|
73
72
|
# +level+:: The importance of this message. Can be :high or :low.
|
74
73
|
#
|
75
|
-
# +
|
74
|
+
# +message+:: The message to be logged.
|
76
75
|
#
|
77
76
|
# +io+:: The IO instance to which the message will be written. Defaults to
|
78
77
|
# standard output.
|
79
|
-
def log(level,
|
78
|
+
def log(level, message, io=$stdout)
|
80
79
|
# Don't log when logging is disabled
|
81
80
|
return if @level == :off
|
82
81
|
|
83
82
|
# Log when level permits it
|
84
|
-
io.puts(
|
83
|
+
io.puts(message) if (@level == :low or @level == level)
|
85
84
|
end
|
86
85
|
|
87
86
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: BlueAdmiral
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- David Love
|
@@ -80,8 +80,19 @@ dependencies:
|
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: *id006
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
83
|
+
name: facets
|
84
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: bundler
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
85
96
|
none: false
|
86
97
|
requirements:
|
87
98
|
- - ~>
|
@@ -89,10 +100,10 @@ dependencies:
|
|
89
100
|
version: 1.0.0
|
90
101
|
type: :development
|
91
102
|
prerelease: false
|
92
|
-
version_requirements: *
|
103
|
+
version_requirements: *id008
|
93
104
|
- !ruby/object:Gem::Dependency
|
94
105
|
name: jeweler
|
95
|
-
requirement: &
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
96
107
|
none: false
|
97
108
|
requirements:
|
98
109
|
- - ~>
|
@@ -100,10 +111,10 @@ dependencies:
|
|
100
111
|
version: 1.6.0
|
101
112
|
type: :development
|
102
113
|
prerelease: false
|
103
|
-
version_requirements: *
|
114
|
+
version_requirements: *id009
|
104
115
|
- !ruby/object:Gem::Dependency
|
105
116
|
name: yard
|
106
|
-
requirement: &
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
107
118
|
none: false
|
108
119
|
requirements:
|
109
120
|
- - ~>
|
@@ -111,10 +122,10 @@ dependencies:
|
|
111
122
|
version: 0.6.0
|
112
123
|
type: :development
|
113
124
|
prerelease: false
|
114
|
-
version_requirements: *
|
125
|
+
version_requirements: *id010
|
115
126
|
- !ruby/object:Gem::Dependency
|
116
127
|
name: rspec
|
117
|
-
requirement: &
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
118
129
|
none: false
|
119
130
|
requirements:
|
120
131
|
- - ~>
|
@@ -122,10 +133,10 @@ dependencies:
|
|
122
133
|
version: 2.3.0
|
123
134
|
type: :development
|
124
135
|
prerelease: false
|
125
|
-
version_requirements: *
|
136
|
+
version_requirements: *id011
|
126
137
|
- !ruby/object:Gem::Dependency
|
127
138
|
name: rcov
|
128
|
-
requirement: &
|
139
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
129
140
|
none: false
|
130
141
|
requirements:
|
131
142
|
- - ">="
|
@@ -133,7 +144,7 @@ dependencies:
|
|
133
144
|
version: "0"
|
134
145
|
type: :development
|
135
146
|
prerelease: false
|
136
|
-
version_requirements: *
|
147
|
+
version_requirements: *id012
|
137
148
|
description: Prepares hosts/networks/etc to become part of a stated Mercury environment
|
138
149
|
email: david@homeunix.org.uk
|
139
150
|
executables:
|
@@ -180,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
191
|
requirements:
|
181
192
|
- - ">="
|
182
193
|
- !ruby/object:Gem::Version
|
183
|
-
hash: -
|
194
|
+
hash: -3823986487516873675
|
184
195
|
segments:
|
185
196
|
- 0
|
186
197
|
version: "0"
|