distil 0.8.4 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.4
1
+ 0.10.0
data/distil.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{distil}
8
- s.version = "0.8.4"
8
+ s.version = "0.10.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Watkins"]
12
- s.date = %q{2010-01-17}
12
+ s.date = %q{2010-03-26}
13
13
  s.default_executable = %q{distil}
14
14
  s.description = %q{A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit}
15
15
  s.executables = ["distil"]
@@ -54,6 +54,8 @@ Gem::Specification.new do |s|
54
54
  "vendor/extconf.rb",
55
55
  "vendor/jsdoc-extras/plugins/distil-plugin.js",
56
56
  "vendor/jsdoc-extras/plugins/interface-plugin.js",
57
+ "vendor/jsdoc-extras/templates/classlist/all-classes.tmpl",
58
+ "vendor/jsdoc-extras/templates/classlist/publish.js",
57
59
  "vendor/jsdoc-extras/templates/coherent/all-classes.tmpl",
58
60
  "vendor/jsdoc-extras/templates/coherent/allclasses.tmpl",
59
61
  "vendor/jsdoc-extras/templates/coherent/allfiles.tmpl",
@@ -138,6 +140,7 @@ Gem::Specification.new do |s|
138
140
  "vendor/jsdoc-toolkit/app/test/memberof3.js",
139
141
  "vendor/jsdoc-toolkit/app/test/memberof_constructor.js",
140
142
  "vendor/jsdoc-toolkit/app/test/module.js",
143
+ "vendor/jsdoc-toolkit/app/test/multi_methods.js",
141
144
  "vendor/jsdoc-toolkit/app/test/name.js",
142
145
  "vendor/jsdoc-toolkit/app/test/namespace_nested.js",
143
146
  "vendor/jsdoc-toolkit/app/test/nocode.js",
data/lib/configurable.rb CHANGED
@@ -66,6 +66,42 @@ class Configurable
66
66
  s
67
67
  end
68
68
 
69
+ def self.class_attr(name)
70
+ if (@class_attributes.nil?)
71
+ @class_attributes=[name]
72
+ else
73
+ @class_attributes<<name
74
+ end
75
+
76
+ class_eval %(
77
+ def self.#{name}(*rest)
78
+ if (rest.length>0)
79
+ @#{name}= rest[0]
80
+ else
81
+ @#{name}
82
+ end
83
+ end
84
+ def self.#{name}=(value)
85
+ @#{name}= value
86
+ end
87
+ def #{name}
88
+ @#{name} || self.class.#{name}
89
+ end
90
+ def #{name}=(value)
91
+ @#{name}=value
92
+ end
93
+ )
94
+
95
+ end
96
+
97
+ def self.inherited(subclass)
98
+ super(subclass)
99
+ (@class_attributes||[]).each { |a|
100
+ instance_var = "@#{a}"
101
+ subclass.instance_variable_set(instance_var, instance_variable_get(instance_var))
102
+ }
103
+ end
104
+
69
105
  # option name, [type], [default], [options]
70
106
  def self.option(name, *rest)
71
107
 
data/lib/file-set.rb CHANGED
@@ -22,17 +22,24 @@ class FileSet
22
22
  next if ('.'==f[/^\./])
23
23
  include_file(File.join(full_path, f))
24
24
  }
25
- else
26
- if (File.exists?(full_path))
27
- source_file= SourceFile.from_path(full_path)
28
- else
29
- source_file= Project.current.find_file(file)
30
- return if (!source_file)
31
- end
32
-
33
- return if (@files.include?(source_file))
34
- @files << source_file
25
+ return
35
26
  end
27
+
28
+ files= Dir.glob(full_path)
29
+ if (files.length>0)
30
+ files.each { |f|
31
+ source_file= SourceFile.from_path(f)
32
+ next if (@files.include?(source_file))
33
+ @files << source_file
34
+ }
35
+ return
36
+ end
37
+
38
+ # file not found by globbing (would also find explicit reference)
39
+ source_file= Project.current.find_file(file)
40
+ return if (!source_file)
41
+ return if (@files.include?(source_file))
42
+ @files << source_file
36
43
  end
37
44
 
38
45
  def each
@@ -5,7 +5,7 @@ $jsl_import_regex= /\/\*jsl:import\s+([^\*]*)\*\//
5
5
  class CssDependencyFilter < FileReferenceFilter
6
6
 
7
7
  def handles_file(file)
8
- return [".css"].include?(file.extension)
8
+ return ["css"].include?(file.content_type)
9
9
  end
10
10
 
11
11
  def preprocess_content(file, content)
@@ -3,7 +3,7 @@ $jsl_import_regex= /\/\*jsl:import\s+([^\*]*)\*\//
3
3
  class JslDependencyFilter < Filter
4
4
 
5
5
  def handles_file(file)
6
- return [".js"].include?(file.extension)
6
+ return ["js"].include?(file.content_type)
7
7
  end
8
8
 
9
9
  def preprocess_content(file, content)
@@ -25,7 +25,7 @@ class JslDependencyFilter < Filter
25
25
  else
26
26
  dependency= Project.current.find_file($1)
27
27
  if (dependency)
28
- file.add_dependency SourceFile.from_path(import_file)
28
+ file.add_dependency dependency
29
29
  else
30
30
  file.error "Missing import file: #{$1}", line_num
31
31
  end
data/lib/project.rb CHANGED
@@ -118,7 +118,7 @@ class Project < Configurable
118
118
  # build or get each project
119
119
  projects.each { |project|
120
120
 
121
- if (project.key?("folder") && !File.directory?(project["folder"]))
121
+ if (project.key?("folder") && !File.directory?(project["folder"]) && !File.symlink?(project["folder"]))
122
122
  if (project["url"])
123
123
  url= project["url"]
124
124
  system "svn co #{url} #{project["folder"]}"
@@ -155,10 +155,10 @@ class Project < Configurable
155
155
  value.is_a?(Hash) && value.has_key?("enabled") && !value["enabled"])
156
156
 
157
157
  puts
158
- puts "#{project_name}-#{section}:"
158
+ puts "#{project_name} #{section}:"
159
159
  puts
160
160
 
161
- task= Task.by_name(section)
161
+ task= Task.by_name(section) || Task.by_product_name(section)
162
162
  if (task)
163
163
  new_value= Hash.new
164
164
  new_value[section]= value
data/lib/source-file.rb CHANGED
@@ -15,15 +15,6 @@ class SourceFile
15
15
  @@file_cache[@full_path]= self
16
16
  end
17
17
 
18
- @@root_folder= FileUtils.pwd
19
- def self.root_folder
20
- @@root_folder
21
- end
22
-
23
- def self.root_folder=(new_root_folder)
24
- @@root_folder= File.expand_path(new_root_folder)
25
- end
26
-
27
18
  def self.extension
28
19
  end
29
20
 
@@ -46,6 +37,10 @@ class SourceFile
46
37
  @@file_types << subclass
47
38
  end
48
39
 
40
+ def self.file_types
41
+ @@file_types
42
+ end
43
+
49
44
  @@file_cache= Hash.new
50
45
  def self.from_path(filepath)
51
46
  full_path= File.expand_path(filepath)
data/lib/target.rb CHANGED
@@ -12,21 +12,34 @@ class Target < Configurable
12
12
  @@current= self
13
13
  @project= project
14
14
  @target_name= name
15
+
16
+ @warning_count=0
17
+ @error_count=0
15
18
 
16
19
  @tasks= []
17
20
 
18
21
  @extras.each { |task_name, task_settings|
19
22
  next if (tasks && !tasks.include?(task_name))
23
+
24
+ if (task_settings.is_a?(Array) || task_settings.is_a?(String))
25
+ task_settings= { "include"=>task_settings }
26
+ end
27
+
20
28
  t= Task.by_name(task_name)
21
- if (t.nil?)
22
- error("Unknown task: #{task_name}")
29
+ if (!t.nil?)
30
+ @tasks << t.new(self, task_settings)
31
+ next
32
+ end
33
+
34
+ t= Task.by_product_name(task_name)
35
+ if (!t.nil?)
36
+ task_settings["output_name"]= task_name[/(.*)\.#{t.output_type}$/,1]
37
+ @tasks << t.new(self, task_settings)
23
38
  next
24
39
  end
25
- @tasks << t.new(self, task_settings)
26
- }
27
40
 
28
- @warning_count=0
29
- @error_count=0
41
+ error("Unknown task: #{task_name}")
42
+ }
30
43
  end
31
44
 
32
45
  @@current=nil
data/lib/task.rb CHANGED
@@ -8,11 +8,9 @@ class Task < Configurable
8
8
  attr_reader :included_files, :assets
9
9
 
10
10
  option :remove_prefix
11
-
11
+ option_alias :remove_prefix, :source_folder
12
+
12
13
  def initialize(target, settings)
13
- if (settings.is_a?(Array) || settings.is_a?(String))
14
- settings= { "include"=>settings }
15
- end
16
14
  super(settings, target)
17
15
 
18
16
  @target= target
@@ -22,10 +20,6 @@ class Task < Configurable
22
20
  @files_to_exclude= []
23
21
  @assets= Set.new
24
22
  @probed= Set.new
25
-
26
- if (remove_prefix)
27
- SourceFile.root_folder= remove_prefix
28
- end
29
23
  end
30
24
 
31
25
  @@tasks= []
@@ -37,6 +31,11 @@ class Task < Configurable
37
31
  @@tasks
38
32
  end
39
33
 
34
+ @@task_aliases= Hash.new
35
+ def self.task_name_alias(name)
36
+ @@task_aliases[name]= self
37
+ end
38
+
40
39
  @@task_index= nil
41
40
  def self.task_index
42
41
  return @@task_index if @@task_index
@@ -49,21 +48,30 @@ class Task < Configurable
49
48
  end
50
49
 
51
50
  def self.by_name(taskname)
52
- self.task_index[taskname]
51
+ self.task_index[taskname] || @@task_aliases[taskname]
53
52
  end
54
53
 
