jsduck 4.3.1 → 4.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -13
- data/jsduck.gemspec +2 -2
- data/lib/jsduck/app_data.rb +2 -0
- data/lib/jsduck/circular_deps.rb +39 -0
- data/lib/jsduck/index_html.rb +5 -1
- data/lib/jsduck/lint.rb +13 -0
- data/lib/jsduck/options.rb +23 -1
- metadata +4 -3
data/Rakefile
CHANGED
@@ -162,20 +162,9 @@ class JsDuckRunner
|
|
162
162
|
@options += options
|
163
163
|
end
|
164
164
|
|
165
|
-
# Enables comments when CORS is supported by browser.
|
166
|
-
# This excludes Opera and IE < 8.
|
167
|
-
# We check explicitly for IE version to make sure the code works the
|
168
|
-
# same way in both real IE7 and IE7-mode of IE8/9.
|
169
165
|
def add_comments(db_name, version)
|
170
|
-
|
171
|
-
|
172
|
-
<script type="text/javascript">
|
173
|
-
Docs.enableComments = ("withCredentials" in new XMLHttpRequest()) || (Ext.ieVersion >= 8);
|
174
|
-
Docs.baseUrl = "#{comments_base_url}";
|
175
|
-
Docs.commentsDb = "#{db_name}";
|
176
|
-
Docs.commentsVersion = "#{version}";
|
177
|
-
</script>
|
178
|
-
EOHTML
|
166
|
+
add_options("--comments-url", "http://localhost:3000/auth")
|
167
|
+
add_options("--comments-domain", db_name+"/"+version)
|
179
168
|
end
|
180
169
|
|
181
170
|
def add_ext4
|
data/jsduck.gemspec
CHANGED
@@ -2,8 +2,8 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.required_rubygems_version = ">= 1.3.5"
|
3
3
|
|
4
4
|
s.name = 'jsduck'
|
5
|
-
s.version = '4.3.
|
6
|
-
s.date = '2012-10-
|
5
|
+
s.version = '4.3.2'
|
6
|
+
s.date = '2012-10-26'
|
7
7
|
s.summary = "Simple JavaScript Duckumentation generator"
|
8
8
|
s.description = "Documentation generator for Sencha JS frameworks"
|
9
9
|
s.homepage = "https://github.com/senchalabs/jsduck"
|
data/lib/jsduck/app_data.rb
CHANGED
@@ -28,6 +28,8 @@ module JsDuck
|
|
28
28
|
:showPrintButton => @opts.seo,
|
29
29
|
:touchExamplesUi => @opts.touch_examples_ui,
|
30
30
|
:source => @opts.source,
|
31
|
+
:commentsUrl => @opts.comments_url,
|
32
|
+
:commentsDomain => @opts.comments_domain,
|
31
33
|
}
|
32
34
|
}) + ";\n"
|
33
35
|
File.open(filename, 'w') {|f| f.write(js) }
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module JsDuck
|
2
|
+
|
3
|
+
# Checks for circular dependencies
|
4
|
+
class CircularDeps
|
5
|
+
|
6
|
+
# Checks class for circular dependencies.
|
7
|
+
#
|
8
|
+
# When all OK, returns false.
|
9
|
+
#
|
10
|
+
# When circular dependencies found returns a string describing the
|
11
|
+
# problematic dependency chain e.g. "Foo extends Bar mixins Foo".
|
12
|
+
def check(cls, names = [])
|
13
|
+
names += [cls[:name]]
|
14
|
+
|
15
|
+
if cls.parent && chain = track_circular(" extends ", cls.parent, names)
|
16
|
+
return chain
|
17
|
+
end
|
18
|
+
|
19
|
+
cls.mixins.each do |mixin|
|
20
|
+
if chain = track_circular(" mixins ", mixin, names)
|
21
|
+
return chain
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def track_circular(type, cls, names)
|
29
|
+
names += [type]
|
30
|
+
if names.include?(cls[:name])
|
31
|
+
(names + [cls[:name]]).join("")
|
32
|
+
else
|
33
|
+
check(cls, names)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/lib/jsduck/index_html.rb
CHANGED
@@ -17,7 +17,6 @@ module JsDuck
|
|
17
17
|
def write
|
18
18
|
if @opts.seo
|
19
19
|
FileUtils.cp(@opts.template_dir+"/index.php", @opts.output_dir+"/index.php")
|
20
|
-
FileUtils.cp(@opts.template_dir+"/Mobile_Detect.php", @opts.output_dir+"/Mobile_Detect.php")
|
21
20
|
create_template_html(@opts.template_dir+"/template.html", @opts.output_dir+"/template.html")
|
22
21
|
create_print_template_html(@opts.template_dir+"/print-template.html", @opts.output_dir+"/print-template.html")
|
23
22
|
create_index_template_html(@opts.template_dir+"/index-template.html", @opts.output_dir+"/index-template.html")
|
@@ -31,6 +30,7 @@ module JsDuck
|
|
31
30
|
def create_template_html(in_file, out_file)
|
32
31
|
write_template(in_file, out_file, {
|
33
32
|
"{title}" => @opts.title,
|
33
|
+
"{mobile_redirect}" => @opts.seo ? include_script(@opts.template_dir+"/mobile-redirect.js") : "",
|
34
34
|
"{header}" => @opts.header,
|
35
35
|
"{footer}" => "<div id='footer-content' style='display: none'>#{@opts.footer}</div>",
|
36
36
|
"{extjs_path}" => @opts.extjs_path,
|
@@ -61,6 +61,10 @@ module JsDuck
|
|
61
61
|
})
|
62
62
|
end
|
63
63
|
|
64
|
+
def include_script(filename)
|
65
|
+
"<script type='text/javascript'>\n" + Util::IO.read(filename) + "\n</script>"
|
66
|
+
end
|
67
|
+
|
64
68
|
# Opens in_file, replaces {keys} inside it, writes to out_file
|
65
69
|
def write_template(in_file, out_file, replacements)
|
66
70
|
Logger.log("Writing", out_file)
|
data/lib/jsduck/lint.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'jsduck/logger'
|
2
2
|
require 'jsduck/class'
|
3
|
+
require 'jsduck/circular_deps'
|
3
4
|
|
4
5
|
module JsDuck
|
5
6
|
|
@@ -20,6 +21,7 @@ module JsDuck
|
|
20
21
|
warn_duplicate_members
|
21
22
|
warn_singleton_statics
|
22
23
|
warn_empty_enums
|
24
|
+
fail_on_circular_dependencies
|
23
25
|
end
|
24
26
|
|
25
27
|
# print warning for each member or parameter with no name
|
@@ -117,6 +119,17 @@ module JsDuck
|
|
117
119
|
end
|
118
120
|
end
|
119
121
|
|
122
|
+
# Print fatal error message for circular dependency.
|
123
|
+
def fail_on_circular_dependencies
|
124
|
+
circular_deps = CircularDeps.new
|
125
|
+
@relations.each do |cls|
|
126
|
+
if chain = circular_deps.check(cls)
|
127
|
+
Logger.fatal("Class #{cls[:name]} has a circular dependency: #{chain}")
|
128
|
+
exit 1
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
120
133
|
# Loops through all members of all classes
|
121
134
|
def each_member(&block)
|
122
135
|
@relations.each {|cls| cls.all_local_members.each(&block) }
|
data/lib/jsduck/options.rb
CHANGED
@@ -37,6 +37,8 @@ module JsDuck
|
|
37
37
|
attr_accessor :eg_iframe
|
38
38
|
attr_accessor :examples_base_url
|
39
39
|
attr_accessor :tests
|
40
|
+
attr_accessor :comments_url
|
41
|
+
attr_accessor :comments_domain
|
40
42
|
|
41
43
|
# Debugging
|
42
44
|
attr_accessor :template_dir
|
@@ -79,7 +81,7 @@ module JsDuck
|
|
79
81
|
@ext4_events = nil
|
80
82
|
@meta_tag_paths = []
|
81
83
|
|
82
|
-
@version = "4.3.
|
84
|
+
@version = "4.3.2"
|
83
85
|
|
84
86
|
# Customizing output
|
85
87
|
@title = "Documentation - JSDuck"
|
@@ -103,6 +105,8 @@ module JsDuck
|
|
103
105
|
@eg_iframe = nil
|
104
106
|
@examples_base_url = "extjs-build/examples/"
|
105
107
|
@tests = false
|
108
|
+
@comments_url = nil
|
109
|
+
@comments_domain = nil
|
106
110
|
|
107
111
|
# Debugging
|
108
112
|
@root_dir = File.dirname(File.dirname(File.dirname(__FILE__)))
|
@@ -376,6 +380,24 @@ module JsDuck
|
|
376
380
|
@new_since = v
|
377
381
|
end
|
378
382
|
|
383
|
+
opts.on('--comments-url=URL',
|
384
|
+
"Address of comments server.",
|
385
|
+
"",
|
386
|
+
"For example: http://projects.sencha.com/auth",
|
387
|
+
"",
|
388
|
+
"Must be used together with --comments-domain option.") do |url|
|
389
|
+
@comments_url = url
|
390
|
+
end
|
391
|
+
|
392
|
+
opts.on('--comments-domain=STRING',
|
393
|
+
"A string consisting of <name>/<version>.",
|
394
|
+
"",
|
395
|
+
"For example: ext-js/4",
|
396
|
+
"",
|
397
|
+
"Must be used together with --comments-url option.") do |domain|
|
398
|
+
@comments_domain = domain
|
399
|
+
end
|
400
|
+
|
379
401
|
opts.separator ""
|
380
402
|
opts.separator "Tweaking:"
|
381
403
|
opts.separator ""
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsduck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-10-
|
13
|
+
date: 2012-10-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdiscount
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/jsduck/batch_formatter.rb
|
160
160
|
- lib/jsduck/batch_parser.rb
|
161
161
|
- lib/jsduck/categories.rb
|
162
|
+
- lib/jsduck/circular_deps.rb
|
162
163
|
- lib/jsduck/class.rb
|
163
164
|
- lib/jsduck/class_doc_expander.rb
|
164
165
|
- lib/jsduck/class_formatter.rb
|
@@ -629,7 +630,6 @@ files:
|
|
629
630
|
- template-min/app.js
|
630
631
|
- template-min/index.php
|
631
632
|
- template-min/build-js.html
|
632
|
-
- template-min/Mobile_Detect.php
|
633
633
|
- template-min/resources/css/app.css
|
634
634
|
- template-min/resources/images/link-green-standard.png
|
635
635
|
- template-min/resources/images/class-m.png
|
@@ -683,6 +683,7 @@ files:
|
|
683
683
|
- template-min/resources/images/group-expand-sprite.gif
|
684
684
|
- template-min/resources/prettify/prettify.css
|
685
685
|
- template-min/resources/prettify/prettify.js
|
686
|
+
- template-min/mobile-redirect.js
|
686
687
|
homepage: https://github.com/senchalabs/jsduck
|
687
688
|
licenses: []
|
688
689
|
post_install_message:
|