Class: Turntables::Turntable

Inherits:
Object
  • Object
show all
Defined in:
lib/turntables/turntable.rb

Overview

The facade controller to the rest of this library.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTurntable

Default constructor, that initializes some standard parameters



10
11
12
13
# File 'lib/turntables/turntable.rb', line 10

def initialize
  @revisions = Array.new
  @repository = Repository.new
end

Instance Attribute Details

#repositoryObject

Returns the value of attribute repository.



39
40
41
# File 'lib/turntables/turntable.rb', line 39

def repository
  @repository
end

Instance Method Details

#make!Object

Create the tables by going through each revision



30
31
32
33
34
35
36
37
# File 'lib/turntables/turntable.rb', line 30

def make!
  if @repository.malformed?
    raise TurntableException, 
      "The directory structure at #{@repository.relative_dir} is malformed."
  else
    @repository.make!
  end
end

#make_at!(location) ⇒ Object

Make the repository at a specific location instead of default.



22
23
24
25
26
27
# File 'lib/turntables/turntable.rb', line 22

def make_at!(location)
  DbRegistry.instance.name = location
  DbRegistry.instance.close!
  DbRegistry.instance.open!
  make!
end

#register(repository_root_path) ⇒ Object

Register a revision that needs to be processed later

Parameters:

  • repository_root_path

    is the root path to all the sql.



17
18
19
# File 'lib/turntables/turntable.rb', line 17

def register(repository_root_path)
  @repository.register(repository_root_path)
end