Class: DNApi::DbStack

Inherits:
Struct
  • Object
show all
Defined in:
lib/dnapi/db_stack.rb

Constant Summary collapse

Mysql =
new(
  :name => 'mysql',
  :label => 'MySQL 5.0.x',
  :supports_replication => true,
  :backup_command => 'eybackup --quiet',
  :adapter => 'mysql'
)
Mysql5_1 =
new(
  :name => 'mysql5_1',
  :label => 'MySQL 5.1.x',
  :supports_replication => true,
  :backup_command => 'eybackup -e mysql --quiet',
  :adapter => 'mysql'
)
Mysql5_5 =
new(
  :name => 'mysql5_5',
  :label => 'MySQL 5.5.x (Beta)',
  :supports_replication => true,
  :backup_command => 'eybackup -e mysql --quiet',
  :adapter => 'mysql'
)
Postgres =
new(
  :name => 'postgres',
  :label => 'PostgreSQL 8.3.x',
  :supports_replication => false,
  :backup_command => 'eybackup -e postgresql --quiet',
  :adapter => 'postgresql'
)
Postgres9 =
new(
  :name => 'postgres9',
  :label => 'PostgreSQL 9.0.x',
  :supports_replication => true,
  :backup_command => 'eybackup -e postgresql --quiet',
  :adapter => 'postgresql'
)
Postgres91 =
new(
  :name => 'postgres9_1',
  :label => 'PostgreSQL 9.1.x',
  :supports_replication => true,
  :backup_command => 'eybackup -e postgresql --quiet',
  :adapter => 'postgresql'
)
NoDB =
new(
  :name => 'no_db',
  :label => 'No Database',
  :supports_replication => false,
  :backup_command => 'echo',
  :adapter => 'none'
)

Instance Attribute Summary collapse

Attributes inherited from Struct

#parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#==, _many, #_many, #_many_values, _ones, #_ones, #_ones_values, _umembers, belongs_to, from, #initialize, #inspect, many, map, one, #to_hash, #umember_inspect, unserialized_member

Methods included from Test::Ext

#default_fauxture_name, #fixture, #generate, #generate_attributes, #pick

Constructor Details

This class inherits a constructor from DNApi::Struct

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter

Returns:

  • (Object)

    the current value of adapter



2
3
4
# File 'lib/dnapi/db_stack.rb', line 2

def adapter
  @adapter
end

#backup_commandObject

Returns the value of attribute backup_command

Returns:

  • (Object)

    the current value of backup_command



2
3
4
# File 'lib/dnapi/db_stack.rb', line 2

def backup_command
  @backup_command
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



2
3
4
# File 'lib/dnapi/db_stack.rb', line 2

def label
  @label
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



2
3
4
# File 'lib/dnapi/db_stack.rb', line 2

def name
  @name
end

#supports_replicationObject

Returns the value of attribute supports_replication

Returns:

  • (Object)

    the current value of supports_replication



2
3
4
# File 'lib/dnapi/db_stack.rb', line 2

def supports_replication
  @supports_replication
end

Class Method Details

.allObject



55
56
57
# File 'lib/dnapi/db_stack.rb', line 55

def self.all
  [Mysql, Mysql5_1, Mysql5_5, Postgres, Postgres9,Postgres91,NoDB]
end

.get(name) ⇒ Object



59
60
61
# File 'lib/dnapi/db_stack.rb', line 59

def self.get(name)
  all.detect {|s| s.name == name }
end

Instance Method Details

#adapter_for(component) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/dnapi/db_stack.rb', line 95

def adapter_for(component)
  if adapter == 'mysql' && DNApi::Components::RubyVersion.encoding_aware.include?(component.class)
    'mysql2'
  else
    adapter
  end
end

#mysql5_1?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/dnapi/db_stack.rb', line 83

def mysql5_1?
  name == 'mysql5_1'
end

#mysql5_5?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/dnapi/db_stack.rb', line 87

def mysql5_5?
  name == 'mysql5_5'
end

#mysql?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/dnapi/db_stack.rb', line 91

def mysql?
  name == 'mysql'
end

#no_db?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/dnapi/db_stack.rb', line 67

def no_db?
  name == 'no_db'
end

#postgres9?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/dnapi/db_stack.rb', line 75

def postgres9?
  name == 'postgres9'
end

#postgres9_1?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/dnapi/db_stack.rb', line 79

def postgres9_1?
  name == 'postgres9_1'
end

#postgres?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/dnapi/db_stack.rb', line 71

def postgres?
  name == 'postgres'
end

#supports_replication?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/dnapi/db_stack.rb', line 63

def supports_replication?
  supports_replication
end