chef-relevant-tests 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: 4f5e163490693818aa4ea66b915c5d42fddfc96a
4
- data.tar.gz: 22154e143b81e92dc60cc92040d61a09fb33e468
3
+ metadata.gz: f19e111176b0c2f64891fb70d66fa68cbb4034d1
4
+ data.tar.gz: eb90a79a7ffa6d67a98af1476fe78be0d8d0595f
5
5
  SHA512:
6
- metadata.gz: 51095f24d9cced208329d1640737613b5a1e24e1814fec7f4278d3357b1af9055e0e1fc95d57e7ba49f6841eb437d44458fda7ecd94f60857bad1ac5c6ee8455
7
- data.tar.gz: 2fa43a9bb328c9c5a12f9767e9695d9f624e21c9210c964ae9b82bf6880dd4c7c09c167e5c37da8561af845fa8a9b21beaede669d25f0b164832fa03c4f7dd93
6
+ metadata.gz: b8c59dde7264289139bf7b9d126ccbb3aed9691264cf90853967f557d3c063914ceb07e34cca3e9e03312290a133efbacb0e7f3cd77b284e57f82569a1fb6ce5
7
+ data.tar.gz: 5a6b37e68c91de2d05e1206d9b58399a019b15256381d3b770ce824cd0c298da69fbc83147d178829afa2dc41ac57333c159ed03f1911ea9646185161cfba15b
@@ -3,8 +3,7 @@ $:.unshift File.expand_path('../../lib', __FILE__)
3
3
  require 'chef-relevant-tests'
4
4
 
5
5
  begin
6
- ChefRelevantTests::Cli.set_revision(ARGV[0])
7
- ChefRelevantTests::Cli.set_expander(ARGV[1])
6
+ ChefRelevantTests::Cli.parse_args!(ARGV)
8
7
 
9
8
  puts ChefRelevantTests::Cli.run.join(' ')
10
9
  rescue => e
@@ -1,13 +1,39 @@
1
1
  require 'set'
2
+ require 'optparse'
2
3
 
3
4
  module ChefRelevantTests
4
5
  class Cli
5
6
  class << self
7
+ def parse_args!(argv)
8
+ parser = OptionParser.new do |opts|
9
+ opts.banner = <<-BANNER.strip
10
+ Usage: chef-relevant-tests [revision] [expander]
11
+ Available Expanders: #{EXPANDER_REGISTRY.keys.join ','}
12
+ BANNER
13
+ end
14
+
15
+ parser.parse!(argv)
16
+
17
+ unless set_revision(ARGV.shift)
18
+ puts "Error: Unknown revision.\n\n#{parser.help}"
19
+ exit(1)
20
+ end
21
+
22
+ unless set_expander(ARGV.shift)
23
+ puts "Error: Unknown expander.\n\n#{parser.help}"
24
+ exit(1)
25
+ end
26
+ end
27
+
6
28
  def set_revision(rev)
29
+ return unless system('git rev-parse #{rev} >/dev/null 2>&1')
30
+
7
31
  @@revision = rev
8
32
  end
9
33
 
10
34
  def set_expander(exp)
35
+ return if !exp || exp.empty?
36
+
11
37
  @@expander = exp
12
38
  end
13
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-relevant-tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brigade Engineering
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-27 00:00:00.000000000 Z
12
+ date: 2014-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef