1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Merge branch 'master' into yard

This commit is contained in:
Nathan Weizenbaum 2009-04-30 12:54:30 -07:00
commit 21560bc4af
4 changed files with 67 additions and 6 deletions

View file

@ -48,9 +48,10 @@ end
task :revision_file do
require 'lib/haml'
if Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
release = Rake.application.top_level_tasks.include?('release') || File.exist?('EDGE_GEM_VERSION')
if Haml.version[:rev] && !release
File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] }
elsif Rake.application.top_level_tasks.include?('release')
elsif release
File.open('REVISION', 'w') { |f| f.puts "(release)" }
else
File.open('REVISION', 'w') { |f| f.puts "(unknown)" }
@ -79,6 +80,46 @@ task :release => [:package] do
sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.zip}
end
task :release_edge do
sh %{git checkout edge-gem}
sh %{git fetch origin}
sh %{git merge origin/edge-gem}
sh %{git merge origin/master}
# Get the current master branch version
version = File.read('VERSION').strip.split('.').map {|n| n.to_i}
unless version[1] % 2 == 1 && version[2] == 0
raise "#{version.join('.')} is not a development version"
end
# Bump the edge gem version
edge_version = File.read('EDGE_GEM_VERSION').strip.split('.').map {|n| n.to_i}
if edge_version[0..1] != version[0..1]
# A new master branch version was released, reset the edge gem version
edge_version[0..1] = version[0..1]
edge_version[2] = 0
else
# Just bump the teeny version
edge_version[2] += 1
end
edge_version = edge_version.join('.')
File.open('EDGE_GEM_VERSION', 'w') {|f| f.puts(edge_version)}
sh %{git commit -m "Bump edge gem version." EDGE_GEM_VERSION}
sh %{git push origin edge-gem}
# Package the edge gem with the proper version
File.open('VERSION', 'w') {|f| f.puts(edge_version)}
sh %{rake package}
sh %{git checkout VERSION}
sh %{rubyforge login}
sh %{rubyforge add_release haml haml-edge "Bleeding Edge (v#{edge_version})" pkg/haml-edge-#{edge_version}.gem}
end
task :watch_for_edge_update do
sh %{ruby extra/edge_gem_watch.rb}
end
# ----- Documentation -----
task :rdoc do

13
extra/edge_gem_watch.rb Normal file
View file

@ -0,0 +1,13 @@
require 'rubygems'
require 'sinatra'
require 'json'
set :port, 3123
set :environment, :production
Dir.chdir(File.dirname(__FILE__) + "/..")
post "/" do
payload = JSON.parse(params["payload"])
break unless payload["ref"] == "refs/heads/master"
system("rake release_edge &> edge-gem-output.log")
end

View file

@ -1,8 +1,13 @@
require 'rubygems'
require 'rake'
# Note that Haml's gem-compilation process requires access to the filesystem.
# This means that it cannot be automatically run by e.g. GitHub's gem system.
# However, a build server automatically packages the master branch
# every time it's pushed to; this is made available as the haml-edge gem.
HAML_GEMSPEC = Gem::Specification.new do |spec|
spec.rubyforge_project = spec.name = 'haml'
spec.rubyforge_project = 'haml'
spec.name = File.exist?('EDGE_GEM_VERSION') ? 'haml-edge' : 'haml'
spec.summary = "An elegant, structured XHTML/XML templating engine.\nComes with Sass, a similar CSS templating engine."
spec.version = File.read('VERSION').strip
spec.authors = ['Nathan Weizenbaum', 'Hampton Catlin']

View file

@ -4,13 +4,15 @@ require 'strscan'
module Haml
# This module contains functionality that's shared across Haml and Sass.
module Shared
def self.handle_interpolation(str)
extend self
def handle_interpolation(str)
scan = StringScanner.new(str)
yield scan while scan.scan(/(.*?)(\\*)\#\{/)
scan.rest
end
def self.balance(scanner, start, finish, count = 0)
def balance(scanner, start, finish, count = 0)
str = ''
scanner = StringScanner.new(scanner) unless scanner.is_a? StringScanner
regexp = Regexp.new("(.*?)[\\#{start.chr}\\#{finish.chr}]", Regexp::MULTILINE)
@ -22,7 +24,7 @@ module Haml
end
end
def self.human_indentation(indentation, was = false)
def human_indentation(indentation, was = false)
if !indentation.include?(?\t)
noun = 'space'
elsif !indentation.include?(?\s)