jsduck 5.3.4 → 6.0.0beta

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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/bin/jsduck +3 -3
  4. data/lib/jsduck/app.rb +1 -1
  5. data/lib/jsduck/assets.rb +3 -3
  6. data/lib/jsduck/base_type.rb +2 -2
  7. data/lib/jsduck/batch_processor.rb +3 -1
  8. data/lib/jsduck/categories/file.rb +2 -2
  9. data/lib/jsduck/class_doc_expander.rb +1 -1
  10. data/lib/jsduck/css/parser.rb +59 -90
  11. data/lib/jsduck/css/type.rb +55 -0
  12. data/lib/jsduck/doc/parser.rb +1 -1
  13. data/lib/jsduck/doc/scanner.rb +2 -2
  14. data/lib/jsduck/doc/subproperties.rb +1 -1
  15. data/lib/jsduck/export_writer.rb +4 -4
  16. data/lib/jsduck/exporter/app.rb +2 -1
  17. data/lib/jsduck/exporter/full.rb +5 -3
  18. data/lib/jsduck/external_classes.rb +337 -5
  19. data/lib/jsduck/format/class.rb +3 -3
  20. data/lib/jsduck/format/doc.rb +6 -5
  21. data/lib/jsduck/format/subproperties.rb +1 -1
  22. data/lib/jsduck/guide_toc.rb +45 -27
  23. data/lib/jsduck/guide_toc_entry.rb +54 -0
  24. data/lib/jsduck/guides.rb +9 -5
  25. data/lib/jsduck/img/dir.rb +1 -1
  26. data/lib/jsduck/inline/example.rb +3 -1
  27. data/lib/jsduck/inline/img.rb +3 -3
  28. data/lib/jsduck/inline/link.rb +2 -2
  29. data/lib/jsduck/inline/link_renderer.rb +3 -2
  30. data/lib/jsduck/inline/video.rb +2 -1
  31. data/lib/jsduck/js/class.rb +6 -11
  32. data/lib/jsduck/js/ext_define.rb +46 -0
  33. data/lib/jsduck/js/ext_patterns.rb +7 -2
  34. data/lib/jsduck/js/rkelly_adapter.rb +16 -2
  35. data/lib/jsduck/logger.rb +40 -25
  36. data/lib/jsduck/member_registry.rb +41 -0
  37. data/lib/jsduck/news.rb +18 -5
  38. data/lib/jsduck/options/config.rb +35 -0
  39. data/lib/jsduck/options/helpful_parser.rb +111 -0
  40. data/lib/jsduck/options/input_files.rb +60 -0
  41. data/lib/jsduck/options/jsb.rb +25 -0
  42. data/lib/jsduck/{options.rb → options/parser.rb} +436 -484
  43. data/lib/jsduck/options/processor.rb +47 -0
  44. data/lib/jsduck/options/record.rb +51 -0
  45. data/lib/jsduck/output_dir.rb +4 -4
  46. data/lib/jsduck/parser.rb +5 -5
  47. data/lib/jsduck/process/components.rb +19 -0
  48. data/lib/jsduck/process/ext4_events.rb +4 -2
  49. data/lib/jsduck/process/importer.rb +5 -2
  50. data/lib/jsduck/process/inherit_members.rb +2 -0
  51. data/lib/jsduck/process/lint.rb +3 -3
  52. data/lib/jsduck/process/no_doc.rb +1 -1
  53. data/lib/jsduck/process/overrides.rb +4 -3
  54. data/lib/jsduck/process/versions.rb +86 -51
  55. data/lib/jsduck/render/class.rb +3 -2
  56. data/lib/jsduck/render/subproperties.rb +18 -0
  57. data/lib/jsduck/render/tags.rb +13 -1
  58. data/lib/jsduck/source/file.rb +2 -2
  59. data/lib/jsduck/tag/class.rb +6 -0
  60. data/lib/jsduck/tag/component.rb +19 -0
  61. data/lib/jsduck/tag/css_mixin.rb +10 -0
  62. data/lib/jsduck/tag/deprecated.rb +1 -1
  63. data/{template-min/resources/images/class-m.png → lib/jsduck/tag/icons/class-large.png} +0 -0
  64. data/lib/jsduck/tag/icons/class-redirect.png +0 -0
  65. data/lib/jsduck/tag/icons/class.png +0 -0
  66. data/{template-min/resources/images/component-m.png → lib/jsduck/tag/icons/component-large.png} +0 -0
  67. data/lib/jsduck/tag/icons/component-redirect.png +0 -0
  68. data/lib/jsduck/tag/icons/component.png +0 -0
  69. data/{template-min/resources/images/singleton-m.png → lib/jsduck/tag/icons/singleton-large.png} +0 -0
  70. data/lib/jsduck/tag/icons/singleton-redirect.png +0 -0
  71. data/lib/jsduck/tag/icons/singleton.png +0 -0
  72. data/lib/jsduck/tag/inheritdoc.rb +2 -2
  73. data/lib/jsduck/tag/new.rb +13 -0
  74. data/lib/jsduck/tag/since.rb +2 -2
  75. data/lib/jsduck/tag/singleton.rb +13 -0
  76. data/lib/jsduck/tag/tag.rb +19 -0
  77. data/lib/jsduck/tag_registry.rb +20 -81
  78. data/lib/jsduck/util/io.rb +5 -0
  79. data/lib/jsduck/util/json.rb +3 -3
  80. data/lib/jsduck/util/null_object.rb +14 -1
  81. data/lib/jsduck/util/parallel.rb +7 -3
  82. data/lib/jsduck/version.rb +1 -1
  83. data/lib/jsduck/warning/registry.rb +4 -2
  84. data/lib/jsduck/warning/tag.rb +57 -0
  85. data/lib/jsduck/web/class_icons.rb +76 -0
  86. data/lib/jsduck/web/css.rb +12 -1
  87. data/lib/jsduck/web/data.rb +4 -3
  88. data/lib/jsduck/web/index_html.rb +26 -10
  89. data/lib/jsduck/web/member_icons.rb +3 -3
  90. data/lib/jsduck/web/search.rb +4 -4
  91. data/lib/jsduck/web/source.rb +1 -1
  92. data/lib/jsduck/web/template.rb +6 -6
  93. data/lib/jsduck/web/tree.rb +22 -0
  94. data/lib/jsduck/web/writer.rb +11 -9
  95. data/template-min/app-0f524ddd276c4019a11a6128932a9c96.js +1 -0
  96. data/template-min/index-template.html +1 -1
  97. data/template-min/print-template.html +1 -1
  98. data/template-min/resources/css/{app-4689d2a5522dcd3c9e9923ca59c33f27.css → app-de670120f43fdad3091a0cc2c10daadb.css} +1 -1
  99. data/template-min/resources/images/icons.xcf +0 -0
  100. data/template-min/template.html +2 -2
  101. metadata +46 -13
  102. data/lib/jsduck/css/lexer.rb +0 -203
  103. data/lib/jsduck/option_parser.rb +0 -109
  104. data/lib/jsduck/web/icons.rb +0 -31
  105. data/template-min/app-0c945a27f43452df695771ddb60b3d14.js +0 -1
