LiterateRuby 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +30 -0
- data/Rakefile +23 -0
- data/bin/literate-ruby +0 -0
- data/lib/literate-ruby.rb +4 -0
- data/lib/literate-ruby/file.rb +15 -0
- data/test/test_file.rb +14 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a83fe70c28d8a6cb8cc3405ad8d4a74a7524e76e
|
4
|
+
data.tar.gz: 836191dec59cbd069d3071b67c2b5c88b60b17c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3e74933ae262fd7a7457b972bea899a2e078d37b7e38a1c38fb46fe945193c9fe067c5f9671777cc539bff8c68199b6d35f988dc16277c205d7c80e1e92c6e67
|
7
|
+
data.tar.gz: bcc1add2ddc784458b8f5b7071de7b5b2a6b6c2defbd166c3fe01942c7fa78da5eba66c67962370608f91e6615442f452efe0bd4ebea6ab886990651970515e9
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Literate Ruby
|
2
|
+
[![Gem
|
3
|
+
Version](https://badge.fury.io/rb/LiterateRuby.svg)](https://badge.fury.io/rb/LiterateRuby)
|
4
|
+
|
5
|
+
## Name
|
6
|
+
The name is inspired by Literate Haskell.
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
A file like this
|
11
|
+
|
12
|
+
```
|
13
|
+
This is some commentary on ruby code,
|
14
|
+
and here is some more commentary.
|
15
|
+
|
16
|
+
> puts 'this is executable ruby code'
|
17
|
+
> # of course, you can include comments
|
18
|
+
> # in here, but why would you?
|
19
|
+
> class A
|
20
|
+
> def you_can_define
|
21
|
+
> @classes_and_such = 'in here'
|
22
|
+
> end
|
23
|
+
> # if you want to
|
24
|
+
> end
|
25
|
+
|
26
|
+
This is called bird style. There are specs on it
|
27
|
+
[here](https://wiki.haskell.org/Literate_programming#Bird_Style).
|
28
|
+
|
29
|
+
## Future
|
30
|
+
In the future LaTeX might be used in here as well.
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rake/testtask'
|
2
|
+
|
3
|
+
Rake::TestTask.new do |t|
|
4
|
+
t.libs << 'test'
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
desc 'Run tests'
|
9
|
+
task default: :test
|
10
|
+
|
11
|
+
task :clean do
|
12
|
+
`rm *.gem`
|
13
|
+
end
|
14
|
+
|
15
|
+
task :build do
|
16
|
+
`gem build literate-ruby.gemspec`
|
17
|
+
end
|
18
|
+
|
19
|
+
task :deploy do
|
20
|
+
`rake clean`
|
21
|
+
`rake build`
|
22
|
+
`gem push *.gem`
|
23
|
+
end
|
data/bin/literate-ruby
ADDED
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module LiterateRuby
|
2
|
+
class File < File
|
3
|
+
def parse
|
4
|
+
base = File.basename(path, '.*')
|
5
|
+
`touch #{File.basename(path, '.*')}.rb`
|
6
|
+
file = read
|
7
|
+
File.open("#{base}.rb", 'w') do |f|
|
8
|
+
file.each_line do |line|
|
9
|
+
f.write(line[2..-1]) if line[0...2] == '> '
|
10
|
+
end
|
11
|
+
end
|
12
|
+
"#{base}.rb"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/test/test_file.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'literate-ruby'
|
3
|
+
|
4
|
+
describe File do
|
5
|
+
describe 'test file conversion' do
|
6
|
+
literate_file = LiterateRuby::File.new('first_file.lrb', 'r')
|
7
|
+
file_name = literate_file.parse
|
8
|
+
lr = File.new(file_name, 'r').read
|
9
|
+
compp = File.new('first_file_actual.rb', 'r').read
|
10
|
+
it 'must show that the conversion works' do
|
11
|
+
lr.must_equal compp
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: LiterateRuby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eli Sadoff
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: "This gem is hightly inspired by literate haskell. It currently will
|
14
|
+
support \n\"bird style\" which is described in full [here](https://wiki.haskell.org/Literate_programming#Bird_Style).\n"
|
15
|
+
email: snood1205@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files:
|
19
|
+
- README.md
|
20
|
+
files:
|
21
|
+
- README.md
|
22
|
+
- Rakefile
|
23
|
+
- bin/literate-ruby
|
24
|
+
- lib/literate-ruby.rb
|
25
|
+
- lib/literate-ruby/file.rb
|
26
|
+
- test/test_file.rb
|
27
|
+
homepage: https://github.com/snood1205/literate-ruby
|
28
|
+
licenses:
|
29
|
+
- MIT
|
30
|
+
metadata: {}
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options:
|
33
|
+
- "-t"
|
34
|
+
- literate-ruby RDocs
|
35
|
+
- "-m"
|
36
|
+
- README.md
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.9.3
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 2.6.8
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: A gem to write, so-called, literate ruby.
|
55
|
+
test_files:
|
56
|
+
- test/test_file.rb
|