speculate_about 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/speculate_about.rb +11 -8
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 585ea729bce40c7978af922d12ac5ec32384c2a4e5b1a19fd159354864344776
|
4
|
+
data.tar.gz: ac750695bb18b891c1977533dce8b8932c74bb75cad89d1a1d81cd6b955cbe8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e46327125543f2e112fef196d87e660e67cd3078d8a8bb61171a775130508bff51c7595be05c1a5345e167a64ec0d342e974ac450f9ddec340622561e6bd5c50
|
7
|
+
data.tar.gz: f384dd4f32c12cf6c9973e520cf237712bb46e28ffe965bdf161c66a1c276977f7e991d8eea9f8d0102f136fed6e76b4f60f3ed0058df7f9737abc4413bff5d4
|
data/lib/speculate_about.rb
CHANGED
@@ -4,9 +4,12 @@ require 'speculations/parser'
|
|
4
4
|
|
5
5
|
module SpeculateAbout
|
6
6
|
def speculate_about file
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
paths = _find_files(file, File.dirname( caller.first ))
|
8
|
+
raise ArgumentError, "no files found for pattern #{file}" if paths.empty?
|
9
|
+
paths.each do |path|
|
10
|
+
code = _compile path, file
|
11
|
+
ENV["SPECULATE_ABOUT_DEBUG"] ? puts(code) : instance_eval(code)
|
12
|
+
end
|
10
13
|
end
|
11
14
|
|
12
15
|
|
@@ -16,11 +19,11 @@ module SpeculateAbout
|
|
16
19
|
ast = Speculations::Parser.new.parse_from_file(path, file)
|
17
20
|
ast.to_code
|
18
21
|
end
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
def _find_files file, local_path
|
23
|
+
[Dir.pwd, local_path]
|
24
|
+
.flat_map do |dir|
|
25
|
+
Dir.glob(File.join(dir, file))
|
26
|
+
end
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speculate_about
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Dober
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-06-23 00:00:00.000000000 Z
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.9'
|
27
|
-
description: Allows Markdown or other text files to be used as literal specs,
|
27
|
+
description: Allows Markdown or other text files to be used as literal specs, à la
|
28
28
|
Elixr doctest, but from any file.
|
29
29
|
email: robert.dober@gmail.com
|
30
30
|
executables: []
|
@@ -47,7 +47,7 @@ homepage: https://github.com/robertdober/speculate
|
|
47
47
|
licenses:
|
48
48
|
- Apache-2.0
|
49
49
|
metadata: {}
|
50
|
-
post_install_message:
|
50
|
+
post_install_message:
|
51
51
|
rdoc_options: []
|
52
52
|
require_paths:
|
53
53
|
- lib
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubygems_version: 3.1.2
|
66
|
-
signing_key:
|
66
|
+
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Extract RSpecs from Markdown
|
69
69
|
test_files: []
|