jsduck 3.11.0 → 3.11.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -41,7 +41,10 @@ For **Windows** users out there, you can download the binary version,
41
41
  which includes Ruby interpreter and all dependencies bundled in a
42
42
  single .exe file. Grab it from the [download page][].
43
43
 
44
+ If you are brave enough: [try out JSDuck 4.0 beta.][beta]
45
+
44
46
  [download page]: https://github.com/senchalabs/jsduck/downloads
47
+ [beta]: https://github.com/senchalabs/jsduck/wiki/4.0-beta
45
48
 
46
49
  Usage
47
50
  -----
@@ -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 = '3.11.0'
6
- s.date = '2012-06-05'
5
+ s.version = '3.11.1'
6
+ s.date = '2012-07-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"
@@ -104,7 +104,12 @@ module JsDuck
104
104
  def parallel_parse(filenames)
105
105
  @parallel.map(filenames) do |fname|
106
106
  Logger.instance.log("Parsing", fname)
107
- SourceFile.new(JsDuck::IO.read(fname), fname, @opts)
107
+ begin
108
+ SourceFile.new(JsDuck::IO.read(fname), fname, @opts)
109
+ rescue
110
+ Logger.instance.fatal("Error while parsing #{fname}", $!)
111
+ exit(1)
112
+ end
108
113
  end
109
114
  end
110
115
 
@@ -159,10 +164,15 @@ module JsDuck
159
164
  # Format all doc-objects in parallel
160
165
  formatted_classes = @parallel.map(@relations.classes) do |cls|
161
166
  Logger.instance.log("Markdown formatting #{cls[:name]}")
162
- {
163
- :doc => class_formatter.format(cls.internal_doc),
164
- :images => doc_formatter.images
165
- }
167
+ begin
168
+ {
169
+ :doc => class_formatter.format(cls.internal_doc),
170
+ :images => doc_formatter.images
171
+ }
172
+ rescue
173
+ Logger.instance.fatal("Error while formatting #{cls[:name]}", $!)
174
+ exit(1)
175
+ end
166
176
  end
167
177
  # Then merge the data back to classes sequentially
168
178
  formatted_classes.each do |cls|
@@ -36,15 +36,13 @@ module JsDuck
36
36
  end
37
37
 
38
38
  # Modified each_item that also loads HTML for each guide
39
- def each_item(&block)
40
- unless @loaded
41
- super do |guide|
42
- guide[:html] = load_guide(guide)
43
- end
44
- @loaded = true
39
+ def each_item
40
+ super do |guide|
41
+ # Load the guide if not loaded
42
+ guide[:html] = load_guide(guide) if guide[:html] == nil
43
+ # Pass guide to block if it was successfully loaded.
44
+ yield guide if guide[:html]
45
45
  end
46
-
47
- super(&block)
48
46
  end
49
47
 
50
48
  # Modified to_array that excludes the :html from guide nodes
@@ -59,16 +57,23 @@ module JsDuck
59
57
 
60
58
  def load_guide(guide)
61
59
  in_dir = @path + "/guides/" + guide["name"]
60
+
62
61
  return Logger.instance.warn(:guide, "Guide #{in_dir} not found") unless File.exists?(in_dir)
63
62
 
64
63
  guide_file = in_dir + "/README.md"
64
+
65
65
  return Logger.instance.warn(:guide, "README.md not found in #{in_dir}") unless File.exists?(guide_file)
66
66
 
67
- @formatter.doc_context = {:filename => guide_file, :linenr => 0}
68
- name = File.basename(in_dir)
69
- @formatter.img_path = "guides/#{name}"
67
+ begin
68
+ @formatter.doc_context = {:filename => guide_file, :linenr => 0}
69
+ name = File.basename(in_dir)
70
+ @formatter.img_path = "guides/#{name}"
70
71
 
71
- return add_toc(guide, @formatter.format(JsDuck::IO.read(guide_file)))
72
+ return add_toc(guide, @formatter.format(JsDuck::IO.read(guide_file)))
73
+ rescue
74
+ Logger.instance.fatal("Error while reading/formatting guide #{in_dir}", $!)
75
+ exit(1)
76
+ end
72
77
  end
73
78
 
74
79
  def write_guide(guide, dir)
@@ -101,6 +101,8 @@ module JsDuck
101
101
  elsif !@warnings.has_key?(type)
102
102
  warn(nil, "Unknown warning type #{type}")
103
103
  end
104
+
105
+ return false
104
106
  end
105
107
 
106
108
  # Formats filename and line number for output
@@ -114,6 +116,15 @@ module JsDuck
114
116
  end
115
117
  out
116
118
  end
119
+
120
+ # Prints fatal error message with backtrace.
121
+ # The error param should be $! from resque block.
122
+ def fatal(msg, error)
123
+ puts "#{msg}: #{error}"
124
+ puts
125
+ puts "Here's a full backtrace:"
126
+ puts error.backtrace
127
+ end
117
128
  end
118
129
 
119
130
  end
@@ -75,11 +75,11 @@ module JsDuck
75
75
  ]
76
76
  @meta_tag_paths = []
77
77
 
78
- @version = "3.11.0"
78
+ @version = "3.11.1"
79
79
 
80
80
  # Customizing output
81
- @title = "Sencha Docs - Ext JS"
82
- @header = "<strong>Sencha Docs</strong> Ext JS"
81
+ @title = "Ext JS - Sencha Docs"
82
+ @header = "<strong>Ext JS</strong> Sencha Docs"
83
83
  @footer = "Generated with <a href='https://github.com/senchalabs/jsduck'>JSDuck</a> #{@version}."
84
84
  @head_html = ""
85
85
  @body_html = ""
@@ -181,7 +181,7 @@ module JsDuck
181
181
 
182
182
  opts.on('--title=TEXT',
183
183
  "Custom title text for the documentation.",
184
- "Defaults to 'Sencha Docs - Ext JS'", " ") do |text|
184
+ "Defaults to 'Ext JS - Sencha Docs'", " ") do |text|
185
185
  @title = text
186
186
  @header = text.sub(/^(.*?) +- +/, "<strong>\\1 </strong>")
187
187
  end
@@ -80,18 +80,10 @@ module JsDuck
80
80
 
81
81
  # Parses the file depending on filename as JS or CSS
82
82
  def parse
83
- begin
84
- if @filename =~ /\.s?css$/
85
- CssParser.new(@contents, @options).parse
86
- else
87
- JsParser.new(@contents, @options).parse
88
- end
89
- rescue
90
- puts "Error while parsing #{@filename}: #{$!}"
91
- puts
92
- puts "Here's a full backtrace:"
93
- puts $!.backtrace
94
- exit(1)
83
+ if @filename =~ /\.s?css$/
84
+ CssParser.new(@contents, @options).parse
85
+ else
86
+ JsParser.new(@contents, @options).parse
95
87
  end
96
88
  end
97
89
 
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: 3.11.0
4
+ version: 3.11.1
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-06-05 00:00:00.000000000 Z
13
+ date: 2012-07-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdiscount
@@ -660,7 +660,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
660
660
  version: 1.3.5
661
661
  requirements: []
662
662
  rubyforge_project: jsduck
663
- rubygems_version: 1.8.23
663
+ rubygems_version: 1.8.24
664
664
  signing_key:
665
665
  specification_version: 3
666
666
  summary: Simple JavaScript Duckumentation generator