oncall 0.1.3 → 0.1.4

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: fd2e38b00bff96ea8ddbf5a16246e61269c82dc8d4d81521f53eef86476885c7
4
- data.tar.gz: fbeace3395aeeab3140c8694e16d3c5b0081c554e8edb70a0d3916e02bbf44c8
3
+ metadata.gz: 31d579e917f9d0d901321e0d2338a6634242af577d39cc47aa03d6a16ca320bd
4
+ data.tar.gz: 2d8ed801f79a30dfe9bd2229b5e480fbc1886fdd242383933afa7f1cdc171c5b
5
5
  SHA512:
6
- metadata.gz: 255ec92f86b9b69e4583e16b2e8561ab73c506f6243c88fd79d8d47cbf568966d01c338ba12594860458cdac5c3def3d6390ba32c42a5d26f8411fd0f0d8508b
7
- data.tar.gz: 976916dbdee674163ba5222c30408653ebc26f40ba5d7f361c8b91dfc4f88404c6b2e5a31564aba76998fa9620482e2621725861489f0826d6da4364572c15e6
6
+ metadata.gz: d40805eb76731aa2759b4ead7d1ab76bbafae194b4117605972edd62f4d2f5c947201a18266176df99861682aa28e9360dfa008d03bb64c43dc76c8e355ae326
7
+ data.tar.gz: fa7d697ca82deb7b7b793667f324ff7af89530339b9584dc2b4e79cf958258e2e8c39ef2c8eeeb088431b1f79e3665fb7c04ce6f731900b2ec9363b2da345ef3
data/bin/oncall CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../lib/oncall')
4
- Oncall::CLI.invoke
4
+ Oncall::CLI.run
data/lib/oncall/cli.rb CHANGED
@@ -8,14 +8,14 @@ module Oncall
8
8
  module CLI
9
9
  extend self
10
10
 
11
- def invoke
11
+ def self.run
12
12
  case ARGV[0].to_s.downcase
13
13
  when 'init'
14
- Oncall::Commands::InitCommand.invoke
14
+ Oncall::Commands::InitCommand.invoke(ARGV.shift)
15
15
  when 'run'
16
- Oncall::Commands::RunCommand.invoke
16
+ Oncall::Commands::RunCommand.invoke(ARGV.shift)
17
17
  else
18
- Oncall::Commands::BaseCommand.invoke
18
+ Oncall::Commands::BaseCommand.invoke(ARGV)
19
19
  end
20
20
  end
21
21
  end
@@ -3,53 +3,25 @@ require_relative '../version'
3
3
  module Oncall
4
4
  module Commands
5
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) }
6
+ def self.invoke(args)
7
+ OptionParser.new do |opts|
8
+ opts.banner = 'Usage: oncall'
9
+ opts.separator ''
10
+ opts.separator 'Options:'
11
+
12
+ opts.on('--version', 'Show version information.') do
13
+ puts "oncall: version #{Oncall::VERSION}"
14
+ exit
15
+ end
16
+
17
+ opts.on('--help', 'Display this help message.') do
18
+ puts opts
19
+ exit
20
+ end
21
+
22
+ puts opts
23
+ exit
50
24
  end.parse!
51
-
52
- options
53
25
  end
54
26
  end
55
27
  end
@@ -1,10 +1,15 @@
1
1
  module Oncall
2
2
  module Commands
3
- class InitCommand < BaseCommand
4
- def call
5
- puts ARGV
3
+ class InitCommand
4
+ def self.invoke(args)
5
+ config_template_path = File.join(File.dirname(__FILE__), '..', 'templates', 'oncall.yml.template')
6
+ template = File.read(config_template_path)
6
7
 
7
- SUCCESS
8
+ File.open(File.join(Dir.getwd, 'oncall.yml'), 'w') do |file|
9
+ file.write(template)
10
+ end
11
+
12
+ exit
8
13
  end
9
14
  end
10
15
  end
@@ -1,12 +1,10 @@
1
1
  module Oncall
2
2
  module Commands
3
- class RunCommand < BaseCommand
4
- def call
5
- env = ARGV[1]
3
+ class RunCommand
4
+ def self.invoke(args)
5
+ env = ARGV[0]
6
6
  runner = Oncall::Runner.new(env)
7
- status = runner.run.to_i
8
-
9
- SUCCESS
7
+ exit runner.run.to_i
10
8
  end
11
9
  end
12
10
  end
@@ -0,0 +1,5 @@
1
+ module Oncall
2
+ class Configuration
3
+ DEFAULT_PATTERN = '**{,/*/**}/*_oncall.rb'.freeze
4
+ end
5
+ end
data/lib/oncall/dsl.rb ADDED
@@ -0,0 +1,4 @@
1
+ module Oncall
2
+ module DSL
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ default: develop
2
+ develop:
3
+ domain: localhost
4
+ port: 4567
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Oncall
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  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.3
4
+ version: 0.1.4
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-29 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: sinatra
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,8 +81,11 @@ files:
67
81
  - lib/oncall/commands/base_command.rb
68
82
  - lib/oncall/commands/init_command.rb
69
83
  - lib/oncall/commands/run_command.rb
84
+ - lib/oncall/configuration.rb
85
+ - lib/oncall/dsl.rb
70
86
  - lib/oncall/request.rb
71
87
  - lib/oncall/runner.rb
88
+ - lib/oncall/templates/oncall.yml.template
72
89
  - lib/oncall/test_case.rb
73
90
  - lib/oncall/test_wrapper.rb
74
91
  - lib/oncall/version.rb