Prompt class

Methods
Attributes
[R] path
Public Class methods
[](path)
# File lib/folio/prompt.rb, line 232
    def self.[](path)
      new(path)
    end
new(*path)
# File lib/folio/prompt.rb, line 10
    def initialize(*path)
      opts = (Hash===path.last ? path.pop : {})
      mode(opts)

      if path.empty?
        path = Dir.pwd
      else
        path = File.join(*path)
      end

      raise FileNotFound unless ::File.exist?(path)
      raise FileNotFound unless ::File.directory?(path)

      @path = Directory.new(path)
    end
Public Instance methods
+(fname)

Join paths.

This method is also aliased as /
# File lib/folio/prompt.rb, line 55
    def +(fname)
      @path =+ fname
    end
/(fname)

Alias for #+

cd(dir, &block)
# File lib/folio/prompt.rb, line 88
    def cd(dir, &block)
      #dir = localize(dir)
      if block
        @path.cd(dir, &block)
      else
        @path += dir
      end
    end
chmod(mode, list, options)
# File lib/folio/prompt.rb, line 178
    def chmod(mode, list, options)
      list = localize(list)
      fileutils.chmod(mode, list, options)
    end
chmod_r(mode, list, options)
# File lib/folio/prompt.rb, line 183
    def chmod_r(mode, list, options)
      list = localize(list)
      fileutils.chmod_r(mode, list, options)
    end
chown(user, group, list, options)

alias_method :chmod_R, :chmod_r

# File lib/folio/prompt.rb, line 189
    def chown(user, group, list, options)
      list = localize(list)
      fileutils.chown(user, group, list, options)
    end
chown_r(user, group, list, options)
# File lib/folio/prompt.rb, line 194
    def chown_r(user, group, list, options)
      list = localize(list)
      fileutils.chown_r(user, group, list, options)
    end
cp(src, dest, options)

cp(list, dir, options)

# File lib/folio/prompt.rb, line 137
    def cp(src, dest, options)
      src  = localize(src)
      dest = localize(dest)
      fileutils.cp(src, dest, options)
    end
cp_r(src, dest, options)

cp_r(list, dir, options)

# File lib/folio/prompt.rb, line 144
    def cp_r(src, dest, options)
      src  = localize(src)
      dest = localize(dest)
      fileutils.cp_r(src, dest, options)
    end
directories()
# File lib/folio/prompt.rb, line 72
    def directories
      path.paths.select{ |f| f.directory? }
    end
entries()
This method is also aliased as ls
# File lib/folio/prompt.rb, line 66
    def entries
      path.entries
    end
file(name)

Get the FileObject.

# File lib/folio/prompt.rb, line 46
    def file(name)
      FileObject(name)
    end
files()
# File lib/folio/prompt.rb, line 77
    def files
      path.paths.select{ |f| f.file? }
    end
glob(*patterns)

Glob pattern.

# File lib/folio/prompt.rb, line 82
    def glob(*patterns)
      opts = (::Integer===patterns.last ? patterns.pop : 0)
      pattern = localize(pattern)
      ::Dir.glob(pattern, opts).each{ |f| FileObject[f] }
    end
install(src, dest, mode, options)
# File lib/folio/prompt.rb, line 172
    def install(src, dest, mode, options)
      src  = localize(src)
      dest = localize(dest)
      fileutils.install(src, dest, mode, options)
    end
ln(old, new, options)

ln(list, destdir, options)

# File lib/folio/prompt.rb, line 117
    def ln(old, new, options)
      old = localize(old)
      new = localize(new)
      fileutils.ln(old, new, options)
    end
ln_s(old, new, options)

ln_s(list, destdir, options)

# File lib/folio/prompt.rb, line 124
    def ln_s(old, new, options)
      old = localize(old)
      new = localize(new)
      fileutils.ln_s(old, new, options)
    end
ln_sf(old, new, options)
# File lib/folio/prompt.rb, line 130
    def ln_sf(old, new, options)
      old = localize(old)
      new = localize(new)
      fileutils.ln_sf(old, new, options)
    end
ls()

Alias for entries

mkdir(dir, options)
# File lib/folio/prompt.rb, line 101
    def mkdir(dir, options)
      dir = localize(dir)
      fileutils.mkdir(dir, options)
    end
mkdir_p(dir, options)
# File lib/folio/prompt.rb, line 106
    def mkdir_p(dir, options)
      dir = localize(dir)
      fileutils.mkdir_p(dir, options)
    end
mode(opts=nil)

opertaton mode

# File lib/folio/prompt.rb, line 27
    def mode(opts=nil)
      return @mode unless opts
      opts.each do |key, val|
        next unless val
        case key
        when :noop
          @mode = (@mode == :verbose ? :dryrun : :noop)
        when :verbose
          @mode = (@mode == :noop ? :dryrun : :verbose)
        when :dryrun
          @mode = :dryrun
        end
      end
    end
mv(src, dest, options)

mv(list, dir, options)

# File lib/folio/prompt.rb, line 151
    def mv(src, dest, options)
      src  = localize(src)
      dest = localize(dest)
      fileutils.mv(src, dest, options)
    end
paths()
# File lib/folio/prompt.rb, line 61
    def paths
      path.paths
    end
pwd()
# File lib/folio/prompt.rb, line 43
    def pwd  ; path ; end
rm(list, options)
# File lib/folio/prompt.rb, line 157
    def rm(list, options)
      list = localize(list)
      fileutils.rm(list, options)
    end
rm_r(list, options)
# File lib/folio/prompt.rb, line 162
    def rm_r(list, options)
      list = localize(list)
      fileutils.rm_f(list, options)
    end
rm_rf(list, options)
# File lib/folio/prompt.rb, line 167
    def rm_rf(list, options)
      list = localize(list)
      fileutils.rm_rf(list, options)
    end
rmdir(dir, options)
# File lib/folio/prompt.rb, line 111
    def rmdir(dir, options)
      dir = localize(dir)
      fileutils.rmdir(dir, options)
    end
to_s()
# File lib/folio/prompt.rb, line 42
    def to_s ; path.to_s ; end
touch(list, options)

alias_method :chown_R, :chown_r

# File lib/folio/prompt.rb, line 200
    def touch(list, options)
      list = localize(list)
      fileutils.touch(list, options)
    end