Sha256: d5e5e28d7cef34380e2b07a550171a4e744286e0a91b0abd01ee2930025ba0f6

Contents?: true

Size: 575 Bytes

Versions: 5

Compression:

Stored size: 575 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'pathname'

module PathCommon
	# 给定相对项目根目录路径,返回绝对路径
	def project_file(path)
		join(project_dir,path)
	end
	# 返回项目绝对目录
  def project_dir
    absolute_path("#{File.dirname(__FILE__)}/../../")
  end
  def absolute_path(path,dir=Dir.pwd)
  	Pathname.new(path).relative? ? File.expand_path(path,dir) : File.expand_path(path,"/")
  end
  # require file from project dir
  def require_p(path)
    require join(project_dir,path)
  end
  def join(path,file=".")
	  File.join(path,file)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-hack-0.0.6 lib/core_ext/path.rb
git-hack-0.0.5 lib/core_ext/path.rb
git-hack-0.0.3 lib/core_ext/path.rb
git-hack-0.0.2 lib/core_ext/path.rb
git-hack-0.0.1 lib/core_ext/path.rb