@@ -17,9 +17,9 @@ module JsDuck
17
17
  @pretty = false
18
18
  end
19
19
 
20
- # Set to true to turn on pretty-formatting of JSON
21
- def pretty=(pretty)
22
- @pretty = pretty
20
+ # Configures the pretty-formatting from command line options.
21
+ def configure(opts)
22
+ @pretty = true if opts.pretty_json
23
23
  end
24
24
 
25
25
  # Turns object into JSON, places it inside JavaScript that calls the
@@ -15,7 +15,20 @@ module JsDuck
15
15
  end
16
16
 
17
17
  def method_missing(meth, *args, &block)
18
- @methods.has_key?(meth) ? @methods[meth] : self
18
+ if @methods.has_key?(meth)
19
+ value = @methods[meth]
20
+ if value.respond_to?(:call)
21
+ value.call(*args, &block)
22
+ else
23
+ value
24
+ end
25
+ else
26
+ self
27
+ end
28
+ end
29
+
30
+ def respond_to?(meth)
31
+ @methods.has_key?(meth)
19
32
  end
20
33
  end
21
34
 
@@ -1,3 +1,4 @@
1
+ require 'jsduck/util/os'
1
2
  require 'parallel'
2
3
 
3
4
  module JsDuck
@@ -8,9 +9,12 @@ module JsDuck
8
9
  class Parallel
9
10
  @@in_processes = nil
10
11
 
11
- # Sets globally the nr of processes to use.
12
- def self.in_processes=(n)
13
- @@in_processes = n
12
+ # Configures the logger to use as many processes as set in
13
+ # command line options. When in Windows, turns the parallel
14
+ # processing off by default.
15
+ def self.configure(opts)
16
+ @@in_processes = 0 if Util::OS::windows?
17
+ @@in_processes = opts.processes if opts.processes
14
18
  end
