public
Rubygem
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/chriseppstein/haml.git
Always create a REVISION file when building a package.
nex3 (author)
Thu Apr 24 21:30:48 -0700 2008
commit  9d942ca94e6a2784cd475defcf678446dba7b931
tree    f59323be080fffe3f3cad162d4967e8afeffc671
parent  a241cd4eb4681f473dc42a0976bc6d9146dee3c8
...
53
54
55
56
57
58
59
60
61
62
63
64
...
79
80
81
 
82
83
84
85
86
87
...
105
106
107
108
 
 
 
 
 
 
 
109
110
111
...
53
54
55
 
 
 
 
 
 
56
57
58
...
73
74
75
76
77
78
 
79
80
81
...
99
100
101
 
102
103
104
105
106
107
108
109
110
111
0
@@ -53,12 +53,6 @@ END
0
   require 'rake/gempackagetask'
0
   require 'lib/haml'
0
 
0
- # Before we run the package task,
0
- # we want to create a REVISION file
0
- # if we've checked out Haml from git
0
- # and we aren't building for a release.
0
- create_revision = Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
0
-
0
   spec = Gem::Specification.new do |spec|
0
     spec.name = 'haml'
0
     spec.summary = "An elegant, structured XHTML/XML templating engine.\nComes with Sass, a similar CSS templating engine."
0
@@ -79,9 +73,9 @@ END
0
     readmes = FileList.new('*') do |list|
0
       list.exclude(/(^|[^.a-z])[a-z]+/)
0
       list.exclude('TODO')
0
+ list.include('REVISION')
0
     end.to_a
0
     spec.executables = ['haml', 'html2haml', 'sass', 'css2sass']
0
- readmes << 'REVISION' if create_revision
0
     spec.files = FileList['lib/**/*', 'bin/*', 'test/**/*', 'Rakefile', 'init.rb'].to_a + readmes
0
     spec.autorequire = ['haml', 'sass']
0
     spec.homepage = 'http://haml.hamptoncatlin.com/'
0
@@ -105,7 +99,13 @@ END
0
 
0
   desc "This is an internal task."
0
   task :revision_file do
0
- File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] } if create_revision
0
+ if Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
0
+ File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] }
0
+ elsif Rake.application.top_level_tasks.include?('release')
0
+ File.open('REVISION', 'w') { |f| f.puts "(release)" }
0
+ else
0
+ File.open('REVISION', 'w') { |f| f.puts "(unknown)" }
0
+ end
0
   end
0
   Rake::Task[:package].prerequisites.insert(0, :revision_file)
0
 
...
937
938
939
940
 
 
 
 
941
942
943
...
937
938
939
 
940
941
942
943
944
945
946
0
@@ -937,7 +937,10 @@ module Haml
0
 
0
     if File.exists?(scope('REVISION'))
0
       rev = File.read(scope('REVISION')).strip
0
- elsif File.exists?(scope('.git/HEAD'))
0
+ rev = nil if rev !~ /a-f0-9+/
0
+ end
0
+
0
+ if rev.nil? && File.exists?(scope('.git/HEAD'))
0
       rev = File.read(scope('.git/HEAD')).strip
0
       if rev =~ /^ref: (.*)$/
0
         rev = File.read(scope(".git/#{$1}")).strip

Comments

    No one has commented yet.