AdvFileUtils is a collection of advanced file utilities for Ruby scripts. It is presently incomplete. Those methods already implemented are listed below without an "x_" prefix, but among their options will only acknowledge :noop and :verbose so far. The particular collection of available functions is also in flux. Some may even be spun out into other libraries. append Quickly append data to a file. truncate Works like #append but truncates the file when opening. replace Works like #truncate but writes to lockfile then replaces. edit Invokes external editor, such as vi, to edit a file. system Runs an external command (more verbose than Kernel.system). shell An alias for system. sh An alias for system. If 'advanced-fileutils' is required, then the methods are available at AdvFileUtils.method_name. If 'fileutils/advanced' is required instead, then the methods can also be called at FileUtils.method_name. # # = advanced-fileutils.rb # # Copyright (c) 2009 Michael H. Buselli # # This program is free software. # You can distribute/modify this program under the same terms of Ruby. # # == module AdvFileUtils # # Advanced FileUtils contains more methods you might have wished were in # FileUtils. # # === Module Functions # # append(filename, data, options) # append(filename, options) {|file| .... } # truncate(filename, options) # truncate(filename, data, options) # truncate(filename, options) {|file| .... } # replace(filename, data, options) # does "atomic" file change # replace(filename, options) {|file| .... } # x_insert(filename, data, options) # :line => 7 # x_insert(filename, options) {|file| .... } # x_update(filename, data, options) # :line => 7 # x_update(filename, options) {|file| .... } # :lines => 7..10 # # :separator => ':' # # :where => '$1 = mbuselli' # edit(filename, options) # :visual => true # edit(filename, data, options) # system(command_list, options) # shell(command_list, options) # alias of system # sh(command_list, options) # alias of system # x_sudo(command_list, options) # :runas => 0 # # Many options are not implemented yet. #
Project
advanced-fileutils
Advanced FileUtils contains more methods you might have wished were in FileUtils.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Development
Dependencies
Runtime
>= 0.0.4
Project Readme