speculate_about 1.3.1 → 1.3.2
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/speculations/debugging.rb +23 -0
- data/lib/speculations/parser/state/specify_block.rb +0 -1
- data/lib/speculations/parser/state/triggers.rb +1 -1
- data/lib/speculations/parser.rb +1 -1
- data/lib/speculations/version.rb +1 -1
- data/lib/speculations.rb +5 -4
- metadata +18 -4
- data/lib/debugging.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bec8c1ea49a9e43ea7e174e2505a6bba43785bac98e53267a4c662bf194a0027
|
|
4
|
+
data.tar.gz: 14f2d1f6d251187eb3125a1f2eea5d34c9b573f28184bf33e7f2db4fe45fbb5f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afb73ccfc87fc19f1bac309942f2f920a2609c47a0739f7c7060ce7b65e52769f5259c518b0f143c016ce235e84961ee39f1d8f535ee628351462316efc16c67
|
|
7
|
+
data.tar.gz: c0687c470470b498dd295b95a57a7366daea2a68587a94d8d3470e005d69c99350349ab7a3ffe7f33bda38f186489ff9e14784c8f7f3d88e35c8c2e62ad29ee7
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'l43/simple_color'
|
|
4
|
+
module Speculations
|
|
5
|
+
module Debugging
|
|
6
|
+
S = L43::SimpleColor
|
|
7
|
+
|
|
8
|
+
def debug__(subject=nil, msg: nil, rtrn: nil, debug:)
|
|
9
|
+
return rtrn || subject unless debug
|
|
10
|
+
|
|
11
|
+
S.putc(msg) if msg
|
|
12
|
+
S.putc(3, :bold_green, subject.inspect) if subject
|
|
13
|
+
rtrn || subject
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def dbg_match(msg, data)
|
|
17
|
+
designation = name.split("::").last.downcase
|
|
18
|
+
debug__(msg: [:blue, "#{data.lnb.succ}", :reset, " #{msg} match in :#{designation}"], debug: data.debug)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
@@ -6,7 +6,7 @@ module Speculations::Parser::State::Triggers
|
|
|
6
6
|
GIVEN_RGX = %r[\A\s{0,3}(?:Given|When|And)\b]
|
|
7
7
|
EXAMPLE_RGX = %r[\A\s{0,3}Example\:?\s+(?<title>.*)]
|
|
8
8
|
RUBY_RGX = %r[\A\s{0,3}```ruby]
|
|
9
|
-
SPEC_CONTEXT_RGX = %r[
|
|
9
|
+
SPEC_CONTEXT_RGX = %r[(?:\sfollowing examples:\s*)|(?:\sas follows:\s*)\z]
|
|
10
10
|
THEN_RGX = %r[\A\s{0,3}(?:Then|But|And|Also|Or|However|Furhermore)\b\s*(?<title>.*)]
|
|
11
11
|
|
|
12
12
|
def blank_line(line) = BLANK_RGX.match(line)
|
data/lib/speculations/parser.rb
CHANGED
data/lib/speculations/version.rb
CHANGED
data/lib/speculations.rb
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
|
-
require_relative 'debugging'
|
|
2
|
+
require_relative 'speculations/debugging'
|
|
3
3
|
require_relative 'speculations/data'
|
|
4
4
|
require_relative 'speculations/parser'
|
|
5
5
|
module Speculations extend self
|
|
6
|
+
include Debugging
|
|
6
7
|
|
|
7
8
|
HELPER_FILE = 'speculations_helper'
|
|
8
9
|
HELPER_PATH = "spec/#{HELPER_FILE}.rb"
|
|
@@ -20,13 +21,13 @@ module Speculations extend self
|
|
|
20
21
|
raise ArgumentError, "#{infile} not found" unless File.readable? infile
|
|
21
22
|
outfile ||= _speculation_path(infile)
|
|
22
23
|
if _out_of_date?(outfile, infile)
|
|
23
|
-
debug__(msg: "recompiling
|
|
24
|
+
debug__(msg: ["recompiling ", :b_blue, infile, :reset, " -> ", :b_blue, outfile], debug:)
|
|
24
25
|
_compile(infile:, outfile:, debug:)
|
|
25
26
|
elsif force
|
|
26
|
-
debug__(msg: "*** forced recompilation
|
|
27
|
+
debug__(msg: [:b_yellow, "*** forced recompilation ", :b_blue, infile, :reset, " -> ", :b_blue, outfile], debug:)
|
|
27
28
|
_compile(infile:, outfile:, debug:)
|
|
28
29
|
else
|
|
29
|
-
debug__(msg:
|
|
30
|
+
debug__(msg: [:green, infile, :reset, " ignored as it is upto date"], debug:)
|
|
30
31
|
end
|
|
31
32
|
outfile
|
|
32
33
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: speculate_about
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Dober
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-04-
|
|
11
|
-
dependencies:
|
|
10
|
+
date: 2026-04-30 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: l43_simple_color
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.1.0
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.1.0
|
|
12
26
|
description: Allows Markdown or other text files to be used as literal specs, à la
|
|
13
27
|
Elixir doctest, but from any file.
|
|
14
28
|
email: robert.dober@gmail.com
|
|
@@ -19,11 +33,11 @@ extra_rdoc_files: []
|
|
|
19
33
|
files:
|
|
20
34
|
- LICENSE
|
|
21
35
|
- bin/speculate
|
|
22
|
-
- lib/debugging.rb
|
|
23
36
|
- lib/speculate_about.rb
|
|
24
37
|
- lib/speculations.rb
|
|
25
38
|
- lib/speculations/cli.rb
|
|
26
39
|
- lib/speculations/data.rb
|
|
40
|
+
- lib/speculations/debugging.rb
|
|
27
41
|
- lib/speculations/parser.rb
|
|
28
42
|
- lib/speculations/parser/context.rb
|
|
29
43
|
- lib/speculations/parser/context/example.rb
|
data/lib/debugging.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kernel
|
|
4
|
-
def debug__(subject=nil, msg: nil, rtrn: nil, debug:)
|
|
5
|
-
return rtrn || subject unless debug
|
|
6
|
-
|
|
7
|
-
$stderr.puts(msg) if msg
|
|
8
|
-
$stderr.puts(subject.inspect) if subject
|
|
9
|
-
rtrn || subject
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def dbg_match(msg, data)
|
|
13
|
-
designation = name.split("::").last.downcase
|
|
14
|
-
debug__(msg: "#{data.lnb.succ}: #{msg} match in :#{designation}", debug: data.debug)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
# SPDX-License-Identifier: AGPL-3.0-or-later
|