55
- def self.task_name
54
+ def self.by_product_name(productname)
55
+ @@tasks.select { |t|
56
+ next if !t.respond_to?(:output_type)
57
+ return t if productname[/\.#{t.output_type}$/]
58
+ }
56
59
  nil
57
60
  end
58
61
 
62
+ def self.task_name
63
+ s= (self.to_s)[/(.*)Task/,1]
64
+ s && !s.empty? ? s.downcase : nil
65
+ end
66
+
59
67
  def task_name
60
68
  self.class.task_name
61
69
  end
62
-
70
+
63
71
  def handles_file?(file)
64
72
  false
65
73
  end
66
-
74
+
67
75
  # Do a simple token substitution. Tokens begin and end with @.
68
76
  def replace_tokens(string, params)
69
77
  return string.gsub(/(\n[\t ]*)?@([^@ \t\r\n]*)@/) { |m|
@@ -96,11 +104,10 @@ class Task < Configurable
96
104
  def find_files
97
105
  @probed= Set.new
98
106
  @included_files= []
107
+
99
108
  @files_to_include.each { |i| include_file(i) }
100
109
 
101
- files= @included_files.map { |f|
102
- f.to_s
103
- }
110
+ # files= @included_files.map { |f| f.to_s }
104
111
  end
105
112
 
106
113
  def products
@@ -183,6 +190,8 @@ class Task < Configurable
183
190
  end
184
191
 
185
192
  def build_assets
193
+ FileUtils.mkdir_p(output_folder)
194
+
186
195
  if ("release"==mode)
187
196
  copy_assets
188
197
  else
@@ -1,9 +1,5 @@
1
1
  class CopyTask < Task
2
2
 
3
- def self.task_name
4
- "copy"
5
- end
6
-
7
3
  def initialize(target, options)
8
4
  super(target, options)
9
5
  @files_to_exclude= @options.exclude.to_a
@@ -2,13 +2,7 @@ require "#{$script_dir}/tasks/single-output-task.rb"
2
2
 
3
3
  class CssTask < SingleOutputTask
4
4
 
5
- def self.task_name
6
- "css"
7
- end
8
-
9
- def output_type
10
- "css"
11
- end
5
+ output_type "css"
12
6
 
13
7
  # CssTask handles files that end in .css
14
8
  def handles_file?(file_name)
@@ -14,22 +14,46 @@ class JavascriptTask < SingleOutputTask
14
14
  option :jsdoc_plugins, "#{$vendor_dir}/jsdoc-extras/plugins"
15
15
  option :doc_folder, "doc"
16
16
  option :generate_docs, false
17
+ option :generate_import, false
18
+ option :class_list, ""
19
+ option :class_list_template, "#{$vendor_dir}/jsdoc-extras/templates/classlist"
20
+
21
+ output_type "js"
17
22
 
18
- def self.task_name
19
- "js"
20
- end
21
-
22
- def output_type
23
- "js"
24
- end
23
+ task_name_alias "js"
25
24
 
26
25
  def initialize(target, options)
27
26
  super(target, options)
28
27
  @concatenation_join_string = "\n/*jsl:ignore*/;/*jsl:end*/\n"
29
28
 
29
+ if (!class_list.empty?)
30
+ @products << File.join(output_folder, class_list)
31
+ end
32
+
30
33
  if (generate_docs)
31
34
  @products << File.join(doc_folder, "index.html")
32
35
  end
36
+
37
+ type= output_extension
38
+ return if (!type)
39
+
40
+ if (!output_name.empty?)
41
+ target_name= "#{output_name}"
42
+ prefix= "#{output_folder}/"
43
+ else
44
+ target_name= "#{target.target_name}".downcase
45
+ prefix= "#{output_folder}/#{project_name}"
46
+ if ("all"==target_name)
47
+ target_name= ""
48
+ else
49
+ prefix= "#{prefix}-"
50
+ end
51
+ end
52
+
53
+ if (generate_import)
54
+ @name_import= "#{prefix}#{target_name}-import#{type}"
55
+ @products << @name_import
56
+ end
33
57
  end
34
58
 
35
59
  # JsTask handles files that end in .js
@@ -58,6 +82,7 @@ class JavascriptTask < SingleOutputTask
58
82
  }
59
83
 
60
84
  @included_files.each { |f|
85
+ next if "js"!=f.content_type
61
86
  tmp << "+process #{f}\n"
62
87
  }
63
88
 
@@ -89,8 +114,44 @@ class JavascriptTask < SingleOutputTask
89
114
 
90
115
  end
91
116
 
117
+ def generate_class_list()
118
+ tmp= Tempfile.new("jsdoc.conf")
119
+
120
+ template= File.read(@options.jsdoc_conf)
121
+ doc_files= @included_files.map { |f|
122
+ p= f.file_path || f.relative_to_folder(options.remove_prefix||"")
123
+ "\"#{p}\""
124
+ }
125
+
126
+ class_list_output= File.join(output_folder, class_list)
127
+
128
+ conf= replace_tokens(template, {
129
+ "DOC_FILES"=>doc_files.join(",\n"),
130
+ "DOC_OUTPUT_DIR"=>output_folder,
131
+ "DOC_TEMPLATE_DIR"=>class_list_template,
132
+ "DOC_PLUGINS_DIR"=>jsdoc_plugins
133
+ })
134
+
135
+ tmp << conf
136
+ tmp.close()
137
+
138
+ command= "#{$jsdoc_command} -c=#{tmp.path}"
139
+
140
+ stdin, stdout, stderr= Open3.popen3(command)
141
+ stdin.close
142
+ output= stdout.read
143
+ errors= stderr.read
144
+
145
+ tmp.delete
146
+
147
+ puts errors
148
+ puts output
149
+ end
150
+
92
151
  def document_files()
93
-
152
+
153
+ generate_class_list() if (!class_list.empty?)
154
+
94
155
  return if (!generate_docs)
95
156
  return if (!File.exists?($jsdoc_command))
96
157
 
@@ -133,5 +194,20 @@ class JavascriptTask < SingleOutputTask
133
194
  "LOAD_SCRIPTS" => @debug
134
195
  })
135
196
  end
197
+
198
+ def finish
199
+ super
200
+ return if (!generate_import)
201
+
202
+ File.delete(@name_import) if (File.exists?(@name_import))
203
+
204
+ File.open(@name_import, "w") { |f|
205
+ f.write(notice_text)
206
+
207
+ @included_files.each { |inc|
208
+ f.puts "/*jsl:import #{inc.relative_to_folder(output_folder)}*/"
209
+ }
210
+ }
211
+ end
136
212
 
