spec_marker 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/spec_marker.rb +16 -6
  2. data/spec_marker.gemspec +1 -1
  3. metadata +50 -62
@@ -3,15 +3,24 @@ require 'rspec/core/formatters/base_formatter'
3
3
  require 'json'
4
4
 
5
5
  class SpecMarker < RSpec::Core::Formatters::BaseFormatter
6
- VERSION = "0.0.2"
6
+ VERSION = "0.0.3"
7
7
 
8
8
  class << self
9
- def mark(*args)
10
- @listeners ||= []
11
- @listeners.each do |listener|
12
- listener.mark *args
9
+ def mark(tag, meta_or_kind={}, kind=nil, meta_for_search=nil)
10
+ if block_given?
11
+ begin
12
+ mark(tag, meta_or_kind, :start)
13
+ return yield
14
+ ensure
15
+ mark(tag, meta_or_kind, :end)
16
+ end
17
+ else
18
+ @listeners ||= []
19
+ @listeners.each do |listener|
20
+ listener.mark(tag, meta_or_kind, kind, meta_for_search)
21
+ end
22
+ self
13
23
  end
14
- self
15
24
  end
16
25
 
17
26
  def _join(formatter)
@@ -49,6 +58,7 @@ class SpecMarker < RSpec::Core::Formatters::BaseFormatter
49
58
  kind = meta_or_kind
50
59
  end
51
60
 
61
+
52
62
  m = {:tag => tag, :at => Time.now.to_f, :meta => meta, :kind => kind}
53
63
  if kind == :end
54
64
  start = @marks.reverse_each.find { |mark| mark[:kind] == :start && mark[:tag] == tag && mark[:meta] == (meta_for_search || meta)}
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "spec_marker"
8
- gem.version = "0.0.2"
8
+ gem.version = "0.0.3"
9
9
  gem.authors = ["Shota Fukumori (sora_h)"]
10
10
  gem.email = ["sorah@tubusu.net"]
11
11
  gem.description = %q{Mark the timestamp of RSpec example starts/ends, and log other stuff for profiling}
metadata CHANGED
@@ -1,60 +1,56 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: spec_marker
3
- version: !ruby/object:Gem::Version
4
- hash: 27
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 2
10
- version: 0.0.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Shota Fukumori (sora_h)
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-12-10 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-12-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: json
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
46
38
  type: :runtime
47
- version_requirements: *id002
48
- description: Mark the timestamp of RSpec example starts/ends, and log other stuff for profiling
49
- email:
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Mark the timestamp of RSpec example starts/ends, and log other stuff
47
+ for profiling
48
+ email:
50
49
  - sorah@tubusu.net
51
50
  executables: []
52
-
53
51
  extensions: []
54
-
55
52
  extra_rdoc_files: []
56
-
57
- files:
53
+ files:
58
54
  - .gitignore
59
55
  - .rspec
60
56
  - .travis.yml
@@ -68,37 +64,29 @@ files:
68
64
  - spec_marker.gemspec
69
65
  homepage: https://github.com/sorah/spec_marker
70
66
  licenses: []
71
-
72
67
  post_install_message:
73
68
  rdoc_options: []
74
-
75
- require_paths:
69
+ require_paths:
76
70
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
71
+ required_ruby_version: !ruby/object:Gem::Requirement
78
72
  none: false
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- hash: 3
83
- segments:
84
- - 0
85
- version: "0"
86
- required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
78
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
95
83
  requirements: []
96
-
97
84
  rubyforge_project:
98
85
  rubygems_version: 1.8.24
99
86
  signing_key:
100
87
  specification_version: 3
101
- summary: Mark the timestamp of RSpec example starts/ends, and log other stuff for profiling.
102
- test_files:
88
+ summary: Mark the timestamp of RSpec example starts/ends, and log other stuff for
89
+ profiling.
90
+ test_files:
103
91
  - spec/spec_helper.rb
104
92
  - spec/spec_marker_spec.rb