ristretto 0.0.1 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c95f889dfdc094fa94194bcbd842b410a1cbd446
4
- data.tar.gz: d2ab58bc836f180ced4d782618f50df1a83b02a8
3
+ metadata.gz: eaeeaea9a3cdae764b9dd7d0ccb82228ac92c24d
4
+ data.tar.gz: 56109bf00339872fbf2b55e0739c1c89c9829f78
5
5
  SHA512:
6
- metadata.gz: 6a74c86902a0e75d60c81d8cb3e98fec4bd8493dc30ccfb1b36b982931855e4ffad59f6509aa9c6e366abffcaf400646c8c13fbd249cac6454dbf7740d8320b0
7
- data.tar.gz: a79da61e8d67ff1d60f6a1f59a91e07ff8ba3dca370999e5ccea5cec053cc52dfb72b199d815ebb9f1af4994e8a9989221e75f67e4ec40ad4e0ec4e283bd8945
6
+ metadata.gz: 2aed50ca43f6b7e5496a3c560dad5eb2f22a6701d3c9c703781156ef3fcfeee4c20ddae5809672b9ce668bdcb5aa6d67f0eea3ca6bbddc524f11c5190585e7e3
7
+ data.tar.gz: 609e648df4b517d8c5df4dc85d2ea9ff70df67ace62350ff305629d3f2de7b8a10e62353017d9784188b9af71c60049f4acc38bc3014e0bd6c675d131ec89c56
data/lib/ristretto.rb CHANGED
@@ -3,13 +3,13 @@ require "ristretto/version"
3
3
  module Ristretto
4
4
  def self.parse(file)
5
5
  ruby = ''
6
- File.read(file).gsub /^ (.*)/ do |match|
6
+ File.read(file).gsub /^ ([^-+*$].*?)$/ do |match|
7
7
  ruby << $1 << "\n"
8
8
  end
9
9
  ruby.strip
10
10
  end
11
11
 
12
12
  def self.execute(source)
13
- eval source
13
+ instance_eval source
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Ristretto
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
Binary file
@@ -3,17 +3,25 @@ require 'minitest/autorun'
3
3
 
4
4
  describe Ristretto do
5
5
 
6
- let(:indented_codeblocks) { Ristretto.parse('specs/markdown/indented_codeblocks.md') }
6
+ let(:parsed_markdown) { Ristretto.parse('specs/specification.md') }
7
7
 
8
8
  describe "#execute" do
9
- it "executes parsed ruby code" do
10
- Ristretto.execute(indented_codeblocks).must_equal "Hello, Ristretto!"
9
+ it "executes simple ruby code" do
10
+ Ristretto.execute(parsed_markdown).must_equal "Hello, Ristretto!"
11
11
  end
12
+
13
+ it "can cope with unbound methods"
14
+
15
+ it "parsed required ristretto files"
12
16
  end
13
17
 
14
18
  describe "#parse" do
15
- it "parses markdown indented codeblocks" do
16
- indented_codeblocks.must_equal "welcome = \"Hello, Ristretto!\"\n# comments\nwelcome"
19
+ it "parses markdown according to the Ristretto specification" do
20
+ parsed_markdown.must_equal "welcome = \"Hello, Ristretto!\"\n# comments\nwelcome"
17
21
  end
22
+
23
+ it "groks tabbed indents"
24
+
25
+ it "parses backticked codeblocks"
18
26
  end
19
27
  end
@@ -0,0 +1,42 @@
1
+ # The Ristretto Specification
2
+
3
+ This specification doubles the code test for the Ristretto gem.
4
+
5
+ ## Indented Codeblocks
6
+
7
+ Ristretto should parse indented code blocks. By default, anything inside them will be treated like ruby.
8
+
9
+ welcome = "Hello, Ristretto!"
10
+
11
+ ## Multiple Codeblocks
12
+
13
+ Multiple blocks should be parsed into a single string with the line termination `\n` character appended after each block.
14
+
15
+ # comments
16
+ welcome
17
+
18
+ The last resulting code string should be stripped of trailing whitespace.
19
+
20
+ ## Tabbed Codelocks
21
+
22
+ TODO
23
+
24
+ ## Fenced Codeblocks
25
+
26
+ TODO
27
+
28
+ ## Lists
29
+
30
+ One thing Ristretto shouldn't do is parse indented lists.
31
+
32
+ - List like these
33
+ - but with sublists 4 or more spaces in.
34
+ + starting with any of the markdown list markers `-`, `+`, or `*`.
35
+
36
+ * and even those with a preceding blank line.
37
+
38
+ ## Non Ruby Code
39
+
40
+ Somethimes, you might need to include more than just Ruby in a codeblock. As such, Ristretto should ignore specific types of code such as shell or bash indicated by `$`
41
+
42
+ $ youknown -? like this
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ristretto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Kinkead
@@ -54,9 +54,10 @@ files:
54
54
  - lib/ristretto.rb
55
55
  - lib/ristretto/version.rb
56
56
  - readme.md
57
+ - ristretto-0.0.1.gem
57
58
  - ristretto.gemspec
58
- - specs/markdown/indented_codeblocks.md
59
59
  - specs/ristretto_spec.rb
60
+ - specs/specification.md
60
61
  homepage: https://github.com/davekinkead/ristretto
61
62
  licenses:
62
63
  - MIT
@@ -82,5 +83,5 @@ signing_key:
82
83
  specification_version: 4
83
84
  summary: Literate Ruby inspired by Coffeescript
84
85
  test_files:
85
- - specs/markdown/indented_codeblocks.md
86
86
  - specs/ristretto_spec.rb
87
+ - specs/specification.md
@@ -1,10 +0,0 @@
1
- # Indented Codeblocks
2
-
3
- Ristretto should parse indented code blocks.
4
-
5
- welcome = "Hello, Ristretto!"
6
-
7
- And concatinate multiple blocks
8
-
9
- # comments
10
- welcome