docs 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.mdown ADDED
@@ -0,0 +1,60 @@
1
+ # Docs
2
+ Docs is a documentation generator for Ruby. It is intended for documenting things like HTTP APIs where the documentation doesn't make sense in the code.
3
+
4
+ ## Install
5
+
6
+ ```
7
+ gem install docs
8
+ ```
9
+
10
+ ## Setup
11
+ To setup Docs, run the following in an empty directory:
12
+
13
+ ```
14
+ docs setup
15
+ ```
16
+
17
+ It will create the following file structure:
18
+
19
+ * docs/
20
+ * examples/
21
+ * config.yaml
22
+ * application.erb
23
+
24
+ The `docs` directory contains your documentation (written in Markdown, using the `.mdown` file extension), these are compiled to HTML at build time. The Markdown files are pre-processed with ERB, primarily so you can include your examples (up next).
25
+
26
+ The `examples` directory contains the examples used within your code. They are stored as shell scripts written in either BASH or Ruby. Both the source of these files and the output when run is made available to your documentation files at build time. These are stored outside of the actual documentation so you can write tests for them. To include the source of an example named `examples/create_a_user.sh`:
27
+
28
+ ```erb
29
+ <%= examples :source, 'examples/create_a_user.sh' %>
30
+ ```
31
+
32
+ If you would like to show in your documentation the output of the bash script:
33
+
34
+ ```erb
35
+ <%= examples :output, 'examples/create_a_user.sh' %>
36
+ ```
37
+
38
+ The `config.yaml` file contains some config variables for Docs. Any variable set here is accessible within your documentation:
39
+
40
+ ```erb
41
+ <%= config.template %>
42
+ ```
43
+
44
+ If `template` is set in `config.yaml`, all markdown files will be compiled with `template` used as the template. Within template you can include the compiled Markdown:
45
+
46
+ ```erb
47
+ <%= content %>
48
+ ```
49
+
50
+ There are a few helpers made available to documentation files:
51
+
52
+ * pretty_print_json(string) — This takes a JSON string and pretty prints it.
53
+ * syntax_highlight(string, language) — Takes any piece of code and syntax highlights it with CodeRay, language is a Symbol representing one of CodeRay's supported languages.
54
+
55
+ ## Building
56
+ To build a Docs project:
57
+
58
+ ```
59
+ docs build
60
+ ```
data/lib/docs/project.rb CHANGED
@@ -14,9 +14,9 @@ module Docs
14
14
  '.rb' => 'ruby'
15
15
  }
16
16
 
17
- desc "setup [DIRECTORY]", "Creates a new Docs Project"
18
- def setup(directory = '.')
19
- nil
17
+ desc "setup", "Creates a new Docs Project in current directory"
18
+ def setup
19
+ directory('template', '.')
20
20
  end
21
21
 
22
22
  desc "build", "Builds the current directory as a docs project into './output'"
@@ -100,5 +100,9 @@ module Docs
100
100
  end
101
101
  end
102
102
 
103
+ def self.source_root
104
+ File.expand_path(File.dirname(__FILE__) + '../../..')
105
+ end
106
+
103
107
  end
104
108
  end
data/lib/docs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Docs
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1 @@
1
+ <%= content %>
@@ -0,0 +1,5 @@
1
+ directories:
2
+ temp: tmp
3
+ output: output
4
+ assets: public
5
+ template: application.erb
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70177518374340 !ruby/object:Gem::Requirement
16
+ requirement: &70229066023880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.14.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70177518374340
24
+ version_requirements: *70229066023880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redcarpet
27
- requirement: &70177518373840 !ruby/object:Gem::Requirement
27
+ requirement: &70229066023380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70177518373840
35
+ version_requirements: *70229066023380
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: coderay
38
- requirement: &70177518373380 !ruby/object:Gem::Requirement
38
+ requirement: &70229066022920 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.0.5
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70177518373380
46
+ version_requirements: *70229066022920
47
47
  description: Documentation generator with support for including code examples and
48
48
  compiling them at compile time
49
49
  email:
@@ -55,7 +55,7 @@ extra_rdoc_files: []
55
55
  files:
56
56
  - .gitignore
57
57
  - Gemfile
58
- - README
58
+ - README.mdown
59
59
  - Rakefile
60
60
  - bin/docs
61
61
  - docs.gemspec
@@ -64,6 +64,11 @@ files:
64
64
  - lib/docs/erb_environment.rb
65
65
  - lib/docs/project.rb
66
66
  - lib/docs/version.rb
67
+ - template/application.erb
68
+ - template/config.yaml
69
+ - template/docs/.empty_directory
70
+ - template/examples/.empty_directory
71
+ - template/public/.empty_directory
67
72
  homepage: ''
68
73
  licenses: []
69
74
  post_install_message: