Class: Folio::Shell
- Inherits:
-
Object
- Object
- Folio::Shell
- Defined in:
- lib/folio/shell.rb
Overview
Prompt class
A Folio Shell object provides a limited file system shell in code.
Instance Attribute Summary collapse
-
#work ⇒ Object
readonly
Present working directory as a Directory object.
Class Method Summary collapse
Instance Method Summary collapse
-
#+(fname) ⇒ Object
(also: #/)
Join paths.
-
#[](name) ⇒ Object
Get the FileObject for the given file name.
- #absolute?(path) ⇒ Boolean
- #blockdev?(path) ⇒ Boolean
- #bzip2(file = nil, options = {}) ⇒ Object
-
#cache(path) ⇒ Object
Look up a cache file.
-
#cd(dir, &block) ⇒ Object
(also: #chdir)
Chage working directory.
- #chardev?(path) ⇒ Boolean
- #chmod(mode, list, options = {}) ⇒ Object
- #chmod_r(mode, list, options = {}) ⇒ Object
-
#chown(user, group, list, options = {}) ⇒ Object
alias_method :chmod_R, :chmod_r.
- #chown_r(user, group, list, options = {}) ⇒ Object
-
#cmp(a, b) ⇒ Object
Same as identical?.
-
#compress(folder, file, options = {}) ⇒ Object
Compress directory to file.
-
#config(path) ⇒ Object
Look up a config file.
-
#cp(src, dest, options = {}) ⇒ Object
(also: #copy)
cp(list, dir, options={}).
-
#cp_r(src, dest, options = {}) ⇒ Object
cp_r(list, dir, options={}).
-
#data(path) ⇒ Object
Look up a data file.
- #dir(name) ⇒ Object
-
#directories ⇒ Object
Returns Enumerator of documents.
- #directory?(path) ⇒ Boolean
-
#directory_entries ⇒ Object
Lists directory entries.
- #doc(name) ⇒ Object
-
#document_entries ⇒ Object
Lists directory entries.
-
#documents ⇒ Object
Returns Enumerator of directories.
-
#entries ⇒ Object
(also: #ls)
Lists all entries.
- #executable?(path) ⇒ Boolean
- #executable_real?(path) ⇒ Boolean
- #exist?(path) ⇒ Boolean
- #exists?(path) ⇒ Boolean
- #file(name) ⇒ Object
- #file?(path) ⇒ Boolean
-
#files ⇒ Object
Returns Enumerator of files objects.
-
#glob(*patterns, &block) ⇒ Object
Glob pattern.
- #grpowned?(path) ⇒ Boolean
- #gzip(file = nil, options = {}) ⇒ Object
-
#home ⇒ Object
Home location.
-
#home_cache ⇒ Object
Return the home cache directory.
-
#home_config ⇒ Object
Return the home config directory.
-
#home_data ⇒ Object
Return the home data directory.
- #identical?(path) ⇒ Boolean
-
#initialize(*path) ⇒ Shell
constructor
New Shell object.
- #install(src, dest, mode, options = {}) ⇒ Object
-
#ln(old, new, options = {}) ⇒ Object
(also: #link)
ln(list, destdir, options={}).
-
#ln_s(old, new, options = {}) ⇒ Object
(also: #symlink)
ln_s(list, destdir, options={}).
- #ln_sf(old, new, options = {}) ⇒ Object
-
#match(*patterns, &block) ⇒ Object
Match pattern.
- #mkdir(dir, options = {}) ⇒ Object
- #mkdir_p(dir, options = {}) ⇒ Object (also: #mkpath)
-
#mode(opts = nil) ⇒ Object
Opertaton mode.
-
#multiglob(*a) ⇒ Object
TODO: Ultimately merge #glob and #multiglob.
- #multiglob_r(*a) ⇒ Object
-
#mv(src, dest, options = {}) ⇒ Object
(also: #move)
mv(list, dir, options={}).
-
#out_of_date?(path, *sources) ⇒ Boolean
TODO: Is #out_of_date? this the same as #uptodate?.
- #owned?(path) ⇒ Boolean
- #pathname(name) ⇒ Object
- #pipe?(path) ⇒ Boolean
-
#pwd ⇒ Object
Present working directory.
- #readable?(path) ⇒ Boolean
- #readable_real?(path) ⇒ Boolean
- #relative?(path) ⇒ Boolean
- #rm(list, options = {}) ⇒ Object (also: #remove)
- #rm_f(list, options = {}) ⇒ Object
- #rm_r(list, options = {}) ⇒ Object
- #rm_rf(list, options = {}) ⇒ Object
- #rmdir(dir, options = {}) ⇒ Object
-
#root ⇒ Object
Root location.
-
#root_config ⇒ Object
Return a enumertor of system config directories.
-
#root_data ⇒ Object
Return a enumertor of system data directories.
- #safe?(path) ⇒ Boolean
- #setgid?(path) ⇒ Boolean
- #setuid?(path) ⇒ Boolean
- #size(path) ⇒ Object
- #size?(path) ⇒ Boolean
- #socket?(path) ⇒ Boolean
- #stage(stage_directory, files) ⇒ Object
- #sticky?(path) ⇒ Boolean
- #symlink?(path) ⇒ Boolean
- #tar(folder, file = nil, options = {}) ⇒ Object
-
#tar_bzip2(folder, file = nil, options = {}) ⇒ Object
Create a tar.bz2 file of a directory.
-
#tar_gzip(folder, file = nil, options = {}) ⇒ Object
(also: #tgz)
Create a tgz file of a directory.
-
#to_s ⇒ Object
String representation is work directory path.
-
#touch(list, options = {}) ⇒ Object
alias_method :chown_R, :chown_r.
- #unbzip2(file, options) ⇒ Object
- #ungzip(file, options) ⇒ Object
- #untar(file, options) ⇒ Object
- #untar_bzip2(file, options) ⇒ Object
- #untar_gzip(file, options) ⇒ Object
- #unzip(file, options) ⇒ Object
- #uptodate?(new, old_list, options = nil) ⇒ Boolean
-
#work_cache ⇒ Object
Return the work cache directory.
-
#work_config ⇒ Object
Return the work config directory.
- #writable?(path) ⇒ Boolean
- #writable_real?(path) ⇒ Boolean
- #zero?(path) ⇒ Boolean
-
#zip(folder, file = nil, options = {}) ⇒ Object
Create a zip file of a directory.
Constructor Details
#initialize(*path) ⇒ Shell
New Shell object.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/folio/shell.rb', line 15 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, "#{path}" unless ::File.exist?(path) raise FileNotFound, "#{path}" unless ::File.directory?(path) @work = dir(path) end |
Instance Attribute Details
#work ⇒ Object (readonly)
Present working directory as a Directory object.
52 53 54 |
# File 'lib/folio/shell.rb', line 52 def work @work end |
Class Method Details
.[](path) ⇒ Object
554 555 556 |
# File 'lib/folio/shell.rb', line 554 def self.[](path) new(path) end |
Instance Method Details
#+(fname) ⇒ Object Also known as: /
Join paths.
91 92 93 |
# File 'lib/folio/shell.rb', line 91 def +(fname) @work =+ fname end |
#[](name) ⇒ Object
Get the FileObject for the given file name.
TODO: Should there be methods like this for each
type, and raise an error if not the right type?
70 71 72 |
# File 'lib/folio/shell.rb', line 70 def [](name) FileObject[name] end |
#absolute?(path) ⇒ Boolean
202 |
# File 'lib/folio/shell.rb', line 202 def absolute?(path) ; FileTest.absolute?(path) ; end |
#blockdev?(path) ⇒ Boolean
179 |
# File 'lib/folio/shell.rb', line 179 def blockdev?(path) ; FileTest.blockdev?(localize(path)) ; end |
#bzip2(file = nil, options = {}) ⇒ Object
382 383 384 385 |
# File 'lib/folio/shell.rb', line 382 def bzip2(file=nil, ={}) file = localize(file) ziputils.bzip2(file, ) end |
#cache(path) ⇒ Object
Look up a cache file.
461 462 463 |
# File 'lib/folio/shell.rb', line 461 def cache(path) file(XDG.xdg_cache_file(path)) end |
#cd(dir, &block) ⇒ Object Also known as: chdir
Chage working directory.
152 153 154 155 156 157 158 |
# File 'lib/folio/shell.rb', line 152 def cd(dir, &block) if block Dir.chdir(localize(dir), &block) else @work += dir end end |
#chardev?(path) ⇒ Boolean
172 |
# File 'lib/folio/shell.rb', line 172 def chardev?(path) ; FileTest.chardev?(localize(path)) ; end |
#chmod(mode, list, options = {}) ⇒ Object
331 332 333 334 |
# File 'lib/folio/shell.rb', line 331 def chmod(mode, list, ={}) list = localize(list) fileutils.chmod(mode, list, ) end |
#chmod_r(mode, list, options = {}) ⇒ Object
336 337 338 339 |
# File 'lib/folio/shell.rb', line 336 def chmod_r(mode, list, ={}) list = localize(list) fileutils.chmod_r(mode, list, ) end |
#chown(user, group, list, options = {}) ⇒ Object
alias_method :chmod_R, :chmod_r
342 343 344 345 |
# File 'lib/folio/shell.rb', line 342 def chown(user, group, list, ={}) list = localize(list) fileutils.chown(user, group, list, ) end |
#chown_r(user, group, list, options = {}) ⇒ Object
347 348 349 350 |
# File 'lib/folio/shell.rb', line 347 def chown_r(user, group, list, ={}) list = localize(list) fileutils.chown_r(user, group, list, ) end |
#cmp(a, b) ⇒ Object
Same as identical?
231 232 233 |
# File 'lib/folio/shell.rb', line 231 def cmp(a,b) fileutils.cmp(a,b) end |
#compress(folder, file, options = {}) ⇒ Object
Compress directory to file. Format is determined by file extension.
371 372 373 |
# File 'lib/folio/shell.rb', line 371 def compress(folder, file, ={}) ziputils.compress(folder, file, ) end |
#config(path) ⇒ Object
Look up a config file.
451 452 453 |
# File 'lib/folio/shell.rb', line 451 def config(path) file(XDG.xdg_config_file(path)) end |
#cp(src, dest, options = {}) ⇒ Object Also known as: copy
cp(list, dir, options={})
282 283 284 285 286 |
# File 'lib/folio/shell.rb', line 282 def cp(src, dest, ={}) src = localize(src) dest = localize(dest) fileutils.cp(src, dest, ) end |
#cp_r(src, dest, options = {}) ⇒ Object
cp_r(list, dir, options={})
290 291 292 293 294 |
# File 'lib/folio/shell.rb', line 290 def cp_r(src, dest, ={}) src = localize(src) dest = localize(dest) fileutils.cp_r(src, dest, ) end |
#data(path) ⇒ Object
Look up a data file.
456 457 458 |
# File 'lib/folio/shell.rb', line 456 def data(path) file(XDG.xdg_data_file(path)) end |
#dir(name) ⇒ Object
86 87 88 |
# File 'lib/folio/shell.rb', line 86 def dir(name) Directory.new(name) end |
#directories ⇒ Object
Returns Enumerator of documents.
119 |
# File 'lib/folio/shell.rb', line 119 def directories ; work.directories ; end |
#directory?(path) ⇒ Boolean
168 |
# File 'lib/folio/shell.rb', line 168 def directory?(path) ; FileTest.directory?(localize(path)) ; end |
#directory_entries ⇒ Object
Lists directory entries.
103 104 105 |
# File 'lib/folio/shell.rb', line 103 def directory_entries work.directory_entries end |
#doc(name) ⇒ Object
82 83 84 |
# File 'lib/folio/shell.rb', line 82 def doc(name) Document.new(name) end |
#document_entries ⇒ Object
Lists directory entries.
108 109 110 |
# File 'lib/folio/shell.rb', line 108 def document_entries work.document_entries end |
#documents ⇒ Object
Returns Enumerator of directories.
116 |
# File 'lib/folio/shell.rb', line 116 def documents ; work.documents ; end |
#entries ⇒ Object Also known as: ls
Lists all entries.
97 98 99 |
# File 'lib/folio/shell.rb', line 97 def entries work.entries end |
#executable?(path) ⇒ Boolean
188 |
# File 'lib/folio/shell.rb', line 188 def executable?(path) ; FileTest.executable?(localize(path)) ; end |
#executable_real?(path) ⇒ Boolean
191 |
# File 'lib/folio/shell.rb', line 191 def executable_real?(path) ; FileTest.executable_real?(localize(path)) ; end |
#exist?(path) ⇒ Boolean
173 |
# File 'lib/folio/shell.rb', line 173 def exist?(path) ; FileTest.exist?(localize(path)) ; end |
#exists?(path) ⇒ Boolean
174 |
# File 'lib/folio/shell.rb', line 174 def exists?(path) ; FileTest.exists?(localize(path)) ; end |
#file(name) ⇒ Object
74 75 76 |
# File 'lib/folio/shell.rb', line 74 def file(name) FileObject[name] end |
#file?(path) ⇒ Boolean
177 |
# File 'lib/folio/shell.rb', line 177 def file?(path) ; FileTest.file?(localize(path)) ; end |
#files ⇒ Object
Returns Enumerator of files objects.
113 |
# File 'lib/folio/shell.rb', line 113 def files ; work.files ; end |
#glob(*patterns, &block) ⇒ Object
Glob pattern. Returns matches as strings.
122 123 124 125 126 127 128 129 |
# File 'lib/folio/shell.rb', line 122 def glob(*patterns, &block) opts = (::Integer===patterns.last ? patterns.pop : 0) patterns = localize(patterns) matches = patterns.map{ |pattern| ::Dir.glob(pattern, opts) }.flatten if block_given? matches.each(&block) end end |
#grpowned?(path) ⇒ Boolean
180 |
# File 'lib/folio/shell.rb', line 180 def grpowned?(path) ; FileTest.grpowned?(localize(path)) ; end |
#gzip(file = nil, options = {}) ⇒ Object
376 377 378 379 |
# File 'lib/folio/shell.rb', line 376 def gzip(file=nil, ={}) file = localize(file) ziputils.gzip(file, ) end |
#home ⇒ Object
Home location.
55 |
# File 'lib/folio/shell.rb', line 55 def home ; dir('~') ; end |
#home_cache ⇒ Object
Return the home cache directory.
486 487 488 |
# File 'lib/folio/shell.rb', line 486 def home_cache dir(XDG.xdg_cache_home) end |
#home_config ⇒ Object
Return the home config directory.
476 477 478 |
# File 'lib/folio/shell.rb', line 476 def home_config dir(XDG.xdg_config_home) end |
#home_data ⇒ Object
Return the home data directory.
481 482 483 |
# File 'lib/folio/shell.rb', line 481 def home_data dir(XDG.xdg_data_home) end |
#identical?(path) ⇒ Boolean
186 |
# File 'lib/folio/shell.rb', line 186 def identical?(path) ; FileTest.identical?(localize(path)) ; end |
#install(src, dest, mode, options = {}) ⇒ Object
325 326 327 328 329 |
# File 'lib/folio/shell.rb', line 325 def install(src, dest, mode, ={}) src = localize(src) dest = localize(dest) fileutils.install(src, dest, mode, ) end |
#ln(old, new, options = {}) ⇒ Object Also known as: link
ln(list, destdir, options={})
260 261 262 263 264 |
# File 'lib/folio/shell.rb', line 260 def ln(old, new, ={}) old = localize(old) new = localize(new) fileutils.ln(old, new, ) end |
#ln_s(old, new, options = {}) ⇒ Object Also known as: symlink
ln_s(list, destdir, options={})
268 269 270 271 272 |
# File 'lib/folio/shell.rb', line 268 def ln_s(old, new, ={}) old = localize(old) new = localize(new) fileutils.ln_s(old, new, ) end |
#ln_sf(old, new, options = {}) ⇒ Object
275 276 277 278 279 |
# File 'lib/folio/shell.rb', line 275 def ln_sf(old, new, ={}) old = localize(old) new = localize(new) fileutils.ln_sf(old, new, ) end |
#match(*patterns, &block) ⇒ Object
Match pattern. Like #glob but returns file objects.
141 142 143 144 145 146 147 148 149 |
# File 'lib/folio/shell.rb', line 141 def match(*patterns, &block) opts = (::Integer===patterns.last ? patterns.pop : 0) patterns = localize(patterns) matches = patterns.map{ |pattern| ::Dir.glob(pattern, opts) }.flatten matches = matches.map{ |f| FileObject[f] } if block_given? matches.each(&block) end end |
#mkdir(dir, options = {}) ⇒ Object
243 244 245 246 |
# File 'lib/folio/shell.rb', line 243 def mkdir(dir, ={}) dir = localize(dir) fileutils.mkdir(dir, ) end |
#mkdir_p(dir, options = {}) ⇒ Object Also known as: mkpath
248 249 250 251 |
# File 'lib/folio/shell.rb', line 248 def mkdir_p(dir, ={}) dir = localize(dir) fileutils.mkdir_p(dir, ) end |
#mode(opts = nil) ⇒ Object
Opertaton mode. This can be :noop, :verbose or :dryrun. The later is the same as the first two combined.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/folio/shell.rb', line 33 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 |
#multiglob(*a) ⇒ Object
TODO: Ultimately merge #glob and #multiglob.
132 133 134 |
# File 'lib/folio/shell.rb', line 132 def multiglob(*a) Dir.multiglob(*a) end |
#multiglob_r(*a) ⇒ Object
136 137 138 |
# File 'lib/folio/shell.rb', line 136 def multiglob_r(*a) Dir.multiglob_r(*a) end |
#mv(src, dest, options = {}) ⇒ Object Also known as: move
mv(list, dir, options={})
297 298 299 300 301 |
# File 'lib/folio/shell.rb', line 297 def mv(src, dest, ={}) src = localize(src) dest = localize(dest) fileutils.mv(src, dest, ) end |
#out_of_date?(path, *sources) ⇒ Boolean
TODO: Is #out_of_date? this the same as #uptodate?
197 198 199 |
# File 'lib/folio/shell.rb', line 197 def out_of_date?(path, *sources) FileTest.out_of_date?(localize(path), *localize(sources)) end |
#owned?(path) ⇒ Boolean
185 |
# File 'lib/folio/shell.rb', line 185 def owned?(path) ; FileTest.owned?(localize(path)) ; end |
#pathname(name) ⇒ Object
78 79 80 |
# File 'lib/folio/shell.rb', line 78 def pathname(name) Pathname.new(name) end |
#pipe?(path) ⇒ Boolean
176 |
# File 'lib/folio/shell.rb', line 176 def pipe?(path) ; FileTest.pipe?(localize(path)) ; end |
#pwd ⇒ Object
Present working directory.
226 227 228 |
# File 'lib/folio/shell.rb', line 226 def pwd work.to_s end |
#readable?(path) ⇒ Boolean
170 |
# File 'lib/folio/shell.rb', line 170 def readable?(path) ; FileTest.readable?(localize(path)) ; end |
#readable_real?(path) ⇒ Boolean
192 |
# File 'lib/folio/shell.rb', line 192 def readable_real?(path) ; FileTest.readable_real?(localize(path)) ; end |
#relative?(path) ⇒ Boolean
201 |
# File 'lib/folio/shell.rb', line 201 def relative?(path) ; FileTest.relative?(path) ; end |
#rm(list, options = {}) ⇒ Object Also known as: remove
304 305 306 307 |
# File 'lib/folio/shell.rb', line 304 def rm(list, ={}) list = localize(list) fileutils.rm(list, ) end |
#rm_f(list, options = {}) ⇒ Object
315 316 317 318 |
# File 'lib/folio/shell.rb', line 315 def rm_f(list, ={}) list = localize(list) fileutils.rm_f(list, ) end |
#rm_r(list, options = {}) ⇒ Object
310 311 312 313 |
# File 'lib/folio/shell.rb', line 310 def rm_r(list, ={}) list = localize(list) fileutils.rm_r(list, ) end |
#rm_rf(list, options = {}) ⇒ Object
320 321 322 323 |
# File 'lib/folio/shell.rb', line 320 def rm_rf(list, ={}) list = localize(list) fileutils.rm_rf(list, ) end |
#rmdir(dir, options = {}) ⇒ Object
254 255 256 257 |
# File 'lib/folio/shell.rb', line 254 def rmdir(dir, ={}) dir = localize(dir) fileutils.rmdir(dir, ) end |
#root_config ⇒ Object
Return a enumertor of system config directories.
466 467 468 |
# File 'lib/folio/shell.rb', line 466 def root_config() #_directories XDG.xdg_config_dirs.to_enum(:each){ |f| dir(f) } end |
#root_data ⇒ Object
Return a enumertor of system data directories.
471 472 473 |
# File 'lib/folio/shell.rb', line 471 def root_data() #_directories XDG.xdg_data_dirs.to_enum(:each){ |f| dir(f) } end |
#safe?(path) ⇒ Boolean
194 |
# File 'lib/folio/shell.rb', line 194 def safe?(path) ; FileTest.safe?(localize(path)) ; end |
#setgid?(path) ⇒ Boolean
181 |
# File 'lib/folio/shell.rb', line 181 def setgid?(path) ; FileTest.setgid?(localize(path)) ; end |
#setuid?(path) ⇒ Boolean
182 |
# File 'lib/folio/shell.rb', line 182 def setuid?(path) ; FileTest.setuid?(localize(path)) ; end |
#size(path) ⇒ Object
166 |
# File 'lib/folio/shell.rb', line 166 def size(path) ; FileTest.size(localize(path)) ; end |
#size?(path) ⇒ Boolean
167 |
# File 'lib/folio/shell.rb', line 167 def size?(path) ; FileTest.size(localize(path)) ; end |
#socket?(path) ⇒ Boolean
183 |
# File 'lib/folio/shell.rb', line 183 def socket?(path) ; FileTest.socket?(localize(path)) ; end |
#stage(stage_directory, files) ⇒ Object
359 360 361 362 363 |
# File 'lib/folio/shell.rb', line 359 def stage(stage_directory, files) dir = localize(stage_directory) files = localize(files) fileutils.stage(dir, files) end |
#sticky?(path) ⇒ Boolean
178 |
# File 'lib/folio/shell.rb', line 178 def sticky?(path) ; FileTest.sticky?(localize(path)) ; end |
#symlink?(path) ⇒ Boolean
169 |
# File 'lib/folio/shell.rb', line 169 def symlink?(path) ; FileTest.symlink?(localize(path)) ; end |
#tar(folder, file = nil, options = {}) ⇒ Object
395 396 397 398 399 |
# File 'lib/folio/shell.rb', line 395 def tar(folder, file=nil, ={}) folder = localize(folder) file = localize(file) ziputils.tar_gzip(folder, file, ) end |
#tar_bzip2(folder, file = nil, options = {}) ⇒ Object
Create a tar.bz2 file of a directory.
410 411 412 413 414 |
# File 'lib/folio/shell.rb', line 410 def tar_bzip2(folder, file=nil, ={}) folder = localize(folder) file = localize(file) ziputils.tar_bzip2(folder, file, ) end |
#tar_gzip(folder, file = nil, options = {}) ⇒ Object Also known as: tgz
Create a tgz file of a directory.
402 403 404 405 406 |
# File 'lib/folio/shell.rb', line 402 def tar_gzip(folder, file=nil, ={}) folder = localize(folder) file = localize(file) ziputils.tar_gzip(folder, file, ) end |
#to_s ⇒ Object
String representation is work directory path.
49 |
# File 'lib/folio/shell.rb', line 49 def to_s ; work.to_s ; end |
#touch(list, options = {}) ⇒ Object
alias_method :chown_R, :chown_r
353 354 355 356 |
# File 'lib/folio/shell.rb', line 353 def touch(list, ={}) list = localize(list) fileutils.touch(list, ) end |
#unbzip2(file, options) ⇒ Object
421 422 423 424 |
# File 'lib/folio/shell.rb', line 421 def unbzip2(file, ) file = localize(file) ziputils.unbzip2(file, ) end |
#ungzip(file, options) ⇒ Object
416 417 418 419 |
# File 'lib/folio/shell.rb', line 416 def ungzip(file, ) file = localize(file) ziputils.ungzip(file, ) end |
#untar(file, options) ⇒ Object
431 432 433 434 |
# File 'lib/folio/shell.rb', line 431 def untar(file, ) file = localize(file) ziputils.untar(file, ) end |
#untar_bzip2(file, options) ⇒ Object
441 442 443 444 |
# File 'lib/folio/shell.rb', line 441 def untar_bzip2(file, ) file = localize(file) ziputils.untar_bzip2(file, ) end |
#untar_gzip(file, options) ⇒ Object
436 437 438 439 |
# File 'lib/folio/shell.rb', line 436 def untar_gzip(file, ) file = localize(file) ziputils.untar_gzip(file, ) end |
#unzip(file, options) ⇒ Object
426 427 428 429 |
# File 'lib/folio/shell.rb', line 426 def unzip(file, ) file = localize(file) ziputils.unzip(file, ) end |
#uptodate?(new, old_list, options = nil) ⇒ Boolean
236 237 238 239 240 |
# File 'lib/folio/shell.rb', line 236 def uptodate?(new, old_list, =nil) new = localize(new) old = localize(old_list) fileutils.uptodate?(new, old, ) end |
#work_cache ⇒ Object
Return the work cache directory.
496 497 498 |
# File 'lib/folio/shell.rb', line 496 def work_cache dir(XDG.xdg_cache_work) end |
#work_config ⇒ Object
Return the work config directory.
491 492 493 |
# File 'lib/folio/shell.rb', line 491 def work_config dir(XDG.xdg_config_work) end |
#writable?(path) ⇒ Boolean
187 |
# File 'lib/folio/shell.rb', line 187 def writable?(path) ; FileTest.writable?(localize(path)) ; end |
#writable_real?(path) ⇒ Boolean
190 |
# File 'lib/folio/shell.rb', line 190 def writable_real?(path) ; FileTest.writable_real?(localize(path)) ; end |
#zero?(path) ⇒ Boolean
175 |
# File 'lib/folio/shell.rb', line 175 def zero?(path) ; FileTest.zero?(localize(path)) ; end |
#zip(folder, file = nil, options = {}) ⇒ Object
Create a zip file of a directory.
388 389 390 391 392 |
# File 'lib/folio/shell.rb', line 388 def zip(folder, file=nil, ={}) folder = localize(folder) file = localize(file) ziputils.zip(folder, file, ) end |