oncall 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e1468fdbc7031c7e94d7fb008215ab5155946abd2cb345b9d686dae3b50346f
4
- data.tar.gz: 9e81904f2d1e772a1ea31a6640fd865518ad8f330f9ed947aa628d40ba017735
3
+ metadata.gz: e9ad3d2188d3421e55651793b44f1373d884140447ea306eee4cb5ac4d5230cc
4
+ data.tar.gz: 4c08ead424c1c35d9c40ab42e0665d7d9f0fd6849c29de876917fc5c099e2edd
5
5
  SHA512:
6
- metadata.gz: 3645aa70fe65da2242bae0e6942a85fb9c5352d569a93dab07301acdb3592a966fe5cc9452d92c014fb7ed0d61f5094c0453b834f2ae10f8da5a7206629c6375
7
- data.tar.gz: 6552d1020124e5f17b244ad9cf46003bd2b73c418646bf8bcc0d5e45707015fd8e7332064828933c7a5ac5c9f1b88dc453a2e2b4f41fac6ad53e405e832707dd
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
- options = parse_options
16
-
17
- if options[:help]
18
- print_usage
19
- exit 0
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
@@ -0,0 +1,11 @@
1
+ module Oncall
2
+ module Commands
3
+ class InitCommand < BaseCommand
4
+ def call
5
+ puts ARGV
6
+
7
+ SUCCESS
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module Oncall
2
+ module Commands
3
+ class RunCommand < BaseCommand
4
+ def call
5
+ runner = Oncall::Runner.new
6
+ status = runner.run.to_i
7
+
8
+ SUCCESS
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Oncall
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
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.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-27 00:00:00.000000000 Z
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