danski-tzatziki 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README +7 -0
- data/README.markdown +8 -0
- data/VERSION.yml +4 -0
- data/bin/taz +95 -0
- data/lib/tzatziki.rb +58 -0
- data/lib/tzatziki/site.rb +11 -0
- data/lib/tzatziki/specification.rb +7 -0
- data/spec/example/source/_layouts/default.html +19 -0
- data/spec/example/source/the_google/index.textile +7 -0
- data/spec/example/source/the_google/search.markdown +17 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/tzatziki_spec.rb +8 -0
- metadata +77 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 danski
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
data/README.markdown
ADDED
data/VERSION.yml
ADDED
data/bin/taz
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
|
+
|
5
|
+
help = <<HELP
|
6
|
+
Tzatziki is a combined API documentation and testing tool.
|
7
|
+
----------------------------------------------------------
|
8
|
+
By writing your developer API documentation with Tzatziki,
|
9
|
+
you're creating a set of tests that run over HTTP *and* a
|
10
|
+
lovely, readable, configurable HTML documentation set.
|
11
|
+
|
12
|
+
Basic Command Line Usage:
|
13
|
+
taz --help # Show this message
|
14
|
+
taz <path to write generated site> # Runs the Tzatziki suites in ./ and saves the resulting documentation to <destination>
|
15
|
+
taz <path to source> <path to write generated site> # Runs the Tzatziki suites in <source> and saves the resulting documentation to <destination>
|
16
|
+
|
17
|
+
Options:
|
18
|
+
HELP
|
19
|
+
|
20
|
+
require 'optparse'
|
21
|
+
require 'tzatziki'
|
22
|
+
|
23
|
+
options = {
|
24
|
+
:generate_default_template=>false,
|
25
|
+
:domain=>"http://localhost"
|
26
|
+
}
|
27
|
+
|
28
|
+
opts = OptionParser.new do |opts|
|
29
|
+
opts.banner = help
|
30
|
+
|
31
|
+
opts.on("--generate", "Generate a new Tzatziki site in the specified directory.") do
|
32
|
+
options[:generate_default_template] = true
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on("--domain [domain]", "Run the tests against a specific domain. Defaults to #{options[:domain]}") do |domain|
|
36
|
+
Tzatziki.domain = domain || options[:domain]
|
37
|
+
end
|
38
|
+
|
39
|
+
opts.on("--nodoc", "Runs your Tzatziki files as tests without producing new documentation files.") do
|
40
|
+
Tzatziki.write_docs = false
|
41
|
+
end
|
42
|
+
|
43
|
+
opts.on("--notest", "Compiles the Tzatziki documentation for your API without running the tests.") do
|
44
|
+
Tzatziki.run_tests = false
|
45
|
+
end
|
46
|
+
|
47
|
+
opts.on("--pygments", "Use pygments to highlight code") do
|
48
|
+
Tzatziki.pygments = true
|
49
|
+
end
|
50
|
+
|
51
|
+
opts.on("--version", "Display current version") do
|
52
|
+
puts "Tzatziki " + Tzatziki.version
|
53
|
+
exit 0
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.parse!
|
58
|
+
|
59
|
+
def clean(dest)
|
60
|
+
FileUtils.rm_rf(dest)
|
61
|
+
FileUtils.mkdir_p(dest)
|
62
|
+
end
|
63
|
+
|
64
|
+
def globs(source)
|
65
|
+
Dir.chdir(source) do
|
66
|
+
dirs = Dir['*'].select { |x| File.directory?(x) }
|
67
|
+
dirs -= ['_site']
|
68
|
+
dirs = dirs.map { |x| "#{x}/**/*" }
|
69
|
+
dirs += ['*']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
source = nil
|
74
|
+
destination = nil
|
75
|
+
|
76
|
+
case ARGV.size
|
77
|
+
when 0
|
78
|
+
source = '.'
|
79
|
+
destination = File.join('.', 'docs')
|
80
|
+
when 1
|
81
|
+
source = '.'
|
82
|
+
destination = ARGV[0]
|
83
|
+
when 2
|
84
|
+
source = ARGV[0]
|
85
|
+
destination = ARGV[1]
|
86
|
+
else
|
87
|
+
puts "Invalid options. Run `taz --help` for assistance."
|
88
|
+
exit(1)
|
89
|
+
end
|
90
|
+
|
91
|
+
if options[:generate_default_template]
|
92
|
+
puts "Generating default template in #{destination}..."
|
93
|
+
else
|
94
|
+
Tzatziki.process!(source, destination)
|
95
|
+
end
|
data/lib/tzatziki.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
|
2
|
+
# Core requires
|
3
|
+
require 'rubygems'
|
4
|
+
# Stdlib requires
|
5
|
+
require 'fileutils'
|
6
|
+
require 'yaml'
|
7
|
+
# Gem requires
|
8
|
+
require 'liquid'
|
9
|
+
require 'redcloth'
|
10
|
+
# Tzatziki requires
|
11
|
+
require 'tzatziki/testable'
|
12
|
+
require 'tzatziki/site'
|
13
|
+
require 'tzatziki/page'
|
14
|
+
require 'tzatziki/specification'
|
15
|
+
|
16
|
+
module Tzatziki
|
17
|
+
|
18
|
+
class << self
|
19
|
+
attr_accessor :source, :destination, :domain, :pygments, :write_docs, :run_tests
|
20
|
+
end
|
21
|
+
|
22
|
+
# Configuration
|
23
|
+
Tzatziki.domain = "http://localhost"
|
24
|
+
Tzatziki.pygments = false
|
25
|
+
Tzatziki.write_docs = true
|
26
|
+
Tzatziki.run_tests = true
|
27
|
+
|
28
|
+
# Pointers
|
29
|
+
|
30
|
+
|
31
|
+
def self.process!(source, destination)
|
32
|
+
if run_tests
|
33
|
+
puts "Running tests against #{domain}..."
|
34
|
+
test(source, destination)
|
35
|
+
end
|
36
|
+
if write_docs
|
37
|
+
puts "Generating documentation in #{destination}"
|
38
|
+
document(source, destination)
|
39
|
+
end
|
40
|
+
puts "Out of Tzatziki."
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
def self.test(source, destination)
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.document(source, destination)
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.version
|
54
|
+
yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
|
55
|
+
"#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
+
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
6
|
+
<head>
|
7
|
+
<title>{{page.title}} - Example Tzatziki Suite</title>
|
8
|
+
</head>
|
9
|
+
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<h1>{{page.title}}</h1>
|
13
|
+
|
14
|
+
<div>
|
15
|
+
{{content}}
|
16
|
+
</div>
|
17
|
+
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
title: The Google Search API
|
3
|
+
---
|
4
|
+
|
5
|
+
This is a textile document intended to be a cover sheet for the The Google Search API. It searches The Google.
|
6
|
+
|
7
|
+
This one doesn't generate any test results, but it does appear in the generated site pretty much just like a Jekyll::Page.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
title: Requesting the search results from The Google
|
3
|
+
request:
|
4
|
+
protocol: http
|
5
|
+
domain: www.google.com
|
6
|
+
uri: /search
|
7
|
+
method: get
|
8
|
+
query_string:
|
9
|
+
q:
|
10
|
+
description: An entity-escaped string that you wish to search for on The Google.
|
11
|
+
example: google (now you're thinking with portals)
|
12
|
+
format: /.*/
|
13
|
+
specifications:
|
14
|
+
successful: true
|
15
|
+
---
|
16
|
+
|
17
|
+
This is an example API document designed to document and test parts of the The Google Search API.
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: danski-tzatziki
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- danski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-27 00:00:00 -07:00
|
13
|
+
default_executable: taz
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: TODO
|
17
|
+
email: dan@angryamoeba.co.uk
|
18
|
+
executables:
|
19
|
+
- taz
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
- README.markdown
|
25
|
+
- LICENSE
|
26
|
+
files:
|
27
|
+
- README.markdown
|
28
|
+
- VERSION.yml
|
29
|
+
- bin/taz
|
30
|
+
- lib/tzatziki
|
31
|
+
- lib/tzatziki/site.rb
|
32
|
+
- lib/tzatziki/specification.rb
|
33
|
+
- lib/tzatziki.rb
|
34
|
+
- spec/example
|
35
|
+
- spec/example/destination
|
36
|
+
- spec/example/source
|
37
|
+
- spec/example/source/_layouts
|
38
|
+
- spec/example/source/_layouts/default.html
|
39
|
+
- spec/example/source/_specifications
|
40
|
+
- spec/example/source/_types
|
41
|
+
- spec/example/source/the_google
|
42
|
+
- spec/example/source/the_google/index.textile
|
43
|
+
- spec/example/source/the_google/search.markdown
|
44
|
+
- spec/spec.opts
|
45
|
+
- spec/spec_helper.rb
|
46
|
+
- spec/tzatziki_spec.rb
|
47
|
+
- README
|
48
|
+
- LICENSE
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/danski/tzatziki
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options:
|
53
|
+
- --inline-source
|
54
|
+
- --charset=UTF-8
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.2.0
|
73
|
+
signing_key:
|
74
|
+
specification_version: 2
|
75
|
+
summary: TODO
|
76
|
+
test_files: []
|
77
|
+
|