Permalink
Browse files

initial Awestruct-based site and build

  • Loading branch information...
1 parent 15c55c6 commit 9e564416cec50041c8fd26a69814ea370a26ef12 @mojavelinux mojavelinux committed Mar 21, 2013
Showing with 19,350 additions and 1 deletion.
  1. +6 −0 .awestruct_ignore
  2. +6 −1 .gitignore
  3. +1 −0 .rvmrc
  4. +11 −0 .travis.yml
  5. +1 −0 CNAME
  6. +31 −0 Gemfile
  7. +103 −0 README.adoc
  8. +118 −0 Rakefile
  9. +694 −0 _archive/asciidoctor-announcement.html
  10. +31 −0 _config/site.yml
  11. +19 −0 _ext/pipeline.rb
  12. +151 −0 _layouts/base.html.slim
  13. +42 −0 _layouts/feed.atom.haml
  14. +5 −0 _layouts/post.html.slim
  15. +10 −0 _layouts/press.html.slim
  16. +25 −0 _partials/entry.html.slim
  17. +8 −0 _partials/pager.html.slim
  18. +69 −0 _partials/pagination.html.slim
  19. +156 −0 docs/asciidoc-quick-reference.adoc
  20. +303 −0 docs/asciidoc-recommended-practices.adoc
  21. +2,087 −0 docs/asciidoc-writers-guide.adoc
  22. +18 −0 docs/index.adoc
  23. BIN fonts/fontawesome-webfont.eot
  24. BIN fonts/fontawesome-webfont.ttf
  25. BIN fonts/fontawesome-webfont.woff
  26. +17 −0 humans.txt
  27. BIN images/icons/caution.png
  28. BIN images/icons/important.png
  29. BIN images/icons/note.png
  30. BIN images/icons/tip.png
  31. BIN images/icons/warning.png
  32. BIN images/octocat.jpg
  33. +400 −0 index.adoc
  34. +372 −0 javascripts/foundation/foundation.js
  35. +225 −0 javascripts/foundation/foundation.topbar.js
  36. +4 −0 javascripts/vendor/custom.modernizr.js
  37. +1 −0 javascripts/vendor/highlight.min.js
  38. +9,597 −0 javascripts/vendor/jquery.js
  39. +1,884 −0 javascripts/vendor/zepto.js
  40. +163 −0 man/asciidoctor.adoc
  41. +7 −0 news.html.slim
  42. +6 −0 news/_index.adoc
  43. +154 −0 news/asciidoc-return-to-github.adoc
  44. +153 −0 news/asciidoctor-announcement.adoc
  45. +4 −0 robots.txt
  46. +534 −0 stylesheets/_font-awesome.scss
  47. +396 −0 stylesheets/_normalize.scss
  48. +1,031 −0 stylesheets/_settings.scss
  49. +1 −0 stylesheets/highlightjs-github.min.css
  50. +506 −0 stylesheets/styles.scss
