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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 585ea729bce40c7978af922d12ac5ec32384c2a4e5b1a19fd159354864344776
4
- data.tar.gz: ac750695bb18b891c1977533dce8b8932c74bb75cad89d1a1d81cd6b955cbe8f
3
+ metadata.gz: 5abf0f1d0b408b81d4b2b9644eeaaca4137bcf0180f298bb94145b275a847ecd
4
+ data.tar.gz: a040f692852c90de48d3d1a758ecda31ce8a3d1f36920ce44145d396f7666aca
5
5
  SHA512:
6
- metadata.gz: e46327125543f2e112fef196d87e660e67cd3078d8a8bb61171a775130508bff51c7595be05c1a5345e167a64ec0d342e974ac450f9ddec340622561e6bd5c50
7
- data.tar.gz: f384dd4f32c12cf6c9973e520cf237712bb46e28ffe965bdf161c66a1c276977f7e991d8eea9f8d0102f136fed6e76b4f60f3ed0058df7f9737abc4413bff5d4
6
+ metadata.gz: d6d2d63515ade99e8eaac787572359c3b707301263d4ebbee6ce3df03546426262202e092eef337239cf9a82e92096e8fa7318756b405f46900c0514fd1d1d4c
7
+ data.tar.gz: 5ca6224cf00ab3ee4cd13d8ba2df5cfc83bcc7d516a018435f097ed509f94a27cc2ec9df054a2cc43b2215a3399a0b79c4279c00b01b9fd27181e0c0ac905597
@@ -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"] ? puts(code) : instance_eval(code)
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
- @filename = parent ? parent.filename : filename
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
 
@@ -0,0 +1,3 @@
1
+ module SpeculateAbout
2
+ VERSION = "0.2.2"
3
+ end
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.1
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-06-23 00:00:00.000000000 Z
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.2
66
+ rubygems_version: 3.2.0.rc.1
66
67
  signing_key:
67
68
  specification_version: 4
68
69
  summary: Extract RSpecs from Markdown