vendor/bundle/ruby/1.8/gems/Ruby-MemCache-0.0.1/utils.rb
### Extract the project name (CVS Repository name) for the given +directory+.
Extract the project name (CVS Repository name) for the given +directory+.
Extract the project name ( CVS Repository name ) for the given + directory + .
def extractProjectName( directory='.' )
		name = nil
		Dir::chdir( directory ) do
			if File::directory?( "CVS" )
				verboseMsg( "Project is versioned via CVS. Using repository name." )
				name = File.open( "CVS/Repository", "r").readline.chomp
				name.sub!( %r{.*/}, '' )
			elsif File::directory?( '.svn' )
				verboseMsg( "Project is versioned via Subversion" )
				if (( svn = findProgram( 'svn' ) ))
					output = shellCommand( svn, 'pg', 'project-name' )
					if !output.empty?
						verboseMsg( "Using 'project-name' property: %p" % output )
						name = output.first.chomp
					elsif (( uri = getSvnUri() ))
						name = uri.path.sub( SVNUrlPath ) { $1 }
					end
				end
			end
			unless name
				name = File::basename(File::dirname( File::expand_path(__FILE__) ))
			end
		end
		return name
	end
def extractProjectName ( directory = '.' ) name = nil Dir :: chdir ( directory ) do if File :: directory? ( "CVS" ) verboseMsg ( "Project is versioned via CVS. Using repository name." ) name = File . open ( "CVS/Repository" , "r" ) . readline . chomp name . sub! ( %r{ .*/ } , '' ) elsif File :: directory? ( '.svn' ) verboseMsg ( "Project is versioned via Subversion" ) if ( ( svn = findProgram ( 'svn' ) ) ) output = shellCommand ( svn , 'pg' , 'project-name' ) if ! output . empty? verboseMsg ( "Using 'project-name' property: %p" % output ) name = output . first . chomp elsif ( ( uri = getSvnUri ( ) ) ) name = uri . path . sub ( SVNUrlPath ) { $1 } end end end unless name name = File :: basename ( File :: dirname ( File :: expand_path ( __FILE__ ) ) ) end end return name end
Extract the project name (CVS Repository name) for the given +directory+.
Extract the project name ( CVS Repository name ) for the given + directory + .
# CVS-controlled # Subversion-controlled # If the machine has the svn tool, try to get the project name # First try an explicit property # If that doesn't work, try to figure it out from the URL # Fall back to guessing based on the directory name
directory