15
19
 
16
20
  def self.each(arr, &block)
@@ -1,5 +1,5 @@
1
1
  # This file is updated by rake bump task.
2
2
  # Do not edit by hand.
3
3
  module JsDuck
4
- VERSION = "5.3.4"
4
+ VERSION = "6.0.0beta"
5
5
  end
@@ -1,5 +1,6 @@
1
1
  require 'jsduck/warning/basic'
2
2
  require 'jsduck/warning/nodoc'
3
+ require 'jsduck/warning/tag'
3
4
  require 'jsduck/warning/deprecated'
4
5
  require 'jsduck/warning/all'
5
6
  require 'jsduck/warning/warn_exception'
@@ -19,7 +20,6 @@ module JsDuck
19
20
  [:global, "Member doesn't belong to any class"],
20
21
  [:inheritdoc, "@inheritdoc referring to unknown class or member"],
21
22
  [:extend, "@extend/mixin/requires/uses referring to unknown class"],
22
- [:tag, "Use of unsupported @tag"],
23
23
  [:tag_repeated, "An @tag used multiple times, but only once allowed"],
24
24
  [:tag_syntax, "@tag syntax error"],
25
25
  [:link, "{@link} to unknown class or member"],
@@ -42,7 +42,6 @@ module JsDuck
42
42
 
43
43
  [:image, "{@img} referring to missing file"],
44
44
  [:image_unused, "An image exists in --images dir that's not used"],
45
- [:cat_old_format, "Categories file uses old deprecated format"],
46
45
  [:cat_no_match, "Class pattern in categories file matches nothing"],
47
46
  [:cat_class_missing, "Class is missing from categories file"],
48
47
  [:guide, "Guide is missing from --guides dir"],
@@ -53,6 +52,9 @@ module JsDuck
53
52
  register(w[0], Warning::Basic.new(w[0], w[1]))
54
53
  end
55
54
 
55
+ # :tag warning
56
+ register(:tag, Warning::Tag.new)
57
+
56
58
  # :nodoc warning
57
59
  register(:nodoc, Warning::Nodoc.new)
58
60
 
