class ActionScriptVersion::Task
Attributes
major[RW]
minor[RW]
output[RW]
patch[RW]
strip_xml_comments[RW]
template[RW]
Public Class Methods
new(name = :version) { |self| ... }
click to toggle source
# File lib/shed/rake/version.rb, line 12 def initialize name = :version @name = name @output = 'Version.as' @strip_xml_comments = false yield self if block_given? define end
Public Instance Methods
define()
click to toggle source
# File lib/shed/rake/version.rb, line 22 def define desc "Generate a ActionScript class containing application version details" task @name do revision = `git rev-parse HEAD`.chomp rescue 'no-git-rev' t = File.read(@template) t.gsub!('@major@', major.to_s) t.gsub!('@minor@', minor.to_s) t.gsub!('@patch@', patch.to_s) t.gsub!('@revision@', revision) t = Stripper.xml_comments(t) if @strip_xml_comments File.open(@output, 'w') {|f| f.write(t) } puts "Created #{output}, v#{major}.#{minor}.#{patch} [#{revision[0..10]}]" end end
Private Instance Methods
to_hash()
click to toggle source
# File lib/shed/rake/version.rb, line 41 def to_hash { :major => major, :minor => minor, :patch => patch, :template => template, :output => output } end