Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
[#6] Add docs-phonegap/ directory for merging PhoneGap docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwbrooks committed Aug 2, 2013
1 parent ff8aa23 commit 226108b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 24,21 @@ File Structure
--------------

docs/
docs/LANGUAGE
docs/LANGUAGE/VERSION
docs/LANGUAGE/
docs/LANGUAGE/VERSION/
docs/LANGUAGE/VERSION/cordova/
docs/LANGUAGE/VERSION/cordova/PluginName/
docs/LANGUAGE/VERSION/cordova/PluginName/className.md
docs/LANGUAGE/VERSION/cordova/PluginName/className.functionName.md

Merging PhoneGap-Specific Documentation
---------------------------------------

docs-phonegap/
docs-phonegap/LANGUAGE/
docs-phonegap/LANGUAGE/VERSION/
docs-phonegap/LANGUAGE/VERSION/path/to/className.md

Contributing to the Documentation
---------------------------------

Expand Down
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions lib/docs_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 40,7 @@ class DocsGenerator
def initialize(input_directory = nil, output_directory = nil)
@input_directory = input_directory || default_input_directory
@output_directory = output_directory || default_output_directory
@merge_directory = default_merge_directory
@working_directory = File.join tmp_directory, 'docs'
end

Expand All @@ -66,10 67,12 @@ def run(one_lang = nil, one_version = nil)
next if one_version and version_dir != one_version
output_path = File.join @output_directory, language_dir, version_dir
input_path = File.join @input_directory, language_dir, version_dir
merge_path = File.join @merge_directory, language_dir, version_dir
options = { :lang => language_dir, :version => version_dir }
next unless File.directory? input_path

copy_directory(input_path, @working_directory)
merge_directory(merge_path, @working_directory)

puts " => Generating the PhoneGap Documentation for #{version_dir}-#{language_dir}..."
generated_path = after_jodoc(jodocify(before_jodoc(@working_directory, options), options), options)
Expand Down
10 changes: 10 additions & 0 deletions lib/file_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 30,10 @@ def default_output_directory
File.join root_directory, 'public'
end

def default_merge_directory
File.join root_directory, 'docs-phonegap'
end

def tmp_directory
File.join root_directory, 'tmp'
end
Expand All @@ -44,6 48,12 @@ def copy_directory(source, destination)
FileUtils.cp_r source, destination
end

def merge_directory(source, destination)
if File.exists? source
FileUtils.copy_entry source, destination
end
end

def move_directory(source, destination)
FileUtils.rm_rf destination
FileUtils.mkdir_p File.dirname(destination)
Expand Down

0 comments on commit 226108b

Please sign in to comment.