vendor/bundle/ruby/1.8/gems/Ruby-MemCache-0.0.1/utils.rb
def extractVersion( directory='.' )
		release = nil

		Dir::chdir( directory ) do
			if File::directory?( "CVS" )
				verboseMsg( "Project is versioned via CVS. Searching for RELEASE_*_* tags..." )

				if (( cvs = findProgram('cvs') ))
					revs = []
					output = %x{cvs log}
					output.scan( /RELEASE_(\d+(?:_\d\w+)*)/ ) {|match|
						rev = $1.split(/_/).collect {|s| Integer(s) rescue 0}
						verboseMsg( "Found %s...\n" % rev.join('.') )
						revs << rev
					}

					release = revs.sort.last
				end

			elsif File::directory?( '.svn' )
				verboseMsg( "Project is versioned via Subversion" )

				if (( svn = findProgram('svn') ))
					output = %x{svn pg project-version}.chomp
					unless output.empty?
						verboseMsg( "Using 'project-version' property: %p" % output )
						release = output.split( /[._]/ ).collect {|s| Integer(s) rescue 0}
					end
				end
			end
		end

		return release
	end
### Search for the release version for the project in the specified
### +directory+.
Search for the release version for the project in the specified
+directory+.
Search for the release version for the project in the specified + directory + .
def extractVersion( directory='.' )
		release = nil
		Dir::chdir( directory ) do
			if File::directory?( "CVS" )
				verboseMsg( "Project is versioned via CVS. Searching for RELEASE_*_* tags..." )
				if (( cvs = findProgram('cvs') ))
					revs = []
					output = %x{cvs log}
					output.scan( /RELEASE_(\d+(?:_\d\w+)*)/ ) {|match|
						rev = $1.split(/_/).collect {|s| Integer(s) rescue 0}
						verboseMsg( "Found %s...\n" % rev.join('.') )
						revs << rev
					}
					release = revs.sort.last
				end
			elsif File::directory?( '.svn' )
				verboseMsg( "Project is versioned via Subversion" )
				if (( svn = findProgram('svn') ))
					output = %x{svn pg project-version}.chomp
					unless output.empty?
						verboseMsg( "Using 'project-version' property: %p" % output )
						release = output.split( /[._]/ ).collect {|s| Integer(s) rescue 0}
					end
				end
			end
		end
		return release
	end
def extractVersion ( directory = '.' ) release = nil Dir :: chdir ( directory ) do if File :: directory? ( "CVS" ) verboseMsg ( "Project is versioned via CVS. Searching for RELEASE_*_* tags..." ) if ( ( cvs = findProgram ( 'cvs' ) ) ) revs = [ ] output = %x{ cvs log } output . scan ( / RELEASE_( \d +(?:_ \d \w +)*) / ) { | match | rev = $1 . split ( / _ / ) . collect { | s | Integer ( s ) rescue 0 } verboseMsg ( "Found %s...\n" % rev . join ( '.' ) ) revs << rev } release = revs . sort . last end elsif File :: directory? ( '.svn' ) verboseMsg ( "Project is versioned via Subversion" ) if ( ( svn = findProgram ( 'svn' ) ) ) output = %x{ svn pg project-version } . chomp unless output . empty? verboseMsg ( "Using 'project-version' property: %p" % output ) release = output . split ( / [._] / ) . collect { | s | Integer ( s ) rescue 0 } end end end end return release end
Search for the release version for the project in the specified
+directory+.
Search for the release version for the project in the specified + directory + .
directory