137
213
  end
@@ -36,11 +36,11 @@ class MultipleOutputTask < OutputTask
36
36
 
37
37
  type= output_extension
38
38
  @included_files.each { |file|
39
- basename= file.basename(".#{type}")
40
- name_concat= "#{@prefix}#{basename}-uncompressed.#{type}"
41
- name_min= "#{@prefix}#{basename}.#{type}"
42
- name_gz= "#{@prefix}#{basename}.#{type}.gz"
43
- name_debug= "#{@prefix}#{basename}-debug.#{type}"
39
+ basename= file.basename("#{type}")
40
+ name_concat= "#{@prefix}#{basename}-uncompressed#{type}"
41
+ name_min= "#{@prefix}#{basename}#{type}"
42
+ name_gz= "#{@prefix}#{basename}#{type}.gz"
43
+ name_debug= "#{@prefix}#{basename}-debug#{type}"
44
44
  @products.concat([name_concat, name_min, name_gz, name_debug])
45
45
  }
46
46
  @products
@@ -81,11 +81,11 @@ class MultipleOutputTask < OutputTask
81
81
  type= output_extension
82
82
  return if (!type)
83
83
 
84
- basename= file.basename(".#{type}")
85
- name_concat= "#{@prefix}#{basename}-uncompressed.#{type}"
86
- name_min= "#{@prefix}#{basename}.#{type}"
87
- name_gz= "#{@prefix}#{basename}.#{type}.gz"
88
- name_debug= "#{@prefix}#{basename}-debug.#{type}"
84
+ basename= file.basename("#{type}")
85
+ name_concat= "#{@prefix}#{basename}-uncompressed#{type}"
86
+ name_min= "#{@prefix}#{basename}#{type}"
87
+ name_gz= "#{@prefix}#{basename}#{type}.gz"
88
+ name_debug= "#{@prefix}#{basename}-debug#{type}"
89
89
 
90
90
  # puts "Finish: #{file}"
91
91
  # puts " #{name_concat}"
@@ -16,16 +16,19 @@ class OutputTask < Task
16
16
  FileUtils.mkdir_p(output_folder)
17
17
  end
18
18
 
19
- def output_type
20
- nil
21
- end
19
+ class_attr :output_type
20
+ class_attr :content_type
22
21
 
23
- def source_type
24
- output_type
22
+ def self.content_type(*rest)
23
+ if (rest.length>0)
24
+ @content_type= rest[0]
25
+ else
26
+ @content_type || output_type
27
+ end
25
28
  end
26
29
 
27
30
  def output_extension
28
- output_type
31
+ output_type && ".#{output_type}"
29
32
  end
30
33
 
31
34
  def products
@@ -36,7 +39,7 @@ class OutputTask < Task
36
39
  # Run the Y!UI Compressor
37
40
  buffer= ""
38
41
 
