oncall 0.0.3 → 0.1.0
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/oncall/cli.rb +44 -3
- data/lib/oncall/oncall.rb +0 -0
- data/lib/oncall/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0778276dcc11e6239223743661c8287e0c7f7efccacb596b9c95012d71705578'
|
4
|
+
data.tar.gz: 2cccbb6c6d524537e3cdcc4ac9628587982c796f0e41f257bd6fae2a1b9d1757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e1c60682fea1c01311ad356a15e68543e963ee59bf82e01a6efe04e4908436a73b9e45d64e1624c60264781d70358623478ac62315b7c5ae13c98b1c87a75b9
|
7
|
+
data.tar.gz: b9f6dbecda4cd65af491aceec80f22029dff7dceeebd18aa460105fcdc33426e9771ad7f3803c99df127a55699ac3800ca75a88c3faf9f0c04c6825714243a9b
|
data/lib/oncall/cli.rb
CHANGED
@@ -1,7 +1,41 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'net/http'
|
3
4
|
require 'yaml'
|
4
5
|
require 'optparse'
|
6
|
+
require 'json-schema'
|
7
|
+
|
8
|
+
class Endpoint
|
9
|
+
def initialize(route)
|
10
|
+
@route = route
|
11
|
+
@config = {
|
12
|
+
'develop' => { 'domain' => 'localhost', 'port' => 4567 }
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def parse(filename)
|
17
|
+
instance_eval File.read(filename)
|
18
|
+
end
|
19
|
+
|
20
|
+
def Endpoint.run(filename)
|
21
|
+
Endpoint.new('').parse(filename)
|
22
|
+
end
|
23
|
+
|
24
|
+
def Endpoint.define(route, &block)
|
25
|
+
new(route).instance_eval(&block)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def get(description, &block)
|
31
|
+
instance_eval(&block)
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate(schema)
|
35
|
+
response = Net::HTTP.get_response(@config['develop']['domain'], @route, @config['develop']['port'])
|
36
|
+
puts JSON::Validator.validate(schema, response.body)
|
37
|
+
end
|
38
|
+
end
|
5
39
|
|
6
40
|
module Oncall
|
7
41
|
module CLI
|
@@ -14,6 +48,8 @@ Options:
|
|
14
48
|
--help Display this help message
|
15
49
|
EOF
|
16
50
|
|
51
|
+
PATTERN = '**{,/*/**}/*_oncall.rb'
|
52
|
+
|
17
53
|
def invoke
|
18
54
|
options = parse_options
|
19
55
|
|
@@ -48,10 +84,15 @@ Options:
|
|
48
84
|
exit 1
|
49
85
|
end
|
50
86
|
|
51
|
-
|
87
|
+
files = Dir.glob(PATTERN)
|
88
|
+
|
89
|
+
process_files(files)
|
90
|
+
end
|
52
91
|
|
53
|
-
|
54
|
-
|
92
|
+
def process_files(files)
|
93
|
+
files.each do |file|
|
94
|
+
Endpoint.run(file)
|
95
|
+
end
|
55
96
|
end
|
56
97
|
end
|
57
98
|
end
|
File without changes
|
data/lib/oncall/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oncall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koen Woortman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- bin/oncall
|
64
64
|
- lib/oncall.rb
|
65
65
|
- lib/oncall/cli.rb
|
66
|
+
- lib/oncall/oncall.rb
|
66
67
|
- lib/oncall/version.rb
|
67
68
|
homepage:
|
68
69
|
licenses:
|
@@ -86,5 +87,5 @@ requirements: []
|
|
86
87
|
rubygems_version: 3.0.3
|
87
88
|
signing_key:
|
88
89
|
specification_version: 4
|
89
|
-
summary: oncall-0.0
|
90
|
+
summary: oncall-0.1.0
|
90
91
|
test_files: []
|