mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Always create a REVISION file when building a package.
This commit is contained in:
parent
a241cd4eb4
commit
9d942ca94e
2 changed files with 12 additions and 9 deletions
16
Rakefile
16
Rakefile
|
@ -53,12 +53,6 @@ END
|
|||
require 'rake/gempackagetask'
|
||||
require 'lib/haml'
|
||||
|
||||
# Before we run the package task,
|
||||
# we want to create a REVISION file
|
||||
# if we've checked out Haml from git
|
||||
# and we aren't building for a release.
|
||||
create_revision = Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
|
||||
|
||||
spec = Gem::Specification.new do |spec|
|
||||
spec.name = 'haml'
|
||||
spec.summary = "An elegant, structured XHTML/XML templating engine.\nComes with Sass, a similar CSS templating engine."
|
||||
|
@ -79,9 +73,9 @@ END
|
|||
readmes = FileList.new('*') do |list|
|
||||
list.exclude(/(^|[^.a-z])[a-z]+/)
|
||||
list.exclude('TODO')
|
||||
list.include('REVISION')
|
||||
end.to_a
|
||||
spec.executables = ['haml', 'html2haml', 'sass', 'css2sass']
|
||||
readmes << 'REVISION' if create_revision
|
||||
spec.files = FileList['lib/**/*', 'bin/*', 'test/**/*', 'Rakefile', 'init.rb'].to_a + readmes
|
||||
spec.autorequire = ['haml', 'sass']
|
||||
spec.homepage = 'http://haml.hamptoncatlin.com/'
|
||||
|
@ -105,7 +99,13 @@ END
|
|||
|
||||
desc "This is an internal task."
|
||||
task :revision_file do
|
||||
File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] } if create_revision
|
||||
if Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
|
||||
File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] }
|
||||
elsif Rake.application.top_level_tasks.include?('release')
|
||||
File.open('REVISION', 'w') { |f| f.puts "(release)" }
|
||||
else
|
||||
File.open('REVISION', 'w') { |f| f.puts "(unknown)" }
|
||||
end
|
||||
end
|
||||
Rake::Task[:package].prerequisites.insert(0, :revision_file)
|
||||
|
||||
|
|
|
@ -937,7 +937,10 @@ module Haml
|
|||
|
||||
if File.exists?(scope('REVISION'))
|
||||
rev = File.read(scope('REVISION')).strip
|
||||
elsif File.exists?(scope('.git/HEAD'))
|
||||
rev = nil if rev !~ /a-f0-9+/
|
||||
end
|
||||
|
||||
if rev.nil? && File.exists?(scope('.git/HEAD'))
|
||||
rev = File.read(scope('.git/HEAD')).strip
|
||||
if rev =~ /^ref: (.*)$/
|
||||
rev = File.read(scope(".git/#{$1}")).strip
|
||||
|
|
Loading…
Reference in a new issue