ristretto 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/Rakefile +6 -0
- data/bin/ristretto +4 -0
- data/lib/ristretto/version.rb +3 -0
- data/lib/ristretto.rb +15 -0
- data/readme.md +42 -0
- data/ristretto.gemspec +23 -0
- data/specs/markdown/indented_codeblocks.md +10 -0
- data/specs/ristretto_spec.rb +19 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c95f889dfdc094fa94194bcbd842b410a1cbd446
|
4
|
+
data.tar.gz: d2ab58bc836f180ced4d782618f50df1a83b02a8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a74c86902a0e75d60c81d8cb3e98fec4bd8493dc30ccfb1b36b982931855e4ffad59f6509aa9c6e366abffcaf400646c8c13fbd249cac6454dbf7740d8320b0
|
7
|
+
data.tar.gz: a79da61e8d67ff1d60f6a1f59a91e07ff8ba3dca370999e5ccea5cec053cc52dfb72b199d815ebb9f1af4994e8a9989221e75f67e4ec40ad4e0ec4e283bd8945
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Dave Kinkead
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/bin/ristretto
ADDED
data/lib/ristretto.rb
ADDED
data/readme.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Ristretto
|
2
|
+
|
3
|
+
Literate Ruby inspired by Coffeescript.
|
4
|
+
|
5
|
+
> The practitioner of literate programming can be regarded as an essayist, whose main concern is with exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its concepts have been introduced in an order that is best for human understanding, using a mixture of formal and informal methods that reinforce each other.
|
6
|
+
>
|
7
|
+
> -- Donald Knuth. "Literate Programming (1984)" in Literate Programming. CSLI, 1992, pg. 99.
|
8
|
+
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Ristretto is designed to work from the command line, so install it with:
|
13
|
+
|
14
|
+
$ gem install ristretto
|
15
|
+
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Write a blog post or documentation explaining your code in some flavour of markdown. Include the code as per markdown syntax.
|
20
|
+
|
21
|
+
$ ristretto blog-post.rb.md
|
22
|
+
|
23
|
+
Ristretto will parse your markdown and try to execute anything in the codeblocks with ruby.
|
24
|
+
|
25
|
+
**TODO**
|
26
|
+
|
27
|
+
Strictly transpile codeblocks. Any codeblock without ````ruby` will be ignored.
|
28
|
+
|
29
|
+
$ ristretto -s blog-post.rb.md
|
30
|
+
|
31
|
+
Transpile ristretto into ruby and pipe it to stdout with the `-t` flag.
|
32
|
+
|
33
|
+
$ ristretto -t blog-post-with-code.rb.md > code-from-the-post.rb
|
34
|
+
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it ( https://github.com/[my-github-username]/ristretto/fork )
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create a new Pull Request
|
data/ristretto.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ristretto/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ristretto"
|
8
|
+
spec.version = Ristretto::VERSION
|
9
|
+
spec.authors = ["Dave Kinkead"]
|
10
|
+
spec.email = ["dave@kinkead.com.au"]
|
11
|
+
spec.summary = %q{Literate Ruby inspired by Coffeescript}
|
12
|
+
spec.description = %q{Literate Ruby inspired by Coffeescript. Execute your blog posts or documentation.}
|
13
|
+
spec.homepage = "https://github.com/davekinkead/ristretto"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|specs|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'ristretto'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
describe Ristretto do
|
5
|
+
|
6
|
+
let(:indented_codeblocks) { Ristretto.parse('specs/markdown/indented_codeblocks.md') }
|
7
|
+
|
8
|
+
describe "#execute" do
|
9
|
+
it "executes parsed ruby code" do
|
10
|
+
Ristretto.execute(indented_codeblocks).must_equal "Hello, Ristretto!"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#parse" do
|
15
|
+
it "parses markdown indented codeblocks" do
|
16
|
+
indented_codeblocks.must_equal "welcome = \"Hello, Ristretto!\"\n# comments\nwelcome"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ristretto
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dave Kinkead
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Literate Ruby inspired by Coffeescript. Execute your blog posts or documentation.
|
42
|
+
email:
|
43
|
+
- dave@kinkead.com.au
|
44
|
+
executables:
|
45
|
+
- ristretto
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- Rakefile
|
53
|
+
- bin/ristretto
|
54
|
+
- lib/ristretto.rb
|
55
|
+
- lib/ristretto/version.rb
|
56
|
+
- readme.md
|
57
|
+
- ristretto.gemspec
|
58
|
+
- specs/markdown/indented_codeblocks.md
|
59
|
+
- specs/ristretto_spec.rb
|
60
|
+
homepage: https://github.com/davekinkead/ristretto
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.2.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Literate Ruby inspired by Coffeescript
|
84
|
+
test_files:
|
85
|
+
- specs/markdown/indented_codeblocks.md
|
86
|
+
- specs/ristretto_spec.rb
|