oncall 0.1.1 → 0.1.2
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 +11 -31
- data/lib/oncall/commands/base_command.rb +56 -0
- data/lib/oncall/commands/init_command.rb +11 -0
- data/lib/oncall/commands/run_command.rb +12 -0
- data/lib/oncall/version.rb +1 -1
- data/lib/oncall.rb +0 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9ad3d2188d3421e55651793b44f1373d884140447ea306eee4cb5ac4d5230cc
|
4
|
+
data.tar.gz: 4c08ead424c1c35d9c40ab42e0665d7d9f0fd6849c29de876917fc5c099e2edd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a16db8a950a63c3121b36ad03c0d2b6f06bd755bf2b0d32515403d7c43c588db30fca9eb37d72fb92add0ac8b8053eeb6e5233a8008897b4500038a940b8881f
|
7
|
+
data.tar.gz: add232c3a1ffb336b396309a9319c5e286d0659f572422377c32ca2e3a75dd52e3a205a8b35b5f3b57bc75705023aaaee01b94daea8b808745a87f1f53f95751
|
data/lib/oncall/cli.rb
CHANGED
@@ -1,42 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'commands/base_command'
|
4
|
+
require_relative 'commands/init_command'
|
5
|
+
require_relative 'commands/run_command'
|
6
|
+
|
3
7
|
module Oncall
|
4
8
|
module CLI
|
5
9
|
extend self
|
6
10
|
|
7
|
-
USAGE = <<~EOF
|
8
|
-
Usage: oncall
|
9
|
-
|
10
|
-
Options:
|
11
|
-
--help Display this help message
|
12
|
-
EOF
|
13
|
-
|
14
11
|
def invoke
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
case ARGV[0].to_s.downcase
|
13
|
+
when 'init'
|
14
|
+
Oncall::Commands::InitCommand.invoke
|
15
|
+
when 'run'
|
16
|
+
Oncall::Commands::RunCommand.invoke
|
17
|
+
else
|
18
|
+
Oncall::Commands::BaseCommand.invoke
|
20
19
|
end
|
21
|
-
|
22
|
-
runner = Oncall::Runner.new
|
23
|
-
status = runner.run.to_i
|
24
|
-
exit(status)
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def parse_options
|
30
|
-
options = {}
|
31
|
-
OptionParser.new do |opt|
|
32
|
-
opt.on('--help') { |o| options[:help] = o }
|
33
|
-
end.parse!
|
34
|
-
|
35
|
-
options
|
36
|
-
end
|
37
|
-
|
38
|
-
def print_usage
|
39
|
-
puts USAGE
|
40
20
|
end
|
41
21
|
end
|
42
22
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative '../version'
|
2
|
+
|
3
|
+
module Oncall
|
4
|
+
module Commands
|
5
|
+
class BaseCommand
|
6
|
+
|
7
|
+
SUCCESS = 0
|
8
|
+
|
9
|
+
USAGE = <<~EOF
|
10
|
+
Usage: oncall
|
11
|
+
|
12
|
+
init Initialize dotfiles directory
|
13
|
+
run Run test suite
|
14
|
+
|
15
|
+
Options:
|
16
|
+
--help Display this help message
|
17
|
+
--version Show version information
|
18
|
+
EOF
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@options = parse_options
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.invoke
|
25
|
+
exit new.call.to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
def call
|
29
|
+
case @options[0]
|
30
|
+
when :version
|
31
|
+
print_version
|
32
|
+
else
|
33
|
+
puts USAGE
|
34
|
+
end
|
35
|
+
|
36
|
+
SUCCESS
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
def print_version
|
42
|
+
puts "oncall: version #{Oncall::VERSION}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def parse_options
|
46
|
+
options = []
|
47
|
+
OptionParser.new do |opt|
|
48
|
+
opt.on('--help') { options.push(:help) }
|
49
|
+
opt.on('--version') { options.push(:version) }
|
50
|
+
end.parse!
|
51
|
+
|
52
|
+
options
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/oncall/version.rb
CHANGED
data/lib/oncall.rb
CHANGED
@@ -12,6 +12,5 @@ module Oncall
|
|
12
12
|
require File.expand_path(File.join(File.dirname(__FILE__), 'oncall', 'request'))
|
13
13
|
require File.expand_path(File.join(File.dirname(__FILE__), 'oncall', 'test_case'))
|
14
14
|
require File.expand_path(File.join(File.dirname(__FILE__), 'oncall', 'test_wrapper'))
|
15
|
-
require File.expand_path(File.join(File.dirname(__FILE__), 'oncall', 'version'))
|
16
15
|
require File.expand_path(File.join(File.dirname(__FILE__), 'oncall', 'runner'))
|
17
16
|
end
|
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.1.
|
4
|
+
version: 0.1.2
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|
@@ -64,6 +64,9 @@ files:
|
|
64
64
|
- lib/oncall.rb
|
65
65
|
- lib/oncall/body_test.rb
|
66
66
|
- lib/oncall/cli.rb
|
67
|
+
- lib/oncall/commands/base_command.rb
|
68
|
+
- lib/oncall/commands/init_command.rb
|
69
|
+
- lib/oncall/commands/run_command.rb
|
67
70
|
- lib/oncall/request.rb
|
68
71
|
- lib/oncall/runner.rb
|
69
72
|
- lib/oncall/test_case.rb
|