View
@@ -0,0 +1,6 @@
+README.adoc
+Gemfile
+Gemfile.lock
+Rakefile
+publish
+TODO
View
@@ -1 +1,6 @@
-/Gemfile.lock
+/_site/
+/.awestruct/
+/.sass-cache/
+/_tmp/
+Gemfile.lock
+TODO
View
@@ -0,0 +1 @@
+rvm use 1.9.3@awestruct-site --create
View
@@ -0,0 +1,11 @@
+language: ruby
+rvm:
+ - 1.9.3
+# - 2.0.0
+env:
+ global:
+ secure: "bc8N2hVcc1Sl5Bs2Y+EDYiazosWzOTC68fWM5BToBuXSNjukYxbeOngKTsCN\nVGiKxEy2+1Wsf+YDV0Y2Z/TibFT7FHq+qXvniZLWLJOsXZJT3MR8SbbzW3dt\nClWN+4ypIgwE42nnQ+sH9F8Fvib8xzN0/UKoH6ppntAv6yfSnIc="
+branches:
+ only:
+ - develop
+script: rake travis
View
@@ -0,0 +1 @@
+asciidoctor.org
View
@@ -0,0 +1,31 @@
+# This is a bundler configuration file (http://gembundler.com).
+#
+# Bundler makes it easy to make sure that your application has the dependencies
+# it needs to start up and run without errors. It locates and installs the gems
+# and their dependencies listed in this file, Gemfile.
+#
+# After installing any needed gems to your system, bundler writes a snapshot of
+# all of the gems and versions that it installed to Gemfile.lock.
+#
+# Gemfile.lock makes your application a single package of both your own code
+# and the third-party code so it remains stable in a known working state.
+
+source 'https://rubygems.org'
+
+gem 'awestruct', '0.5.0.cr'
+#gem 'awestruct', :git => 'git://github.com/awestruct/awestruct.git', :branch => 'master'
+#gem 'awestruct', :git => 'git://github.com/mojavelinux/awestruct.git', :branch => 'integrate'
+gem 'asciidoctor', '0.1.1'
+gem 'erubis', '2.7.0'
+gem 'haml', '3.1.8'
+gem 'slim', '2.0.0.pre.6'
+gem 'zurb-foundation'
+gem 'jruby-openssl', '0.7.7', :platforms => :jruby
+gem 'rb-inotify', '0.8.8', :platforms => [:ruby, :jruby]
+gem 'tzinfo', '0.3.35'
+gem 'uglifier', '1.3.0'
+gem 'htmlcompressor', '0.0.3'
+gem 'git', '1.2.5', :group => :test
+gem 'rake', '10.0.3', :group => :test
+gem 'rdoc', '4.0.0', :group => :test
+gem 'tomdoc', '0.2.5', :group => :test
View
@@ -0,0 +1,103 @@
+= asciidoctor.org image:https://secure.travis-ci.org/asciidoctor/asciidoctor.github.com.png?branch=develop["Build Status", link="https://travis-ci.org/asciidoctor/asciidoctor.github.com"]
+
+Project site for http://asciidoctor.org[Asciidoctor], baked with Awestruct and published by Travis CI.
+
+For instructions on how to install Awestruct and its dependencies, refer to the section xref:install-awestruct[Install Awestruct] below.
+
+== Preview the site locally
+
+To preview the site locally, simply run the default rake build task:
+
+ rake
+
+The default rake build task is +preview+, so you're effectively typing:
+
+ rake preview
+
+The +preview+ task is just a short way of invoking Awestruct in development mode directly:
+
+ awestruct -d
+
+Now visit http://localhost:4242 to preview the site.
+
+To rebuild the site from a clean state, pass the +--force+ flag to the +preview+ task:
+
+ rake preview[--force]
+
+You can pass any flag through to Awestruct using the syntax in the previous command.
+
+If you just want to generate the site, run:
+
+ rake gen
+
+=== Set the JavaScript runtime
+
+If you're building the site on Linux and Awestruct fails to locate a JavaScript runtime, you can either:
+
+. install a node.js package or
+. set the following environment variable in your shell profile scripts (e.g., +~/.bash_profile+):
+
+ export EXECJS_RUNTIME=SpiderMonkey
+
+== Add and commit files
+
+Add new files (such as a new blog entry or image):
+
+ git add news/news-slug.adoc
+
+or all new files present in a directory (it only affects new files, skips files already committed)
+
+ git add news/
+
+Commit all files marked to be committed, including new files that were just added:
+
+ git commit -m 'your message here'
+
+Commit all files that have changed, even if not marked to be committed:
+
+ git commit -a -m 'your message here'
+
+Make sure there are no files that are "untracked" or "modified":
+
+ git status
+
+You should see:
+
+ nothing to commit (working directory clean)
+
+Now you are ready to deploy.
+
+== Deploy the site to GitHub Pages
+
+The following commands will push changes (+git push+), clean build the site (+--force -g+) using the production profile (+-P production+), then deploy it to github pages (+--deploy+):
+
+ git push
+ awestruct -P production --force -g --deploy
+
+Or simply run the prepared rake build task (to deploy locally):
+
+ rake deploy
+
+Or just push and let https://travis-ci.org/asciidoctor/asciidoctor.github.com[Travis CI] do the work of deploying the site:
+
+ rake push
+
+If you want to push without triggering a publish, add the following to the commit message:
+
+ [ci skip]
+
+== Install Awestruct
+
+First, install http://rvm.io[RVM]. Trust me on this.
+
+ $ curl -#L https://get.rvm.io | bash -s stable --ruby
+
+Next, setup an RVM gemset for working with the Asciidoctor site:
+
+ $ rvm use 1.9.3@asciidoctor-site --create
+
+At this point, you could install Awestruct directly, but since the site build has some additional dependencies, it's best to let bundler handle the installation. Bundler will also ensure that you are using the correct versions of each gem when you run Awestruct.
+
+ $ bundle install
+
+You're now Awestruct!
View
@@ -0,0 +1,118 @@
+require 'rubygems'
+
+task :default => :preview
+
+desc 'Preview the site locally in development mode'
+task :preview, [:flags] do |t, args|
+ cmd = 'bundle exec awestruct -d'
+ if (args[:flags])
+ cmd = "#{cmd} #{args[:flags]}"
+ end
+ system cmd
+end
+
+desc 'Generate the site using the development profile'
+task :gen, [:flags] do |t, args|
+ cmd = 'bundle exec awestruct -P development -g'
+ if (args[:flags])
+ cmd = "#{cmd} #{args[:flags]}"
+ end
+ system cmd
+end
+
+desc 'Push local commits to origin/develop'
+task :push do
+ system 'git push origin develop'
+end
+
+desc 'Generate and publish site to production (GitHub Pages) from home'
+task :deploy => :push do
+ system 'bundle exec awestruct -P production --force -g'
+ gen_rdoc
+ system 'bundle exec awestruct -P production --deploy'
+end
+
+desc 'Generate site from Travis CI and, if not a pull request, publish site to production (GitHub Pages)'
+task :travis do
+ # if this is a pull request, do a simple build of the site and stop
+ if ENV['TRAVIS_PULL_REQUEST'] == '1' || ENV['TRAVIS_PULL_REQUEST'] == 'true'
+ system 'bundle exec awestruct -P production -g'
+ next
+ end
+
+ require 'yaml'
+ require 'fileutils'
+
+ # TODO use the Git library for these commands rather than system
+ repo = %x(git config remote.origin.url).gsub(/^git:/, 'https:')
+ system "git remote set-url --push origin #{repo}"
+ system 'git remote set-branches --add origin master'
+ system 'git fetch -q'
+ system "git config user.name '#{ENV['GIT_NAME']}'"
+ system "git config user.email '#{ENV['GIT_EMAIL']}'"
+ system 'git config credential.helper "store --file=.git/credentials"'
+ # CREDENTIALS assigned by a Travis CI Secure Environment Variable
+ # see http://about.travis-ci.org/docs/user/build-configuration/#Secure-environment-variables for details
+ File.open('.git/credentials', 'w') {|f| f.write("https://#{ENV['GH_TOKEN']}:@github.com") }
+ set_pub_dates 'develop'
+ system 'git branch master origin/master'
+ system 'bundle exec awestruct -P production -g'
+ gen_rdoc
+ system 'bundle exec awestruct -P production --deploy'
+ File.delete '.git/credentials'
+end
+
+desc "Assign publish dates to news entries"
+task :setpub do
+ set_pub_dates 'develop'
+end
+
+def gen_rdoc
+ require 'fileutils'
+ asciidoctor_dir = %x(bundle show asciidoctor).chomp
+ asciidoctor_ver = asciidoctor_dir.split('-').last
+ system %(rdoc -m README.asciidoc -t "API Documentation for Asciidoctor #{asciidoctor_ver}" --markup tomdoc -o rdoc README.* lib), :chdir => asciidoctor_dir
+ FileUtils.mv "#{asciidoctor_dir}/rdoc", '_site/rdoc'
+end
+
+def set_pub_dates(branch)
+ require 'tzinfo'
+ require 'git'
+ local_tz = IO.readlines('_config/site.yml').find {|l| l.start_with?('local_tz: ') }.chomp.sub('local_tz: ', '')
+ local_tz = TZInfo::Timezone.get(local_tz)
+
+ repo = nil
+
+ Dir['news/*.adoc'].select {|e| !e.start_with? 'news/_'}.each do |e|
+ lines = IO.readlines e
+ header = lines.inject([]) {|collector, l|
+ break collector if l.chomp.empty?
+ collector << l
+ collector
+ }
+
+ do_commit = false
+ if !header.detect {|l| l.start_with?(':revdate: ') || l.start_with?(':awestruct-draft:') || l.start_with?(':awestruct-layout:') }
+ revdate = Time.now.utc.getlocal(local_tz.current_period.utc_total_offset)
+ lines[2] = "#{revdate.strftime('%Y-%m-%d')}\n"
+ lines.insert(3, ":revdate: #{revdate}\n")
+ File.open(e, 'w') {|f|
+ f.write(lines.join)
+ }
+ if !repo
+ repo = Git.open('.')
+ b = repo.branch(branch)
+ b.remote = 'origin/develop'
+ b.create
+ b.checkout
+ end
+ repo.add(e)
+ repo.commit "Set publish date of post #{e}"
+ do_commit = true
+ end
+
+ if do_commit
+ repo.push('origin', branch)
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 9e56441

Please sign in to comment.