speculate_about 0.5.0 → 0.5.1
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.
- checksums.yaml +4 -4
- data/lib/speculate_about.rb +27 -0
- data/lib/speculations/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50dd660d1e2e984b66f854df6f71e1f280ddef2e162d2848a3cf363ffe5751a4
|
4
|
+
data.tar.gz: 56ed0de10d7ee9751ae86deb247e7f8ad8d6b90f3a2e71623d83b0d169f18f59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd78c231bd7ab5eb1146c8d1f2fb3b19bea52951c30001d373981b748a77404bd5a5b87477bef989fa9707ff1049d9d7d6a91e2c3a0fa1cdc4533351c2a214bc
|
7
|
+
data.tar.gz: dbb334195b9354655edc06a11e52a0e77bee6be0961cc545fafc19ca6f2e0de5ba2c7c818ccde14bbf0fc2b2ba14b42f10fa02b114eb3f39b679763ea8427e2e
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require_relative 'speculations/parser'
|
3
|
+
module SpeculateAbout
|
4
|
+
|
5
|
+
def speculate_about(infile)
|
6
|
+
raise ArgumentError, "#{infile} not found" unless File.readable? infile
|
7
|
+
ast = Speculations::Parser.new.parse_from_file(infile)
|
8
|
+
code = ast.to_code.join("\n")
|
9
|
+
ENV["SPECULATE_ABOUT_DEBUG"] ? _show(code, infile) : instance_eval(code, infile)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
def _show(code, path)
|
14
|
+
message = "Generated code for #{path}"
|
15
|
+
_underline(message)
|
16
|
+
puts code
|
17
|
+
end
|
18
|
+
def _underline(message, ul: "=")
|
19
|
+
puts message
|
20
|
+
puts message.gsub(/./, ul)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
RSpec.configure do |conf|
|
26
|
+
conf.extend SpeculateAbout
|
27
|
+
end
|
data/lib/speculations/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.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
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -47,6 +47,7 @@ extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
49
|
- bin/speculate
|
50
|
+
- lib/speculate_about.rb
|
50
51
|
- lib/speculations.rb
|
51
52
|
- lib/speculations/cli.rb
|
52
53
|
- lib/speculations/parser.rb
|
@@ -63,7 +64,7 @@ homepage: https://github.com/robertdober/speculate
|
|
63
64
|
licenses:
|
64
65
|
- Apache-2.0
|
65
66
|
metadata: {}
|
66
|
-
post_install_message:
|
67
|
+
post_install_message:
|
67
68
|
rdoc_options: []
|
68
69
|
require_paths:
|
69
70
|
- lib
|
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
80
|
version: '0'
|
80
81
|
requirements: []
|
81
82
|
rubygems_version: 3.2.3
|
82
|
-
signing_key:
|
83
|
+
signing_key:
|
83
84
|
specification_version: 4
|
84
85
|
summary: Extract RSpecs from Markdown
|
85
86
|
test_files: []
|