peck 0.4.0 → 0.5.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8d02cb15338b60e32592ca9edff3b23106b4306f
4
+ data.tar.gz: 4049a740ea4ba2d85bfa19e2ba122323c0f15aa4
5
+ SHA512:
6
+ metadata.gz: 83030d67cbcd51b60cda3dc7a0f9825d6901b9c9e8292eb9f34971b465494e4cc298df92af65cd1085bd6663aa7da96f9c149179b973de18bba9546f3f2d1b6b
7
+ data.tar.gz: 8e19322b728c46bff2fc3ee36fcde70c389bc8c8892bb44730a467c77fe459a8d64207c8851766b2cd5074511e9b780779b541098b1b8326ce65265be433af57
data/README.md CHANGED
@@ -86,7 +86,7 @@ system.
86
86
 
87
87
  ### Peck is extensible
88
88
 
89
- Expect opening up Peck classes you can also extend during runtime with the
89
+ Except opening up Peck classes you can also extend during runtime with the
90
90
  `once` callback. This callback is ran when a new context (describe) is
91
91
  created.
92
92
 
data/bin/peck CHANGED
@@ -1,8 +1,52 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- files = ARGV
3
+ require File.expand_path('../../lib/peck', __FILE__)
4
+ require File.expand_path('../../lib/peck/option_parser', __FILE__)
5
+
6
+ options = Peck::OptionParser.parse(ARGV)
7
+ files = options.last
8
+
9
+ if options.first.has_key?('h') || options.first.has_key?('help')
10
+ puts <<-EOF
11
+ Usage: peck [options] [files]
12
+
13
+ -c, --concurrency set the number of threads used to run the suite
14
+ -e, --match-regexp run tests that match a given regular expression
15
+ -t, --match-text run tests that match a given string
16
+ -a, --recently-accessed run tests that have been updated in the last 15 minutes
17
+ -d, --debug log debug messages to stdout
18
+ -h, --help show this message
19
+ EOF
20
+ exit
21
+ end
22
+
23
+ unless (%w(v version) & options.first.keys).empty?
24
+ puts "Peck #{Peck::VERSION}"
25
+ exit 1
26
+ end
27
+
28
+ if concurrency = options.first['c'] || options.first['concurrency']
29
+ Peck.concurrency = concurrency.to_i
30
+ end
31
+
32
+ if match_regexp = options.first['e'] || options.first['match-regexp']
33
+ Peck.spec_selector = Regexp.new(match_regexp)
34
+ end
35
+
36
+ if match_text = options.first['t'] || options.first['match-text']
37
+ Peck.spec_selector = /#{match_text}/
38
+ end
39
+
40
+ unless (%w(d debug) & options.first.keys).empty?
41
+ require File.expand_path('../../lib/peck/debug', __FILE__)
42
+ end
43
+
4
44
  files.concat Dir["{test,spec}/**/*_{test,spec}.rb"] if files.empty?
5
45
 
6
46
  files.each do |file|
7
- load file
47
+ if options.first.has_key?('a') || options.first.has_key?('recently-accessed')
48
+ load file if File.ctime(file) > Time.now - 900
49
+ else
50
+ load file
51
+ end
8
52
  end
data/lib/peck.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'thread'
4
4
 
5
5
  class Peck
6
- VERSION = "0.1.0"
6
+ VERSION = "0.5.0"
7
7
 
8
8
  class << self
9
9
  # Returns all the defined contexts.
@@ -88,7 +88,7 @@ class Peck
88
88
  end
89
89
 
90
90
  def self.run_concurrent
91
- Peck.log("Running specs concurrently")
91
+ Peck.log("Running specs concurrently (#{Peck.concurrency} threads)")
92
92
  current_spec = -1
93
93
  specs = all_specs
94
94
  threaded do |nr|
@@ -0,0 +1,37 @@
1
+ class Peck
2
+ # Parser for command line options
3
+ class OptionParser
4
+ # Parses ARGV from a Ruby script and returns options as a hash and
5
+ # arguments as a list.
6
+ #
7
+ # OptionParser.parse(%w(create --username manfred)) #=>
8
+ # [{"username"=>"manfred"}, ["create"]]
9
+ def self.parse(argv)
10
+ return [{},[]] if argv.empty?
11
+
12
+ options = {}
13
+ rest = []
14
+ switch = nil
15
+
16
+ for value in argv
17
+ bytes = value.respond_to?(:bytes) ? value.bytes.first(2) : [value[0], value[1]]
18
+ # value is a switch
19
+ if bytes[0] == 45
20
+ switch = value.slice((bytes[1] == 45 ? 2 : 1)..-1)
21
+ options[switch] = nil
22
+ else
23
+ if switch
24
+ # we encountered another switch so this
25
+ # value belongs to the last switch
26
+ options[switch] = value
27
+ switch = nil
28
+ else
29
+ rest << value
30
+ end
31
+ end
32
+ end
33
+
34
+ [options, rest]
35
+ end
36
+ end
37
+ end
metadata CHANGED
@@ -1,33 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: peck
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Manfred Stienstra
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-08-28 00:00:00 +02:00
19
- default_executable:
11
+ date: 2013-09-20 00:00:00.000000000 Z
20
12
  dependencies: []
21
-
22
- description: " Concurrent spec framework.\n"
13
+ description: |2
14
+ Concurrent spec framework.
23
15
  email: manfred@fngtps.com
24
- executables:
16
+ executables:
25
17
  - peck
26
18
  extensions: []
27
-
28
- extra_rdoc_files:
19
+ extra_rdoc_files:
29
20
  - COPYING
30
- files:
21
+ files:
31
22
  - lib/peck/context.rb
32
23
  - lib/peck/counter.rb
33
24
  - lib/peck/debug.rb
@@ -40,44 +31,36 @@ files:
40
31
  - lib/peck/notifiers/base.rb
41
32
  - lib/peck/notifiers/default.rb
42
33
  - lib/peck/notifiers/documentation.rb
34
+ - lib/peck/option_parser.rb
43
35
  - lib/peck/specification.rb
44
36
  - lib/peck.rb
45
37
  - COPYING
46
38
  - README.md
47
39
  - bin/peck
48
- has_rdoc: true
49
40
  homepage:
50
41
  licenses: []
51
-
42
+ metadata: {}
52
43
  post_install_message:
53
- rdoc_options:
44
+ rdoc_options:
54
45
  - --charset=utf-8
55
- require_paths:
46
+ require_paths:
56
47
  - lib
57
- required_ruby_version: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- hash: 3
63
- segments:
64
- - 0
65
- version: "0"
66
- required_rubygems_version: !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
75
58
  requirements: []
76
-
77
59
  rubyforge_project:
78
- rubygems_version: 1.6.2
60
+ rubygems_version: 2.0.3
79
61
  signing_key:
80
- specification_version: 3
81
- summary: Peck is a concurrent spec framework which inherits a lot from the fabulous Bacon and MacBacon. We call it a framework because it was designed to be used in parts and is easily extended.
62
+ specification_version: 4
63
+ summary: Peck is a concurrent spec framework which inherits a lot from the fabulous
64
+ Bacon and MacBacon. We call it a framework because it was designed to be used in
65
+ parts and is easily extended.
82
66
  test_files: []
83
-