columbusctl 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ecfb29fb270880ef7b7ca2bf5f8f53bbaf3b816937accbd998ad88b5a4860371
4
+ data.tar.gz: a8bdfd8c21128e48ca806ecf9dbb957e6dd1c7560c66f9b8be007f2a6193934a
5
+ SHA512:
6
+ metadata.gz: 670a1a23db7cd77e5cbaad196c5f745c4f29649578a95ead8bb01aecbdd152c7893488cc4faaa19e4aaaf4daa6de23fd065e49aecff8f6e52670c65e11bb6497
7
+ data.tar.gz: f4600c9510f12470abe08ab2ef058fc8e8cf71686a359923d919891ac3047f6a67a007edd7206a5441d888b39a05e7d385866e2e3bc90be22af246151300c064
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /.idea
10
+ columbusctl-*.gem
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in columbus.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,46 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ columbusctl (0.0.1)
5
+ colorize (~> 0.8.1)
6
+ json (~> 2.1, >= 2.1.0)
7
+ rest-client (~> 1.8)
8
+ terminal-table (~> 1.8.0)
9
+ thor (~> 0.20.0)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ colorize (0.8.1)
15
+ domain_name (0.5.20180417)
16
+ unf (>= 0.0.5, < 1.0.0)
17
+ http-cookie (1.0.3)
18
+ domain_name (~> 0.5)
19
+ json (2.1.0)
20
+ mime-types (2.99.3)
21
+ minitest (5.8.5)
22
+ netrc (0.11.0)
23
+ rake (10.4.2)
24
+ rest-client (1.8.0)
25
+ http-cookie (>= 1.0.2, < 2.0)
26
+ mime-types (>= 1.16, < 3.0)
27
+ netrc (~> 0.7)
28
+ terminal-table (1.8.0)
29
+ unicode-display_width (~> 1.1, >= 1.1.1)
30
+ thor (0.20.0)
31
+ unf (0.1.4)
32
+ unf_ext
33
+ unf_ext (0.0.7.5)
34
+ unicode-display_width (1.4.0)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ bundler (~> 1.17)
41
+ columbusctl!
42
+ minitest (~> 5.0)
43
+ rake (~> 10.0)
44
+
45
+ BUNDLED WITH
46
+ 1.17.1
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Columbus
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/columbus`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'columbus'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install columbus
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/columbus.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "columbus"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
9
+ echo Y | gem uninstall columbusctl
10
+ gem build columbus.gemspec
11
+ gem install columbusctl
data/columbus.gemspec ADDED
@@ -0,0 +1,45 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "columbus/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "columbusctl"
8
+ spec.version = Columbus::VERSION
9
+ spec.authors = ["Nils Engelbrecht", "Robert Pueschel"]
10
+ spec.email = ["n.engelbrecht@gmx.net","robert.pueschel@me.com"]
11
+
12
+ spec.summary = "Summary"
13
+ spec.description = "Desc"
14
+ spec.homepage = "https://www.github.com/n3xtdata/columbus-cli"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://www.github.com/n3xtdata/columbus-cli"
21
+ spec.metadata["changelog_uri"] = "https://www.github.com/n3xtdata/columbus-cli"
22
+ else
23
+ raise "RubyGems 2.0 or newer is required to protect against " \
24
+ "public gem pushes."
25
+ end
26
+
27
+ # Specify which files should be added to the gem when it is released.
28
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
29
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
30
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ spec.add_development_dependency "bundler", "~> 1.17"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "minitest", "~> 5.0"
39
+
40
+ spec.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
41
+ spec.add_runtime_dependency 'rest-client', '~> 1.8'
42
+ spec.add_runtime_dependency 'thor', '~> 0.20.0'
43
+ spec.add_runtime_dependency 'colorize', '~> 0.8.1'
44
+ spec.add_runtime_dependency 'terminal-table', '~> 1.8.0'
45
+ end
data/exe/columbus ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "columbus"
4
+
5
+ Columbus::CommandLineRunner.start(ARGV)
data/lib/columbus.rb ADDED
@@ -0,0 +1,56 @@
1
+ require 'thor'
2
+ require 'rest-client'
3
+ require 'yaml'
4
+ require 'colorize'
5
+ require 'terminal-table'
6
+ require "columbus/version"
7
+ require "columbus/start"
8
+ require "columbus/stop"
9
+ require "columbus/checks"
10
+ require "columbus/check"
11
+ require "columbus/connections"
12
+ require "columbus/connection"
13
+ require "columbus/env"
14
+
15
+ module Columbus
16
+ class Error < StandardError; end
17
+ # Your code goes here...
18
+ class CommandLineRunner < Thor
19
+
20
+ desc 'start', 'starts columbus'
21
+ def start
22
+ Columbus.start
23
+ end
24
+
25
+ desc 'stop', 'stops columbus'
26
+ def stop
27
+ Columbus.stop
28
+ end
29
+
30
+ desc 'checks', 'returns a list of all checks'
31
+ def checks()
32
+ Columbus.checks
33
+ end
34
+
35
+ desc 'check label', 'returns a single check'
36
+ def check(label)
37
+ Columbus.check(label)
38
+ end
39
+
40
+ desc 'connections', 'returns a list of all connections'
41
+ def connections
42
+ Columbus.connections
43
+ end
44
+
45
+ desc 'connection label', 'returns a single connection'
46
+ def connection(label)
47
+ Columbus.connection(label)
48
+ end
49
+
50
+ desc 'env', 'return all Columbus Environment Variables'
51
+ def env
52
+ Columbus.env
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,20 @@
1
+ module Columbus
2
+ def self.check(label)
3
+
4
+ url = "http://localhost:8080/api/check/#{label}"
5
+
6
+ begin
7
+ response = RestClient.get url
8
+
9
+ check = JSON.parse(response.body)
10
+
11
+ yaml = YAML.dump(check)
12
+
13
+ puts yaml
14
+ end
15
+
16
+ rescue RestClient::InternalServerError
17
+ puts "#{"Error: ".red} Check with label #{label.light_blue} does not exist"
18
+
19
+ end
20
+ end
@@ -0,0 +1,23 @@
1
+ module Columbus
2
+ def self.checks()
3
+ response = RestClient.get 'http://localhost:8080/api/checks'
4
+
5
+ checks = JSON.parse(response.body)
6
+
7
+ rows = []
8
+
9
+
10
+ checks.each do |check|
11
+ rows << [ check["label"], check["description"], check["components"].length, check["evaluation"]["type"], check["schedules"].length, check["notifications"].length, check["path"]]
12
+ end
13
+
14
+ table = Terminal::Table.new do |t|
15
+ t.headings = %w(Label Description #Components Evaluation #Schedules #Notifications Path)
16
+ t.rows = rows
17
+ end
18
+
19
+ puts table
20
+
21
+
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ module Columbus
2
+ COLUMBUS_JAR = ENV['COLUMBUS_JAR']
3
+ COLUMBUS_HOME = ENV['COLUMBUS_HOME']
4
+ end
@@ -0,0 +1,20 @@
1
+ module Columbus
2
+ def self.connection(label)
3
+
4
+ url = "http://localhost:8080/api/connection/#{label}"
5
+
6
+ begin
7
+ response = RestClient.get url
8
+
9
+ connection = JSON.parse(response.body)
10
+
11
+ yaml = YAML.dump(connection)
12
+
13
+ puts yaml
14
+ end
15
+
16
+ rescue RestClient::InternalServerError
17
+ puts "#{"Error: ".red} Connection with label #{label.light_blue} does not exist"
18
+
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ module Columbus
2
+ def self.connections()
3
+
4
+ response = RestClient.get 'http://localhost:8080/api/connections'
5
+
6
+ connections = JSON.parse(response.body)
7
+
8
+
9
+ rows = []
10
+
11
+ connections.each do |connection|
12
+
13
+ rows << [connection["label"], connection["type"]]
14
+
15
+ end
16
+
17
+ table = Terminal::Table.new :headings => ['Label', 'Type'], :rows => rows
18
+
19
+ puts table
20
+
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ require "columbus/config"
2
+
3
+ module Columbus
4
+ def self.env()
5
+ puts "Get Env ..."
6
+
7
+ puts "COLUMBUS_JAR" + " " + Columbus::COLUMBUS_JAR;
8
+
9
+ puts "COLUMBUS_HOME" + " " + Columbus::COLUMBUS_HOME;
10
+
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ require "columbus/config"
2
+
3
+ module Columbus
4
+ def self.start
5
+ puts "Starting Columbus ..."
6
+ system "nohup java -jar #{Columbus::COLUMBUS_JAR} > #{Columbus::COLUMBUS_HOME}/columbus.log 2>&1 & echo $! > #{Columbus::COLUMBUS_HOME}/columbus.pid"
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ require "columbus/config"
2
+
3
+ module Columbus
4
+ def self.stop
5
+ puts "Stopping Columbus ..."
6
+
7
+ system "kill -9 $(cat #{Columbus::COLUMBUS_HOME}/columbus.pid)"
8
+
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Columbus
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: columbusctl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nils Engelbrecht
8
+ - Robert Pueschel
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2018-11-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.17'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.17'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '10.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '10.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: minitest
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '5.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '5.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: json
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.1'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 2.1.0
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '2.1'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.1.0
76
+ - !ruby/object:Gem::Dependency
77
+ name: rest-client
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.8'
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.8'
90
+ - !ruby/object:Gem::Dependency
91
+ name: thor
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.20.0
97
+ type: :runtime
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.20.0
104
+ - !ruby/object:Gem::Dependency
105
+ name: colorize
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.8.1
111
+ type: :runtime
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.8.1
118
+ - !ruby/object:Gem::Dependency
119
+ name: terminal-table
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.8.0
125
+ type: :runtime
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.8.0
132
+ description: Desc
133
+ email:
134
+ - n.engelbrecht@gmx.net
135
+ - robert.pueschel@me.com
136
+ executables:
137
+ - columbus
138
+ extensions: []
139
+ extra_rdoc_files: []
140
+ files:
141
+ - ".gitignore"
142
+ - Gemfile
143
+ - Gemfile.lock
144
+ - README.md
145
+ - Rakefile
146
+ - bin/console
147
+ - bin/setup
148
+ - columbus.gemspec
149
+ - exe/columbus
150
+ - lib/columbus.rb
151
+ - lib/columbus/check.rb
152
+ - lib/columbus/checks.rb
153
+ - lib/columbus/config.rb
154
+ - lib/columbus/connection.rb
155
+ - lib/columbus/connections.rb
156
+ - lib/columbus/env.rb
157
+ - lib/columbus/start.rb
158
+ - lib/columbus/stop.rb
159
+ - lib/columbus/version.rb
160
+ homepage: https://www.github.com/n3xtdata/columbus-cli
161
+ licenses: []
162
+ metadata:
163
+ homepage_uri: https://www.github.com/n3xtdata/columbus-cli
164
+ source_code_uri: https://www.github.com/n3xtdata/columbus-cli
165
+ changelog_uri: https://www.github.com/n3xtdata/columbus-cli
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.7.6
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Summary
186
+ test_files: []