Module: Rundoc::CodeCommand::FileUtil

Included in:
Rundoc::CodeCommand::FileCommand::Append, Rundoc::CodeCommand::FileCommand::Remove, Write
Defined in:
lib/rundoc/code_command/write.rb

Instance Method Summary collapse

Instance Method Details

#filenameObject



4
5
6
7
8
9
10
# File 'lib/rundoc/code_command/write.rb', line 4

def filename
  files = Dir.glob(@filename)
  if files.length > 1
    raise "Filename glob #{@filename.inspect} matched more than one file. Be more specific to only match one file. Matches:\n" + files.join("  \n")
  end
  files.first || @filename
end

#mkdir_pObject



12
13
14
15
# File 'lib/rundoc/code_command/write.rb', line 12

def mkdir_p
  dir = File.expand_path("../", filename)
  FileUtils.mkdir_p(dir)
end