From 0a626fdcdd89c57769bf626b5c0ab7634f9cdd39 Mon Sep 17 00:00:00 2001 From: Karel Minarik Date: Sun, 2 Jan 2011 00:39:56 +0100 Subject: [PATCH] Added endpoint for building Rails guides from HTTP hook --- Gemfile | 6 ++++++ application.rb | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/Gemfile b/Gemfile index ee84871..dd7d272 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,9 @@ source 'http://rubygems.org' gem 'rake' gem 'sinatra' + +group :guides do + gem 'RedCloth' + gem 'i18n' + gem 'erubis' +end diff --git a/application.rb b/application.rb index 21ee786..285ae30 100644 --- a/application.rb +++ b/application.rb @@ -12,6 +12,17 @@ class Application < Sinatra::Base username == Config::USERNAME && password == Config::PASSWORD end + post '/build' do + cmd = [] + cmd << "cd #{Config::GUIDES}" + cmd << "rm -rf output/cz" + cmd << "git fetch origin" + cmd << "git reset origin/czech --hard" + cmd << "rake generate_guides ONLY=getting_started LANG=cz" + puts "Running command: " + cmd.join(' && ') + system cmd.join(' && ') + end + end end