Proper version tracking that is compatible with jeweler.
This commit is contained in:
parent
b2d2d46d58
commit
7a3bc728f1
27
Rakefile
27
Rakefile
@ -60,6 +60,25 @@ rescue LoadError
|
|||||||
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Record the current git revision."
|
||||||
|
task :REVISION do
|
||||||
|
require 'git'
|
||||||
|
|
||||||
|
repo = Git.open('.')
|
||||||
|
open("REVISION", "w") do |f|
|
||||||
|
f.write(repo.object("HEAD").sha)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Commit the revision file."
|
||||||
|
task :commit_revision => :REVISION do
|
||||||
|
require 'git'
|
||||||
|
repo = Git.open('.')
|
||||||
|
repo.add("REVISION")
|
||||||
|
repo.commit("Record current revision for release.")
|
||||||
|
end
|
||||||
|
|
||||||
|
task :release => :commit_revision
|
||||||
|
|
||||||
desc "Compile Examples into HTML and CSS"
|
desc "Compile Examples into HTML and CSS"
|
||||||
task :examples do
|
task :examples do
|
||||||
@ -92,15 +111,7 @@ task :examples do
|
|||||||
end
|
end
|
||||||
|
|
||||||
namespace :git do
|
namespace :git do
|
||||||
desc "Perform normal operations required for pushing to github."
|
|
||||||
task :push => [:manifest, :gem] do
|
|
||||||
sh "git", "add", "Manifest", "compass.gemspec", "VERSION"
|
|
||||||
sh "git", "commit", "-m", "Updated Manifest and gemspec."
|
|
||||||
sh "git", "push", "origin", "master"
|
|
||||||
end
|
|
||||||
task :clean do
|
task :clean do
|
||||||
sh "git", "clean", "-fdx"
|
sh "git", "clean", "-fdx"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task :manifest => :"git:clean"
|
|
@ -12,7 +12,6 @@ module Compass
|
|||||||
return @version if defined?(@version)
|
return @version if defined?(@version)
|
||||||
|
|
||||||
read_version_file
|
read_version_file
|
||||||
parse_version
|
|
||||||
|
|
||||||
if r = revision
|
if r = revision
|
||||||
@version[:rev] = r
|
@version[:rev] = r
|
||||||
@ -29,17 +28,10 @@ module Compass
|
|||||||
end
|
end
|
||||||
|
|
||||||
def read_version_file
|
def read_version_file
|
||||||
@version = {
|
require 'yaml'
|
||||||
:string => File.read(scope('VERSION')).strip
|
@version = YAML::load(File.read(scope('VERSION.yml')))
|
||||||
}
|
@version[:string] = "#{@version[:major]}.#{@version[:minor]}.#{@version[:patch]}"
|
||||||
end
|
@version[:teeny] = @version[:patch]
|
||||||
|
|
||||||
def parse_version
|
|
||||||
dotted_string, @version[:label] = @version[:string].split(/-/, 2)
|
|
||||||
numbers = dotted_string.split('.').map { |n| n.to_i }
|
|
||||||
[:major, :minor, :teeny].zip(numbers).each do |attr, value|
|
|
||||||
@version[attr] = value
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def revision
|
def revision
|
||||||
|
Loading…
Reference in New Issue
Block a user