Class: Rails::Generators::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/generators/database.rb

Direct Known Subclasses

MariaDB, MySQL, Null, PostgreSQL, SQLite3

Defined Under Namespace

Modules: MySqlSocket Classes: MariaDB, MySQL, Null, PostgreSQL, SQLite3

Constant Summary collapse

DATABASES =
%w( mysql trilogy postgresql sqlite3 )

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.allObject



19
20
21
22
23
24
25
26
# File 'lib/rails/generators/database.rb', line 19

def all
  @all ||= [
    MySQL.new,
    PostgreSQL.new,
    MariaDB.new,
    SQLite3.new,
  ]
end

.build(database_name) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/rails/generators/database.rb', line 9

def build(database_name)
  case database_name
  when "mysql" then MySQL.new
  when "postgresql" then PostgreSQL.new
  when "trilogy" then MariaDB.new
  when "sqlite3" then SQLite3.new
  else Null.new
  end
end

Instance Method Details

#base_packageObject

Raises:

  • (NotImplementedError)


49
50
51
# File 'lib/rails/generators/database.rb', line 49

def base_package
  raise NotImplementedError
end

#build_packageObject

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/rails/generators/database.rb', line 53

def build_package
  raise NotImplementedError
end

#featureObject



60
61
62
63
64
# File 'lib/rails/generators/database.rb', line 60

def feature
  return unless feature_name

  { feature_name => {} }
end

#feature_nameObject

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/rails/generators/database.rb', line 41

def feature_name
  raise NotImplementedError
end

#gemObject

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/rails/generators/database.rb', line 45

def gem
  raise NotImplementedError
end

#hostObject



58
# File 'lib/rails/generators/database.rb', line 58

def host; end

#nameObject

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/rails/generators/database.rb', line 29

def name
  raise NotImplementedError
end

#portObject

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/rails/generators/database.rb', line 37

def port
  raise NotImplementedError
end

#serviceObject

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/rails/generators/database.rb', line 33

def service
  raise NotImplementedError
end

#socketObject



57
# File 'lib/rails/generators/database.rb', line 57

def socket; end

#volumeObject



66
67
68
69
70
# File 'lib/rails/generators/database.rb', line 66

def volume
  return unless service

  "#{name}-data"
end