data_doc 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.
- data/.gemtest +0 -0
- data/History.txt +10 -0
- data/Manifest.txt +14 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +75 -0
- data/Rakefile +26 -0
- data/bin/data_doc +10 -0
- data/lib/data_doc/cli.rb +42 -0
- data/lib/data_doc.rb +6 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/test_data_doc.rb +11 -0
- data/test/test_data_doc_cli.rb +14 -0
- data/test/test_helper.rb +3 -0
- metadata +125 -0
data/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
bin/data_doc
|
7
|
+
lib/data_doc.rb
|
8
|
+
lib/data_doc/cli.rb
|
9
|
+
script/console
|
10
|
+
script/destroy
|
11
|
+
script/generate
|
12
|
+
test/test_data_doc.rb
|
13
|
+
test/test_data_doc_cli.rb
|
14
|
+
test/test_helper.rb
|
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
= data_doc
|
2
|
+
|
3
|
+
* http://github.com/alilee/data_doc
|
4
|
+
|
5
|
+
{<img src="https://secure.travis-ci.org/alilee/data_doc.png" alt="Build Status" />}[http://travis-ci.org/alilee/data_doc]
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
Complex documents can be challenging to author, and time-consuming to achieve
|
10
|
+
high levels of internal consistency. This gem offers a Domain Specific Language
|
11
|
+
to embed structured data in a markdown document and then render it into
|
12
|
+
configurable tables.
|
13
|
+
|
14
|
+
== FEATURES/PROBLEMS:
|
15
|
+
|
16
|
+
* Main document is Markdown for convenient content authoring.
|
17
|
+
* Builds up data in relational database, facilitating review and
|
18
|
+
analysis.
|
19
|
+
* Generates HTML from Markdown.
|
20
|
+
* Provides fine-grained control over the HTML headers, including
|
21
|
+
CSS, for the output.
|
22
|
+
* Simple DSL for capturing structured data
|
23
|
+
* Simple DSL for querying data stores and laying out in tables.
|
24
|
+
|
25
|
+
== SYNOPSIS:
|
26
|
+
|
27
|
+
data_doc your_file.md.erb > result.html
|
28
|
+
|
29
|
+
The data definition language looks like this:
|
30
|
+
|
31
|
+
store 'requirement' do
|
32
|
+
string 'name'
|
33
|
+
text 'description'
|
34
|
+
string 'priority'
|
35
|
+
alternate_key 'name'
|
36
|
+
end
|
37
|
+
|
38
|
+
requirement name: "It MUST "
|
39
|
+
|
40
|
+
The
|
41
|
+
|
42
|
+
== REQUIREMENTS:
|
43
|
+
|
44
|
+
* Tested on Ruby 1.9.3 only (so far)
|
45
|
+
* ActiveRecord-compatible data store
|
46
|
+
* RDiscount for Markdown
|
47
|
+
|
48
|
+
== INSTALL:
|
49
|
+
|
50
|
+
gem install data_doc
|
51
|
+
|
52
|
+
== LICENSE:
|
53
|
+
|
54
|
+
(The MIT License)
|
55
|
+
|
56
|
+
Copyright (c) 2012 Alister Lee
|
57
|
+
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
59
|
+
a copy of this software and associated documentation files (the
|
60
|
+
'Software'), to deal in the Software without restriction, including
|
61
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
62
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
63
|
+
permit persons to whom the Software is furnished to do so, subject to
|
64
|
+
the following conditions:
|
65
|
+
|
66
|
+
The above copyright notice and this permission notice shall be
|
67
|
+
included in all copies or substantial portions of the Software.
|
68
|
+
|
69
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
70
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
71
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
72
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
73
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
74
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
75
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/data_doc'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
# Hoe.plugin :website
|
9
|
+
# Hoe.plugin :cucumberfeatures
|
10
|
+
|
11
|
+
# Generate all the Rake tasks
|
12
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
|
+
$hoe = Hoe.spec 'data_doc' do
|
14
|
+
self.developer 'Alister Lee', 'gems@shortepic.com'
|
15
|
+
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
16
|
+
self.rubyforge_name = 'data-doc' # TODO this is default value
|
17
|
+
# self.extra_deps = [['activesupport','>= 2.0.2']]
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'newgem/tasks'
|
22
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
23
|
+
|
24
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
25
|
+
# remove_task :default
|
26
|
+
# task :default => [:spec, :features]
|
data/bin/data_doc
ADDED
data/lib/data_doc/cli.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module DataDoc
|
4
|
+
class CLI
|
5
|
+
def self.execute(stdout, arguments=[])
|
6
|
+
|
7
|
+
# NOTE: the option -p/--path= is given as an example, and should be replaced in your application.
|
8
|
+
|
9
|
+
options = {
|
10
|
+
:path => '~'
|
11
|
+
}
|
12
|
+
mandatory_options = %w( )
|
13
|
+
|
14
|
+
parser = OptionParser.new do |opts|
|
15
|
+
opts.banner = <<-BANNER.gsub(/^ /,'')
|
16
|
+
This application is wonderful because...
|
17
|
+
|
18
|
+
Usage: #{File.basename($0)} [options]
|
19
|
+
|
20
|
+
Options are:
|
21
|
+
BANNER
|
22
|
+
opts.separator ""
|
23
|
+
opts.on("-p", "--path PATH", String,
|
24
|
+
"This is a sample message.",
|
25
|
+
"For multiple lines, add more strings.",
|
26
|
+
"Default: ~") { |arg| options[:path] = arg }
|
27
|
+
opts.on("-h", "--help",
|
28
|
+
"Show this help message.") { stdout.puts opts; exit }
|
29
|
+
opts.parse!(arguments)
|
30
|
+
|
31
|
+
if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }
|
32
|
+
stdout.puts opts; exit
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
path = options[:path]
|
37
|
+
|
38
|
+
# do stuff
|
39
|
+
stdout.puts "To update this executable, look in lib/data_doc/cli.rb"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/data_doc.rb
ADDED
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/data_doc.rb'}"
|
9
|
+
puts "Loading data_doc gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_helper.rb")
|
2
|
+
require 'data_doc/cli'
|
3
|
+
|
4
|
+
class TestDataDocCli < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
DataDoc::CLI.execute(@stdout_io = StringIO.new, [])
|
7
|
+
@stdout_io.rewind
|
8
|
+
@stdout = @stdout_io.read
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_print_default_output
|
12
|
+
assert_match(/To update this executable/, @stdout)
|
13
|
+
end
|
14
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: data_doc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alister Lee
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rdoc
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.10'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.10'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: newgem
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.5.3
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.5.3
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: hoe
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.1'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
description: ! "Complex documents can be challenging to author, and time-consuming
|
63
|
+
to achieve \nhigh levels of internal consistency. This gem offers a Domain Specific
|
64
|
+
Language \nto embed structured data in a markdown document and then render it into
|
65
|
+
\nconfigurable tables."
|
66
|
+
email:
|
67
|
+
- gems@shortepic.com
|
68
|
+
executables:
|
69
|
+
- data_doc
|
70
|
+
extensions: []
|
71
|
+
extra_rdoc_files:
|
72
|
+
- History.txt
|
73
|
+
- Manifest.txt
|
74
|
+
- PostInstall.txt
|
75
|
+
- README.rdoc
|
76
|
+
files:
|
77
|
+
- History.txt
|
78
|
+
- Manifest.txt
|
79
|
+
- PostInstall.txt
|
80
|
+
- README.rdoc
|
81
|
+
- Rakefile
|
82
|
+
- bin/data_doc
|
83
|
+
- lib/data_doc.rb
|
84
|
+
- lib/data_doc/cli.rb
|
85
|
+
- script/console
|
86
|
+
- script/destroy
|
87
|
+
- script/generate
|
88
|
+
- test/test_data_doc.rb
|
89
|
+
- test/test_data_doc_cli.rb
|
90
|
+
- test/test_helper.rb
|
91
|
+
- .gemtest
|
92
|
+
homepage: http://github.com/alilee/data_doc
|
93
|
+
licenses: []
|
94
|
+
post_install_message: PostInstall.txt
|
95
|
+
rdoc_options:
|
96
|
+
- --main
|
97
|
+
- README.rdoc
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
hash: -1827853280249206312
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project: data-doc
|
117
|
+
rubygems_version: 1.8.24
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Complex documents can be challenging to author, and time-consuming to achieve high
|
121
|
+
levels of internal consistency
|
122
|
+
test_files:
|
123
|
+
- test/test_data_doc.rb
|
124
|
+
- test/test_data_doc_cli.rb
|
125
|
+
- test/test_helper.rb
|