lab42_literate 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbef1724d92d9a3df339142900482ca1dc58e69a
4
- data.tar.gz: 4662d0f09f4940508bd2032052798e3e039fbbf5
3
+ metadata.gz: 9af148dabdc4777ca8d0e99ddb16853ceafd4ca5
4
+ data.tar.gz: e431c6f0d2aa762843140ae80f73fd09ceb3d39b
5
5
  SHA512:
6
- metadata.gz: 20abba63d97c849c167ee5037accc083ee8204314c01038e8987cb504957f41c18d7b339f072c43687c2a6dc255fb6c4628b47a74495289a317494e675402582
7
- data.tar.gz: f8b75604fbbc2ba09ced1db0d4bcb28ab495e767081ef75ed4d05851b1ef9fb010adf02544ea53649abd35a041043606f718a4b3fd601728ab164e439c576f66
6
+ metadata.gz: 25db3aefd339b3016e646894321c29503633a77db4924581fbcc4d8f2946df5d4d23640a040b372e086b7deeeb1d2c34a9f8885d06027d11b336ded6d0d7ab6e
7
+ data.tar.gz: 2d390a643c3a1ce311f456ed0e0d41449db276ee2973368d5dcfae2555ce8fa8a08b5cbf5d6eaa8aa97859dccbd46bd7be09e89d6d6f843dc3e6dde414338069
data/README.md CHANGED
@@ -11,3 +11,37 @@
11
11
 
12
12
  Just extract code blocks from any file, and run them as specs with a simple `doctest file` in an RSpec example group.
13
13
 
14
+ ### Installation
15
+
16
+ gem install lab42_literate
17
+
18
+ or in Gemfile
19
+
20
+ gem 'lab42_literate'
21
+
22
+ Then in your `spec_helper`
23
+
24
+ require 'lab42/literate'
25
+
26
+ which makes the `doctest` method available in all example groupes of type `literate`.
27
+
28
+ ### Example
29
+
30
+ You can write RSpec example code inside a ` ```ruby literate ` block.
31
+
32
+ ```ruby literate
33
+ expect(%w{a b c}).not_to be_empty
34
+ ```
35
+
36
+ There is an easy way to express `expect(...).to eq(...)` with the following special form...
37
+
38
+ ```ruby literate
39
+ 1 + 41 #=> 42
40
+ ```
41
+
42
+ Then, assuming the above text being inside a file `some_literate.md` one can execute the two examples above
43
+ with
44
+
45
+ RSpec.describe 'example', type: :literate do
46
+ doctest 'some_literate.md'
47
+ end
@@ -19,7 +19,6 @@ module Lab42::Literate::Extractor extend self
19
19
  # Potentially convert alternate equality syntax to class equality synatx, meaning that
20
20
  # \A(.*)\s+#=>\s+(.*)\z => expect(strip($1)).to eq(strip($2))
21
21
  def convert line
22
- p line
23
22
  line.chomp.sub(ALTERNATE_EQ_FORM){ |*|
24
23
  %W{#{$1}expect(#{$2}).to eq(#{$3.strip})}.join(' ') }
25
24
  end
@@ -1,5 +1,5 @@
1
1
  module Lab42
2
2
  module Literate
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lab42_literate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober