speculate_about 0.2.1 → 0.2.2
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 +10 -1
- data/lib/speculations/parser/context.rb +5 -1
- data/lib/speculations/version.rb +3 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5abf0f1d0b408b81d4b2b9644eeaaca4137bcf0180f298bb94145b275a847ecd
|
4
|
+
data.tar.gz: a040f692852c90de48d3d1a758ecda31ce8a3d1f36920ce44145d396f7666aca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6d2d63515ade99e8eaac787572359c3b707301263d4ebbee6ce3df03546426262202e092eef337239cf9a82e92096e8fa7318756b405f46900c0514fd1d1d4c
|
7
|
+
data.tar.gz: 5ca6224cf00ab3ee4cd13d8ba2df5cfc83bcc7d516a018435f097ed509f94a27cc2ec9df054a2cc43b2215a3399a0b79c4279c00b01b9fd27181e0c0ac905597
|
data/lib/speculate_about.rb
CHANGED
@@ -8,7 +8,7 @@ module SpeculateAbout
|
|
8
8
|
raise ArgumentError, "no files found for pattern #{file}" if paths.empty?
|
9
9
|
paths.each do |path|
|
10
10
|
code = _compile path, file
|
11
|
-
ENV["SPECULATE_ABOUT_DEBUG"] ?
|
11
|
+
ENV["SPECULATE_ABOUT_DEBUG"] ? _show(code, path) : instance_eval(code, path)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -19,12 +19,21 @@ module SpeculateAbout
|
|
19
19
|
ast = Speculations::Parser.new.parse_from_file(path, file)
|
20
20
|
ast.to_code
|
21
21
|
end
|
22
|
+
def _show(code, path)
|
23
|
+
message = "Generated code for #{path}"
|
24
|
+
_underline(message)
|
25
|
+
puts code
|
26
|
+
end
|
22
27
|
def _find_files file, local_path
|
23
28
|
[Dir.pwd, local_path]
|
24
29
|
.flat_map do |dir|
|
25
30
|
Dir.glob(File.join(dir, file))
|
26
31
|
end
|
27
32
|
end
|
33
|
+
def _underline(message, ul: "=")
|
34
|
+
puts message
|
35
|
+
puts message.gsub(/./, ul)
|
36
|
+
end
|
28
37
|
end
|
29
38
|
|
30
39
|
RSpec.configure do |conf|
|
@@ -74,8 +74,12 @@ class Speculations::Parser::Context
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def _init_from_parent filename, orig_filename, parent
|
77
|
-
|
77
|
+
_set_filename filename, orig_filename, parent
|
78
78
|
@orig_filename = parent ? parent.orig_filename : orig_filename
|
79
|
+
end
|
80
|
+
|
81
|
+
def _set_filename filename, orig_filename, parent
|
82
|
+
@filename = parent ? parent.filename : filename
|
79
83
|
raise ArgumentError, "no filename given in root context" unless @filename
|
80
84
|
end
|
81
85
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Dober
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/speculations/parser/state/exa.rb
|
44
44
|
- lib/speculations/parser/state/inc.rb
|
45
45
|
- lib/speculations/parser/state/out.rb
|
46
|
+
- lib/speculations/version.rb
|
46
47
|
homepage: https://github.com/robertdober/speculate
|
47
48
|
licenses:
|
48
49
|
- Apache-2.0
|
@@ -62,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
63
|
- !ruby/object:Gem::Version
|
63
64
|
version: '0'
|
64
65
|
requirements: []
|
65
|
-
rubygems_version: 3.1
|
66
|
+
rubygems_version: 3.2.0.rc.1
|
66
67
|
signing_key:
|
67
68
|
specification_version: 4
|
68
69
|
summary: Extract RSpecs from Markdown
|