aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAndy Konwinski <andyk@berkeley.edu>2012-09-13 16:52:53 -0700
committerAndy Konwinski <andyk@berkeley.edu>2012-09-13 17:17:58 -0700
commit6765d9727e6e374a8fc6a361c43e3ddc5c8e12db (patch)
treeadb1a8b749c2cb856f66ca78aa23026899069754 /docs
parent462cd8be60bcd78180a31641b20c6d313e91f56d (diff)
downloadspark-6765d9727e6e374a8fc6a361c43e3ddc5c8e12db.tar.gz
spark-6765d9727e6e374a8fc6a361c43e3ddc5c8e12db.tar.bz2
spark-6765d9727e6e374a8fc6a361c43e3ddc5c8e12db.zip
Adds a jekyll plugin (written in Ruby) to the _plugins directory
which generates scala doc by calling `sbt/sbt doc`, copies it over to docs, and updates the links from the api webpage to now point to the copied over scaladoc (making the _site directory easy to just copy over to a public website).
Diffstat (limited to 'docs')
-rw-r--r--docs/README.md12
-rw-r--r--docs/_plugins/copy_api_dirs.rb28
-rw-r--r--docs/api.md8
3 files changed, 40 insertions, 8 deletions
diff --git a/docs/README.md b/docs/README.md
index 9f179a437a..91862b50d4 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -2,19 +2,21 @@ Welcome to the Spark documentation!
This readme will walk you through navigating and building the Spark documentation, which is included here with the Spark source code. You can also find documentation specific to release versions of Spark at http://spark-project.org/documentation.html.
-Read on to learn more about viewing documentation in plain text (i.e., markdown) or building the documentation yourself that corresponds to whichever version of Spark you currently have checked out of revision control.
+Read on to learn more about viewing documentation in plain text (i.e., markdown) or building the documentation yourself. Why build it yourself? So that you have the docs that corresponds to whichever version of Spark you currently have checked out of revision control.
## Generating the Documentation HTML
-We include the Spark documentation as part of the source (as opposed to using a hosted wiki as the definitive documentation) to enable the documentation to evolve along with the source code and be captured by revision control (currently git). This way the code automatically includes the version of the documentation that is relevant regardless of which version or release you have checked out or downloaded.
+We include the Spark documentation as part of the source (as opposed to using a hosted wiki, such as the github wiki, as the definitive documentation) to enable the documentation to evolve along with the source code and be captured by revision control (currently git). This way the code automatically includes the version of the documentation that is relevant regardless of which version or release you have checked out or downloaded.
In this directory you will find textfiles formatted using Markdown, with an ".md" suffix. You can read those text files directly if you want. Start with index.md.
-To make things quite a bit prettier and make the links easier to follow, generate the html version of the documentation based on the src directory by running `jekyll` in the docs directory (You will need to have Jekyll installed, the easiest way to do this is via a Ruby Gem). This will create a directory called _site which will contain index.html as well as the rest of the compiled files. Read more about Jekyll at https://github.com/mojombo/jekyll/wiki.
+To make things quite a bit prettier and make the links easier to follow, generate the html version of the documentation based on the src directory by running `jekyll` in the docs directory. To do so, you will need to have Jekyll installed, the easiest way to do this is via a Ruby Gem, see the [jekyll installation instructions](https://github.com/mojombo/jekyll/wiki/install). This will create a directory called _site containing index.html as well as the rest of the compiled files. Read more about Jekyll at https://github.com/mojombo/jekyll/wiki.
+
+In addition to generating the site as html from the markdown files, jekyll can serve up the site via a webserver. To build and run a webserver use the command `jekyll --server` which (currently) runs the webserver on port 4000, then visit the site at http://localhost:4000.
## Pygments
-We also use pygments (http://pygments.org) for syntax highlighting, so you will also need to install that (it requires Python) by running `sudo easy_install Pygments`.
+We also use pygments (http://pygments.org) for syntax highlighting in documentation markdown pages, so you will also need to install that (it requires Python) by running `sudo easy_install Pygments`.
To mark a block of code in your markdown to be syntax highlighted by jekyll during the compile phase, use the following sytax:
@@ -26,3 +28,5 @@ To mark a block of code in your markdown to be syntax highlighted by jekyll duri
## Scaladoc
You can build just the Spark scaladoc by running `sbt/sbt doc` from the SPARK_PROJECT_ROOT directory.
+
+When you run `jekyll` in the docs directory, it will also copy over the scala doc for the various Spark subprojects into the docs directory (and then also into the _site directory). We use a jekyll plugin to run `sbt/sbt doc` before building the site so if you haven't run it (recently) it may take some time as it generates all of the scaladoc.
diff --git a/docs/_plugins/copy_api_dirs.rb b/docs/_plugins/copy_api_dirs.rb
new file mode 100644
index 0000000000..84f5e59fde
--- /dev/null
+++ b/docs/_plugins/copy_api_dirs.rb
@@ -0,0 +1,28 @@
+require 'fileutils'
+include FileUtils
+
+projects = ["core", "examples", "repl", "bagel"]
+
+puts "Moving to project root and building scaladoc."
+curr_dir = pwd
+cd("..")
+
+puts "Running sbt/sbt doc from " + pwd + "; this may take a few minutes..."
+puts `sbt/sbt doc`
+
+puts "moving back into docs dir."
+cd("docs")
+
+# Copy over the scaladoc from each project into the docs directory.
+# This directory will be copied over to _site when `jekyll` command is run.
+projects.each do |project_name|
+ source = "../" + project_name + "/target/scala-2.9.1/api"
+ dest = "api/" + project_name
+
+ puts "echo making directory " + dest
+ mkdir_p dest
+
+ # From the rubydoc: cp_r('src', 'dest') makes src/dest, but this doesn't.
+ puts "cp -r " + source + "/. " + dest
+ cp_r(source + "/.", dest)
+end
diff --git a/docs/api.md b/docs/api.md
index b0acbe34c5..8a01023ad4 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -5,7 +5,7 @@ title: Spark API documentation (Scaladoc)
Here you can find links to the Scaladoc generated for the Spark sbt subprojects. If the following links don't work, try running `sbt/sbt doc` from the Spark project home directory.
-- [Core]({{HOME_PATH}}../../core/target/scala-2.9.1/api/index.html)
-- [Examples]({{HOME_PATH}}../../examples/target/scala-2.9.1/api/index.html)
-- [Repl]({{HOME_PATH}}../../repl/target/scala-2.9.1/api/index.html)
-- [Bagel]({{HOME_PATH}}../../bagel/target/scala-2.9.1/api/index.html)
+- [Core](api/core/index.html)
+- [Examples](api/examples/index.html)
+- [Repl](api/repl/index.html)
+- [Bagel](api/bagel/index.html)