Skip to content
This repository
Browse code

Update site release paradigm to make it easier for devs.

  • Loading branch information...
commit 18c4d3e46ceee9c63bfde74fcf6c2cbc432343ae 1 parent 2f2e769
Tom Preston-Werner authored

Showing 2 changed files with 22 additions and 14 deletions. Show diff stats Hide diff stats

  1. +1 0  .gitignore
  2. +21 14 Rakefile
1  .gitignore
@@ -10,4 +10,5 @@ logs
10 10 Gemfile.lock
11 11 bbin/
12 12 .bundle
  13 +site/index.html
13 14 gh-pages
35 Rakefile
@@ -92,16 +92,6 @@ end
92 92
93 93 desc "Generate the new-style site"
94 94 task :site do
95   - # Ensure the gh-pages dir exists so we can generate into it.
96   - puts "Checking for gh-pages dir..."
97   - unless File.exist?("./gh-pages")
98   - puts "No gh-pages directory found. Run the following commands first:"
99   - puts " `git clone git@github.com:mojombo/god gh-pages"
100   - puts " `cd gh-pages"
101   - puts " `git checkout gh-pages`"
102   - exit(1)
103   - end
104   -
105 95 # Generate the dynamic parts of the site.
106 96 puts "Generating dynamic..."
107 97 require 'gollum'
@@ -109,18 +99,35 @@ task :site do
109 99 html = wiki.page('god', 'HEAD').formatted_data.gsub("\342\200\231", "'")
110 100 template = File.read('./site/index.template.html')
111 101 index = template.sub("{{ content }}", html)
112   - File.open('./gh-pages/index.html', 'w') do |f|
  102 + File.open('./site/index.html', 'w') do |f|
113 103 f.write(index)
114 104 end
115 105
  106 + puts "Done. Opening in browser..."
  107 + sh "open site/index.html"
  108 +end
  109 +
  110 +desc "Generate the new-style site"
  111 +task :site_release do
  112 + # Ensure the gh-pages dir exists so we can generate into it.
  113 + puts "Checking for gh-pages dir..."
  114 + unless File.exist?("./gh-pages")
  115 + puts "No gh-pages directory found. Run the following commands first:"
  116 + puts " `git clone git@github.com:mojombo/god gh-pages"
  117 + puts " `cd gh-pages"
  118 + puts " `git checkout gh-pages`"
  119 + exit(1)
  120 + end
  121 +
116 122 # Copy the rest of the site over.
117 123 puts "Copying static..."
118 124 sh "cp -R site/* gh-pages/"
119 125
120   - puts "Done. Opening in browser..."
121   - sh "open gh-pages/index.html"
  126 + # Commit the changes
  127 + sha = `git log`.match(/[a-z0-9]{40}/)[0]
  128 + sh "cd gh-pages && git add . && git commit -m 'Updating to #{sha}.'"
  129 + puts 'Done.'
122 130 end
123   -
124 131 #############################################################################
125 132 #
126 133 # Packaging tasks

0 comments on commit 18c4d3e

Please sign in to comment.
Something went wrong with that request. Please try again.