@@ -0,0 +1,57 @@
1
+ module JsDuck
2
+ module Warning
3
+
4
+ # Unknown tag warning.
5
+ class Tag
6
+
7
+ # Creates the :tag warning type
8
+ def initialize
9
+ @rules = []
10
+ # disable by default
11
+ set(false)
12
+ end
13
+
14
+ # Enables or disables a particular sub-warning
15
+ def set(enabled, path_pattern=nil, tagnames=[])
16
+ @rules.unshift({
17
+ :enabled => enabled,
18
+ :tagnames => tagnames,
19
+ :path_re => path_pattern ? Regexp.new(Regexp.escape(path_pattern)) : nil
20
+ })
21
+ end
22
+
23
+ # True when the warning is enabled for the given filename and
24
+ # params combination where params contains one tagname.
25
+ def enabled?(filename="", params=[])
26
+ tagname = params[0]
27
+
28
+ # Filter out the most recently added rule that applies to our current item
29
+ match = @rules.find do |r|
30
+ (r[:tagnames].empty? || r[:tagnames].include?(tagname)) &&
31
+ (r[:path_re].nil? || r[:path_re] =~ filename)
32
+ end
33
+
34
+ return match[:enabled]
35
+ end
36
+
37
+ # Extensive documentation for :nodoc warning
38
+ def doc
39
+ [
40
+ "",
41
+ " +tag(<name1>,<name2>,...) - Use of unsupported @tag",
42
+ "",
43
+ " This warning type can optionally take a list of tag names",
44
+ " to limit its effect to only these tags.",
45
+ "",
46
+ " So, to disable warnings for JavaDoc tags @file and @overview",
47
+ " which aren't supported by JSDuck:",
48
+ "",
49
+ " --warnings='-tag(file,overview)'",
50
+ "",
51
+ ]
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,76 @@
1
+ require 'jsduck/tag_registry'
2
+ require 'jsduck/logger'
3
+ require 'fileutils'
4
+
5
+ module JsDuck
6
+ module Web
7
+ class ClassIcons
8
+ class << self
9
+ # Returns CSS class name for an icon of class
10
+ def get(cls)
11
+ class_icon_providers.each do |tag|
12
+ if cls[tag.tagname]
13
+ return "icon-#{tag.tagname}"
14
+ end
15
+ end
16
+
17
+ return "icon-class"
18
+ end
19
+
20
+ # Generates CSS for class icons
21
+ def css
22
+ css = []
23
+ class_icon_providers.each do |tag|
24
+ css << <<-EOCSS
25
+ #center-container h1.icon-#{tag.tagname} .class-source-link {
26
+ background: url(class-icons/#{tag.tagname}-large.png) no-repeat 0 -5px; }
27
+ #treecontainer .x-grid-cell-inner .icon-#{tag.tagname} {
28
+ background: url(class-icons/#{tag.tagname}.png) no-repeat; }
29
+ #search-dropdown .icon-#{tag.tagname} {
30
+ background: url(class-icons/#{tag.tagname}.png) no-repeat; }
31
+ #search-dropdown .icon-#{tag.tagname}-redirect {
32
+ background: url(class-icons/#{tag.tagname}-redirect.png) no-repeat; }
33
+ .doctabs .icon-#{tag.tagname} {
34
+ background: url(class-icons/#{tag.tagname}.png) no-repeat; }
35
+ EOCSS
36
+ end
37
+ css.join("\n")
38
+ end
39
+
40
+ # Copies all class icons to given destination dir.
41
+ def write(dir)
42
+ FileUtils.mkdir(dir)
43
+
44
+ icons = {}
45
+ class_icon_providers.each do |tag|
46
+ icons[tag.class_icon[:small]] = "#{dir}/#{tag.tagname}.png"
47
+ icons[tag.class_icon[:large]] = "#{dir}/#{tag.tagname}-large.png"
48
+ icons[tag.class_icon[:redirect]] = "#{dir}/#{tag.tagname}-redirect.png"
49
+ end
50
+
51
+ icons.each_pair do |source, target|
52
+ if File.exists?(source)
53
+ FileUtils.cp(source, target)
54
+ else
55
+ Logger.warn(nil, "Class icon file not found", {:filename => source})
56
+ end
57
+ end
58
+ end
59
+
60
+ private
61
+
62
+ def class_icon_providers
63
+ @providers ||= generate_class_icon_providers
64
+ end
65
+
66
+ # Find tags with #class_icon and sort them from highest priority to lowest
67
+ def generate_class_icon_providers
68
+ TagRegistry.tags.find_all {|t| t.class_icon }.sort do |a, b|
69
+ a.class_icon[:priority] <=> b.class_icon[:priority]
70
+ end.reverse
71
+ end
72
+ end
73
+ end
74
+
75
+ end
76
+ end
@@ -1,5 +1,6 @@
1
1
  require 'jsduck/tag_registry'
2
2
  require 'jsduck/util/md5'
3
+ require 'jsduck/web/class_icons'
3
4
  require 'jsduck/web/member_icons'
4
5
 
5
6
  module JsDuck
@@ -21,7 +22,17 @@ module JsDuck
21
22
  private
22
23
 
23
24
  def all_css
24
- TagRegistry.css + Web::MemberIcons.css + @opts.css
25
+ [
26
+ css_from_tags,
27
+ Web::ClassIcons.css,
28
+ Web::MemberIcons.css,
29
+ @opts.css,
30
+ ].join
31
+ end
32
+
33
+ # Returns all the CSS gathered from @css attributes of tags.
34
+ def css_from_tags
35
+ TagRegistry.tags.map(&:css).compact.join("\n")
25
36
  end
26
37
  end
27
38
 
@@ -1,8 +1,9 @@
1
1
  require 'jsduck/util/json'
2
2
  require 'jsduck/util/md5'
3
- require 'jsduck/web/icons'
3
+ require 'jsduck/web/tree'
4
4
  require 'jsduck/web/search'
5
5
  require 'jsduck/tag_registry'
6
+ require 'jsduck/member_registry'
6
7
 
7
8
  module JsDuck
8
9
  module Web
@@ -21,7 +22,7 @@ module JsDuck
21
22
  def write(filename)
22
23
  js = "Docs = " + Util::Json.generate({
23
24
  :data => {
24
- :classes => Web::Icons.new.create(@relations.classes),
25
+ :classes => Web::Tree.create(@relations.classes),
25
26
  :guides => @assets.guides.to_array,
26
27
  :videos => @assets.videos.to_array,
27
28
  :examples => @assets.examples.to_array,
@@ -29,7 +30,7 @@ module JsDuck
29
30
  :guideSearch => @opts.search,
30
31
  :tests => @opts.tests,
31
32
  :signatures => TagRegistry.signatures,
32
- :memberTypes => TagRegistry.member_types,
33
+ :memberTypes => MemberRegistry.definitions,
33
34
  :localStorageDb => @opts.local_storage_db,
34
35
  :showPrintButton => @opts.seo,
35
36
  :touchExamplesUi => @opts.touch_examples_ui,
@@ -1,6 +1,7 @@
1
1
  require 'jsduck/logger'
2
2
  require 'jsduck/util/io'
3
3
  require 'jsduck/tag_registry'
4
+ require 'jsduck/version'
4
5
  require 'fileutils'
5
6
 
6
7
  module JsDuck
@@ -19,12 +20,12 @@ module JsDuck
19
20
  # When --seo enabled, creates index.php, template.html and print-template.html.
20
21
  def write
21
22
  if @opts.seo
22
- FileUtils.cp(@opts.template_dir+"/index.php", @opts.output_dir+"/index.php")
23
- create_template_html(@opts.template_dir+"/template.html", @opts.output_dir+"/template.html")
24
- create_print_template_html(@opts.template_dir+"/print-template.html", @opts.output_dir+"/print-template.html")
25
- create_index_template_html(@opts.template_dir+"/index-template.html", @opts.output_dir+"/index-template.html")
23
+ FileUtils.cp(@opts.template+"/index.php", @opts.output+"/index.php")
24
+ create_template_html(@opts.template+"/template.html", @opts.output+"/template.html")
25
+ create_print_template_html(@opts.template+"/print-template.html", @opts.output+"/print-template.html")
26
+ create_index_template_html(@opts.template+"/index-template.html", @opts.output+"/index-template.html")
26
27
  else
27
- create_template_html(@opts.template_dir+"/template.html", @opts.output_dir+"/index.html")
28
+ create_template_html(@opts.template+"/template.html", @opts.output+"/index.html")
28
29
  end
29
30
  end
30
31
 
@@ -33,9 +34,9 @@ module JsDuck
33
34
  def create_template_html(in_file, out_file)
34
35
  write_template(in_file, out_file, {
35
36
  "{title}" => @opts.title,
36
- "{mobile_redirect}" => @opts.seo ? include_script(@opts.template_dir+"/mobile-redirect.js") : "",
37
- "{header}" => @opts.header,
38
- "{footer}" => "<div id='footer-content' style='display: none'>#{@opts.footer}</div>",
37
+ "{mobile_redirect}" => @opts.seo ? include_script(@opts.template+"/mobile-redirect.js") : "",
38
+ "{header}" => header,
39
+ "{footer}" => footer,
39
40
  "{extjs_path}" => @opts.extjs_path,
40
41
  "{data_path}" => File.basename(@paths[:data]),
41
42
  "{css_path}" => File.basename(@paths[:css]),
@@ -51,7 +52,7 @@ module JsDuck
51
52
  def create_print_template_html(in_file, out_file)
52
53
  write_template(in_file, out_file, {
53
54
  "{title}" => @opts.title,
54
- "{header}" => @opts.header,
55
+ "{header}" => header,
55
56
  "{css_path}" => File.basename(@paths[:css]),
56
57
  })
57
58
  end
@@ -62,7 +63,7 @@ module JsDuck
62
63
 
63
64
  write_template(in_file, out_file, {
64
65
  "{title}" => @opts.title,
65
- "{header}" => @opts.header,
66
+ "{header}" => header,
66
67
  "{categories}" => categories ? "<h1>API Documentation</h1> #{categories}" : "",
67
68
  "{guides}" => guides ? "<h1>Guides</h1> #{guides}" : "",
68
69
  "{css_path}" => File.basename(@paths[:css]),
@@ -73,6 +74,21 @@ module JsDuck
73
74
  "<script type='text/javascript'>\n" + Util::IO.read(filename) + "\n</script>"
74
75
  end
75
76
 
77
+ def header
78
+ @opts.title.sub(/^(.*?) +- +/, "<strong>\\1</strong> ")
79
+ end
80
+
81
+ def footer
82
+ jsduck = "<a href='https://github.com/senchalabs/jsduck'>JSDuck</a>"
83
+ date = Time.new.strftime('%a %d %b %Y %H:%M:%S')
84
+
85
+ footer_text = @opts.footer.gsub(/\{VERSION\}/, JsDuck::VERSION)
86
+ .gsub(/\{JSDUCK\}/, jsduck)
87
+ .gsub(/\{DATE\}/, date)
88
+
89
+ return "<div id='footer-content' style='display: none'>#{footer_text}</div>"
90
+ end
91
+
76
92
  # Opens in_file, replaces {keys} inside it, writes to out_file
77
93
  def write_template(in_file, out_file, replacements)
78
94
  Logger.log("Writing", out_file)
@@ -1,4 +1,4 @@
1
- require 'jsduck/tag_registry'
1
+ require 'jsduck/member_registry'
2
2
  require 'fileutils'
3
3
 
4
4
  module JsDuck
@@ -29,13 +29,13 @@ module JsDuck
29
29
  if File.exists?(m[:icon])
30
30
  FileUtils.cp(m[:icon], "#{dir}/#{m[:name]}.png")
31
31
  else
32
- Logger.warn(nil, "Member icon file not found", m[:icon])
32
+ Logger.warn(nil, "Member icon file not found", {:filename => m[:icon]})
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
37
  def self.members_with_icons
38
- TagRegistry.member_types.find_all {|m| m[:icon] }
38
+ MemberRegistry.definitions.find_all {|m| m[:icon] }
39
39
  end
40
40
  end
41
41
 
@@ -1,4 +1,4 @@
1
- require 'jsduck/web/icons'
1
+ require 'jsduck/web/class_icons'
2
2
  require 'jsduck/class_name'
3
3
  require 'jsduck/tag_registry'
4
4
 
@@ -52,7 +52,7 @@ module JsDuck
52
52
  return {
53
53
  :name => name,
54
54
  :fullName => alias_display_name(key)+": "+name,
55
- :icon => Web::Icons::class_icon(cls) + "-redirect",
55
+ :icon => Web::ClassIcons.get(cls) + "-redirect",
56
56
  :url => "#!/api/" + cls[:name],
57
57
  :meta => combine_meta(cls),
58
58
  :sort => 0,
@@ -63,7 +63,7 @@ module JsDuck
63
63
  return {
64
64
  :name => ClassName.short(cls[:name]),
65
65
  :fullName => cls[:name],
66
- :icon => Web::Icons::class_icon(cls),
66
+ :icon => Web::ClassIcons.get(cls),
67
67
  :url => "#!/api/" + cls[:name],
68
68
  :meta => combine_meta(cls),
69
69
  :sort => 1,
@@ -75,7 +75,7 @@ module JsDuck
75
75
  :name => ClassName.short(name),
76
76
  :fullName => name,
77
77
  :type => :class,
78
- :icon => Web::Icons::class_icon(cls) + "-redirect",
78
+ :icon => Web::ClassIcons.get(cls) + "-redirect",
79
79
  :url => "#!/api/" + cls[:name],
80
80
  :meta => combine_meta(cls),
81
81
  :sort => 2,
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
  module JsDuck
6
6
  module Web
7
7
 
8
- # Writes HTML JavaScript/CSS source into HTML files.
8
+ # Writes HTML JavaScript/SCSS source into HTML files.
9
9
  class Source
10
10
  def initialize(source_files)
11
11
  @source_files = source_files
@@ -21,16 +21,16 @@ module JsDuck
21
21
 
22
22
  def write
23
23
  if @opts.template_links
24
- Logger.log("Linking template files to", @opts.output_dir)
24
+ Logger.log("Linking template files to", @opts.output)
25
25
  move_files(:symlink)
26
26
  else
27
- Logger.log("Copying template files to", @opts.output_dir)
27
+ Logger.log("Copying template files to", @opts.output)
28
28
  move_files(:cp_r)
29
29
  end
30
30
 
31
31
  # always copy the eg-iframe file.
32
- eg_iframe = @opts.eg_iframe || @opts.template_dir+"/eg-iframe.html"
33
- FileUtils.cp(eg_iframe, @opts.output_dir+"/eg-iframe.html")
32
+ eg_iframe = @opts.eg_iframe || @opts.template+"/eg-iframe.html"
33
+ FileUtils.cp(eg_iframe, @opts.output+"/eg-iframe.html")
34
34
  end
35
35
 
36
36
  private
@@ -38,8 +38,8 @@ module JsDuck
38
38
  # moves files from one dir to another using a method of FileUtils module.
39
39
  def move_files(method)
40
40
  @files.each do |file|
41
- target = File.expand_path(@opts.output_dir)
42
- Dir.glob(File.expand_path(@opts.template_dir+"/"+file)).each do |source|
41
+ target = File.expand_path(@opts.output)
42
+ Dir.glob(File.expand_path(@opts.template+"/"+file)).each do |source|
43
43
  FileUtils.send(method, source, target)
44
44
  end
45
45
  end