lib/bones/main.rb
# Copy a file from the Bones prototype project location to the user
# specified project location. A message will be displayed to the screen
# indicating that the file is being created.
#
Copy a file from the Bones prototype project location to the user
specified project location. A message will be displayed to the screen
indicating that the file is being created.
Copy a file from the Bones prototype project location to the user specified project location . A message will be displayed to the screen indicating that the file is being created .
def cp( file )
    dir = File.dirname(file).sub('NAME', name)
    dir = (dir == '.' ? output_dir : File.join(output_dir, dir))
    dst = File.join(dir,  File.basename(file, '.erb').sub('NAME', name))
    src = File.join(data, file)
    STDOUT.puts(test(?e, dst) ? "updating #{dst}" : "creating #{dst}") if verbose
    FileUtils.mkdir_p(dir)
    if '.erb' == File.extname(file)
      txt = ERB.new(File.read(src), nil, '-').result(binding)
      File.open(dst, 'w') {|fd| fd.write(txt)}
    else
      FileUtils.cp src, dst
    end
    FileUtils.chmod(File.stat(src).mode, dst)
  end
def cp ( file ) dir = File . dirname ( file ) . sub ( 'NAME' , name ) dir = ( dir == '.' ? output_dir : File . join ( output_dir , dir ) ) dst = File . join ( dir , File . basename ( file , '.erb' ) . sub ( 'NAME' , name ) ) src = File . join ( data , file ) STDOUT . puts ( test ( ?e , dst ) ? "updating #{dst}" : "creating #{dst}" ) if verbose FileUtils . mkdir_p ( dir ) if '.erb' == File . extname ( file ) txt = ERB . new ( File . read ( src ) , nil , '-' ) . result ( binding ) File . open ( dst , 'w' ) { | fd | fd . write ( txt ) } else FileUtils . cp src , dst end FileUtils . chmod ( File . stat ( src ) . mode , dst ) end
Copy a file from the Bones prototype project location to the user
specified project location.
Copy a file from the Bones prototype project location to the user specified project location .
file
<not_specific>