Permalink
Browse files

Update build script to support cordova namespace.

  • Loading branch information...
1 parent 21e511f commit 97b5fdd92f935bef7692815f39c0a9be4ccdf832 @mwbrooks mwbrooks committed with Mar 30, 2012
Showing with 178 additions and 212 deletions.
  1. +137 −137 docs/en/edge/config.json
  2. 0 docs/en/edge/{phonegap → cordova}/accelerometer/acceleration/acceleration.md
  3. 0 docs/en/edge/{phonegap → cordova}/accelerometer/accelerometer.clearWatch.md
  4. 0 docs/en/edge/{phonegap → cordova}/accelerometer/accelerometer.getCurrentAcceleration.md
  5. 0 docs/en/edge/{phonegap → cordova}/accelerometer/accelerometer.md
  6. 0 docs/en/edge/{phonegap → cordova}/accelerometer/accelerometer.watchAcceleration.md
  7. 0 docs/en/edge/{phonegap → cordova}/accelerometer/parameters/accelerometerError.md
  8. 0 docs/en/edge/{phonegap → cordova}/accelerometer/parameters/accelerometerOptions.md
  9. 0 docs/en/edge/{phonegap → cordova}/accelerometer/parameters/accelerometerSuccess.md
  10. 0 docs/en/edge/{phonegap → cordova}/camera/camera.getPicture.md
  11. 0 docs/en/edge/{phonegap → cordova}/camera/camera.md
  12. 0 docs/en/edge/{phonegap → cordova}/camera/parameter/cameraError.md
  13. 0 docs/en/edge/{phonegap → cordova}/camera/parameter/cameraOptions.md
  14. 0 docs/en/edge/{phonegap → cordova}/camera/parameter/cameraSuccess.md
  15. 0 docs/en/edge/{phonegap → cordova}/compass/compass.clearWatch.md
  16. 0 docs/en/edge/{phonegap → cordova}/compass/compass.clearWatchFilter.md
  17. 0 docs/en/edge/{phonegap → cordova}/compass/compass.getCurrentHeading.md
  18. 0 docs/en/edge/{phonegap → cordova}/compass/compass.md
  19. 0 docs/en/edge/{phonegap → cordova}/compass/compass.watchHeading.md
  20. 0 docs/en/edge/{phonegap → cordova}/compass/compass.watchHeadingFilter.md
  21. 0 docs/en/edge/{phonegap → cordova}/compass/compassError/compassError.md
  22. 0 docs/en/edge/{phonegap → cordova}/compass/parameters/compassError.md
  23. 0 docs/en/edge/{phonegap → cordova}/compass/parameters/compassHeading.md
  24. 0 docs/en/edge/{phonegap → cordova}/compass/parameters/compassOptions.md
  25. 0 docs/en/edge/{phonegap → cordova}/compass/parameters/compassSuccess.md
  26. 0 docs/en/edge/{phonegap → cordova}/connection/connection.md
  27. 0 docs/en/edge/{phonegap → cordova}/connection/connection.type.md
  28. 0 docs/en/edge/{phonegap → cordova}/contacts/Contact/contact.md
  29. 0 docs/en/edge/{phonegap → cordova}/contacts/ContactAddress/contactaddress.md
  30. 0 docs/en/edge/{phonegap → cordova}/contacts/ContactError/contactError.md
  31. 0 docs/en/edge/{phonegap → cordova}/contacts/ContactField/contactfield.md
  32. 0 docs/en/edge/{phonegap → cordova}/contacts/ContactFindOptions/contactfindoptions.md
  33. 0 docs/en/edge/{phonegap → cordova}/contacts/ContactName/contactname.md
  34. 0 docs/en/edge/{phonegap → cordova}/contacts/ContactOrganization/contactorganization.md
  35. 0 docs/en/edge/{phonegap → cordova}/contacts/contacts.create.md
  36. 0 docs/en/edge/{phonegap → cordova}/contacts/contacts.find.md
  37. 0 docs/en/edge/{phonegap → cordova}/contacts/contacts.md
  38. 0 docs/en/edge/{phonegap → cordova}/contacts/parameters/contactError.md
  39. 0 docs/en/edge/{phonegap → cordova}/contacts/parameters/contactFields.md
  40. 0 docs/en/edge/{phonegap → cordova}/contacts/parameters/contactFindOptions.md
  41. 0 docs/en/edge/{phonegap → cordova}/contacts/parameters/contactSuccess.md
  42. 0 docs/en/edge/{phonegap → cordova}/device/device.cordova.md
  43. 0 docs/en/edge/{phonegap → cordova}/device/device.md
  44. 0 docs/en/edge/{phonegap → cordova}/device/device.name.md
  45. 0 docs/en/edge/{phonegap → cordova}/device/device.platform.md
  46. 0 docs/en/edge/{phonegap → cordova}/device/device.uuid.md
  47. 0 docs/en/edge/{phonegap → cordova}/device/device.version.md
  48. 0 docs/en/edge/{phonegap → cordova}/events/events.backbutton.md
  49. 0 docs/en/edge/{phonegap → cordova}/events/events.batterycritical.md
  50. 0 docs/en/edge/{phonegap → cordova}/events/events.batterylow.md
  51. 0 docs/en/edge/{phonegap → cordova}/events/events.batterystatus.md
  52. 0 docs/en/edge/{phonegap → cordova}/events/events.deviceready.md
  53. 0 docs/en/edge/{phonegap → cordova}/events/events.endcallbutton.md
  54. 0 docs/en/edge/{phonegap → cordova}/events/events.md
  55. 0 docs/en/edge/{phonegap → cordova}/events/events.menubutton.md
  56. 0 docs/en/edge/{phonegap → cordova}/events/events.offline.md
  57. 0 docs/en/edge/{phonegap → cordova}/events/events.online.md
  58. 0 docs/en/edge/{phonegap → cordova}/events/events.pause.md
  59. 0 docs/en/edge/{phonegap → cordova}/events/events.resume.md
  60. 0 docs/en/edge/{phonegap → cordova}/events/events.searchbutton.md
  61. 0 docs/en/edge/{phonegap → cordova}/events/events.startcallbutton.md
  62. 0 docs/en/edge/{phonegap → cordova}/events/events.volumedownbutton.md
  63. 0 docs/en/edge/{phonegap → cordova}/events/events.volumeupbutton.md
  64. 0 docs/en/edge/{phonegap → cordova}/file/directoryentry/directoryentry.md
  65. 0 docs/en/edge/{phonegap → cordova}/file/directoryreader/directoryreader.md
  66. 0 docs/en/edge/{phonegap → cordova}/file/file.md
  67. 0 docs/en/edge/{phonegap → cordova}/file/fileentry/fileentry.md
  68. 0 docs/en/edge/{phonegap → cordova}/file/fileerror/fileerror.md
  69. 0 docs/en/edge/{phonegap → cordova}/file/fileobj/fileobj.md
  70. 0 docs/en/edge/{phonegap → cordova}/file/filereader/filereader.md
  71. 0 docs/en/edge/{phonegap → cordova}/file/filesystem/filesystem.md
  72. 0 docs/en/edge/{phonegap → cordova}/file/filetransfer/filetransfer.md
  73. 0 docs/en/edge/{phonegap → cordova}/file/filetransfererror/filetransfererror.md
  74. 0 docs/en/edge/{phonegap → cordova}/file/fileuploadoptions/fileuploadoptions.md
  75. 0 docs/en/edge/{phonegap → cordova}/file/fileuploadresult/fileuploadresult.md
  76. 0 docs/en/edge/{phonegap → cordova}/file/filewriter/filewriter.md
  77. 0 docs/en/edge/{phonegap → cordova}/file/flags/flags.md
  78. 0 docs/en/edge/{phonegap → cordova}/file/localfilesystem/localfilesystem.md
  79. 0 docs/en/edge/{phonegap → cordova}/file/metadata/metadata.md
  80. 0 docs/en/edge/{phonegap → cordova}/geolocation/Coordinates/coordinates.md
  81. 0 docs/en/edge/{phonegap → cordova}/geolocation/Position/position.md
  82. 0 docs/en/edge/{phonegap → cordova}/geolocation/PositionError/positionError.md
  83. 0 docs/en/edge/{phonegap → cordova}/geolocation/geolocation.clearWatch.md
  84. 0 docs/en/edge/{phonegap → cordova}/geolocation/geolocation.getCurrentPosition.md
  85. 0 docs/en/edge/{phonegap → cordova}/geolocation/geolocation.md
  86. 0 docs/en/edge/{phonegap → cordova}/geolocation/geolocation.watchPosition.md
  87. 0 docs/en/edge/{phonegap → cordova}/geolocation/parameters/geolocation.options.md
  88. 0 docs/en/edge/{phonegap → cordova}/geolocation/parameters/geolocationError.md
  89. 0 docs/en/edge/{phonegap → cordova}/geolocation/parameters/geolocationSuccess.md
  90. 0 docs/en/edge/{phonegap → cordova}/media/MediaError/mediaError.md
  91. 0 docs/en/edge/{phonegap → cordova}/media/Parameters/mediaError.md
  92. 0 docs/en/edge/{phonegap → cordova}/media/capture/CaptureCB.md
  93. 0 docs/en/edge/{phonegap → cordova}/media/capture/CaptureError.md
  94. 0 docs/en/edge/{phonegap → cordova}/media/capture/CaptureErrorCB.md
  95. 0 docs/en/edge/{phonegap → cordova}/media/capture/ConfigurationData.md
  96. 0 docs/en/edge/{phonegap → cordova}/media/capture/MediaFile.getFormatData.md
  97. 0 docs/en/edge/{phonegap → cordova}/media/capture/MediaFile.md
  98. 0 docs/en/edge/{phonegap → cordova}/media/capture/MediaFileData.md
  99. 0 docs/en/edge/{phonegap → cordova}/media/capture/capture.md
  100. 0 docs/en/edge/{phonegap → cordova}/media/capture/captureAudio.md
  101. 0 docs/en/edge/{phonegap → cordova}/media/capture/captureAudioOptions.md
  102. 0 docs/en/edge/{phonegap → cordova}/media/capture/captureImage.md
  103. 0 docs/en/edge/{phonegap → cordova}/media/capture/captureImageOptions.md
  104. 0 docs/en/edge/{phonegap → cordova}/media/capture/captureVideo.md
  105. 0 docs/en/edge/{phonegap → cordova}/media/capture/captureVideoOptions.md
  106. 0 docs/en/edge/{phonegap → cordova}/media/media.getCurrentPosition.md
  107. 0 docs/en/edge/{phonegap → cordova}/media/media.getDuration.md
  108. 0 docs/en/edge/{phonegap → cordova}/media/media.md
  109. 0 docs/en/edge/{phonegap → cordova}/media/media.pause.md
  110. 0 docs/en/edge/{phonegap → cordova}/media/media.play.md
  111. 0 docs/en/edge/{phonegap → cordova}/media/media.release.md
  112. 0 docs/en/edge/{phonegap → cordova}/media/media.seekTo.md
  113. 0 docs/en/edge/{phonegap → cordova}/media/media.startRecord.md
  114. 0 docs/en/edge/{phonegap → cordova}/media/media.stop.md
  115. 0 docs/en/edge/{phonegap → cordova}/media/media.stopRecord.md
  116. 0 docs/en/edge/{phonegap → cordova}/notification/notification.alert.md
  117. 0 docs/en/edge/{phonegap → cordova}/notification/notification.beep.md
  118. 0 docs/en/edge/{phonegap → cordova}/notification/notification.confirm.md
  119. 0 docs/en/edge/{phonegap → cordova}/notification/notification.md
  120. 0 docs/en/edge/{phonegap → cordova}/notification/notification.vibrate.md
  121. 0 docs/en/edge/{phonegap → cordova}/storage/database/database.md
  122. 0 docs/en/edge/{phonegap → cordova}/storage/localstorage/localstorage.md
  123. 0 docs/en/edge/{phonegap → cordova}/storage/parameters/display_name.md
  124. 0 docs/en/edge/{phonegap → cordova}/storage/parameters/name.md
  125. 0 docs/en/edge/{phonegap → cordova}/storage/parameters/size.md
  126. 0 docs/en/edge/{phonegap → cordova}/storage/parameters/version.md
  127. 0 docs/en/edge/{phonegap → cordova}/storage/sqlerror/sqlerror.md
  128. 0 docs/en/edge/{phonegap → cordova}/storage/sqlresultset/sqlresultset.md
  129. 0 docs/en/edge/{phonegap → cordova}/storage/sqlresultsetlist/sqlresultsetlist.md
  130. 0 docs/en/edge/{phonegap → cordova}/storage/sqltransaction/sqltransaction.md
  131. 0 docs/en/edge/{phonegap → cordova}/storage/storage.md
  132. 0 docs/en/edge/{phonegap → cordova}/storage/storage.opendatabase.md
  133. +40 −25 lib/cordova/file_merger.rb
  134. +0 −48 lib/cordova/quirks_merger.rb
  135. +1 −2 lib/docs_generator.rb
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -6,36 +6,51 @@ class FileMerger
def initialize
end
- def run(file_path)
- # partial files are deleted after being merged, so they may not exist
- return unless File.exists? file_path
+ def run(filepath)
+ # skip missing files (file that are merged are also deleted)
+ return unless File.exists?(filepath)
- root_name = File.basename file_path
- @root_dir ||= File.dirname file_path
- @json ||= config_json(@root_dir)['merge']
-
- @json.each do |name, files|
- if name == root_name
- File.open file_path, 'a' do |file|
- files.each do |filename|
- # skip the file that is opened for appending
- next if File.basename(filename) == root_name
-
- filename = File.join @root_dir, filename
- next unless file_exists? filename
-
- file.write "\n\n---\n"
- file.write File.read(filename).strip
- FileUtils.rm filename unless name == File.basename(filename)
- end
- end
+ # file info
+ @filename = File.basename(filepath)
+ @directory = File.dirname(filepath)
+
+ # skip unless file is referenced in the merge JSON
+ return unless config.include?(@filename)
+
+ # open the file to merge into
+ File.open filepath, 'a' do |f|
+ # loop over the files to merge
+ config[@filename].each do |filepath|
+ # skip the file that we're merging into because it's listed in config.json
+ next if File.basename(filepath) == @filename
+
+ # hacky to qualify the path
+ filepath = File.join('tmp', 'docs', filepath)
+
+ # append and delete the file
+ f.write "\n\n---\n"
+ f.write File.read(filepath).strip
+ FileUtils.rm filepath
end
end
end
- def config_json(basename)
- file = File.join basename, 'config.json'
- return JSON.parse IO.read(file)
+ def config
+ return @config unless @config.nil?
+
+ directory = @directory
+
+ while @config.nil?
+ file = File.join(directory, 'config.json')
+
+ if File.exists?(file)
+ @config = (JSON.parse IO.read(file))['merge']
+ else
+ directory = File.dirname(directory)
+ end
+ end
+
+ return @config
end
def file_exists?(file_path)
@@ -1,48 +0,0 @@
-require 'fileutils'
-
-class QuirksMerger
- attr_accessor :cordova_path
-
- def run(file_path)
- @cordova_path = nil
-
- platform_directory = find_directory_containing(file_path, 'phonegap')
- platform_directory = find_directory_containing(file_path, 'cordova') if platform_directory.nil?
- return if platform_directory.nil?
- return if ['phonegap', 'cordova'].include?(File.basename(platform_directory).downcase)
-
- @cordova_path = generate_cordova_path(file_path, platform_directory)
- return unless File.file? @cordova_path
-
- cordova_data = File.read(@cordova_path).strip
- partial_data = File.read(file_path).strip
-
- File.open(@cordova_path, 'w') { |file| file.write(cordova_data + "\n\n" + partial_data) }
- FileUtils.rm file_path
- end
-
- protected
-
- def find_directory_containing(directory, directory_to_find)
- platform_name = nil
-
- until File.exists? File.join(directory, directory_to_find)
- return nil if File.dirname(directory) == directory
-
- platform_name = File.basename(directory)
- directory = File.dirname(directory)
- end
-
- File.join directory, platform_name
- end
-
- def generate_cordova_path(full_path, platform_path)
- path = {
- :prefix => File.dirname(platform_path),
- :platform => File.basename(platform_path),
- :postfix => full_path.sub(platform_path, '')
- }
-
- "#{path[:prefix]}/#{path[:platform]}/#{path[:postfix]}".gsub(/\/+/, '/')
- end
-end
View
@@ -2,7 +2,6 @@
$: << File.join(File.dirname(__FILE__), 'cordova')
require 'file_helpers'
require 'yaml_front_matter'
-require 'quirks_merger'
require 'file_merger'
require 'add_title'
require 'update_index'
@@ -64,7 +63,7 @@ def run
protected
def before_jodoc(input_directory, options)
- klasses = [ YamlFrontMatter.new, QuirksMerger.new, FileMerger.new ]
+ klasses = [ YamlFrontMatter.new, FileMerger.new ]
klasses.each do |klass|
each_file input_directory do |file|

0 comments on commit 97b5fdd

Please sign in to comment.