coverband_ext 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4324e229c56d8cc296a8b2c765e82d2f557aed22
4
+ data.tar.gz: 122396f1d8bf1e318d4a51df662f57bdcf3d3728
5
+ SHA512:
6
+ metadata.gz: 77cff550418502341fc8187ee8cdaa7e1a499e525acf4bd2b80205b1561d0e6700626db6eb1fa2e0335f2dc36d64c479902d5137fbb05a972ffb4a0d7de0b196
7
+ data.tar.gz: dddd30c51f401e64890528dbcd53d4974b52a3c42b474031d8ff75806339aff8339c2d6c17e9af18b98e14f61615674b8327e3673be1cf38810dd06bcf5ae373
data/README.md CHANGED
@@ -8,7 +8,7 @@ This gem does nothing on its own. So make sure you already have setup the [cover
8
8
 
9
9
  Add this line to your application's Gemfile, after the existing coverband line:
10
10
 
11
- gem 'coverband_ext'
11
+ gem 'coverband'
12
12
  gem 'coverband_ext'
13
13
 
14
14
  And then execute:
@@ -10,6 +10,21 @@
10
10
 
11
11
  #include <ruby.h>
12
12
 
13
+ static int
14
+ any_ignore_patterns( VALUE rb_ignore_patterns, const char *srcfile ) {
15
+ int ignore_patterns_len = RARRAY_LEN(rb_ignore_patterns);
16
+ VALUE * ignore_patterns = RARRAY_PTR(rb_ignore_patterns);
17
+ char * ignore_pattern;
18
+ int i;
19
+ for(i = 0; i < ignore_patterns_len; i++) {
20
+ ignore_pattern = StringValueCStr(ignore_patterns[i]);
21
+ if (strstr(srcfile, ignore_pattern)) {
22
+ return 1;
23
+ }
24
+ }
25
+ return 0;
26
+ }
27
+
13
28
  // TODO I read below do I need to do this for my variables below?
14
29
  // If you create a Ruby object from C and store it in a C global variable without exporting it to Ruby, you must at least tell the garbage collector about it, lest ye be reaped inadvertently:
15
30
  // VALUE obj;
@@ -21,10 +36,6 @@ static void trace_line_handler_ext(VALUE rb_event_flag_t, VALUE data, VALUE self
21
36
  static void
22
37
  trace_line_handler_ext(VALUE rb_event_flag_t, VALUE data, VALUE self, ID id, VALUE klass)
23
38
  {
24
- // TODO at the moment ignore patterns are not supported by the c_ext
25
- // since they were mostly added to improve the ruby version perf might not matter much
26
- // anyways would be good to add, but need some C help or research to convert
27
- // !@ignore_patterns.any?{|pattern| file.match(/#{pattern}/)
28
39
  VALUE currentCoverbandBase = rb_funcall(rb_path2class("Coverband::Base"), rb_intern("instance"), 0);
29
40
  const char *srcfile = rb_sourcefile();
30
41
  VALUE proj_dir = rb_iv_get(currentCoverbandBase, "@project_directory");
@@ -32,21 +43,22 @@ trace_line_handler_ext(VALUE rb_event_flag_t, VALUE data, VALUE self, ID id, VAL
32
43
 
33
44
  if((strstr(srcfile, "gems") == NULL) &&
34
45
  (strstr(srcfile, "internal:prelude") == NULL) &&
35
- (strstr(srcfile, c_str_proj_dir) != NULL)
46
+ (strstr(srcfile, c_str_proj_dir) != NULL) &&
47
+ (!any_ignore_patterns( rb_iv_get(currentCoverbandBase, "@ignore_patterns"), srcfile))
36
48
  ) {
37
49
  rb_funcall(currentCoverbandBase, rb_intern("add_file_without_checks"), 2, rb_str_new2(srcfile), INT2NUM(rb_sourceline()));
38
50
  }
39
51
 
40
52
  }
41
53
 
42
- static VALUE
54
+ static VALUE
43
55
  cb_extended(VALUE self) {
44
56
  return Qtrue;
45
57
  }
46
58
 
47
59
  static VALUE
48
60
  cb_set_tracer(VALUE self) {
49
- if(!rb_iv_get(self, "@tracer_set")) {
61
+ if(!rb_iv_get(self, "@tracer_set")) {
50
62
  // NOTE: We are using rb_add_event_hook opposed to rb_tracepoint_new for 1.9.X compat
51
63
  // not using higher level C functions of set_trace_func to avoid extra overhead we don't need since we only need the RUBY_EVENT_LINE hook as well as only needing file / line number opposed to everything else.
52
64
  // TODO possibly use rb_thread_add_event_hook
@@ -1,3 +1,3 @@
1
1
  module CoverbandExt
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dan Mayer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-08-04 00:00:00.000000000 Z
11
+ date: 2015-12-08 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: coverband
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: C extension for fast coverband
@@ -67,7 +60,7 @@ extensions:
67
60
  - ext/coverband_ext/extconf.rb
68
61
  extra_rdoc_files: []
69
62
  files:
70
- - .gitignore
63
+ - ".gitignore"
71
64
  - Gemfile
72
65
  - LICENSE.txt
73
66
  - README.md
@@ -130,32 +123,25 @@ files:
130
123
  homepage: ''
131
124
  licenses:
132
125
  - MIT
126
+ metadata: {}
133
127
  post_install_message:
134
128
  rdoc_options: []
135
129
  require_paths:
136
130
  - lib
137
131
  required_ruby_version: !ruby/object:Gem::Requirement
138
- none: false
139
132
  requirements:
140
- - - ! '>='
133
+ - - ">="
141
134
  - !ruby/object:Gem::Version
142
135
  version: '0'
143
- segments:
144
- - 0
145
- hash: -1916411580250023859
146
136
  required_rubygems_version: !ruby/object:Gem::Requirement
147
- none: false
148
137
  requirements:
149
- - - ! '>='
138
+ - - ">="
150
139
  - !ruby/object:Gem::Version
151
140
  version: '0'
152
- segments:
153
- - 0
154
- hash: -1916411580250023859
155
141
  requirements: []
156
142
  rubyforge_project:
157
- rubygems_version: 1.8.23
143
+ rubygems_version: 2.4.5
158
144
  signing_key:
159
- specification_version: 3
145
+ specification_version: 4
160
146
  summary: C extension for fast coverband
161
147
  test_files: []