0.0
No commit activity in last 3 years
No release in over 3 years
Prepend any file with text (think licenses, copyright, ownership etc)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

PrependFile

Due to the fact that most file systems do not support prepend operations, I decided to create a simple gem to do just that.

##Install [sudo] gem install prependfile

##Usage

Command Line

Usage:
   prependfile [options] target_file

Examples:
  
  prependfile file.cpp --text="PUT THIS ON TOP"

  prependfile file.cpp main.cpp test.cpp --text="This goes on all of them!"

  prependfile *.cpp --file=banner.txt

  prependfile *.rb (this will put you into STDIN)

  prependfile *.rb < banner.txt

where [options] are:
  --text, -t <s>:   Text to prepend to file
  --file, -f <s>:   Contents of file to prepend to the dest file
   --version, -v:   Print version and exit
  --help, -h:   Show this message

Ruby Code

General

require 'prependfile'

PrependFile.prepend(<file_to_append>, <text_to_prepend>)

<file_to_append> and <text_to_prepend> can be a filename(String), File Object, or IO Object

Examples

PrependFile.prepend("sample.txt", "I want this text to be on the top!")

PrependFile.prepend("sample.txt", File.new("file_that_contains_header.txt"))

PrependFile.prepend("sample.txt", "file_that_contains_header.txt")

PrependFile.prepend(File.new("sample.txt"), "I want this text to be on the top!")

To see all examples/cases, see the spec file.