Module: Cotta

Defined in:
lib/cotta/cotta.rb,
lib/cotta/cotta_dir.rb,
lib/cotta/cotta_file.rb,
lib/cotta/file_factory.rb,
lib/cotta/impl/command_error.rb,
lib/cotta/impl/command_runner.rb,
lib/cotta/file_not_found_error.rb,
lib/cotta/impl/physical_system.rb,
lib/cotta/impl/in_memory_system.rb,
lib/cotta/impl/command_interface.rb

Overview

if RUBY_PLATFORM =~ /mswin|mingw/

begin
  require 'win32/open3'
rescue LoadError
  warn "You must 'gem install win32-open3' to use Cotta on Windows"
  exit 1
end

else

require 'open3'

end

Defined Under Namespace

Classes: CommandError, CommandInterface, CommandRunner, ContentStat, CottaDir, CottaFile, DirectoryContent, FileContent, FileFactory, FileNotFoundError, InMemorySystem, PhysicalSystem, SystemIo

Constant Summary collapse

PHYSICAL =
FileFactory.new(PhysicalSystem.new)

Class Method Summary collapse

Class Method Details

.dir(path) ⇒ Object

Creates CottaDir representing physical directory



12
13
14
# File 'lib/cotta/cotta.rb', line 12

def self::dir(path)
  FileFactory.dir(path)
end

.factory(system) ⇒ Object

returns the file factory backed by the given system



34
35
36
# File 'lib/cotta/cotta.rb', line 34

def self::factory(system)
  FileFactory.new(system)
end

.file(path) ⇒ Object

Creates CottaFile repersenting physical file



7
8
9
# File 'lib/cotta/cotta.rb', line 7

def self::file(path)
  FileFactory.file(path)
end

.in_memoryObject

Returns the file factory backed by in-memory system



29
30
31
# File 'lib/cotta/cotta.rb', line 29

def self::in_memory
  FileFactory.in_memory
end

.parent_dir(path) ⇒ Object

Creates CottaDir that is the parent of the path This is typically used with __FILE__ e.g. dir = Cotta.parent_dir(__FILE__)



19
20
21
# File 'lib/cotta/cotta.rb', line 19

def self.parent_dir(path)
  FileFactory.parent_dir(path)
end

.physicalObject

Returns the file facotry backed by physical system



24
25
26
# File 'lib/cotta/cotta.rb', line 24

def self::physical
  FileFactory.physical
end