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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/speculate_about.rb +11 -8
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 669757a09c549512732274147c0b65dc3d71c3446b73490f961ae61b4e6a7d2b
4
- data.tar.gz: 68b1e0f9babc9630616b14b16bf5ad60a9974983495dc7c575287dfbb29472a0
3
+ metadata.gz: 585ea729bce40c7978af922d12ac5ec32384c2a4e5b1a19fd159354864344776
4
+ data.tar.gz: ac750695bb18b891c1977533dce8b8932c74bb75cad89d1a1d81cd6b955cbe8f
5
5
  SHA512:
6
- metadata.gz: 4253cedda25c3f32eaf71b0bbe5a99376f05e42e1dd8ab1e4ca818d12f99d6ac88404883ba25e74318d4de094d4614bad63ac397cde6f71f2835d32109586e5e
7
- data.tar.gz: 2766bdc6aafb5f70c7ab73ec3b24e82ef025f6bbdfefd95de4d1bc797478de37de60ee60ff50c2895ead4c22e03117f432b6924252abae42419de5f46cf26ab9
6
+ metadata.gz: e46327125543f2e112fef196d87e660e67cd3078d8a8bb61171a775130508bff51c7595be05c1a5345e167a64ec0d342e974ac450f9ddec340622561e6bd5c50
7
+ data.tar.gz: f384dd4f32c12cf6c9973e520cf237712bb46e28ffe965bdf161c66a1c276977f7e991d8eea9f8d0102f136fed6e76b4f60f3ed0058df7f9737abc4413bff5d4
@@ -4,9 +4,12 @@ require 'speculations/parser'
4
4
 
5
5
  module SpeculateAbout
6
6
  def speculate_about file
7
- path = _find_file(file, File.dirname( caller.first ))
8
- code = _compile path, file
9
- ENV["SPECULATE_ABOUT_DEBUG"] ? puts(code) : instance_eval(code)
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 _find_file file, local_path
20
- return file if File.readable? file
21
- local_file = File.join(local_path, file)
22
- return local_file if File.readable? local_file
23
- raise ArgumentError, "file #{file.inspect} not found"
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.0
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, a la
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: []