Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 38 additions & 35 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -290,45 +290,48 @@ namespace :todo do
end
end if File.exists?(File.join(library_root, 'TODO'))

namespace :site do
require 'erb'
require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'

readme = lambda { IO.read('README')[/^== Getting started\n(.*)/m, 1] }
begin
namespace :site do
require 'erb'
require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_html'

readme = lambda { IO.read('README')[/^== Getting started\n(.*)/m, 1] }

readme_to_html = lambda do
handler = SM::ToHtml.new
handler.instance_eval do
require 'syntax'
require 'syntax/convertors/html'
def accept_verbatim(am, fragment)
syntax = Syntax::Convertors::HTML.for_syntax('ruby')
@res << %(<div class="ruby">#{syntax.convert(fragment.txt, true)}</div>)
readme_to_html = lambda do
handler = SM::ToHtml.new
handler.instance_eval do
require 'syntax'
require 'syntax/convertors/html'
def accept_verbatim(am, fragment)
syntax = Syntax::Convertors::HTML.for_syntax('ruby')
@res << %(<div class="ruby">#{syntax.convert(fragment.txt, true)}</div>)
end
end
SM::SimpleMarkup.new.convert(readme.call, handler)
end
SM::SimpleMarkup.new.convert(readme.call, handler)
end

desc 'Regenerate the public website page'
task :build => 'doc:readme' do
open('site/public/index.html', 'w') do |file|
erb_data = {}
erb_data[:readme] = readme_to_html.call
file.write ERB.new(IO.read('site/index.erb')).result(binding)

desc 'Regenerate the public website page'
task :build => 'doc:readme' do
open('site/public/index.html', 'w') do |file|
erb_data = {}
erb_data[:readme] = readme_to_html.call
file.write ERB.new(IO.read('site/index.erb')).result(binding)
end
end

task :refresh => :build do
system 'open site/public/index.html'
end

desc 'Update the live website'
task :deploy => :build do
site_files = FileList['site/public/*']
site_files.delete_if {|file| File.directory?(file)}
sh %(scp #{site_files.join ' '} [email protected]:/var/www/gforge-projects/amazon/)
end
end

task :refresh => :build do
system 'open site/public/index.html'
end

desc 'Update the live website'
task :deploy => :build do
site_files = FileList['site/public/*']
site_files.delete_if {|file| File.directory?(file)}
sh %(scp #{site_files.join ' '} [email protected]:/var/www/gforge-projects/amazon/)
end
end
rescue LoadError
end

task :clean => ['dist:clobber_package', 'doc:clobber_rdoc', 'test:clobber_coverage']
3 changes: 2 additions & 1 deletion test/extensions_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
require File.dirname(__FILE__) + '/test_helper'

class HashExtensionsTest < Test::Unit::TestCase
Expand Down Expand Up @@ -342,4 +343,4 @@ def test_setting_the_proxy_as_non_exclusive

assert_equal 'baz', n.foo
end
end
end