You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/09/21 08:56:28 UTC

svn commit: r1388348 - in /buildr/trunk: CHANGELOG addon/buildr/git_auto_version.rb

Author: donaldp
Date: Fri Sep 21 06:56:28 2012
New Revision: 1388348

URL: http://svn.apache.org/viewvc?rev=1388348&view=rev
Log:
Create the git_auto_aversion addon that automatically specifies a version for a git project based on git describe

Added:
    buildr/trunk/addon/buildr/git_auto_version.rb
Modified:
    buildr/trunk/CHANGELOG

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1388348&r1=1388347&r2=1388348&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri Sep 21 06:56:28 2012
@@ -1,4 +1,6 @@
 1.4.8 (Pending)
+* Added:  Create the git_auto_aversion addon that automatically specifies a version for a git project based
+          on git describe.
 * Added:   Integrate with Zinc (incremental compilation wrapper for scalac 2.9+)
 * Changed: Default to Scala 2.9.2, ScalaTest 1.8, Scala Specs2 1.11,
            ScalaCheck 1.10.0.

Added: buildr/trunk/addon/buildr/git_auto_version.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/addon/buildr/git_auto_version.rb?rev=1388348&view=auto
==============================================================================
--- buildr/trunk/addon/buildr/git_auto_version.rb (added)
+++ buildr/trunk/addon/buildr/git_auto_version.rb Fri Sep 21 06:56:28 2012
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+module Buildr
+  module GitAutoVersion
+    module ProjectExtension
+      include Extension
+
+      before_define do |project|
+        unless project.version
+          version_suffix = ENV['BUILD_NUMBER'] ? "-#{ENV['BUILD_NUMBER']}" : ''
+          project.version = `git describe --tags --always`.strip + version_suffix
+        end
+      end
+    end
+  end
+end
+
+class Buildr::Project
+  include Buildr::GitAutoVersion::ProjectExtension
+end
\ No newline at end of file