speculate_about 0.5.0 → 0.5.1

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: b7194ffffa00a4292176dafa4120ea24ddf47e8aa6b6ed04d8be2dfaeefcfb8b
4
- data.tar.gz: bb6b85091a5c9c59465f7df1f2369f33aa6e3090c249ee4cdc9184a9ef1580e3
3
+ metadata.gz: 50dd660d1e2e984b66f854df6f71e1f280ddef2e162d2848a3cf363ffe5751a4
4
+ data.tar.gz: 56ed0de10d7ee9751ae86deb247e7f8ad8d6b90f3a2e71623d83b0d169f18f59
5
5
  SHA512:
6
- metadata.gz: 2e88641b31f6adf08b14730b619fbc31828f4d04b8058946cb1b9b71d7cecf05695d9d1b59849184b31220d88d7fd0d821e0b318f24cc68d803ed303cb792b97
7
- data.tar.gz: 7de92ee9f101df89939eea6b8c0b42513d88222bbef60fa51fe2a9413add66e50b5f1da0ca7ff46d7ca02811b31be7ceb925c45509a3ad8c5dabb82fcc28f5e0
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
@@ -1,3 +1,3 @@
1
1
  module Speculations
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
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.5.0
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-01 00:00:00.000000000 Z
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: []