docjs 0.1

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.
Files changed (109) hide show
  1. data/CONCEPT.md +80 -0
  2. data/DOCUMENTATION.md +41 -0
  3. data/LICENSE.md +19 -0
  4. data/README.md +19 -0
  5. data/RENDERING.md +8 -0
  6. data/bin/docjs +190 -0
  7. data/docjs.gemspec +32 -0
  8. data/lib/boot.rb +34 -0
  9. data/lib/code_object/base.rb +48 -0
  10. data/lib/code_object/converter.rb +48 -0
  11. data/lib/code_object/exceptions.rb +5 -0
  12. data/lib/code_object/function.rb +84 -0
  13. data/lib/code_object/object.rb +18 -0
  14. data/lib/code_object/type.rb +43 -0
  15. data/lib/configs.rb +53 -0
  16. data/lib/document/document.rb +25 -0
  17. data/lib/dom/dom.rb +188 -0
  18. data/lib/dom/exceptions.rb +12 -0
  19. data/lib/dom/no_doc.rb +26 -0
  20. data/lib/dom/node.rb +415 -0
  21. data/lib/helper/helper.rb +120 -0
  22. data/lib/helper/linker.rb +130 -0
  23. data/lib/logger.rb +49 -0
  24. data/lib/parser/comment.rb +69 -0
  25. data/lib/parser/comment_parser.rb +90 -0
  26. data/lib/parser/exceptions.rb +6 -0
  27. data/lib/parser/meta_container.rb +20 -0
  28. data/lib/parser/parser.rb +269 -0
  29. data/lib/processor.rb +123 -0
  30. data/lib/renderer.rb +108 -0
  31. data/lib/tasks/render_task.rb +112 -0
  32. data/lib/thor.rb +27 -0
  33. data/lib/token/container.rb +84 -0
  34. data/lib/token/exceptions.rb +6 -0
  35. data/lib/token/handler.rb +242 -0
  36. data/lib/token/token.rb +46 -0
  37. data/templates/application.rb +14 -0
  38. data/templates/helpers/template.rb +66 -0
  39. data/templates/resources/css/.sass-cache/98c121fba905284c2c8ca6220fe3c590e5c9ec19/application.scssc +0 -0
  40. data/templates/resources/css/application.css +836 -0
  41. data/templates/resources/img/arrow_down.png +0 -0
  42. data/templates/resources/img/arrow_right.png +0 -0
  43. data/templates/resources/img/arrow_up.png +0 -0
  44. data/templates/resources/img/bullet_toggle_minus.png +0 -0
  45. data/templates/resources/img/bullet_toggle_plus.png +0 -0
  46. data/templates/resources/img/constructor.png +0 -0
  47. data/templates/resources/img/function.png +0 -0
  48. data/templates/resources/img/object.png +0 -0
  49. data/templates/resources/img/page.png +0 -0
  50. data/templates/resources/img/prototype.png +0 -0
  51. data/templates/resources/img/tag.png +0 -0
  52. data/templates/resources/js/application.js +318 -0
  53. data/templates/resources/js/jcore.js +129 -0
  54. data/templates/resources/js/jquery.cookie.js +92 -0
  55. data/templates/resources/js/jquery.js +16 -0
  56. data/templates/resources/js/jquery.tooltip.js +77 -0
  57. data/templates/resources/js/jquery.treeview.js +238 -0
  58. data/templates/resources/scss/_footer.scss +10 -0
  59. data/templates/resources/scss/_header.scss +184 -0
  60. data/templates/resources/scss/_helpers.scss +91 -0
  61. data/templates/resources/scss/_print.scss +20 -0
  62. data/templates/resources/scss/_resets.scss +132 -0
  63. data/templates/resources/scss/_tooltip.scss +26 -0
  64. data/templates/resources/scss/application.scss +442 -0
  65. data/templates/tasks/api_index_task.rb +26 -0
  66. data/templates/tasks/docs_task.rb +33 -0
  67. data/templates/tasks/json_data_task.rb +55 -0
  68. data/templates/tasks/typed_task.rb +54 -0
  69. data/templates/tokens/tokens.rb +22 -0
  70. data/templates/types/prototype.rb +20 -0
  71. data/templates/views/api_index.html.erb +21 -0
  72. data/templates/views/doc_page.html.erb +11 -0
  73. data/templates/views/function/_detail.html.erb +8 -0
  74. data/templates/views/function/index.html.erb +53 -0
  75. data/templates/views/index.html.erb +0 -0
  76. data/templates/views/layout/application.html.erb +73 -0
  77. data/templates/views/layout/json.html.erb +3 -0
  78. data/templates/views/object/index.html.erb +63 -0
  79. data/templates/views/tokens/_default.html.erb +11 -0
  80. data/templates/views/tokens/_default_token.html.erb +19 -0
  81. data/templates/views/tokens/_example.html.erb +2 -0
  82. data/templates/views/tokens/_examples.html.erb +1 -0
  83. data/test/code_object/converter.rb +78 -0
  84. data/test/code_object/prototype.rb +70 -0
  85. data/test/configs.rb +65 -0
  86. data/test/docs/README.CONCEPT.md +83 -0
  87. data/test/docs/README.md +14 -0
  88. data/test/dom/dom.absolute_nodes.rb +40 -0
  89. data/test/dom/dom.rb +72 -0
  90. data/test/dom/node.rb +53 -0
  91. data/test/integration/converter.rb +72 -0
  92. data/test/integration/parser_factory.rb +28 -0
  93. data/test/interactive.rb +7 -0
  94. data/test/js-files/absolute.js +11 -0
  95. data/test/js-files/comments_in_strings.js +31 -0
  96. data/test/js-files/core-doc-relative.js +77 -0
  97. data/test/js-files/core-doc.js +145 -0
  98. data/test/js-files/nested.js +34 -0
  99. data/test/js-files/nested_with_strings.js +35 -0
  100. data/test/js-files/prototype.js +33 -0
  101. data/test/js-files/simple.js +17 -0
  102. data/test/js-files/tokens.js +32 -0
  103. data/test/parser/comments_in_strings.rb +51 -0
  104. data/test/parser/intelligent_skip_until.rb +110 -0
  105. data/test/parser/parser.rb +273 -0
  106. data/test/rspec_helper.rb +23 -0
  107. data/test/token/handler.rb +136 -0
  108. data/test/token/tokens.rb +52 -0
  109. metadata +184 -0
