Skip to content

Commit

Permalink
more gh-pages love
Browse files Browse the repository at this point in the history
  • Loading branch information
ot-matt-florence committed Apr 24, 2012
1 parent ee9a596 commit f4a1728
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions RakeFile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'nokogiri'
require 'cgi'
require 'date'
require 'zip/zipfilesystem'

desc 'build'
Expand Down Expand Up @@ -139,9 +140,16 @@ task :samples, :spec do |t,args|
sh "NSpecRunner/bin/debug/NSpecRunner.exe SampleSpecs/bin/debug/SampleSpecs.dll #{spec}"
end

desc 'supply the current tutorial markup in source.html and generate new.html containing current source code and output'
desc 'supply the current tutorial markup in index.html and generate a new index.html containing current source code and output'
task :website => :spec do
if File.exists? 'source.html'
`git checkout gh-pages`
`git pull origin gh-pages`
`git checkout master`
`git checkout gh-pages index.html`
if File.exists? 'index.html'

FileUtils.cp 'index.html', 'source.html'

@doc = Nokogiri::HTML.fragment(File.read 'source.html')

Dir['SampleSpecs/WebSite/**/*.*'].each {|f| generate_html f}
Expand All @@ -156,8 +164,19 @@ task :website => :spec do

File.open('new.html', 'w') {|f| f.write(@doc) }
else
puts 'you must download the current markup into source.html'
puts 'you must download the current markup into index.html'
end

version = get_version_node.text

`git checkout gh-pages`

FileUtils.cp 'new.html', 'index.html'

`git add index.html`
`git commit -m "#{version} #{DateTime.now}`
#`git push`
#`git checkout master`
end

def generate_html file
Expand Down

0 comments on commit f4a1728

Please sign in to comment.