mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Add a VERSION_NAME file.
This commit is contained in:
parent
a6bfe3f8a2
commit
7518015a1b
3 changed files with 11 additions and 6 deletions
5
Rakefile
5
Rakefile
|
@ -71,8 +71,9 @@ end
|
|||
|
||||
desc "Release a new Haml package to Rubyforge. Requires the NAME and VERSION flags."
|
||||
task :release => [:package] do
|
||||
name, version = ENV['NAME'], ENV['VERSION']
|
||||
raise "Must supply NAME and VERSION for release task." unless name && version
|
||||
name = File.read("VERSION_NAME").strip
|
||||
version = File.read("VERSION").strip
|
||||
raise "VERSION_NAME must not be 'Bleeding Edge'" if name == "Bleeding Edge"
|
||||
sh %{rubyforge login}
|
||||
sh %{rubyforge add_release haml haml "#{name} (v#{version})" pkg/haml-#{version}.gem}
|
||||
sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.tar.gz}
|
||||
|
|
1
VERSION_NAME
Normal file
1
VERSION_NAME
Normal file
|
@ -0,0 +1 @@
|
|||
Bleeding Edge
|
|
@ -10,6 +10,7 @@ module Haml
|
|||
|
||||
# Returns a hash representing the version of Haml.
|
||||
# The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Fixnums.
|
||||
# The `:name` key has the name of the version.
|
||||
# The `:string` key contains a human-readable string representation of the version.
|
||||
# If Haml is checked out from Git, the `:rev` key will have the revision hash.
|
||||
# For example:
|
||||
|
@ -20,15 +21,17 @@ module Haml
|
|||
# :major => 2, :minor => 1, :teeny => 0
|
||||
# }
|
||||
#
|
||||
# @return [Hash<Symbol, String/Symbol>] The version hash
|
||||
# @return [Hash<Symbol, String/Fixnum>] The version hash
|
||||
def version
|
||||
return @@version if defined?(@@version)
|
||||
|
||||
numbers = File.read(scope('VERSION')).strip.split('.').map { |n| n.to_i }
|
||||
name = File.read(scope('VERSION_NAME')).strip
|
||||
@@version = {
|
||||
:major => numbers[0],
|
||||
:minor => numbers[1],
|
||||
:teeny => numbers[2]
|
||||
:teeny => numbers[2],
|
||||
:name => name
|
||||
}
|
||||
@@version[:string] = [:major, :minor, :teeny].map { |comp| @@version[comp] }.compact.join('.')
|
||||
|
||||
|
@ -47,9 +50,9 @@ module Haml
|
|||
if rev
|
||||
@@version[:rev] = rev
|
||||
unless rev[0] == ?(
|
||||
@@version[:string] << "."
|
||||
@@version[:string] << rev[0...7]
|
||||
@@version[:string] << "." << rev[0...7]
|
||||
end
|
||||
@@version[:string] << " (#{name})"
|
||||
end
|
||||
|
||||
@@version
|
||||
|
|
Loading…
Add table
Reference in a new issue