@@ -0,0 +1,23 @@
1
+ def should_raise(exception_type, &block)
2
+ begin
3
+ block.call
4
+ raise RSpec::Expectations::ExpectationNotMetError
5
+ rescue Exception => e
6
+ e.class.should == exception_type
7
+ end
8
+ end
9
+
10
+ class Object
11
+
12
+ def should_be_named_typed_token(name, types, content)
13
+ self.name.should == name
14
+ self.types.should == types
15
+ self.content.should == content
16
+ end
17
+
18
+ def should_be_typed_token(types, content)
19
+ self.types.should == types
20
+ self.content.should == content
21
+ end
22
+
23
+ end
@@ -0,0 +1,136 @@
1
+ # ../data.img#1771563:1
2
+ require_relative '../../lib/parser/comment'
3
+ require_relative '../../lib/code_object/function'
4
+
5
+ describe Token::Handler, ".register" do
6
+
7
+ before :each do
8
+ Token::Handler.unregister :test_handler
9
+ @object = CodeObject::Function.new
10
+ end
11
+
12
+ after :all do
13
+ Token::Handler.unregister :test_handler
14
+ end
15
+
16
+
17
+ context "using a default handler" do
18
+
19
+ before do
20
+ Token::Handler.register :test_handler
21
+ token = Parser::Tokenline.new :test_handler, "This is some content"
22
+ @object.process_token(token)
23
+ end
24
+
25
+ describe "the processed token" do
26
+ subject { @object.token(:test_handler).first }
27
+
28
+ it "should have got the correct content" do
29
+ subject.content.should == "This is some content"
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+
36
+ context "using a typed handler" do
37
+
38
+ before do
39
+ Token::Handler.register :test_handler, :typed
40
+ token = Parser::Tokenline.new :test_handler, "[MyType] This is some content"
41
+ @object.process_token(token)
42
+ end
43
+
44
+ describe "the processed token" do
45
+ subject { @object.token(:test_handler).first }
46
+
47
+ it "should have got correct type and content" do
48
+ subject.types.should == ["MyType"]
49
+ subject.content.should == "This is some content"
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+
56
+ context "using a typed_with_name handler" do
57
+
58
+ before do
59
+ Token::Handler.register :test_handler, :typed_with_name
60
+ token = Parser::Tokenline.new :test_handler, "[Foo, Bar, Baz] MyName This is some content"
61
+ @object.process_token(token)
62
+ end
63
+
64
+ describe "the processed token" do
65
+ subject { @object.token(:test_handler).first }
66
+
67
+ it "should have got correct typedname and content" do
68
+ subject.types.should == ["Foo", "Bar", "Baz"]
69
+ subject.name.should == "MyName"
70
+ subject.content.should == "This is some content"
71
+ end
72
+ end
73
+
74
+ end
75
+
76
+
77
+ context "processing a token without handler" do
78
+
79
+ token = Parser::Tokenline.new :test_handler, "[Foo, Bar, Baz] MyName This is some content"
80
+
81
+ it "should raise an error" do
82
+ should_raise Token::NoTokenHandler do
83
+ @object.process_token(token)
84
+ end
85
+ end
86
+
87
+ end
88
+
89
+
90
+ context "multiple tokens of the same type" do
91
+
92
+ before do
93
+ Token::Handler.register :test_handler
94
+ @object.process_token Parser::Tokenline.new :test_handler, "This is some content"
95
+ @object.process_token Parser::Tokenline.new :test_handler, "And another one"
96
+ @object.process_token Parser::Tokenline.new :test_handler, "Third content"
97
+ end
98
+
99
+ subject { @object.token(:test_handler) }
100
+
101
+ it "should be processed to an array" do
102
+ subject.length.should == 3
103
+ subject[0].content.should == "This is some content"
104
+ subject[1].content.should == "And another one"
105
+ subject[2].content.should == "Third content"
106
+ end
107
+
108
+ end
109
+
110
+
111
+ context "using a user-defined block as token-handler" do
112
+
113
+ before do
114
+ Token::Handler.register(:test_handler) do |token, content|
115
+ define_singleton_method :test_token do
116
+ token
117
+ end
118
+
119
+ define_singleton_method :test_content do
120
+ content
121
+ end
122
+ end
123
+ @object.process_token Parser::Tokenline.new :test_handler, "This is some content"
124
+ end
125
+
126
+ it "should be added to the list of handlers" do
127
+ Token::Handler.handlers.include?(:test_handler).should == true
128
+ end
129
+
130
+ it "should be evaled in CodeObject context" do
131
+ @object.test_token.should == :test_handler
132
+ @object.test_content.should == "This is some content"
133
+ end
134
+
135
+ end
136
+ end
@@ -0,0 +1,52 @@
1
+ require_relative '../../lib/parser/comment'
2
+ require_relative '../../lib/code_object/function'
3
+ require_relative '../../lib/token/tokens'
4
+
5
+ describe Token::Handler, ".register" do
6
+
7
+ before :each do
8
+ @object = CodeObject::Function.new
9
+ end
10
+
11
+ context "token @example with name" do
12
+
13
+ before do
14
+ @object.process_token(Parser::Tokenline.new(:example, "MyName \nThis is a multiline \nCodeexample."))
15
+ end
16
+
17
+ describe "the token" do
18
+
19
+ subject { @object.tokens[:example].first }
20
+
21
+ it "should have a correct name" do
22
+ subject.name.should == "MyName"
23
+ end
24
+
25
+ it "should have correct content" do
26
+ subject.content.should == "This is a multiline \nCodeexample."
27
+ end
28
+ end
29
+ end
30
+
31
+
32
+ context "token @example without name" do
33
+
34
+ before do
35
+ @object.process_token(Parser::Tokenline.new(:example, "\nThis is a multiline \nCodeexample."))
36
+ end
37
+
38
+ describe "the token" do
39
+
40
+ subject { @object.tokens[:example].first }
41
+
42
+ it "should have empty name" do
43
+ subject.name.should == ""
44
+ end
45
+
46
+ it "should have correct content" do
47
+ subject.content.should == "This is a multiline \nCodeexample."
48
+ end
49
+ end
50
+ end
51
+ end
52
+
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: docjs
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.1"
6
+ platform: ruby
7
+ authors:
8
+ - "Jonathan Brachth\xC3\xA4user"
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-06-07 00:00:00 +02:00
14
+ default_executable: bin/docjs
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rdiscount
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ description: Create beautyful Javascript documentations with this ruby-gem. It's pretty easy to customize and add your own tokens/DSL.
39
+ email: jonathan@b-studios.de
40
+ executables:
41
+ - docjs
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - CONCEPT.md
48
+ - DOCUMENTATION.md
49
+ - LICENSE.md
50
+ - README.md
51
+ - RENDERING.md
52
+ - bin/docjs
53
+ - docjs.gemspec
54
+ - lib/boot.rb
55
+ - lib/code_object/base.rb
56
+ - lib/code_object/converter.rb
57
+ - lib/code_object/exceptions.rb
58
+ - lib/code_object/function.rb
59
+ - lib/code_object/object.rb
60
+ - lib/code_object/type.rb
61
+ - lib/configs.rb
62
+ - lib/document/document.rb
63
+ - lib/dom/dom.rb
64
+ - lib/dom/exceptions.rb
65
+ - lib/dom/no_doc.rb
66
+ - lib/dom/node.rb
67
+ - lib/helper/helper.rb
68
+ - lib/helper/linker.rb
69
+ - lib/logger.rb
70
+ - lib/parser/comment.rb
71
+ - lib/parser/comment_parser.rb
72
+ - lib/parser/exceptions.rb
73
+ - lib/parser/meta_container.rb
74
+ - lib/parser/parser.rb
75
+ - lib/processor.rb
76
+ - lib/renderer.rb
77
+ - lib/tasks/render_task.rb
78
+ - lib/thor.rb
79
+ - lib/token/container.rb
80
+ - lib/token/exceptions.rb
81
+ - lib/token/handler.rb
82
+ - lib/token/token.rb
83
+ - templates/application.rb
84
+ - templates/helpers/template.rb
85
+ - templates/resources/css/.sass-cache/98c121fba905284c2c8ca6220fe3c590e5c9ec19/application.scssc
86
+ - templates/resources/css/application.css
87
+ - templates/resources/img/arrow_down.png
88
+ - templates/resources/img/arrow_right.png
89
+ - templates/resources/img/arrow_up.png
90
+ - templates/resources/img/bullet_toggle_minus.png
91
+ - templates/resources/img/bullet_toggle_plus.png
92
+ - templates/resources/img/constructor.png
93
+ - templates/resources/img/function.png
94
+ - templates/resources/img/object.png
95
+ - templates/resources/img/page.png
96
+ - templates/resources/img/prototype.png
97
+ - templates/resources/img/tag.png
98
+ - templates/resources/js/application.js
99
+ - templates/resources/js/jcore.js
100
+ - templates/resources/js/jquery.cookie.js
101
+ - templates/resources/js/jquery.js
102
+ - templates/resources/js/jquery.tooltip.js
103
+ - templates/resources/js/jquery.treeview.js
104
+ - templates/resources/scss/_footer.scss
105
+ - templates/resources/scss/_header.scss
106
+ - templates/resources/scss/_helpers.scss
107
+ - templates/resources/scss/_print.scss
108
+ - templates/resources/scss/_resets.scss
109
+ - templates/resources/scss/_tooltip.scss
110
+ - templates/resources/scss/application.scss
111
+ - templates/tasks/api_index_task.rb
112
+ - templates/tasks/docs_task.rb
113
+ - templates/tasks/json_data_task.rb
114
+ - templates/tasks/typed_task.rb
115
+ - templates/tokens/tokens.rb
116
+ - templates/types/prototype.rb
117
+ - templates/views/api_index.html.erb
118
+ - templates/views/doc_page.html.erb
119
+ - templates/views/function/_detail.html.erb
120
+ - templates/views/function/index.html.erb
121
+ - templates/views/index.html.erb
122
+ - templates/views/layout/application.html.erb
123
+ - templates/views/layout/json.html.erb
124
+ - templates/views/object/index.html.erb
125
+ - templates/views/tokens/_default.html.erb
126
+ - templates/views/tokens/_default_token.html.erb
127
+ - templates/views/tokens/_example.html.erb
128
+ - templates/views/tokens/_examples.html.erb
129
+ - test/code_object/converter.rb
130
+ - test/code_object/prototype.rb
131
+ - test/configs.rb
132
+ - test/docs/README.CONCEPT.md
133
+ - test/docs/README.md
134
+ - test/dom/dom.absolute_nodes.rb
135
+ - test/dom/dom.rb
136
+ - test/dom/node.rb
137
+ - test/integration/converter.rb
138
+ - test/integration/parser_factory.rb
139
+ - test/interactive.rb
140
+ - test/js-files/absolute.js
141
+ - test/js-files/comments_in_strings.js
142
+ - test/js-files/core-doc-relative.js
143
+ - test/js-files/core-doc.js
144
+ - test/js-files/nested.js
145
+ - test/js-files/nested_with_strings.js
146
+ - test/js-files/prototype.js
147
+ - test/js-files/simple.js
148
+ - test/js-files/tokens.js
149
+ - test/parser/comments_in_strings.rb
150
+ - test/parser/intelligent_skip_until.rb
151
+ - test/parser/parser.rb
152
+ - test/rspec_helper.rb
153
+ - test/token/handler.rb
154
+ - test/token/tokens.rb
155
+ has_rdoc: true
156
+ homepage: https://github.com/b-studios/docjs
157
+ licenses: []
158
+
159
+ post_install_message:
160
+ rdoc_options: []
161
+
162
+ require_paths:
163
+ - lib
164
+ required_ruby_version: !ruby/object:Gem::Requirement
165
+ none: false
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: "1.9"
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: "1.5"
176
+ requirements: []
177
+
178
+ rubyforge_project: docjs
179
+ rubygems_version: 1.5.2
180
+ signing_key:
181
+ specification_version: 3
182
+ summary: Javascript Documentation Generator
183
+ test_files: []
184
+