Method: JsDuck::Web::Data#write
- Defined in:
- lib/jsduck/web/data.rb
#write(filename) ⇒ Object
Writes classes, guides, videos, and search data to one big .js file. Then Renames the file so it contains an MD5 hash inside it, returning the resulting fingerprinted name.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/jsduck/web/data.rb', line 21 def write(filename) js = "Docs = " + Util::Json.generate({ :data => { :classes => Web::Icons.new.create(@relations.classes), :guides => @assets.guides.to_array, :videos => @assets.videos.to_array, :examples => @assets.examples.to_array, :search => Web::Search.new.create(@relations.classes, @assets, @opts), :guideSearch => @opts.search, :tests => @opts.tests, :signatures => TagRegistry.signatures, :memberTypes => TagRegistry.member_types, :localStorageDb => @opts.local_storage_db, :showPrintButton => @opts.seo, :touchExamplesUi => @opts.touch_examples_ui, :source => @opts.source, :commentsUrl => @opts.comments_url, :commentsDomain => @opts.comments_domain, :message => @opts., } }) + ";\n" File.open(filename, 'w') {|f| f.write(js) } Util::MD5.rename(filename) end |