You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/12/31 05:49:58 UTC
[2/2] docs commit: CB-6751 Remove Ruby scripts and README.md
references! (close #249)
CB-6751 Remove Ruby scripts and README.md references! (close #249)
Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/468560dd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/468560dd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/468560dd
Branch: refs/heads/master
Commit: 468560dd3de3f86afe996bc42bba2145d868d205
Parents: f1405f8
Author: Andrey Kurdyumov <ka...@gmail.com>
Authored: Thu Dec 25 10:44:41 2014 +0600
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Dec 30 23:49:33 2014 -0500
----------------------------------------------------------------------
Gemfile | 23 ----
README.md | 149 ++++---------------------
Rakefile | 71 ------------
Vagrantfile | 125 ---------------------
bin/incrementversion | 110 ++++++++++++++++++
bin/incrementversion.bat | 26 +++++
lib/cordova/add_title.rb | 36 ------
lib/cordova/file_merger.rb | 82 --------------
lib/cordova/jodoc.rb | 68 -----------
lib/cordova/navigation_menu.rb | 81 --------------
lib/cordova/noindex.rb | 87 ---------------
lib/cordova/prettify.rb | 33 ------
lib/cordova/table_of_contents.rb | 76 -------------
lib/cordova/update_index.rb | 46 --------
lib/cordova/update_keyword_index.rb | 51 ---------
lib/cordova/version_menu.rb | 89 ---------------
lib/cordova/yaml_front_matter.rb | 43 -------
lib/docs_generator.rb | 115 -------------------
lib/file_helpers.rb | 78 -------------
spec/cordova/add_title_spec.rb | 52 ---------
spec/cordova/jodoc_spec.rb | 44 --------
spec/cordova/prettify_spec.rb | 47 --------
spec/cordova/table_of_contents_spec.rb | 84 --------------
spec/cordova/update_index_spec.rb | 59 ----------
spec/cordova/update_keyword_index_spec.rb | 66 -----------
spec/cordova/yaml_front_matter_spec.rb | 56 ----------
spec/docs_generator_spec.rb | 49 --------
spec/file_helpers_spec.rb | 67 -----------
spec/spec_helpers.rb | 73 ------------
vagrant/cordova-docs.sh | 33 ------
30 files changed, 156 insertions(+), 1863 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/Gemfile
----------------------------------------------------------------------
diff --git a/Gemfile b/Gemfile
deleted file mode 100644
index 3f9e3c5..0000000
--- a/Gemfile
+++ /dev/null
@@ -1,23 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-source "https://rubygems.org"
-
-ruby '1.8.7'
-gem 'nokogiri', '1.5.9'
-gem 'json'
-gem 'rspec', '1.3.0'
-
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 645a6a8..abf15e1 100644
--- a/README.md
+++ b/README.md
@@ -17,9 +17,7 @@ File Structure
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
+ docs/LANGUAGE/VERSION/guide/platforms/PLATFORMNAME/
Contributing to the Documentation
---------------------------------
@@ -78,87 +76,27 @@ Each language can override the default template in `template/docs/LANGUAGE`.
Please see the `STYLESHEET.md` file for guidelines on language and usage.
-## Generating Documentation with Vagrant
+## Generating Documentation with Node.js
-It can be trouble generating the documentation. Juggling Ruby
-environments and the dependencies can be a sensitive matter.
+Right now documentation could be run using Node.js either on Windows, or on Linux box.
-To make our lives easier, Vagrant support has been added to our documentation
-generator. It's easy to setup and works on all the major operating
-systems. After you've installed Vagrant and VirtualBox, you only need to
-run one command to download and provision a light-weight virtual machine
-(approx 200MB). At that point all the dependencies exist inside the
-virtual machine, so you don't need to install them manually on your
-bare metal machine.
+ $ ./bin/genjs # compile all docs
+ $ ./bin/genjs en edge # compile English Edge docs
+ $ ./bin/genjs ru edge # compile Russian Edge docs
+ $ ./bin/genjs es 3.5.0 # compile Spanish 3.5.0 docs
+
+### Setting up Node.js
-### Setup
+1. Go to Node.JS [downloads page](http://nodejs.org/download/)
+2. Download and install package for your operation system.
+3. Checkout this repository using Git
-- [Install Vagrant](http://www.vagrantup.com/downloads.html)
-- [Install VirtualBox](https://www.virtualbox.org/wiki/Downloads)
+ git clone https://github.com/apache/cordova-docs
-### Initialize Vagrant Box
-
- $ cd cordova-docs/
- $ vagrant up
-
-### Build the Documentation
-
- $ vagrant ssh
- $ cd /vagrant # shared copy of this repo
- $
- $ ./bin/generate # compile all docs
- $ ./bin/generate en edge # compile English Edge docs
- $
- $ exit # exit the ssh tunnel
-
-The `/vagrant` directory is a shared copy of this repository. When the
-documentation is done generating, you will see a `public/` directory on
-both your virtual and local machine.
-
-### Shutdown the Virtual Machine
-
-Pick one of the following, depending on what you want to do:
-
- $ vagrant suspend # pause the vm and save its state
- $ vagrant halt # shutdown the vm
- $ vagrant destroy # delete the vm and all its contents
-
-## Generating Documentation Locally
-
-### Install
-
-- Clone [joDoc](http://github.com/davebalmer/jodoc)
-
- git clone http://github.com/davebalmer/joDoc.git
-
-- Install markdown
-
- curl -O http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip
- unzip Markdown_1.0.1.zip
- chmod u+x Markdown_1.0.1/Markdown.pl
- mv Markdown_1.0.1/Markdown.pl markdown
- rm -r Markdown_1*
-
-- Install Ruby Dependencies
-
- curl -sSL https://get.rvm.io | bash -s stable
- rvm install 1.8.7
- gem install bundler
- bundle install
-
-### Run the Script
-
-Generate all versions
-
- PATH=$PATH:$PWD/joDoc:$PWD bin/generate
-
-Generate a specific language and version
-
- PATH=$PATH:$PWD/joDoc:$PWD bin/generate en edge
-
-or as a shortcut
-
- PATH=$PATH:$PWD/joDoc:$PWD bin/generate --edge
+4. Install dependencies. In the root of the cloned cordova-docs folder run
+
+ npm install
+5. Now you able to build documentation locally.
### Quick Preview
@@ -166,7 +104,7 @@ When making minor edits, it is usually safe to simply render the edited from
Markdown to HTML. Many code editors have plugins to render Markdown to HTML
and there are a handful of [good](http://dillinger.io/) online editors.
-Currently, a Ruby script and [joDoc](http://github.com/davebalmer/jodoc) are
+Currently, a Node.JS script and [joDoc-js](https://github.com/kant2002/jodoc-js) are
used to generate the HTML documentation.
Generating a Version Release
@@ -174,53 +112,6 @@ Generating a Version Release
There is a Rake task to increment the version, generate the version directory, and update the edge documentation.
- # generate version 1.7.0 for english.
- rake version[1.7.0,en]
-
-If while running rake you get the error
-
- no such file to load -- spec/rake/spectask
-
-then run
-
- gem install rspec -v 1.3.0
-
-FAQ
----
-
-### Error while running `./bin/generate`
-
-If you get the following error:
-
- ./bin/../lib/cordova/navigation_menu.rb:14:in `read': can't convert nil into String (TypeError)
- from ./bin/../lib/cordova/navigation_menu.rb:14:in `initialize'
- from ./bin/../lib/docs_generator.rb:86:in `new'
- from ./bin/../lib/docs_generator.rb:86:in `after_jodoc'
- from ./bin/../lib/docs_generator.rb:55:in `run'
- from ./bin/../lib/docs_generator.rb:45:in `foreach'
- from ./bin/../lib/docs_generator.rb:45:in `run'
- from ./bin/../lib/docs_generator.rb:41:in `foreach'
- from ./bin/../lib/docs_generator.rb:41:in `run'
- from ./bin/generate:6
-
-You may need to add the following line to the joDoc script:
-
- $markdown_bin = "/path/to/Markdown.pl";
-
-For more details, see the [Issue #590](https://issues.apache.org/jira/browse/CB-590).
-
-### Error with ruby and nokogiri versions
-
-If you get the following error:
-
- custom_require.rb:36:in `require': /lib/cordova/jodoc.rb:28: syntax error, unexpected tCONSTANT, expecting ']' (SyntaxError)
- @template_directories = [ File.join TEMPLATE_PATH, 'default' ]
- ^
-- You may need to downgrade the version of ruby to 1.8.7 and nokogiri to 1.5.2
- Use rvm and the Gemfile provided to install the dependencies
-
- rvm install 1.8.7
- rvm use 1.8.7
- bundle install
-
+ # generate version 4.1.0 for english.
+ .\bin\incrementversion en 4.1.0
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/Rakefile
----------------------------------------------------------------------
diff --git a/Rakefile b/Rakefile
deleted file mode 100644
index 2a5d0bc..0000000
--- a/Rakefile
+++ /dev/null
@@ -1,71 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'rake'
-require 'spec/rake/spectask'
-require 'fileutils'
-
-task :default => :spec
-
-desc "Run specs"
-Spec::Rake::SpecTask.new('spec') do |t|
- t.spec_opts = %w(-fs --color)
- t.warning = true
- t.spec_files = FileList['spec/**/*.rb']
-end
-task :spec
-
-desc "Increment the version - generates a release and updates the edge documentation"
-task :version, :nextVersion, :lang do |t, args|
- # get current and next version
- nextVersion = args[:nextVersion].strip
- lang = args[:lang].strip
- prevVersion = File.read('VERSION').sub(/rc\d+$/, '').strip # remove release candidate
-
- # generate a release
- edge_dir = File.join('docs', lang, 'edge')
- release_dir = File.join('docs', lang, nextVersion)
- FileUtils.cp_r(edge_dir, release_dir)
-
- # update version number in new release directory
- _nextVersion = nextVersion.sub(/rc\d+$/, '') # cordova file references do not include the RC
- unless prevVersion == _nextVersion
- files = Dir.glob(File.join('docs', lang, nextVersion, '**', '*'))
-
- files.sort.each do |file|
- next if File.directory?(file) or file !~ /md|html/
- content = File.read(file)
- content.gsub!('x.x.x', _nextVersion)
- File.open(file, 'w') { |f| f.write(content) }
- end
- end
-
- # update VERSION file
- File.open('VERSION', 'w') do |f|
- f.write(nextVersion)
- end
-
- # echo results
- puts "Generated version #{nextVersion}"
- puts ""
- puts "Next steps:"
- puts " 1. Review the update using `git status`"
- puts " 2. Commit the changes as 'Version #{nextVersion}'"
- puts " 3. Tag the commit as '#{nextVersion}'"
- puts ""
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/Vagrantfile
----------------------------------------------------------------------
diff --git a/Vagrantfile b/Vagrantfile
deleted file mode 100644
index 90873c9..0000000
--- a/Vagrantfile
+++ /dev/null
@@ -1,125 +0,0 @@
-# -*- mode: ruby -*-
-# vi: set ft=ruby :
-
-# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
-VAGRANTFILE_API_VERSION = "2"
-
-Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- # All Vagrant configuration is done here. The most common configuration
- # options are documented and commented below. For a complete reference,
- # please see the online documentation at vagrantup.com.
-
- # Every Vagrant virtual environment requires a box to build off of.
- config.vm.box = "hashicorp/precise32"
-
- # Provision for cordova-docs generator
- config.vm.provision :shell, path: "vagrant/cordova-docs.sh"
-
- # Disable automatic box update checking. If you disable this, then
- # boxes will only be checked for updates when the user runs
- # `vagrant box outdated`. This is not recommended.
- # config.vm.box_check_update = false
-
- # Create a forwarded port mapping which allows access to a specific port
- # within the machine from a port on the host machine. In the example below,
- # accessing "localhost:8080" will access port 80 on the guest machine.
- # config.vm.network "forwarded_port", guest: 80, host: 8080
-
- # Create a private network, which allows host-only access to the machine
- # using a specific IP.
- # config.vm.network "private_network", ip: "192.168.33.10"
-
- # Create a public network, which generally matched to bridged network.
- # Bridged networks make the machine appear as another physical device on
- # your network.
- # config.vm.network "public_network"
-
- # If true, then any SSH connections made will enable agent forwarding.
- # Default value: false
- # config.ssh.forward_agent = true
-
- # Share an additional folder to the guest VM. The first argument is
- # the path on the host to the actual folder. The second argument is
- # the path on the guest to mount the folder. And the optional third
- # argument is a set of non-required options.
- # config.vm.synced_folder "../data", "/vagrant_data"
-
- # Provider-specific configuration so you can fine-tune various
- # backing providers for Vagrant. These expose provider-specific options.
- # Example for VirtualBox:
- #
- # config.vm.provider "virtualbox" do |vb|
- # # Don't boot with headless mode
- # vb.gui = true
- #
- # # Use VBoxManage to customize the VM. For example to change memory:
- # vb.customize ["modifyvm", :id, "--memory", "1024"]
- # end
- #
- # View the documentation for the provider you're using for more
- # information on available options.
-
- # Enable provisioning with CFEngine. CFEngine Community packages are
- # automatically installed. For example, configure the host as a
- # policy server and optionally a policy file to run:
- #
- # config.vm.provision "cfengine" do |cf|
- # cf.am_policy_hub = true
- # # cf.run_file = "motd.cf"
- # end
- #
- # You can also configure and bootstrap a client to an existing
- # policy server:
- #
- # config.vm.provision "cfengine" do |cf|
- # cf.policy_server_address = "10.0.2.15"
- # end
-
- # Enable provisioning with Puppet stand alone. Puppet manifests
- # are contained in a directory path relative to this Vagrantfile.
- # You will need to create the manifests directory and a manifest in
- # the file default.pp in the manifests_path directory.
- #
- # config.vm.provision "puppet" do |puppet|
- # puppet.manifests_path = "manifests"
- # puppet.manifest_file = "site.pp"
- # end
-
- # Enable provisioning with chef solo, specifying a cookbooks path, roles
- # path, and data_bags path (all relative to this Vagrantfile), and adding
- # some recipes and/or roles.
- #
- # config.vm.provision "chef_solo" do |chef|
- # chef.cookbooks_path = "../my-recipes/cookbooks"
- # chef.roles_path = "../my-recipes/roles"
- # chef.data_bags_path = "../my-recipes/data_bags"
- # chef.add_recipe "mysql"
- # chef.add_role "web"
- #
- # # You may also specify custom JSON attributes:
- # chef.json = { mysql_password: "foo" }
- # end
-
- # Enable provisioning with chef server, specifying the chef server URL,
- # and the path to the validation key (relative to this Vagrantfile).
- #
- # The Opscode Platform uses HTTPS. Substitute your organization for
- # ORGNAME in the URL and validation key.
- #
- # If you have your own Chef Server, use the appropriate URL, which may be
- # HTTP instead of HTTPS depending on your configuration. Also change the
- # validation key to validation.pem.
- #
- # config.vm.provision "chef_client" do |chef|
- # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
- # chef.validation_key_path = "ORGNAME-validator.pem"
- # end
- #
- # If you're using the Opscode platform, your validator client is
- # ORGNAME-validator, replacing ORGNAME with your organization name.
- #
- # If you have your own Chef Server, the default validation client name is
- # chef-validator, unless you changed the configuration.
- #
- # chef.validation_client_name = "ORGNAME-validator"
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/bin/incrementversion
----------------------------------------------------------------------
diff --git a/bin/incrementversion b/bin/incrementversion
new file mode 100644
index 0000000..e74852f
--- /dev/null
+++ b/bin/incrementversion
@@ -0,0 +1,110 @@
+#!/usr/bin/env node
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+/*jslint node:true, nomen: true */
+
+var fs = require('fs-extra'),
+ path = require('path'),
+ yargs = require('yargs')
+ .describe('edge', 'Compare edge version of English docs with Ruby version')
+ .count("verbose")
+ .alias('v', 'verbose')
+ .describe('verbose', 'Increase verbosity level of produced output')
+ .demand(2)
+ .usage('Usage: $0 [lang] [version]\n' +
+ ' <lang>: Language for which update version number.\n' +
+ ' <version>: Next version.\n');
+var argv = yargs.argv;
+
+function processEachFile(source_path, callback) {
+ var directoryEntries = fs.readdirSync(source_path);
+ directoryEntries.forEach(function (dirEntry) {
+ var fullPath = path.join(source_path, dirEntry),
+ stat;
+ if (!fs.existsSync(fullPath)) {
+ return;
+ }
+
+ stat = fs.lstatSync(fullPath);
+ if (stat.isFile()) {
+ callback(fullPath);
+ return;
+ }
+
+ if (stat.isDirectory()) {
+ processEachFile(fullPath, callback);
+ return;
+ }
+ });
+}
+
+if (argv.help) {
+ yargs.showHelp();
+ process.exit(1);
+}
+
+var language = null,
+ version = null,
+ argumentsCount = argv._.length;
+if (argumentsCount === 2) {
+ language = argv._[0];
+ version = argv._[1];
+} else {
+ yargs.showHelp();
+ process.exit(1);
+}
+
+var prevVersion = fs.readFileSync('VERSION', { encoding: 'utf8' }),
+ edge_dir = path.join('docs', language, 'edge'),
+ release_dir = path.join('docs', language, version),
+ versionShort;
+
+prevVersion = prevVersion.replace(/rc\d+$/, '').trim();
+
+if (argv.verbose > 0) {
+ console.log("Copy edge docs to " + release_dir);
+}
+
+fs.mkdirSync(release_dir);
+fs.copySync(edge_dir, release_dir);
+
+versionShort = version.replace(/rc\d+$/, '').trim();
+if (prevVersion !== versionShort) {
+ // Replace x.x.x to new version in all files.
+ processEachFile(release_dir, function (filename) {
+ if (path.extname(filename) != ".md" && path.extname(filename) != ".html") {
+ return;
+ }
+
+ var content = fs.readFileSync(filename, { encoding: 'utf8' });
+ content.replace('x.x.x', versionShort);
+ fs.writeFileSync(filename, content);
+ });
+}
+
+// Save version number to file.
+fs.writeFileSync('VERSION', version);
+
+console.log("Generated version " + version);
+console.log("");
+console.log("Next steps:");
+console.log(" 1. Review the update using `git status`");
+console.log(" 2. Commit the changes as 'Version " + version + "'");
+console.log(" 3. Tag the commit as '" + version + "'");
+console.log("");
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/bin/incrementversion.bat
----------------------------------------------------------------------
diff --git a/bin/incrementversion.bat b/bin/incrementversion.bat
new file mode 100644
index 0000000..36464e2
--- /dev/null
+++ b/bin/incrementversion.bat
@@ -0,0 +1,26 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements. See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership. The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License. You may obtain a copy of the License at
+::
+:: http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing,
+:: software distributed under the License is distributed on an
+:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+:: KIND, either express or implied. See the License for the
+:: specific language governing permissions and limitations
+:: under the License.
+
+@ECHO OFF
+SET script_path="%~dp0incrementversion"
+IF EXIST %script_path% (
+ node "%script_path%" %*
+) ELSE (
+ ECHO.
+ ECHO ERROR: Could not find 'incrementversion' script in 'bin' folder, aborting...>&2
+ EXIT /B 1
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/add_title.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/add_title.rb b/lib/cordova/add_title.rb
deleted file mode 100644
index 9ac20ff..0000000
--- a/lib/cordova/add_title.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'nokogiri'
-
-class AddTitle
- def run(filename)
- doc = Nokogiri::HTML(File.read(filename))
-
- title_source = doc.css('#content > h1')[0]
- return nil if title_source.nil?
-
- title_target = doc.css('#subheader > h1')[0]
- return nil if title_target.nil?
-
- title_target.content = title_source.content
- File.open(filename, 'w') { |file| file.write doc.to_html }
-
- return title_source.content
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/file_merger.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/file_merger.rb b/lib/cordova/file_merger.rb
deleted file mode 100644
index 4ee2c20..0000000
--- a/lib/cordova/file_merger.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'fileutils'
-require 'rubygems'
-require 'json'
-
-class FileMerger
- def initialize
- end
-
- def run(filepath)
- # skip the guides
- return if filepath.match(/\/guide\//)
-
- # skip missing files (file that are merged are also deleted)
- return unless File.exists?(filepath)
-
- # 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
- 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)
- return true if File.exists? file_path
-
- puts "Missing: #{file_path}"
- return false
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/jodoc.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/jodoc.rb b/lib/cordova/jodoc.rb
deleted file mode 100644
index 03dc346..0000000
--- a/lib/cordova/jodoc.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-class JoDoc
- JO_DOC_CLI = 'jodoc'
- TEMPLATE_PATH = File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'template', 'docs' )
-
- attr_accessor :input_directory
- attr_accessor :output_directory
-
- def initialize(input_directory, output_directory, options)
- @input_directory = input_directory
- @output_directory = output_directory
- @template_directories = [ File.join TEMPLATE_PATH, 'default' ]
-
- # add custom language template
- if options[:lang]
- @template_directories.push(File.join TEMPLATE_PATH, options[:lang])
- end
-
- check_dependencies
- end
-
- def run
- # Copy HTML template assets
- @template_directories.each do |template|
- next unless File.directory? template
- FileUtils.cp_r File.join(template, '.'), @output_directory
- end
-
- # Run joDoc
- FileUtils.cd @input_directory do
- `jodoc --output "#{@output_directory}" --title "Cordova API Documentation" --template "#{@output_directory}/index.html" ./ > /dev/null 2> /dev/null`
- end
- end
-
- protected
-
- def check_dependencies
- die 'The jodoc script is not in your path' unless command_exists?(JO_DOC_CLI)
-
- [@input_directory, @template_directories[0]].each do |directory|
- die "The directory #{directory}/ should exist." unless File.directory? directory
- end
- end
-
- def command_exists?(command)
- system("which #{command} > /dev/null 2> /dev/null")
- end
-
- def die(message)
- raise StandardError, message
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/navigation_menu.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/navigation_menu.rb b/lib/cordova/navigation_menu.rb
deleted file mode 100644
index 59d7982..0000000
--- a/lib/cordova/navigation_menu.rb
+++ /dev/null
@@ -1,81 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$: << File.join(File.dirname(__FILE__))
-require 'rubygems'
-require 'nokogiri'
-require 'fileutils'
-require 'file_helpers'
-
-class NavigationMenu
- include FileHelpers
-
- def initialize(options = {})
- @sections = []
-
- filename = Dir.glob(File.join tmp_directory, '**', 'index.md.html')[0]
- if filename == nil
- abort('index.md.html was not generated in ' + tmp_directory)
- end
- doc = Nokogiri::HTML(File.read(filename))
-
- h1_set = doc.css('#home > h1')
- ul_set = doc.css('#home > ul')
- count = h1_set.length
-
- count.times do |index|
- links = []
- ul_set[index].css('li > h2 > a').each { |a| links.push(a) }
-
- @sections.push({
- 'title' => h1_set[index].text,
- 'links' => links
- })
- end
- end
-
- def run(filename)
- doc = Nokogiri::HTML(File.read(filename))
-
- @sections.each do |section|
- insert_title(section['title'], doc)
- insert_links(section['links'], doc)
- end
-
- File.open(filename, 'w') { |file| file.write doc.to_html }
-
- return doc.to_html
- end
-
- def insert_title(title, doc)
- h1 = Nokogiri::XML::Node.new 'h1', doc
- h1.content = title
- doc.css('#sidebar').first.add_child(h1)
- end
-
- def insert_links(links, doc)
- ul = Nokogiri::XML::Node.new 'ul', doc
-
- links.each do |link|
- li = Nokogiri::XML::Node.new 'li', doc
- li.add_child(link)
- ul.add_child(li)
- end
-
- doc.css('#sidebar').first.add_child(ul)
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/noindex.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/noindex.rb b/lib/cordova/noindex.rb
deleted file mode 100644
index 9599709..0000000
--- a/lib/cordova/noindex.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'json'
-require 'nokogiri'
-require 'fileutils'
-
-class NoIndex
- @@latest_version = nil;
- @versions = nil
- @languages = {}
-
- def initialize(options = {})
- @@latest_version = get_latest_version()
- @version = options[:version]
- @language = options[:lang]
- end
-
- def run(filename)
- if (@@latest_version == @version && @language == 'en')
- return;
- end
-
- doc = Nokogiri::HTML(File.read(filename))
-
- meta_tags = doc.css('head meta')
- meta_tags.last.add_next_sibling(meta_element_noindex(doc))
-
- File.open(filename, 'w') { |file| file.write doc.to_html }
-
- return doc.to_html
- end
-
- private
-
- def get_latest_version
- # skip if we have the latest version
- if !@@latest_version.nil?
- return @@latest_version
- end
-
- docs_path = File.expand_path File.join(__FILE__, '..', '..', '..', 'docs')
- glob_exp = File.join(docs_path, 'en', '*', 'config.json')
- versions = []
-
- # collect all english versions because they are the most up-to-date
- Dir.glob(glob_exp).each do |file|
- version = File.basename(File.dirname(file))
- versions.push(version)
- end
-
- # sort the version list because Dir does not guarantee an order
- versions.sort!
-
- # we want the latest stable release
- # if edge is the most recent, remove it
- if (versions.last == 'edge')
- versions.pop
- end
-
- # return the latest version
- return versions.last
- end
-
- def meta_element_noindex(doc)
- # create and return: <meta name="robots" content="noindex" />
- element = Nokogiri::XML::Node.new('meta', doc)
- element['name'] = 'robots'
- element['content'] = 'noindex'
- return element
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/prettify.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/prettify.rb b/lib/cordova/prettify.rb
deleted file mode 100644
index 535f6b4..0000000
--- a/lib/cordova/prettify.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'nokogiri'
-
-class Prettify
- def run(filename)
- doc = Nokogiri::HTML(File.read(filename))
-
- code_tags = doc.css('#content pre').each do |tag|
- tag['class'] = 'prettyprint'
- end
-
- File.open(filename, 'w') { |file| file.write doc.to_html }
-
- return code_tags
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/table_of_contents.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/table_of_contents.rb b/lib/cordova/table_of_contents.rb
deleted file mode 100644
index 0f7b7f0..0000000
--- a/lib/cordova/table_of_contents.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'nokogiri'
-require 'uri'
-
-class TableOfContents
- def run(filename)
- doc = Nokogiri::HTML(File.read(filename))
- option_set = Nokogiri::XML::NodeSet.new(doc)
-
- # Find all the H1 and H2 elements in the content area
- #
- current_h1 = ""
- indentation = " " * 6
-
- doc.xpath("id('content')/h1 | id('content')/h2").each do |tag|
- if (tag.name == 'h1' && tag.child[:name]) then
- current_h1 = tag.content
-
- option = Nokogiri::XML::Node.new 'option', doc
- option['value'] = URI.escape(tag.child[:name])
- option.content = tag.content
- option_set.push option
- else
- # Remove all leading and trailing non-word characters
- # Replace all inner non-word characters with an underscore
- s = tag.content.gsub(/^\W+|\W+$/, '').gsub(/\W+/, '_').downcase
-
- option = Nokogiri::XML::Node.new 'option', doc
- option['value'] = URI.escape("#{current_h1}_#{s}")
- option.content = "#{indentation}- #{tag.content}"
- option_set.push option
-
- a = Nokogiri::XML::Node.new 'a', doc
- a['name'] = "#{current_h1}_#{s}"
- a.content = tag.content
-
- tag.content = ''
- tag.add_child a
- end
- end
-
- # Return if one or less elements found (useless selection box)
- #
- return nil if option_set.length <= 1
-
- # Add select menu to the subheader
- #
- select = Nokogiri::XML::Node.new 'select', doc
- select.add_child option_set
- subheader = doc.css('#subheader > small')[0]
- subheader.add_child select
-
- # Save Table of Contents
- # Add Nokogiri hack to properly render spaces
- File.open(filename, 'w') { |file| file.write doc.to_html.gsub('&nbsp;', ' ') }
-
- return option_set
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/update_index.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/update_index.rb b/lib/cordova/update_index.rb
deleted file mode 100644
index e8062ff..0000000
--- a/lib/cordova/update_index.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'nokogiri'
-require 'fileutils'
-
-class UpdateIndex
- attr_accessor :header_title
- attr_accessor :filename
-
- def initialize
- @input_filename = 'index.md.html'
- @output_filename = 'index.html'
- @header_title = 'Home'
- end
-
- def run(filename)
- return false unless File.basename(filename) == @input_filename
-
- doc = Nokogiri::HTML(File.read(filename))
-
- element = doc.css('#subheader > h1')[0]
- element.content = @header_title unless element.nil?
-
- File.open(filename, 'w') { |file| file.write doc.to_html }
-
- FileUtils.mv(filename, File.join(File.dirname(filename), @output_filename))
-
- return true
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/update_keyword_index.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/update_keyword_index.rb b/lib/cordova/update_keyword_index.rb
deleted file mode 100644
index a54a9d1..0000000
--- a/lib/cordova/update_keyword_index.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'nokogiri'
-require 'fileutils'
-
-class UpdateKeywordIndex
- attr_accessor :header_title
- attr_accessor :content_title
- attr_accessor :filename
-
- def initialize
- @header_title = 'Keyword Index'
- @content_title = 'Keyword Index'
- end
-
- def run(filename)
- return false unless File.basename(filename) == '_index.html'
-
- doc = Nokogiri::HTML(File.read(filename))
-
- element = doc.css('#subheader > h1')[0]
- element.content = @header_title unless element.nil?
-
- element = doc.css('#content > h1')[0]
- element.content = @content_title unless element.nil?
-
- element = doc.css('#content > hr')[0]
- element.remove unless element.nil?
-
- # Update referenced to index.md.html
- # Then save
- File.open(filename, 'w') { |file| file.write doc.to_html.gsub('"index.md.html', '"index.html') }
- return true
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/version_menu.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/version_menu.rb b/lib/cordova/version_menu.rb
deleted file mode 100644
index fbb629d..0000000
--- a/lib/cordova/version_menu.rb
+++ /dev/null
@@ -1,89 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'rubygems'
-require 'json'
-require 'nokogiri'
-require 'fileutils'
-
-class VersionMenu
- @@versions = nil
- @@languages = {}
-
- def initialize(options = {})
- @version = options[:version]
- @language = options[:lang]
- end
-
- def run(filename)
- doc = Nokogiri::HTML(File.read(filename))
-
- select = doc.css('#header small select')[0]
- select.add_child generate_set(doc)
-
- File.open(filename, 'w') { |file| file.write doc.to_html }
-
- return doc.to_html
- end
-
- private
-
- def generate_set doc
- docs_path = File.expand_path File.join(__FILE__, '..', '..', '..', 'docs')
- glob_exp = File.join(docs_path, '*', '*', 'config.json')
- html = []
-
- # only build versions once for performance
- if @@versions.nil?
- @@versions = {}
-
- # build hash of languages and versions
- Dir.glob(glob_exp).each do |file|
- version = File.basename(File.dirname file)
- lang = File.basename(File.dirname(File.dirname file))
- language = JSON.parse(IO.read(file))['language']
-
- if language
- @@versions[language] ||= []
- @@versions[language].push version
- @@languages[language] = lang
- else
- puts "Warning: The key 'language' was not defined in #{file}"
- end
- end
- end
-
- # generate HTML <select> output
- optgroup_set = Nokogiri::XML::NodeSet.new doc
- @@versions.keys.sort.each do |language|
- optgroup = Nokogiri::XML::Node.new 'optgroup', doc
- optgroup['label'] = language
- optgroup['value'] = @@languages[language]
- optgroup_set.push optgroup
-
- @@versions[language].sort.reverse.each do |v|
- option = Nokogiri::XML::Node.new 'option', doc
- option['selected'] = 'selected' if @version == v && @language == @@languages[language]
- option['value'] = v;
- option.content = v
- optgroup.add_child option
- end
- end
-
- return optgroup_set
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/cordova/yaml_front_matter.rb
----------------------------------------------------------------------
diff --git a/lib/cordova/yaml_front_matter.rb b/lib/cordova/yaml_front_matter.rb
deleted file mode 100644
index 25ed166..0000000
--- a/lib/cordova/yaml_front_matter.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'yaml'
-
-class YamlFrontMatter
- def initialize
- end
-
- def run(file_path)
- content = IO.read(file_path)
- yaml = {}
-
- # This will also strip out any leading whitespace
- # Copied the RegEx from [Jekyll](http://github.com/mojombo/jekyll)
- #
- if content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
- content = content[($1.size + $2.size)..-1]
- yaml = YAML.load($1)
-
- # Save the file
- File.open(file_path, 'w+') do |file|
- file.write content
- end
- end
-
- yaml
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/docs_generator.rb
----------------------------------------------------------------------
diff --git a/lib/docs_generator.rb b/lib/docs_generator.rb
deleted file mode 100644
index 74423a6..0000000
--- a/lib/docs_generator.rb
+++ /dev/null
@@ -1,115 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$: << File.join(File.dirname(__FILE__))
-$: << File.join(File.dirname(__FILE__), 'cordova')
-require 'file_helpers'
-require 'yaml_front_matter'
-require 'file_merger'
-require 'add_title'
-require 'update_index'
-require 'update_keyword_index'
-require 'jodoc'
-require 'fileutils'
-require 'table_of_contents'
-require 'version_menu'
-require 'navigation_menu'
-require 'noindex'
-require 'prettify'
-
-class DocsGenerator
- include FileHelpers
-
- attr_accessor :input_directory
- attr_accessor :output_directory
-
- def initialize(input_directory = nil, output_directory = nil)
- @input_directory = input_directory || default_input_directory
- @output_directory = output_directory || default_output_directory
- @working_directory = File.join tmp_directory, 'docs'
- end
-
- # Cordova Build-Time Steps
- # - For each version of the documentation
- # - Create a work space for the docs processing
- # - Pre-file processing
- # - Run joDoc
- # - Pre-file processing
- # - Release and cleanup
- #
- def run(one_lang = nil, one_version = nil)
- empty_output_directory
-
- ignore_list = ['.', '..', '.DS_Store']
-
- Dir.foreach @input_directory do |language_dir|
- next if ignore_list.include? language_dir
- next if one_lang and language_dir != one_lang
- language_path = File.join @input_directory, language_dir
-
- Dir.foreach language_path do |version_dir|
- next if ignore_list.include? version_dir
- 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
- options = { :lang => language_dir, :version => version_dir }
- next unless File.directory? input_path
-
- copy_directory(input_path, @working_directory)
-
- puts " => Generating the Cordova Documentation for #{version_dir}-#{language_dir}..."
- generated_path = after_jodoc(jodocify(before_jodoc(@working_directory, options), options), options)
-
- move_directory(generated_path, output_path)
- empty_tmp_directory
- end
- end
- end
-
- protected
-
- def before_jodoc(input_directory, options)
- klasses = [ YamlFrontMatter.new, FileMerger.new ]
-
- klasses.each do |klass|
- each_file input_directory do |file|
- klass.run file
- end
- end
-
- input_directory
- end
-
- def jodocify(input_directory, options)
- output_directory = File.join tmp_directory, 'jodoc'
- JoDoc.new(input_directory, output_directory, options).run
-
- output_directory
- end
-
- def after_jodoc(input_directory, options)
- klasses = [ AddTitle.new, UpdateIndex.new, UpdateKeywordIndex.new, TableOfContents.new, VersionMenu.new(options), NavigationMenu.new(options), Prettify.new, NoIndex.new(options) ]
-
- klasses.each do |klass|
- each_file input_directory do |file|
- klass.run file
- end
- end
-
- input_directory
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/lib/file_helpers.rb
----------------------------------------------------------------------
diff --git a/lib/file_helpers.rb b/lib/file_helpers.rb
deleted file mode 100644
index e3eb481..0000000
--- a/lib/file_helpers.rb
+++ /dev/null
@@ -1,78 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'fileutils'
-
-module FileHelpers
- #
- # Directory Paths
- #
-
- def default_input_directory
- File.join root_directory, 'docs'
- end
-
- def default_output_directory
- File.join root_directory, 'public'
- end
-
- def tmp_directory
- File.join root_directory, 'tmp'
- end
-
- #
- # Directory Operations
- #
-
- def copy_directory(source, destination)
- FileUtils.rm_rf destination
- FileUtils.mkdir_p File.dirname(destination)
- FileUtils.cp_r source, destination
- end
-
- def move_directory(source, destination)
- FileUtils.rm_rf destination
- FileUtils.mkdir_p File.dirname(destination)
- FileUtils.mv source, destination
- end
-
- def empty_tmp_directory
- FileUtils.rm_rf tmp_directory
- end
-
- def empty_output_directory
- FileUtils.rm_rf @output_directory
- end
-
- #
- # File Operations
- #
-
- def each_file(directory)
- directory_glob = Dir.glob(File.join(directory, '**', '*'))
-
- directory_glob.sort.each do |entry|
- yield(entry) unless File.directory?(entry) or entry !~ /md|html/
- end
- end
-
- private
-
- def root_directory
- File.expand_path(File.join(File.dirname(__FILE__), '..'))
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/cordova/add_title_spec.rb
----------------------------------------------------------------------
diff --git a/spec/cordova/add_title_spec.rb b/spec/cordova/add_title_spec.rb
deleted file mode 100644
index 8214eb0..0000000
--- a/spec/cordova/add_title_spec.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$: << File.join(File.dirname(__FILE__), '..')
-$: << File.join(File.dirname(__FILE__), '..', '..', 'lib', 'cordova')
-require 'spec_helpers'
-require 'add_title'
-require 'nokogiri' # Nokogiri may not be the best way to test this suite. Any thoughts?
-
-describe AddTitle do
- # Create a fresh copy of the test file for each test run
- before :all do
- tmp_directory = Helper::create_tmp_directory_assets(__FILE__)
- @file = {
- :normal => File.join(tmp_directory, 'example.html'),
- :no_source => File.join(tmp_directory, 'example_no_source.html'),
- :no_target => File.join(tmp_directory, 'example_no_target.html')
- }
- @add_title = AddTitle.new
- end
-
- it 'should set the title' do
- @add_title.run(@file[:normal]).should == 'Accelerometer'
- Nokogiri::HTML(File.read @file[:normal]).css('#subheader > h1')[0].content.should == 'Accelerometer'
- end
-
- it 'should skip files with no source title' do
- @add_title.run(@file[:no_source]).should be_nil
- end
-
- it 'should skip files with no target title' do
- @add_title.run(@file[:no_target]).should be_nil
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/cordova/jodoc_spec.rb
----------------------------------------------------------------------
diff --git a/spec/cordova/jodoc_spec.rb b/spec/cordova/jodoc_spec.rb
deleted file mode 100644
index 4efe9c6..0000000
--- a/spec/cordova/jodoc_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$:.unshift File.join(File.dirname(__FILE__), '..')
-require 'spec_helpers'
-require 'jodoc'
-
-describe JoDoc do
- before :all do
- @tmp_public_directory = Helper::tmp_public_directory
- DocsGenerator.new(Helper::create_tmp_directory_assets, @tmp_public_directory).run
- end
-
- it 'should run on a validate directory' do
- File.directory?(@tmp_public_directory).should be_true
- end
-
- it 'should not run on a non-existent directory' do
- bad_input_directory = File.expand_path File.join(File.dirname(__FILE__), 'hello', 'world')
- lambda { JoDoc.new bad_input_directory, @tmp_public_directory }.should raise_exception
- end
-
- it 'should generate HTML assets from Markdown' do
- File.exists?(File.join(@tmp_public_directory, 'en', 'edge', 'phonegap_accelerometer_accelerometer.md.html')).should be_true
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/cordova/prettify_spec.rb
----------------------------------------------------------------------
diff --git a/spec/cordova/prettify_spec.rb b/spec/cordova/prettify_spec.rb
deleted file mode 100644
index 481c019..0000000
--- a/spec/cordova/prettify_spec.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$: << File.join(File.dirname(__FILE__), '..', '..', 'lib')
-$: << File.join(File.dirname(__FILE__), '..', '..', 'lib', 'cordova')
-require 'prettify'
-require 'spec_helpers'
-
-describe Prettify do
- before :each do
- directory = Helper::create_tmp_directory_assets(__FILE__)
- @file = {
- :normal => File.join(directory, 'example.html'),
- }
- @prettify = Prettify.new
- end
-
- it 'should find some code blocks' do
- code_tags = @prettify.run @file[:normal]
- code_tags.should have_at_least(1).item
- end
-
- it 'should add the prettyprint class to each code block' do
- @prettify.run @file[:normal]
-
- doc = Nokogiri::HTML(File.read @file[:normal])
- doc.css('#content pre.prettyprint').should have_at_least(1).item
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/cordova/table_of_contents_spec.rb
----------------------------------------------------------------------
diff --git a/spec/cordova/table_of_contents_spec.rb b/spec/cordova/table_of_contents_spec.rb
deleted file mode 100644
index 3f823cb..0000000
--- a/spec/cordova/table_of_contents_spec.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$: << File.join(File.dirname(__FILE__), '..', '..', 'lib')
-$: << File.join(File.dirname(__FILE__), '..', '..', 'lib', 'cordova')
-require 'table_of_contents'
-require 'spec_helpers'
-
-describe TableOfContents do
- before :each do
- directory = Helper::create_tmp_directory_assets(__FILE__)
- @file = {
- :normal => File.join(directory, 'example.html'),
- :no_source => File.join(directory, 'example_no_source.html'),
- :no_target => File.join(directory, 'example_no_target.html')
- }
- @toc = TableOfContents.new
- end
-
- it 'should find the table of content values' do
- contents = @toc.run @file[:normal]
- contents.should have(32).items
- end
-
- it 'should find all <h1> elements' do
- contents = @toc.run @file[:normal]
-
- headers = []
- contents.each { |header| headers.push(header) if (header =~ /-/).nil? }
- headers.should have(8).items
- end
-
- it 'should find all <h2> elements' do
- contents = @toc.run @file[:normal]
-
- headers = []
- contents.each { |header| headers.push(header) if nil != (header =~ /-/) and (header =~ /-/) > 0 }
- headers.should have(24).items
- end
-
- it 'should ignore whitespace in the target name' do
- contents = @toc.run @file[:normal]
- contents = contents.reverse
-
- names = []
- doc = Nokogiri::HTML(File.read @file[:normal])
- doc.xpath("id('content')/h1 | id('content')/h2").each do |tag|
- tag.child[:name].should == contents.pop.match(/value=\"([^\"]*)\"/)[1]
- end
- end
-
- it 'should create a HTML select element' do
- @toc.run @file[:normal]
-
- doc = Nokogiri::HTML(File.read @file[:normal])
- doc.css('#subheader > small > select').should have(1).item
- end
-
- it 'should skip files with no source (no H1 or H2 available)' do
- @toc.run(@file[:no_source]).should be_nil
- end
-
- it 'should skip files with no target (no <select> available)' do
- @toc.run(@file[:no_target]).should be_nil
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/cordova/update_index_spec.rb
----------------------------------------------------------------------
diff --git a/spec/cordova/update_index_spec.rb b/spec/cordova/update_index_spec.rb
deleted file mode 100644
index 7b28a4f..0000000
--- a/spec/cordova/update_index_spec.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$:.unshift File.join(File.dirname(__FILE__), '..')
-require 'spec_helpers'
-require 'update_index'
-require 'rubygems'
-require 'nokogiri'
-
-describe UpdateIndex do
- before :each do
- directory = Helper::create_tmp_directory_assets(__FILE__)
- @file = {
- :input => File.join(directory, 'index.md.html'),
- :output => File.join(directory, 'index.html')
- }
- @update_index = UpdateIndex.new
- end
-
- it 'should skip all files but index.md.html' do
- @update_index.run('index.md').should be_false
- @update_index.run('index.html').should be_false
- @update_index.run('_index.md.html').should be_false
- end
-
- it 'should rename the title' do
- Nokogiri::HTML( File.read @file[:input] ).css('#subheader > h1')[0].content.should_not == @update_index.header_title
- @update_index.run @file[:input]
- Nokogiri::HTML( File.read @file[:output] ).css('#subheader > h1')[0].content.should == @update_index.header_title
- end
-
- it 'should rename the file' do
- File.exists?(@file[:input]).should be_true
- File.exists?(@file[:output]).should be_false
-
- @update_index.run @file[:input]
-
- File.exists?(@file[:input]).should be_false
- File.exists?(@file[:output]).should be_true
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/cordova/update_keyword_index_spec.rb
----------------------------------------------------------------------
diff --git a/spec/cordova/update_keyword_index_spec.rb b/spec/cordova/update_keyword_index_spec.rb
deleted file mode 100644
index 96f855c..0000000
--- a/spec/cordova/update_keyword_index_spec.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$:.unshift File.join(File.dirname(__FILE__), '..')
-require 'spec_helpers'
-require 'update_keyword_index'
-require 'rubygems'
-require 'nokogiri'
-
-describe UpdateKeywordIndex do
- before :each do
- directory = Helper::create_tmp_directory_assets(__FILE__)
- @file = File.join(directory, '_index.html')
- @update_keyword = UpdateKeywordIndex.new
- end
-
- it 'should skip all files but _index.html' do
- # All false
- @update_keyword.run('index.html').should be_false
- @update_keyword.run('index.htm').should be_false
- @update_keyword.run('_index.htm').should be_false
- @update_keyword.run('index.md.html').should be_false
- end
-
- it 'should rename the title' do
- Nokogiri::HTML(File.read @file).css('#subheader > h1' )[0].content.should_not == @update_keyword.header_title
- @update_keyword.run @file
- Nokogiri::HTML(File.read @file).css('#subheader > h1' )[0].content.should == @update_keyword.header_title
- end
-
- it 'should rename the h1' do
- Nokogiri::HTML(File.read @file).css('#content > h1')[0].content.should_not == @update_keyword.content_title
- @update_keyword.run @file
- Nokogiri::HTML(File.read @file).css('#content > h1')[0].content.should == @update_keyword.content_title
- end
-
- it 'should remove the <hr/>' do
- Nokogiri::HTML(File.read @file).css('#content > hr').should have_at_least(1).items
- @update_keyword.run @file
- Nokogiri::HTML(File.read @file).css('#content > hr').should have(0).items
- end
-
- it 'should update references from index.md.html to index.html' do
- Nokogiri::HTML(File.read @file).to_html.scan('index.md.html').length.should_not == 0
- @update_keyword.run @file
- Nokogiri::HTML(File.read @file).to_html.scan('index.md.html').length.should == 0
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/cordova/yaml_front_matter_spec.rb
----------------------------------------------------------------------
diff --git a/spec/cordova/yaml_front_matter_spec.rb b/spec/cordova/yaml_front_matter_spec.rb
deleted file mode 100644
index 74e969e..0000000
--- a/spec/cordova/yaml_front_matter_spec.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$:.unshift File.join(File.dirname(__FILE__), '..')
-require 'spec_helpers'
-require 'yaml_front_matter'
-
-describe YamlFrontMatter do
- before :each do
- directory = Helper::create_tmp_directory_assets(__FILE__)
- @file = {
- :yaml => File.join(directory, 'has_yaml.md'),
- :no_yaml => File.join(directory, 'no_yaml.md')
- }
- @yaml_front_matter = YamlFrontMatter.new
- end
-
- it 'should skip files with no YAML Front Matter' do
- expected_data = File.read(@file[:no_yaml])
- @yaml_front_matter.run(@file[:no_yaml]).should == {}
- actual_data = File.read(@file[:no_yaml])
-
- actual_data.should == expected_data
- end
-
- it 'should parse files with YAML Front Matter' do
- @yaml_front_matter.run(@file[:yaml]).should == {
- 'platforms' => 'Android, BlackBerry, iOS',
- 'type' => 'Function'
- }
- end
-
- it 'should strip YAML Front Matter from the file' do
- File.read(@file[:yaml]).should match(/\A\W+/)
- @yaml_front_matter.run(@file[:yaml])
- File.read(@file[:yaml]).should_not match(/\A\W+/) # No whitespace
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/docs_generator_spec.rb
----------------------------------------------------------------------
diff --git a/spec/docs_generator_spec.rb b/spec/docs_generator_spec.rb
deleted file mode 100644
index 2a40847..0000000
--- a/spec/docs_generator_spec.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$:.unshift File.join(File.dirname(__FILE__))
-require 'spec_helpers'
-require 'docs_generator'
-
-describe DocsGenerator do
- before :each do
- @tmp_docs_directory = Helper::create_tmp_directory_assets
- @tmp_public_directory = Helper::tmp_public_directory
- @generator = DocsGenerator.new(@tmp_docs_directory, Helper::tmp_public_directory)
- end
-
- it 'should create an output directory' do
- @generator.run
- File.exists?(@tmp_public_directory).should be_true
- Dir.glob(File.join(@tmp_public_directory, '**', '*')).should have_at_least(1).items
- end
-
- it 'should have a valid default directories' do
- generator = DocsGenerator.new
- File.exists?(generator.input_directory).should be_true
- end
-
- it 'should accept custom directories' do
- @generator.run
- @generator.input_directory.should == @tmp_docs_directory
- @generator.output_directory.should == @tmp_public_directory
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/file_helpers_spec.rb
----------------------------------------------------------------------
diff --git a/spec/file_helpers_spec.rb b/spec/file_helpers_spec.rb
deleted file mode 100644
index 708771a..0000000
--- a/spec/file_helpers_spec.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$:.unshift File.join(File.dirname(__FILE__))
-require 'spec_helpers'
-
-describe FileHelpers do
- before :all do
- @helpers = Object.new.extend FileHelpers
- end
-
- before :each do
- Helper::remove_tmp_directory
-
- @tmp_docs_directory = Helper::create_tmp_directory_assets
- @tmp_public_directory = Helper::tmp_public_directory
- end
-
- it 'should have a default input directory that exists' do
- File.exists?(@helpers.default_input_directory).should be_true
- end
-
- it 'should copy directories' do
- @helpers.copy_directory(@tmp_docs_directory, @tmp_public_directory)
-
- input_content = Dir.glob File.join(@tmp_docs_directory, '**', '*')
- tmp_content = Dir.glob File.join(@tmp_public_directory, '**', '*')
- input_content.length.should == tmp_content.length
- end
-
- it 'should move a directory' do
- File.exists?(@tmp_public_directory).should be_false
-
- @helpers.move_directory(@tmp_docs_directory, @tmp_public_directory)
-
- File.exists?(@tmp_docs_directory).should be_false
- File.exists?(@tmp_public_directory).should be_true
- end
-
- it 'should yield each file in the directory' do
- files = []
-
- @helpers.each_file @tmp_docs_directory do |file|
- files.push(file)
- end
-
- files.should have_at_least(1).items
- end
-
- after :all do
- Helper::remove_tmp_directory
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/spec/spec_helpers.rb
----------------------------------------------------------------------
diff --git a/spec/spec_helpers.rb b/spec/spec_helpers.rb
deleted file mode 100644
index e388671..0000000
--- a/spec/spec_helpers.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
-$:.unshift File.join(File.dirname(__FILE__), '..', 'lib', 'cordova')
-require 'file_helpers'
-require 'fileutils'
-
-class Helper
- @@helpers = Object.new.extend(FileHelpers)
-
- def self.create_tmp_directory_assets(reference_filename = nil)
- if reference_filename.nil?
- directories = { :source => docs_directory, :destination => tmp_docs_directory }
- else
- directories = find_test_directories(reference_filename)
- end
-
- if directories
- @@helpers.copy_directory(directories[:source], directories[:destination])
- end
-
- directories[:destination]
- end
-
- def self.tmp_public_directory
- File.join(tmp_directory, 'public')
- end
-
- def self.remove_tmp_directory
- FileUtils.rm_rf(tmp_directory)
- end
-
- private
-
- def self.root_directory
- File.expand_path File.dirname(__FILE__)
- end
-
- def self.tmp_directory
- File.expand_path File.join(root_directory, '..', 'tmp_spec')
- end
-
- def self.docs_directory
- @@helpers.default_input_directory
- end
-
- def self.tmp_docs_directory
- File.join(tmp_directory, 'docs')
- end
-
- def self.find_test_directories(filename)
- source_directory = filename.sub(/#{File.extname(filename)}$/, '')
- destination_directory = File.join(tmp_directory, File.basename(source_directory))
-
- return nil unless File.directory?(source_directory)
- { :source => source_directory, :destination => destination_directory }
- end
-end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/468560dd/vagrant/cordova-docs.sh
----------------------------------------------------------------------
diff --git a/vagrant/cordova-docs.sh b/vagrant/cordova-docs.sh
deleted file mode 100644
index 1ebceb7..0000000
--- a/vagrant/cordova-docs.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env bash
-
-# update system
-apt-get update
-
-# install curl
-apt-get install -y curl
-
-# install joDoc
-curl -sSL https://github.com/davebalmer/joDoc/archive/master.tar.gz | tar xvz
-mv joDoc-master joDoc
-echo "export PATH=$PATH:~/joDoc/" >> /home/vagrant/.bashrc
-source /home/vagrant/.bashrc
-
-# install markdown
-apt-get install -y markdown
-
-## install rvm and ruby 1.8.7
-curl -sSL https://get.rvm.io | bash -s stable
-source /etc/profile.d/rvm.sh
-rvm install ruby-1.8.7-p374
-rvm use ruby-1.8.7-p374
-gem install bundler
-
-# install nokogiri dependencies
-apt-get install -y libxslt-dev libxml2-dev
-
-# additonal tools to build new versions
-apt-get install -y rake
-
-# setup project
-cd /vagrant
-bundle install
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org