Module: Columbus
- Defined in:
- lib/columbus.rb,
lib/columbus/config.rb,
lib/columbus/cli/env.rb,
lib/columbus/cli/log.rb,
lib/columbus/version.rb,
lib/columbus/cli/stop.rb,
lib/columbus/cli/check.rb,
lib/columbus/cli/start.rb,
lib/columbus/cli/checks.rb,
lib/columbus/cli/download.rb,
lib/columbus/cli/connection.rb,
lib/columbus/cli/connections.rb
Defined Under Namespace
Classes: CommandLineRunner, Error
Constant Summary
collapse
- COLUMBUS_HOME =
ENV['COLUMBUS_HOME']
- COLUMBUS_JAR =
"#{ENV['COLUMBUS_HOME']}/lib/columbus.jar"
- VERSION =
"0.0.2"
Class Method Summary
collapse
Class Method Details
.check(label) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/columbus/cli/check.rb', line 2
def self.check(label)
url = "http://localhost:8080/api/check/#{label}"
begin
response = RestClient.get url
check = JSON.parse(response.body)
yaml = YAML.dump(check)
puts yaml
end
rescue RestClient::InternalServerError
puts "#{"Error: ".red} Check with label #{label.light_blue} does not exist"
end
|
.checks ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/columbus/cli/checks.rb', line 2
def self.checks
response = RestClient.get 'http://localhost:8080/api/checks'
checks = JSON.parse(response.body)
rows = []
checks.each do |check|
rows << [ check["label"], check["description"], check["components"].length, check["evaluation"]["type"], check["schedules"].length, check["notifications"].length, check["path"]]
end
table = Terminal::Table.new do |t|
t.headings = %w(Label Description #Components Evaluation #Schedules #Notifications Path)
t.rows = rows
end
puts table
end
|
.connection(label) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/columbus/cli/connection.rb', line 2
def self.connection(label)
url = "http://localhost:8080/api/connection/#{label}"
begin
response = RestClient.get url
connection = JSON.parse(response.body)
yaml = YAML.dump(connection)
puts yaml
end
rescue RestClient::InternalServerError
puts "#{"Error: ".red} Connection with label #{label.light_blue} does not exist"
end
|
.connections ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/columbus/cli/connections.rb', line 2
def self.connections
response = RestClient.get 'http://localhost:8080/api/connections'
connections = JSON.parse(response.body)
rows = []
connections.each do |connection|
rows << [connection["label"], connection["type"]]
end
table = Terminal::Table.new :headings => ['Label', 'Type'], :rows => rows
puts table
end
|
.download ⇒ Object
2
3
4
5
6
7
|
# File 'lib/columbus/cli/download.rb', line 2
def self.download
puts "Downloading Columbus ..."
columbus_jar_dir = "#{Columbus::COLUMBUS_HOME}/lib"
system "mkdir #{columbus_jar_dir}"
system "curl -L https://github.com/n3xtdata/columbus/raw/artifacts/columbus-0.0.1-SNAPSHOT.jar -o #{columbus_jar_dir}/columbus.jar"
end
|
.log ⇒ Object
2
3
4
5
6
|
# File 'lib/columbus/cli/log.rb', line 2
def self.log
exec "tail -f #{Columbus::COLUMBUS_HOME}/log/columbus.log"
end
|
.stop ⇒ Object
2
3
4
5
6
7
|
# File 'lib/columbus/cli/stop.rb', line 2
def self.stop
puts "Stopping Columbus ..."
system "kill -9 $(cat #{Columbus::COLUMBUS_HOME}/tmp/columbus.pid)"
end
|