jsduck 4.0.1 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -0
- data/esprima/esprima.js +210 -85
- data/jsduck.gemspec +3 -3
- data/lib/jsduck/accessors.rb +10 -8
- data/lib/jsduck/aggregator.rb +7 -7
- data/lib/jsduck/app.rb +24 -164
- data/lib/jsduck/app_data.rb +2 -4
- data/lib/jsduck/assets.rb +5 -2
- data/lib/jsduck/ast.rb +9 -4
- data/lib/jsduck/batch_formatter.rb +54 -0
- data/lib/jsduck/batch_parser.rb +106 -0
- data/lib/jsduck/categories.rb +5 -6
- data/lib/jsduck/class.rb +77 -239
- data/lib/jsduck/class_doc_expander.rb +0 -5
- data/lib/jsduck/class_formatter.rb +14 -10
- data/lib/jsduck/class_name.rb +23 -0
- data/lib/jsduck/class_writer.rb +9 -8
- data/lib/jsduck/doc_ast.rb +5 -6
- data/lib/jsduck/doc_formatter.rb +61 -272
- data/lib/jsduck/enum.rb +4 -4
- data/lib/jsduck/esprima.rb +10 -4
- data/lib/jsduck/examples.rb +5 -5
- data/lib/jsduck/export_writer.rb +62 -0
- data/lib/jsduck/exporter/app.rb +62 -0
- data/lib/jsduck/exporter/examples.rb +58 -0
- data/lib/jsduck/exporter/full.rb +60 -0
- data/lib/jsduck/file_categories.rb +7 -4
- data/lib/jsduck/function_ast.rb +99 -0
- data/lib/jsduck/grouped_asset.rb +27 -16
- data/lib/jsduck/guide_writer.rb +8 -7
- data/lib/jsduck/guides.rb +31 -29
- data/lib/jsduck/icons.rb +12 -1
- data/lib/jsduck/images.rb +3 -3
- data/lib/jsduck/importer.rb +7 -7
- data/lib/jsduck/index_html.rb +20 -6
- data/lib/jsduck/inherit_doc.rb +9 -12
- data/lib/jsduck/inline/example.rb +42 -0
- data/lib/jsduck/inline/img.rb +55 -0
- data/lib/jsduck/inline/link.rb +227 -0
- data/lib/jsduck/inline/video.rb +67 -0
- data/lib/jsduck/inline_examples.rb +7 -7
- data/lib/jsduck/js_parser.rb +5 -4
- data/lib/jsduck/lint.rb +14 -2
- data/lib/jsduck/logger.rb +5 -6
- data/lib/jsduck/members_index.rb +132 -0
- data/lib/jsduck/merger.rb +3 -9
- data/lib/jsduck/options.rb +39 -41
- data/lib/jsduck/override.rb +3 -7
- data/lib/jsduck/relations.rb +9 -9
- data/lib/jsduck/renderer.rb +3 -3
- data/lib/jsduck/return_values.rb +72 -0
- data/lib/jsduck/search_data.rb +16 -20
- data/lib/jsduck/shortener.rb +58 -0
- data/lib/jsduck/signature_renderer.rb +1 -2
- data/lib/jsduck/source/file.rb +98 -0
- data/lib/jsduck/source/file_parser.rb +72 -0
- data/lib/jsduck/source/writer.rb +89 -0
- data/lib/jsduck/tag/aside.rb +1 -1
- data/lib/jsduck/tag/since.rb +1 -1
- data/lib/jsduck/template_dir.rb +2 -2
- data/lib/jsduck/util/html.rb +27 -0
- data/lib/jsduck/util/io.rb +32 -0
- data/lib/jsduck/util/json.rb +60 -0
- data/lib/jsduck/util/null_object.rb +23 -0
- data/lib/jsduck/util/os.rb +14 -0
- data/lib/jsduck/util/parallel.rb +34 -0
- data/lib/jsduck/util/singleton.rb +35 -0
- data/lib/jsduck/util/stdout.rb +33 -0
- data/lib/jsduck/videos.rb +5 -5
- data/lib/jsduck/web_writer.rb +79 -0
- data/lib/jsduck/welcome.rb +6 -6
- data/spec/class_factory.rb +20 -0
- metadata +32 -20
- data/lib/jsduck/api_exporter.rb +0 -48
- data/lib/jsduck/app_exporter.rb +0 -60
- data/lib/jsduck/examples_exporter.rb +0 -56
- data/lib/jsduck/full_exporter.rb +0 -35
- data/lib/jsduck/html.rb +0 -25
- data/lib/jsduck/inline_img.rb +0 -53
- data/lib/jsduck/inline_video.rb +0 -58
- data/lib/jsduck/io.rb +0 -30
- data/lib/jsduck/json_duck.rb +0 -52
- data/lib/jsduck/lexer.rb +0 -251
- data/lib/jsduck/null_object.rb +0 -19
- data/lib/jsduck/os.rb +0 -11
- data/lib/jsduck/parallel_wrap.rb +0 -32
- data/lib/jsduck/source_file.rb +0 -97
- data/lib/jsduck/source_file_parser.rb +0 -70
- data/lib/jsduck/source_writer.rb +0 -87
- data/lib/jsduck/stats.rb +0 -103
- data/lib/jsduck/stdout.rb +0 -31
data/lib/jsduck/lint.rb
CHANGED
@@ -17,6 +17,7 @@ module JsDuck
|
|
17
17
|
warn_optional_params
|
18
18
|
warn_duplicate_params
|
19
19
|
warn_duplicate_members
|
20
|
+
warn_singleton_statics
|
20
21
|
warn_empty_enums
|
21
22
|
end
|
22
23
|
|
@@ -95,10 +96,21 @@ module JsDuck
|
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
99
|
+
# Print warnings for static members in singleton classes
|
100
|
+
def warn_singleton_statics
|
101
|
+
@relations.each do |cls|
|
102
|
+
if cls[:singleton]
|
103
|
+
cls.find_members({:local => true, :static => true}).each do |m|
|
104
|
+
warn(:sing_static, "Static members don't make sense in singleton class #{cls[:name]}", m)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
98
110
|
# print warnings for enums with no values
|
99
111
|
def warn_empty_enums
|
100
112
|
@relations.each do |cls|
|
101
|
-
if cls[:enum] && cls[:members]
|
113
|
+
if cls[:enum] && cls[:members].length == 0
|
102
114
|
warn(:enum, "Enum #{cls[:name]} defined without values in it", cls)
|
103
115
|
end
|
104
116
|
end
|
@@ -112,7 +124,7 @@ module JsDuck
|
|
112
124
|
# Prints warning + filename and linenumber from doc-context
|
113
125
|
def warn(type, msg, member)
|
114
126
|
context = member[:files][0]
|
115
|
-
Logger.
|
127
|
+
Logger.warn(type, msg, context[:filename], context[:linenr])
|
116
128
|
end
|
117
129
|
|
118
130
|
end
|
data/lib/jsduck/logger.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'singleton'
|
2
|
-
require 'jsduck/os'
|
1
|
+
require 'jsduck/util/singleton'
|
2
|
+
require 'jsduck/util/os'
|
3
3
|
|
4
4
|
module JsDuck
|
5
5
|
|
6
6
|
# Central logging of JsDuck
|
7
7
|
class Logger
|
8
|
-
include Singleton
|
8
|
+
include Util::Singleton
|
9
9
|
|
10
10
|
# Set to true to enable verbose logging
|
11
11
|
attr_accessor :verbose
|
@@ -25,7 +25,6 @@ module JsDuck
|
|
25
25
|
[:no_doc, "Member or class without documentation"],
|
26
26
|
[:dup_param, "Method has two parameters with the same name"],
|
27
27
|
[:dup_member, "Class has two members with the same name"],
|
28
|
-
[:dup_asset, "Duplicate guide/video/example"],
|
29
28
|
[:req_after_opt, "Required parameter comes after optional"],
|
30
29
|
[:subproperty, "@param foo.bar where foo param doesn't exist"],
|
31
30
|
[:sing_static, "Singleton class member marked as @static"],
|
@@ -110,7 +109,7 @@ module JsDuck
|
|
110
109
|
def format(filename=nil, line=nil)
|
111
110
|
out = ""
|
112
111
|
if filename
|
113
|
-
out = OS
|
112
|
+
out = Util::OS.windows? ? filename.gsub('/', '\\') : filename
|
114
113
|
if line
|
115
114
|
out += ":#{line}:"
|
116
115
|
end
|
@@ -153,7 +152,7 @@ module JsDuck
|
|
153
152
|
# Only does color output when STDERR is attached to TTY
|
154
153
|
# i.e. is not piped/redirected.
|
155
154
|
def paint(color_name, msg)
|
156
|
-
if OS.windows? || !$stderr.tty?
|
155
|
+
if Util::OS.windows? || !$stderr.tty?
|
157
156
|
msg
|
158
157
|
else
|
159
158
|
COLORS[color_name] + msg + CLEAR
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'jsduck/logger'
|
2
|
+
|
3
|
+
module JsDuck
|
4
|
+
|
5
|
+
# Helper for JsDuck::Class for indexing its members.
|
6
|
+
#
|
7
|
+
# While indexing the members of a class it accesses the MembersIndex
|
8
|
+
# instances of parent and mixins of that class through the
|
9
|
+
# #members_index accessor. This isn't the nicest approach, but
|
10
|
+
# better than having all of this functionality inside the
|
11
|
+
# JsDuck::Class itself.
|
12
|
+
class MembersIndex
|
13
|
+
def initialize(cls)
|
14
|
+
@cls = cls
|
15
|
+
@map_by_id = nil
|
16
|
+
@global_map_by_id = nil
|
17
|
+
@global_map_by_name = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns hash of all members by name (including inherited ones)
|
21
|
+
def global_by_name
|
22
|
+
unless @global_map_by_name
|
23
|
+
@global_map_by_name = {}
|
24
|
+
|
25
|
+
global_by_id.each_pair do |id, m|
|
26
|
+
@global_map_by_name[m[:name]] = [] unless @global_map_by_name[m[:name]]
|
27
|
+
@global_map_by_name[m[:name]] << m
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
@global_map_by_name
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns hash of all members by ID (including inherited ones)
|
35
|
+
def global_by_id
|
36
|
+
unless @global_map_by_id
|
37
|
+
# Make copy of parent class members.
|
38
|
+
# Otherwise we'll be merging directly into parent class.
|
39
|
+
@global_map_by_id = @cls.parent ? @cls.parent.members_index.global_by_id.clone : {}
|
40
|
+
|
41
|
+
@cls.mixins.each do |mix|
|
42
|
+
merge!(@global_map_by_id, mix.members_index.global_by_id)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Exclude all non-inheritable static members
|
46
|
+
@global_map_by_id.delete_if {|id, m| m[:meta][:static] && !m[:inheritable] }
|
47
|
+
|
48
|
+
merge!(@global_map_by_id, local_by_id)
|
49
|
+
end
|
50
|
+
|
51
|
+
@global_map_by_id
|
52
|
+
end
|
53
|
+
|
54
|
+
# Returns hash of local members by ID (no inherited members)
|
55
|
+
def local_by_id
|
56
|
+
unless @map_by_id
|
57
|
+
@map_by_id = {}
|
58
|
+
|
59
|
+
@cls[:members].each do |m|
|
60
|
+
@map_by_id[m[:id]] = m
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
@map_by_id
|
65
|
+
end
|
66
|
+
|
67
|
+
# Clears the search cache.
|
68
|
+
# Using this is REALLY BAD - try to get rid of it.
|
69
|
+
def invalidate!
|
70
|
+
@map_by_id = nil
|
71
|
+
@global_map_by_id = nil
|
72
|
+
@global_map_by_name = nil
|
73
|
+
|
74
|
+
@cls.parent.members_index.invalidate! if @cls.parent
|
75
|
+
|
76
|
+
@cls.mixins.each {|mix| mix.members_index.invalidate! }
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
# merges second members hash into first one
|
82
|
+
def merge!(hash1, hash2)
|
83
|
+
hash2.each_pair do |name, m|
|
84
|
+
if m[:meta] && m[:meta][:hide]
|
85
|
+
if hash1[name]
|
86
|
+
hash1.delete(name)
|
87
|
+
else
|
88
|
+
ctx = m[:files][0]
|
89
|
+
msg = "@hide used but #{m[:tagname]} #{m[:name]} not found in parent class"
|
90
|
+
Logger.warn(:hide, msg, ctx[:filename], ctx[:linenr])
|
91
|
+
end
|
92
|
+
else
|
93
|
+
if hash1[name]
|
94
|
+
store_overrides(hash1[name], m)
|
95
|
+
end
|
96
|
+
hash1[name] = m
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Invoked when merge! finds two members with the same name.
|
102
|
+
# New member always overrides the old, but inside new we keep
|
103
|
+
# a list of members it overrides. Normally one member will
|
104
|
+
# override one other member, but a member from mixin can override
|
105
|
+
# multiple members - although there's not a single such case in
|
106
|
+
# ExtJS, we have to handle it.
|
107
|
+
#
|
108
|
+
# Every overridden member is listed just once.
|
109
|
+
def store_overrides(old, new)
|
110
|
+
# Sometimes a class is included multiple times (like Ext.Base)
|
111
|
+
# resulting in its members overriding themselves. Because of
|
112
|
+
# this, ignore overriding itself.
|
113
|
+
if new[:owner] != old[:owner]
|
114
|
+
new[:overrides] = [] unless new[:overrides]
|
115
|
+
unless new[:overrides].any? {|m| m[:owner] == old[:owner] }
|
116
|
+
# Make a copy of the important properties for us. We can't
|
117
|
+
# just push the actual `old` member itself, because there
|
118
|
+
# can be circular overrides (notably with Ext.Base), which
|
119
|
+
# will result in infinite loop when we try to convert our
|
120
|
+
# class into JSON.
|
121
|
+
new[:overrides] << {
|
122
|
+
:name => old[:name],
|
123
|
+
:owner => old[:owner],
|
124
|
+
:id => old[:id],
|
125
|
+
}
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
data/lib/jsduck/merger.rb
CHANGED
@@ -48,8 +48,7 @@ module JsDuck
|
|
48
48
|
# Used by Aggregator to determine if we're dealing with Ext4 code
|
49
49
|
h[:code_type] = code[:code_type] if code[:code_type]
|
50
50
|
|
51
|
-
h[:members] =
|
52
|
-
h[:statics] = Class.default_members_hash
|
51
|
+
h[:members] = []
|
53
52
|
|
54
53
|
h
|
55
54
|
end
|
@@ -57,6 +56,7 @@ module JsDuck
|
|
57
56
|
def merge_like_method(docs, code)
|
58
57
|
h = do_merge(docs, code)
|
59
58
|
h[:params] = merge_params(docs, code)
|
59
|
+
h[:meta][:chainable] = code[:chainable] if code[:chainable]
|
60
60
|
h
|
61
61
|
end
|
62
62
|
|
@@ -81,7 +81,7 @@ module JsDuck
|
|
81
81
|
end
|
82
82
|
|
83
83
|
h[:name] = merge_name(docs, code)
|
84
|
-
h[:id] =
|
84
|
+
h[:id] = JsDuck::Class.member_id(h)
|
85
85
|
|
86
86
|
# Copy private to meta
|
87
87
|
h[:meta][:private] = h[:private] if h[:private]
|
@@ -96,12 +96,6 @@ module JsDuck
|
|
96
96
|
h
|
97
97
|
end
|
98
98
|
|
99
|
-
def create_member_id(m)
|
100
|
-
# Sanitize $ in member names with something safer
|
101
|
-
name = m[:name].gsub(/\$/, 'S-')
|
102
|
-
"#{m[:meta][:static] ? 'static-' : ''}#{m[:tagname]}-#{name}"
|
103
|
-
end
|
104
|
-
|
105
99
|
# Given array of full alias names like "foo.bar", "foo.baz"
|
106
100
|
# build hash like {"foo" => ["bar", "baz"]}
|
107
101
|
def build_aliases_hash(aliases)
|
data/lib/jsduck/options.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'jsduck/option_parser'
|
2
2
|
require 'jsduck/meta_tag_registry'
|
3
3
|
require 'jsduck/logger'
|
4
|
-
require 'jsduck/
|
4
|
+
require 'jsduck/util/json'
|
5
|
+
require 'jsduck/util/os'
|
6
|
+
require 'jsduck/util/parallel'
|
5
7
|
|
6
8
|
module JsDuck
|
7
9
|
|
@@ -24,10 +26,8 @@ module JsDuck
|
|
24
26
|
attr_accessor :guides
|
25
27
|
attr_accessor :videos
|
26
28
|
attr_accessor :examples
|
27
|
-
attr_accessor :stats
|
28
29
|
attr_accessor :categories_path
|
29
30
|
attr_accessor :source
|
30
|
-
attr_accessor :pretty_json
|
31
31
|
attr_accessor :images
|
32
32
|
attr_accessor :link_tpl
|
33
33
|
attr_accessor :img_tpl
|
@@ -38,7 +38,6 @@ module JsDuck
|
|
38
38
|
attr_accessor :tests
|
39
39
|
|
40
40
|
# Debugging
|
41
|
-
attr_accessor :processes
|
42
41
|
attr_accessor :template_dir
|
43
42
|
attr_accessor :template_links
|
44
43
|
attr_accessor :extjs_path
|
@@ -79,7 +78,7 @@ module JsDuck
|
|
79
78
|
@ext4_events = nil
|
80
79
|
@meta_tag_paths = []
|
81
80
|
|
82
|
-
@version = "4.
|
81
|
+
@version = "4.1.1"
|
83
82
|
|
84
83
|
# Customizing output
|
85
84
|
@title = "Documentation - JSDuck"
|
@@ -91,10 +90,8 @@ module JsDuck
|
|
91
90
|
@guides = nil
|
92
91
|
@videos = nil
|
93
92
|
@examples = nil
|
94
|
-
@stats = false
|
95
93
|
@categories_path = nil
|
96
94
|
@source = true
|
97
|
-
@pretty_json = false
|
98
95
|
@images = []
|
99
96
|
@link_tpl = '<a href="#!/api/%c%-%m" rel="%c%-%m" class="docClass">%a</a>'
|
100
97
|
# Note that we wrap image template inside <p> because {@img} often
|
@@ -107,8 +104,6 @@ module JsDuck
|
|
107
104
|
@tests = false
|
108
105
|
|
109
106
|
# Debugging
|
110
|
-
# Turn multiprocessing off by default in Windows
|
111
|
-
@processes = OS::windows? ? 0 : nil
|
112
107
|
@root_dir = File.dirname(File.dirname(File.dirname(__FILE__)))
|
113
108
|
@template_dir = @root_dir + "/template-min"
|
114
109
|
@template_links = false
|
@@ -119,9 +114,12 @@ module JsDuck
|
|
119
114
|
@imports = []
|
120
115
|
@new_since = nil
|
121
116
|
|
117
|
+
# Turn multiprocessing off by default in Windows
|
118
|
+
Util::Parallel.in_processes = Util::OS::windows? ? 0 : nil
|
119
|
+
|
122
120
|
# enable all warnings except :link_auto
|
123
|
-
Logger.
|
124
|
-
Logger.
|
121
|
+
Logger.set_warning(:all, true)
|
122
|
+
Logger.set_warning(:link_auto, false)
|
125
123
|
end
|
126
124
|
|
127
125
|
# Make options object behave like hash.
|
@@ -172,9 +170,14 @@ module JsDuck
|
|
172
170
|
"TYPE is one of:",
|
173
171
|
"",
|
174
172
|
"- full - full class docs.",
|
175
|
-
"- api - only class- and member names.",
|
176
173
|
"- examples - extracts inline examples from classes.") do |format|
|
177
|
-
|
174
|
+
export_type = format.to_sym
|
175
|
+
if [:full, :examples].include?(export_type)
|
176
|
+
@export = export_type
|
177
|
+
else
|
178
|
+
Logger.fatal("Unsupported export type: '#{export_type}'")
|
179
|
+
exit(1)
|
180
|
+
end
|
178
181
|
end
|
179
182
|
|
180
183
|
opts.on('--builtin-classes',
|
@@ -211,7 +214,7 @@ module JsDuck
|
|
211
214
|
if File.exists?(path)
|
212
215
|
config = read_json_config(path)
|
213
216
|
else
|
214
|
-
Logger.
|
217
|
+
Logger.fatal("The config file #{path} doesn't exist")
|
215
218
|
exit(1)
|
216
219
|
end
|
217
220
|
# treat paths inside JSON config relative to the location of
|
@@ -336,11 +339,6 @@ module JsDuck
|
|
336
339
|
@tests = true
|
337
340
|
end
|
338
341
|
|
339
|
-
opts.on('--stats',
|
340
|
-
"Creates page with all kinds of statistics.") do
|
341
|
-
@stats = true
|
342
|
-
end
|
343
|
-
|
344
342
|
opts.on('--import=VERSION:PATH',
|
345
343
|
"Imports docs generating @since & @new.",
|
346
344
|
"",
|
@@ -512,7 +510,7 @@ module JsDuck
|
|
512
510
|
"Turns on excessive logging.",
|
513
511
|
"",
|
514
512
|
"Log messages are writted to STDERR.") do
|
515
|
-
Logger.
|
513
|
+
Logger.verbose = true
|
516
514
|
end
|
517
515
|
|
518
516
|
opts.on('--warnings=+A,-B,+C', Array,
|
@@ -523,12 +521,12 @@ module JsDuck
|
|
523
521
|
"List of all available warning types:",
|
524
522
|
"(Those with '+' in front of them default to on)",
|
525
523
|
"",
|
526
|
-
*Logger.
|
524
|
+
*Logger.doc_warnings) do |warnings|
|
527
525
|
warnings.each do |op|
|
528
526
|
if op =~ /^([-+]?)(.*)$/
|
529
527
|
enable = !($1 == "-")
|
530
528
|
name = $2.to_sym
|
531
|
-
Logger.
|
529
|
+
Logger.set_warning(name, enable)
|
532
530
|
end
|
533
531
|
end
|
534
532
|
end
|
@@ -543,7 +541,7 @@ module JsDuck
|
|
543
541
|
"results.",
|
544
542
|
"",
|
545
543
|
"In Windows this option is disabled.") do |count|
|
546
|
-
|
544
|
+
Util::Parallel.in_processes = count.to_i
|
547
545
|
end
|
548
546
|
|
549
547
|
opts.on('--pretty-json',
|
@@ -553,7 +551,7 @@ module JsDuck
|
|
553
551
|
"by --export option. But the option effects any JSON",
|
554
552
|
"that gets generated, so it's also useful when debugging",
|
555
553
|
"the resource files generated for the docs app.") do
|
556
|
-
|
554
|
+
Util::Json.pretty = true
|
557
555
|
end
|
558
556
|
|
559
557
|
opts.on('--template=PATH',
|
@@ -620,7 +618,7 @@ module JsDuck
|
|
620
618
|
# config options that can be feeded into optparser.
|
621
619
|
def read_json_config(fname)
|
622
620
|
config = []
|
623
|
-
json =
|
621
|
+
json = Util::Json.read(fname)
|
624
622
|
json.each_pair do |key, value|
|
625
623
|
if key == "--"
|
626
624
|
# filenames
|
@@ -650,13 +648,13 @@ module JsDuck
|
|
650
648
|
@input_files << fname
|
651
649
|
end
|
652
650
|
else
|
653
|
-
Logger.
|
651
|
+
Logger.warn(nil, "File not found", fname)
|
654
652
|
end
|
655
653
|
end
|
656
654
|
|
657
655
|
# Extracts files of first build in jsb file
|
658
656
|
def extract_jsb_files(jsb_file)
|
659
|
-
json =
|
657
|
+
json = Util::Json.read(jsb_file)
|
660
658
|
basedir = File.dirname(jsb_file)
|
661
659
|
|
662
660
|
return json["builds"][0]["packages"].map do |package_id|
|
@@ -679,35 +677,35 @@ module JsDuck
|
|
679
677
|
# Runs checks on the options
|
680
678
|
def validate
|
681
679
|
if @input_files.length == 0 && !@welcome && !@guides && !@videos && !@examples
|
682
|
-
Logger.
|
680
|
+
Logger.fatal("You should specify some input files, otherwise there's nothing I can do :(")
|
683
681
|
exit(1)
|
684
682
|
elsif @output_dir == :stdout && !@export
|
685
|
-
Logger.
|
683
|
+
Logger.fatal("Output to STDOUT only works when using --export option")
|
686
684
|
exit(1)
|
687
685
|
elsif ![nil, :full, :api, :examples].include?(@export)
|
688
|
-
Logger.
|
686
|
+
Logger.fatal("Unknown export format: #{@export}")
|
689
687
|
exit(1)
|
690
688
|
elsif @output_dir != :stdout
|
691
689
|
if !@output_dir
|
692
|
-
Logger.
|
690
|
+
Logger.fatal("You should also specify an output directory, where I could write all this amazing documentation")
|
693
691
|
exit(1)
|
694
692
|
elsif File.exists?(@output_dir) && !File.directory?(@output_dir)
|
695
|
-
Logger.
|
693
|
+
Logger.fatal("The output directory is not really a directory at all :(")
|
696
694
|
exit(1)
|
697
695
|
elsif !File.exists?(File.dirname(@output_dir))
|
698
|
-
Logger.
|
696
|
+
Logger.fatal("The parent directory for #{@output_dir} doesn't exist")
|
699
697
|
exit(1)
|
700
698
|
elsif !@export && !File.exists?(@template_dir + "/extjs")
|
701
|
-
Logger.
|
702
|
-
Logger.
|
703
|
-
Logger.
|
704
|
-
Logger.
|
699
|
+
Logger.fatal("Oh noes! The template directory does not contain extjs/ directory :(")
|
700
|
+
Logger.fatal("Please copy ExtJS over to template/extjs or create symlink.")
|
701
|
+
Logger.fatal("For example:")
|
702
|
+
Logger.fatal(" $ cp -r /path/to/ext-4.0.0 " + @template_dir + "/extjs")
|
705
703
|
exit(1)
|
706
704
|
elsif !@export && !File.exists?(@template_dir + "/resources/css")
|
707
|
-
Logger.
|
708
|
-
Logger.
|
709
|
-
Logger.
|
710
|
-
Logger.
|
705
|
+
Logger.fatal("Oh noes! CSS files for custom ExtJS theme missing :(")
|
706
|
+
Logger.fatal("Please compile SASS files in template/resources/sass with compass.")
|
707
|
+
Logger.fatal("For example:")
|
708
|
+
Logger.fatal(" $ compass compile " + @template_dir + "/resources/sass")
|
711
709
|
exit(1)
|
712
710
|
end
|
713
711
|
end
|