Class: Rails::Generators::Database
- Inherits:
-
Object
- Object
- Rails::Generators::Database
show all
- Defined in:
- lib/rails/generators/database.rb
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
.all ⇒ Object
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_package ⇒ Object
49
50
51
|
# File 'lib/rails/generators/database.rb', line 49
def base_package
raise NotImplementedError
end
|
#build_package ⇒ Object
53
54
55
|
# File 'lib/rails/generators/database.rb', line 53
def build_package
raise NotImplementedError
end
|
#feature ⇒ Object
60
61
62
63
64
|
# File 'lib/rails/generators/database.rb', line 60
def feature
return unless feature_name
{ feature_name => {} }
end
|
#feature_name ⇒ Object
41
42
43
|
# File 'lib/rails/generators/database.rb', line 41
def feature_name
raise NotImplementedError
end
|
#gem ⇒ Object
45
46
47
|
# File 'lib/rails/generators/database.rb', line 45
def gem
raise NotImplementedError
end
|
#host ⇒ Object
58
|
# File 'lib/rails/generators/database.rb', line 58
def host; end
|
#name ⇒ Object
29
30
31
|
# File 'lib/rails/generators/database.rb', line 29
def name
raise NotImplementedError
end
|
#port ⇒ Object
37
38
39
|
# File 'lib/rails/generators/database.rb', line 37
def port
raise NotImplementedError
end
|
#service ⇒ Object
33
34
35
|
# File 'lib/rails/generators/database.rb', line 33
def service
raise NotImplementedError
end
|
#socket ⇒ Object
57
|
# File 'lib/rails/generators/database.rb', line 57
def socket; end
|
#volume ⇒ Object
66
67
68
69
70
|
# File 'lib/rails/generators/database.rb', line 66
def volume
return unless service
"#{name}-data"
end
|