Permalink
Browse files

Merge branch 'gen-master' of github.com:sbt/sbt.github.com into gen-m…

…aster
  • Loading branch information...
jsuereth committed Mar 16, 2012
2 parents b46a518 + 03f908e commit 11ff5e6616419481dbb656bb42a23b09efbe4935
View
@@ -2,3 +2,4 @@ target
project/boot
project/build/target
project/plugins/target
+.history
View
@@ -8,13 +8,27 @@ The project contains the sources used to generate [http://www.scala-sbt.org/](h
## Requirements
-You need to have `jekyll` installed. Luckily that's quite easy: `gem install jekyll`. If that doesn't work check out the [installation instructions](https://github.com/mojombo/jekyll/wiki/Install "installation instructions").
+You need to have `jekyll` installed. Luckily, that's quite easy: `gem install jekyll rdiscount --no-ri --no-rdoc`. If that doesn't work, check out the [installation instructions](https://github.com/mojombo/jekyll/wiki/Install "installation instructions").
## Usage
You can find the sources in the src/jekyll folder.
-To generate the site simple start an SBT shell and type:
+To generate the site, simply start an SBT shell and type:
> make-site
> ghpages-push-site
+
+When you fire up `sbt`, you _may_ see an error like this:
+
+ [error] AttributeKey ID collisions detected for: 'pgp-signer' (sbt.Task[com.jsuereth.pgp.sbtplugin.PgpSigner], sbt.Task[com.jsuereth.pgp.sbtplugin.PgpSigner]), 'pgp-verifier' (sbt.Task[com.jsuereth.pgp.sbtplugin.PgpVerifier], sbt.Task[com.jsuereth.pgp.sbtplugin.PgpVerifier]), 'pgp-context' (sbt.Task[com.jsuereth.pgp.cli.PgpCommandContext], sbt.Task[com.jsuereth.pgp.cli.PgpCommandContext]), 'check-pgp-signatures' (sbt.Task[com.jsuereth.pgp.sbtplugin.SignatureCheckReport], sbt.Task[com.jsuereth.pgp.sbtplugin.SignatureCheckReport]), 'pgp-static-context' (com.jsuereth.pgp.cli.PgpStaticContext, com.jsuereth.pgp.cli.PgpStaticContext), 'signatures-module' (sbt.Task[com.jsuereth.pgp.sbtplugin.GetSignaturesModule], sbt.Task[com.jsuereth.pgp.sbtplugin.GetSignaturesModule])
+
+If that happens, you probably have a global SBT setting or plugin that
+conflicts with the expectations of this repo's `build.sbt`. In that case, just
+fire up SBT so that it skips your `~/.sbt` directory. e.g.:
+
+ $ sbt -Dsbt.global.base=/tmp
+
+To preview the site, start jekyll and browse to [localhost:4000](http://localhost:4000):
+
+ $ jekyll src/jekyll/ target/jekyll/ --server
@@ -2,7 +2,5 @@ import sbt._
object PluginDef extends Build {
override def projects = Seq(root)
lazy val root = Project("plugins", file(".")) dependsOn(ghpages)
- // move back to josh's repo after pull requests for git branch key
- // support goes through
- lazy val ghpages = uri("git://github.com/jsuereth/xsbt-ghpages-plugin.git")
+ lazy val ghpages = uri("git://github.com/jsuereth/xsbt-ghpages-plugin.git#e326b5358347a8ab258171e3ed2ac10b9e4914cf")
}
View
@@ -2,3 +2,4 @@ pygments: true
name: Simple Build Tool
description: Homepage for the Simple Build Tool
url: http://scala-sbt.org
+markdown: rdiscount
@@ -1,11 +1,15 @@
-<script type="text/javascript" src="jquery.scrollto.min.js"></script>
+<script type="text/javascript" src="/jquery.scrollto.min.js"></script>
<script type="text/javascript">
(function($){ $(function(){
$("#top").click(function(){ $("#intro").ScrollTo(); })
var applyH = function() {
- $("#intro, .feature").height($(window).height());
+ $("#intro, .feature").each(function (i, elt) {
+ if ($(elt).height() < $(window).height()) {
+ $(elt).height($(window).height());
+ }
+ });
};
$(window).bind('resize', function() { applyH(); });
applyH();
@@ -5,8 +5,8 @@
<head>
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}</title>
<link href='http://fonts.googleapis.com/css?family=Copse' rel='stylesheet' type='text/css'>
- <link href='resources/site.css' rel='stylesheet' type='text/css'>
- <link href='resources/syntax.css' rel='stylesheet' type='text/css'>
+ <link href='/resources/site.css' rel='stylesheet' type='text/css'>
+ <link href='/resources/syntax.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
</script>
</head>
@@ -5,9 +5,9 @@
<div class="container">
<a class="brand" href="/">SBT</a>
<ul class="nav">
- <li><a href="learn.html">Learn</a>
- <li><a href="download.html">Download</a>
- <li><a href="community.html">Community</a></li>
+ <li><a href="/learn.html">Learn</a>
+ <li><a href="/download.html">Download</a>
+ <li><a href="/community.html">Community</a></li>
<li><a href="#top">Top</a></li>
</ul>
</div>
@@ -17,4 +17,7 @@ <h2><span style="color:black;">sbt</span> {{page.title}}</h2>
</div>
-{% include footer.txt %}
+</body>
+</html>
+
+
@@ -0,0 +1,29 @@
+{% include header.txt %}
+
+{% include topbar.txt %}
+
+<div class="cf" id="container">
+ <div class="span2 columns container-spacer"><p>&nbsp;</p></div>
+ <div id="intro" class="span10 columns content">
+ <div id="head" class="cf">
+ <div id="name" class="left">
+ <h1>sbt</h1>
+ <h2>{{page.title}}</h2>
+ </div>
+ </div>
+ <div id="features" class="cf"><div id="feature-list">
+ <ul class="left">
+ {% for section in page.sections %}
+ <li id="feature"><h4><a href="#{{section.id}}">How to {{section.name}}</a></h4></li>
+ {% endfor %}
+ </ul>
+ </div></div>
+ <div id="pagecontent" class="cf">
+ {{ content }}
+ </div>
+ </div>
+ </div>
+</div>
+
+
+{% include footer.txt %}
@@ -28,6 +28,20 @@ toplinks:
*Note: Your code must abide by the [repository polices](repository-rules.html).*
+ To automatically deploy snapshot/release versions of your plugin use
+ the following configuration:
+
+ publishTo <<= (version) { version: String =>
+ val scalasbt = "http://scalasbt.artifactoryonline.com/scalasbt/"
+ val (name, url) = if (version.contains("-SNAPSHOT"))
+ ("sbt-plugin-snapshots", scalasbt+"sbt-plugin-snapshots")
+ else
+ ("sbt-plugin-releases", scalasbt+"sbt-plugin-releases")
+ Some(Resolver.url(name, new URL(url))(Resolver.ivyStylePatterns))
+ }
+
+ *Note: ivy repositories currently don't support Maven-style snapshots.*
+
- name: 'SBT Organization'
id: 'sbtorg'
content: |
@@ -38,7 +52,7 @@ toplinks:
control over their repository and its access. The Goal of the SBT organization is to
organize SBT software into one central location.
- A side benefit to using the SBT organization for projects is that you can us gh-pages to host websites in the http://scala-sbt.org domain.
+ A side benefit to using the SBT organization for projects is that you can use gh-pages to host websites in the http://scala-sbt.org domain.
- name: 'Community Plugin Build'
id: 'pluginbuild'
View
@@ -0,0 +1,23 @@
+---
+layout: content
+title: How to...
+description: How to do common tasks.
+---
+
+{% capture table %}
+{% for page in site.pages %}
+ {% if page.sections %}
+## [{{page.title}}]({{page.url}}) ##
+ {% for section in page.sections %}
+* [How to {{section.name}}]({{page.url | append: "#" | append: section.id}})
+ {% if section.short %} {{section.short | strip_newlines | markdownify}} {% endif %}
+ {% if section.batch %} {% highlight console %} $ sbt {{section.batch | strip_newlines}} {% endhighlight %}{% endif %}
+ {% if section.setting %} {% highlight scala %} {{section.setting | strip_newlines}} {% endhighlight %}{% endif %}
+ {% if section.command %} {% highlight console %} > {{section.command | strip_newlines}} {% endhighlight %}{% endif %}
+ {% if section.commands %} {% highlight console %} {{section.commands}} {% endhighlight %}{% endif %}
+ {% endfor %}
+ {% endif %}
+{% endfor %}
+{% endcapture %}
+
+{{ table | unindent | markdownify }}
@@ -0,0 +1,76 @@
+---
+layout: howto
+title: Generating files
+sections:
+ - id: sources
+ name: generate sources
+ setting: 'sourceGenerators in Compile <+= <your Task[Seq[File]] here>'
+ - id: resources
+ name: generate resources
+ setting: 'resourceGenerators in Compile <+= <your Task[Seq[File]] here>'
+---
+
+sbt provides standard hooks for adding source or resource generation tasks.
+
+<h4 id="sources">Generate sources</h4>
+
+A source generation task should generate sources in a subdirectory of `sourceManaged` and return a sequence of files generated. The key to add the task to is called `sourceGenerators`. It should be scoped according to whether the generated files are main (`Compile`) or test (`Test`) sources. This basic structure looks like:
+
+{% highlight scala %}
+sourceGenerators in Compile <+= <your Task[Seq[File]] here>
+{% endhighlight %}
+
+For example, assuming a method `def makeSomeSources(base: File): Seq[File]`,
+
+{% highlight scala %}
+sourceGenerators in Compile <+= sourceManaged in Compile map { outDir: File =>
+ makeSomeSources(outDir / "demo")
+}
+{% endhighlight %}
+
+As a specific example, the following generates a hello world source file:
+
+{% highlight scala %}
+sourceGenerators in Compile <+= sourceManaged in Compile map { dir =>
+ val file = dir / "demo" / "Test.scala"
+ IO.write(file, """object Test extends App { println("Hi") }""")
+ Seq(file)
+}
+{% endhighlight %}
+
+Executing 'run' will print "Hi". Change `Compile` to `Test` to make it a test source. For efficiency, you would only want to generate sources when necessary and not every run.
+
+By default, generated sources are not included in the packaged source artifact. To do so, add them as you would other mappings. See `Adding files to a package`.
+
+<h4 id="resources">Generate resources</h4>
+
+A resource generation task should generate resources in a subdirectory of `resourceManaged` and return a sequence of files generated. The key to add the task to is called `resourceGenerators`. It should be scoped according to whether the generated files are main (`Compile`) or test (`Test`) resources. This basic structure looks like:
+
+{% highlight scala %}
+resourceGenerators in Compile <+= <your Task[Seq[File]] here>
+{% endhighlight %}
+
+For example, assuming a method `def makeSomeResources(base: File): Seq[File]`,
+
+{% highlight scala %}
+resourceGenerators in Compile <+= resourceManaged in Compile map { outDir: File =>
+ makeSomeResources(outDir / "demo")
+}
+{% endhighlight %}
+
+As a specific example, the following generates a properties file containing the application name and version:
+
+{% highlight scala %}
+resourceGenerators in Compile <+=
+ (resourceManaged in Compile, name, version) map { (dir, n, v) =>
+ val file = dir / "demo" / "myapp.properties"
+ val contents = "name=%s\nversion=%s".format(n,v)
+ IO.write(file, contents)
+ Seq(file)
+ }
+}
+{% endhighlight %}
+
+Change `Compile` to `Test` to make it a test resource. Normally, you would only want to generate resources when necessary and not every run.
+
+By default, generated resources are not included in the packaged source artifact. To do so, add them as you would other mappings. See the `Adding files to a package` section.
Oops, something went wrong.

0 comments on commit 11ff5e6

Please sign in to comment.