39
- IO.popen("java -jar #{$compressor} --type #{source_type}", "r+") { |pipe|
42
+ IO.popen("java -jar #{$compressor} --type #{content_type}", "r+") { |pipe|
40
43
  pipe.puts(source)
41
44
  pipe.close_write
42
45
  buffer= pipe.read
@@ -2,25 +2,31 @@ require "#{$script_dir}/tasks/output-task.rb"
2
2
 
3
3
  class SingleOutputTask < OutputTask
4
4
 
5
+ option :output_name, ""
6
+
5
7
  def initialize(target, options)
6
8
  super(target, options)
7
9
 
8
10
  type= output_extension
9
11
  return if (!type)
10
-
11
- target_name= "#{target.target_name}".downcase
12
- prefix= "#{output_folder}/#{project_name}"
13
-
14
- if ("all"==target_name)
15
- target_name= ""
12
+
13
+ if (!output_name.empty?)
14
+ target_name= "#{output_name}"
15
+ prefix= "#{output_folder}/"
16
16
  else
17
- prefix= "#{prefix}-"
17
+ target_name= "#{target.target_name}".downcase
18
+ prefix= "#{output_folder}/#{project_name}"
19
+ if ("all"==target_name)
20
+ target_name= ""
21
+ else
22
+ prefix= "#{prefix}-"
23
+ end
18
24
  end
19
25
 
20
- @name_concat= "#{prefix}#{target_name}-uncompressed.#{type}"
21
- @name_min= "#{prefix}#{target_name}.#{type}"
22
- @name_gz= "#{prefix}#{target_name}.#{type}.gz"
23
- @name_debug= "#{prefix}#{target_name}-debug.#{type}"
26
+ @name_concat= "#{prefix}#{target_name}-uncompressed#{type}"
27
+ @name_min= "#{prefix}#{target_name}#{type}"
28
+ @name_gz= "#{prefix}#{target_name}#{type}.gz"
29
+ @name_debug= "#{prefix}#{target_name}-debug#{type}"
24
30
 
25
31
  @concatenation_join_string= ""
26
32
  @products= [@name_concat, @name_min, @name_gz, @name_debug]
@@ -29,14 +35,16 @@ class SingleOutputTask < OutputTask
29
35
  @debug = ""
30
36
  end
31
37
 
38
+ def process_file(file)
39
+ if (!@concat.empty?)
40
+ @concat << @concatenation_join_string||""
41
+ end
42
+ @concat << file.filtered_content(options)
43
+ @debug << file.debug_content(options)
44
+ end
45
+
32
46
  def process_files
33
- @included_files.each { |f|
34
- if (!@concat.empty?)
35
- @concat << @concatenation_join_string||""
36
- end
37
- @concat << f.filtered_content(options)
38
- @debug << f.debug_content(options)
39
- }
47
+ @included_files.each { |f| process_file(f) }
40
48
  end
41
49
 
42
50
  def finish
@@ -189,10 +189,6 @@ class TestTask < Task
189
189
  @skipped= 0
190
190
  end
191
191
 
192
- def self.task_name
193
- "test"
194
- end
195
-
196
192
  def handles_file?(file_name)
197
193
  "#{file_name}"[/\.js$/] || "#{file_name}"[/\.html$/]
198
194
  end
@@ -0,0 +1,7 @@
1
+ function classIndex()
2
+ {
3
+ {!
4
+ var aliases= data.map(function(c) { return '"' + c.alias + '"'; });
5
+ !}
6
+ return [{+aliases.join(',')+}];
7
+ }
@@ -0,0 +1,43 @@
1
+ /** Called automatically by JsDoc Toolkit. */
2
+ function publish(symbolSet) {
3
+ publish.conf = { // trailing slash expected for dirs
4
+ ext: ".html",
5
+ outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/",
6
+ templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/jsdoc/",
7
+ symbolsDir: "symbols/",
8
+ srcDir: "symbols/src/"
9
+ };
10
+
11
+ // is source output is suppressed, just display the links to the source file
12
+ if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) {
13
+ Link.prototype._makeSrcLink = function(srcFilePath) {
14
+ return "&lt;"+srcFilePath+"&gt;";
15
+ }
16
+ }
17
+
18
+ // used to allow Link to check the details of things being linked to
19
+ Link.symbolSet = symbolSet;
20
+
21
+ // create the required templates
22
+ try {
23
+ var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"all-classes.tmpl");
24
+ }
25
+ catch(e) {
26
+ print("Couldn't create the required templates: "+e);
27
+ quit();
28
+ }
29
+
30
+ // some ustility filters
31
+ function hasNoParent($) {return (!$.memberOf);}
32
+ function isaFile($) {return ($.is("FILE"));}
33
+ function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace) && '_global_'!=$.alias;}
34
+
35
+ // get an array version of the symbolset, useful for filtering
36
+ var symbols = symbolSet.toArray();
37
+
38
+ // get a list of all the classes in the symbolset
39
+ var classes = symbols.filter(isaClass);
40
+ var classesIndex = classesTemplate.process(classes);
41
+
42
+ IO.saveFile(publish.conf.outDir, 'classes.js', classesIndex);
43
+ }
@@ -94,8 +94,6 @@ JSDOC.JsPlate.prototype.process = function(data, compact) {
94
94
  if (e.lineNumber-2 >= 0) print("line "+(e.lineNumber-1)+": "+lines[e.lineNumber-2]);
95
95
  print("line "+e.lineNumber+": "+lines[e.lineNumber-1]);
96
96
  print("");
97
-
98
- print(this.code);
99
97
  }
