Sha256: e41832912a2f68d11e0263240346a6190e528cd275ac1416503e35b0d9c8c3b0

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

class Pa
module State

	# @see File.chmod
	def chmod(mode, *paths) paths.map!{|v|get(v)}; File.chmod(mode, *paths) end

	# @see File.lchmod
	def lchmod(mode, *paths) paths.map!{|v|get(v)}; File.lchmod(mode, *paths) end

	# @see File.chown
	def chown(user, group, *paths) paths.map!{|v|get(v)}; File.chown(user, group, *paths) end

	# @see File.lchown
	def lchown(user, group, *paths) paths.map!{|v|get(v)}; File.lchown(user, group, *paths) end

	# @see File.utime
	def utime(atime, mtime, *paths) paths.map!{|v|get(v)}; File.utime(atime, mtime, *paths) end


	# get file type
	#
	# file types:
	#   "chardev" "blockdev" "symlink" ..
	#
	# @param [String] path
	# @return [String] 
	def type(path)
		case (t=ftype(get(path)))
		when "characterSpecial"
			"chardev"
		when "blockSpecial"
			"blockdev"
		when "link"
			"symlink"
		else
			t
		end
	end # def type


	# is path a mountpoint?
	#
	# @param[String] path
	# @return [Boolean]
	def mountpoint? path
		path=get(path)
		begin
			stat1 = path.lstat
			stat2 = path.parent.lstat
			stat1.dev == stat2.dev && stat1.ino == stat2.ino || stat1.dev != stat2.dev
		rescue Errno::ENOENT
			false
		end
	end
end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tagen-0.2.1 lib/tagen/core/pa/state.rb
tagen-0.2.0 lib/tagen/core/pa/state.rb
tagen-0.1.1 lib/tagen/core/pa/state.rb
tagen-0.1.0 lib/tagen/core/pa/state.rb