Don't fail if we can't write REVISION in haml.gemspec.

This commit is contained in:
Nathan Weizenbaum 2010-03-18 02:00:50 -07:00
parent a02519e9ff
commit 3e21850960
3 changed files with 18 additions and 5 deletions

View File

@ -14,6 +14,8 @@
* Make sure line numbers are reported correctly when filters are being used.
* Make loading the gemspec not crash on read-only filesystems like Heroku's.
## 2.2.21
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.21).

View File

@ -8,6 +8,8 @@
* Add a railtie so Haml and Sass will be automatically loaded in Rails 3.
Thanks to [Daniel Neighman](http://pancakestacks.wordpress.com/).
* Make loading the gemspec not crash on read-only filesystems like Heroku's.
## 2.2.21
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.21).

View File

@ -25,14 +25,23 @@ HAML_GEMSPEC = Gem::Specification.new do |spec|
spec.add_development_dependency 'yard', '>= 0.5.3'
spec.add_development_dependency 'maruku', '>= 0.5.9'
# We need the revision file to exist,
# so we just create it if it doesn't.
# It'll usually just get overwritten, though.
File.open('REVISION', 'w') { |f| f.puts "(unknown)" } unless File.exist?('REVISION')
have_revision = true
unless File.exist?('REVISION')
begin
# We need the revision file to exist,
# so we just create it if it doesn't.
# It'll usually just get overwritten, though.
File.open('REVISION', 'w') { |f| f.puts "(unknown)" }
rescue
# If the file can't be created (e.g. on Heroku) continue without it
have_revision = false
end
end
readmes = FileList.new('*') do |list|
list.exclude(/(^|[^.a-z])[a-z]+/)
list.exclude('TODO')
list.include('REVISION')
list.include('REVISION') if have_revision
end.to_a
spec.executables = ['haml', 'html2haml', 'sass', 'css2sass']
spec.files = FileList['rails/init.rb', 'lib/**/*', 'bin/*', 'test/**/*',