100
98
 
101
99
  if (compact) { // patch by mcbain.asm
@@ -52,12 +52,14 @@ if (JSDOC.opt.S) {
52
52
  }
53
53
  }
54
54
 
55
- // if a symbol alias is documented more than once the last one with the user docs wins
55
+ // if a symbol alias is documented more than once the first one with the user docs wins
56
56
  if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) {
57
57
  var oldSymbol = JSDOC.Parser.symbols.getSymbol(symbol.alias);
58
58
  if (oldSymbol.comment.isUserComment) {
59
+ if (JSDOC.opt.m) return;
59
60
  if (symbol.comment.isUserComment) { // old and new are both documented
60
61
  LOG.warn("The symbol '"+symbol.alias+"' is documented more than once.");
62
+ return;
61
63
  }
62
64
  else { // old is documented but new isn't
63
65
  return;
@@ -16,8 +16,9 @@ JSDOC.SymbolSet.prototype.hasSymbol = function(alias) {
16
16
  }
17
17
 
18
18
  JSDOC.SymbolSet.prototype.addSymbol = function(symbol) {
19
- if (this.hasSymbol(symbol.alias)) {
19
+ if (JSDOC.opt.a && this.hasSymbol(symbol.alias)) {
20
20
  LOG.warn("Overwriting symbol documentation for: "+symbol.alias + ".");
21
+ this.deleteSymbol(symbol.alias);
21
22
  }
22
23
  this._index.set(symbol.alias, symbol);
23
24
  }
@@ -111,11 +112,11 @@ if (/#$/.test(borrows[i].alias)) {
111
112
  JSDOC.SymbolSet.prototype.resolveMemberOf = function() {
112
113
  for (var p = this._index.first(); p; p = this._index.next()) {
113
114
  var symbol = p.value;
115
+
114
116
  if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
115
117
 
116
118
  // the memberOf value was provided in the @memberOf tag
117
119
  else if (symbol.memberOf) {
118
-
119
120
  // like foo.bar is a memberOf foo
120
121
  if (symbol.alias.indexOf(symbol.memberOf) == 0) {
121
122
  var memberMatch = new RegExp("^("+symbol.memberOf+")[.#-]?(.+)$");
@@ -142,6 +143,7 @@ JSDOC.SymbolSet.prototype.resolveMemberOf = function() {
142
143
  // the memberOf must be calculated
143
144
  else {
144
145
  var parts = symbol.alias.match(/^(.*[.#-])([^.#-]+)$/);
146
+
145
147
  if (parts) {
146
148
  symbol.memberOf = parts[1];
147
149
  symbol.name = parts[2];
@@ -182,6 +182,15 @@ JSDOC.Walker.prototype.step = function() {
182
182
  }
183
183
  // foo = function() {}
184
184
  else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("FUNCTION")) {
185
+ var constructs;
186
+ var isConstructor = false;
187
+ if (doc && (constructs = doc.getTag("constructs")) && constructs.length) {
188
+ if (constructs[0].desc) {
189
+ name = constructs[0].desc;
190
+ isConstructor = true;
191
+ }
192
+ }
193
+
185
194
  var isInner;
186
195
  if (this.ts.look(-1).is("VAR") || this.isInner) {
187
196
  if (doc && doc.getTag("memberOf").length > 0) {
@@ -204,6 +213,7 @@ JSDOC.Walker.prototype.step = function() {
204
213
  symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc);
205
214
 
206
215
  if (isInner) symbol.isInner = true;
216
+ if (isConstructor) symbol.isa = "CONSTRUCTOR";
207
217
 
208
218
  if (this.ts.look(1).is("JSDOC")) {
209
219
  var inlineReturn = ""+this.ts.look(1).data;
@@ -260,8 +270,6 @@ JSDOC.Walker.prototype.step = function() {
260
270
  if (this.lastDoc) doc = this.lastDoc;
261
271
  params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN"));
262
272
 
263
- if (/(^|#)constructor$/.test(name)) JSDOC.PluginManager.run("onConstructorDefined", doc);
264
-
265
273
  if (doc && doc.getTag("constructs").length) {
266
274
  name = name.replace(/\.prototype(\.|$)/, "#");
267
275
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  @overview
3
- @date $Date: 2009-10-28 16:25:32 -0700 (Wed, 28 Oct 2009) $
4
- @version $Revision: 816 $
3
+ @date $Date: 2010-01-10 10:49:48 -0800 (Sun, 10 Jan 2010) $
4
+ @version $Revision: 829 $
5
5
  @location $HeadURL: http://jsdoc-toolkit.googlecode.com/svn/trunk/jsdoc-toolkit/app/lib/JSDOC.js $
6
6
  @name JSDOC.js
7
7
  */
@@ -27,6 +27,7 @@ JSDOC.opt = Opt.get(
27
27
  e: "encoding",
28
28
  "E[]": "exclude",
29
29
  h: "help",
30
+ m: "multiple",
30
31
  n: "nocode",
31
32
  o: "out",
32
33
  p: "private",
@@ -58,6 +59,7 @@ JSDOC.usage = function() {
58
59
  print(" -e=<ENCODING> or --encoding=<ENCODING>\n Use this encoding to read and write files.\n");
59
60
  print(" -E=\"REGEX\" or --exclude=\"REGEX\"\n Multiple. Exclude files based on the supplied regex.\n");
60
61
  print(" -h or --help\n Show this message and exit.\n");
62
+ print(" -m or --multiples\n Don't warn about symbols being documented more than once.\n");
61
63
  print(" -n or --nocode\n Ignore all code, only document comments with @name tags.\n");
62
64
  print(" -o=<PATH> or --out=<PATH>\n Print log messages to a file (defaults to stdout).\n");
63
65
  print(" -p or --private\n Include symbols tagged as private, underscored and inner symbols.\n");
@@ -0,0 +1,25 @@
1
+
2
+ /**
3
+ Get the entire flavor.
4
+ @name flavor^3
5
+ @function
6
+ @returns {Object} The entire flavor hash.
7
+ */
8
+ /**
9
+ Get a named flavor.
10
+ @name flavor^2
11
+ @function
12
+ @param {String} name The name of the flavor to get.
13
+ @returns {String} The value of that flavor.
14
+ */
15
+ /**
16
+ Set the flavor.
17
+ @param {String} name The name of the flavor to set.
18
+ @param {String} value The value of the flavor.
19
+ @returns {String} The value of that flavor.
20
+ */
21
+ function flavor(name, value) {
22
+ if (arguments.length > 1) flavor[name] = value;
23
+ else if (arguments.length == 1) return flavor[name];
24
+ else return flavor;
25
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Watkins
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-17 00:00:00 -08:00
12
+ date: 2010-03-26 00:00:00 -07:00
13
13
  default_executable: distil
14
14
  dependencies: []
15
15
 
@@ -61,6 +61,8 @@ files:
61
61
  - vendor/extconf.rb
62
62
  - vendor/jsdoc-extras/plugins/distil-plugin.js
63
63
  - vendor/jsdoc-extras/plugins/interface-plugin.js
64
+ - vendor/jsdoc-extras/templates/classlist/all-classes.tmpl
65
+ - vendor/jsdoc-extras/templates/classlist/publish.js
64
66
  - vendor/jsdoc-extras/templates/coherent/all-classes.tmpl
65
67
  - vendor/jsdoc-extras/templates/coherent/allclasses.tmpl
66
68
  - vendor/jsdoc-extras/templates/coherent/allfiles.tmpl
@@ -145,6 +147,7 @@ files:
145
147
  - vendor/jsdoc-toolkit/app/test/memberof3.js
146
148
  - vendor/jsdoc-toolkit/app/test/memberof_constructor.js
147
149
  - vendor/jsdoc-toolkit/app/test/module.js
150
+ - vendor/jsdoc-toolkit/app/test/multi_methods.js
148
151
  - vendor/jsdoc-toolkit/app/test/name.js
149
152
  - vendor/jsdoc-toolkit/app/test/namespace_nested.js
150
153
  - vendor/jsdoc-toolkit/app/test/nocode.js