snapshot_coverage 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 42b3f631e2cb54bf3a0107be83e34d1235d41c0e
4
+ data.tar.gz: 1e5a50432bba9dfb726ea95627bc92ce8f2536f2
5
+ SHA512:
6
+ metadata.gz: 198289f81f71623aebbe9e40d97fc7e992c41ecfc78277fc79bbe74ffd17edb0c7ea4155501295f70d3f3c03f0810de473bdce8e6003bde2847c7e49d29263f5
7
+ data.tar.gz: 170dbca23fc0801246c1cabffded0e8cf42270d36a613052fec863ae62ea835e9e93f5ef246404628bb57d1d60dbcd7b54950b13767fb08832343e936cc216b9
@@ -0,0 +1,2 @@
1
+ tmp/
2
+ lib/snapshot_coverage.bundle
@@ -0,0 +1 @@
1
+ snapshot_coverage
@@ -0,0 +1 @@
1
+ ruby-2.1.5
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake-compiler'
@@ -0,0 +1,16 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ archive-tar-minitar (0.5.2)
5
+ rake (10.4.2)
6
+ rake-compiler (0.9.3)
7
+ rake
8
+ ruby_core_source (0.1.5)
9
+ archive-tar-minitar (>= 0.5.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ rake-compiler
16
+ ruby_core_source
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 hashrocketeer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,4 @@
1
+ snapshot_coverage
2
+ =================
3
+
4
+ Add snapshot method to ruby coverage lib
@@ -0,0 +1,3 @@
1
+ require 'rake/extensiontask'
2
+ spec = Gem::Specification.load('snapshot_coverage.gemspec')
3
+ Rake::ExtensionTask.new('snapshot_coverage', spec)
@@ -0,0 +1,13 @@
1
+ require 'mkmf'
2
+ extension_name = 'snapshot_coverage'
3
+ dir_config(extension_name)
4
+
5
+ # require 'ruby_core_source'
6
+ # hdrs = proc { have_header("vm_core.h") and have_header("iseq.h") }
7
+ # dir_config("ruby") # allow user to pass in non-standard core include directory
8
+ # if !Ruby_core_source::create_makefile_with_core(hdrs, "foo")
9
+ # # error
10
+ # exit(1)
11
+ # end
12
+
13
+ create_makefile(extension_name)
@@ -0,0 +1,56 @@
1
+ /************************************************
2
+
3
+ coverage.c -
4
+
5
+ $Author: $
6
+
7
+ Copyright (c) 2008 Yusuke Endoh
8
+
9
+ ************************************************/
10
+
11
+ #include "ruby.h"
12
+ extern VALUE rb_get_coverages(void);
13
+
14
+ static VALUE rb_coverages = Qundef;
15
+
16
+ static int
17
+ coverage_result_i(st_data_t key, st_data_t val, st_data_t h)
18
+ {
19
+ VALUE path = (VALUE)key;
20
+ VALUE coverage = (VALUE)val;
21
+ VALUE coverages = (VALUE)h;
22
+ coverage = rb_ary_dup(coverage);
23
+ rb_ary_freeze(coverage);
24
+ rb_hash_aset(coverages, path, coverage);
25
+ return ST_CONTINUE;
26
+ }
27
+
28
+ /*
29
+ * call-seq:
30
+ * Coverage.result => hash
31
+ *
32
+ * Returns a hash that contains filename as key and coverage array as value
33
+ * and disables coverage measurement.
34
+ */
35
+ static VALUE
36
+ rb_coverage_snapshot(VALUE klass)
37
+ {
38
+ VALUE coverages = rb_get_coverages();
39
+ VALUE ncoverages = rb_hash_new();
40
+ if (!RTEST(coverages)) {
41
+ rb_raise(rb_eRuntimeError, "coverage measurement is not enabled");
42
+ }
43
+ st_foreach(RHASH_TBL(coverages), coverage_result_i, ncoverages);
44
+ rb_hash_freeze(ncoverages);
45
+ return ncoverages;
46
+ }
47
+
48
+ void
49
+ Init_snapshot_coverage(void)
50
+ {
51
+ rb_require("coverage");
52
+ VALUE rb_mCoverage = rb_define_module("Coverage");
53
+ rb_define_module_function(rb_mCoverage, "snapshot", rb_coverage_snapshot, 0);
54
+ rb_gc_register_address(&rb_coverages);
55
+ }
56
+
@@ -0,0 +1,13 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'snapshot_coverage'
3
+ s.version = '1.0.0'
4
+ s.licenses = %w[MIT]
5
+ s.summary = 'Like coverage, but with snapshots'
6
+ s.description = "Add snapshot method to coverage lib"
7
+ s.authors = ["Brian Dunn", "Chris Erin"]
8
+ s.email = 'dev@hashrocket.com'
9
+ s.extensions = %w[ext/snapshot_coverage/extconf.rb]
10
+ s.require_paths = %w[lib]
11
+ s.files = %x{git ls-files}.split("\n")
12
+ s.add_development_dependency 'rake-compiler'
13
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: snapshot_coverage
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Dunn
8
+ - Chris Erin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-12-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake-compiler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ description: Add snapshot method to coverage lib
29
+ email: dev@hashrocket.com
30
+ executables: []
31
+ extensions:
32
+ - ext/snapshot_coverage/extconf.rb
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".gitignore"
36
+ - ".ruby-gemset"
37
+ - ".ruby-version"
38
+ - Gemfile
39
+ - Gemfile.lock
40
+ - LICENSE
41
+ - README.md
42
+ - Rakefile
43
+ - ext/snapshot_coverage/extconf.rb
44
+ - ext/snapshot_coverage/snapshot_coverage.c
45
+ - snapshot_coverage.gemspec
46
+ homepage:
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.4.4
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: Like coverage, but with snapshots
70
+ test_files: []