Class: ThemeJuice::Tasks::Database
- Inherits:
-
Entry
- Object
- ThemeJuice::Task
- Entry
- ThemeJuice::Tasks::Database
- Defined in:
- lib/theme-juice/tasks/database.rb
Instance Attribute Summary
Attributes inherited from Entry
Attributes inherited from ThemeJuice::Task
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(opts = {}) ⇒ Database
constructor
A new instance of Database.
- #unexecute ⇒ Object
Methods inherited from ThemeJuice::Task
Constructor Details
#initialize(opts = {}) ⇒ Database
Returns a new instance of Database.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/theme-juice/tasks/database.rb', line 7 def initialize(opts = {}) super @entry = { :project => @project.name, :file => "#{@env.vm_path}/database/init-custom.sql", :name => "database", :id => "DB" } end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/theme-juice/tasks/database.rb', line 18 def execute if @project.db_host && @project.db_name && @project.db_user && @project.db_pass create_entry_file create_entry do %Q{CREATE DATABASE IF NOT EXISTS `#{@project.db_name}`; GRANT ALL PRIVILEGES ON `#{@project.db_name}`.* TO '#{@project.db_user}'@'localhost' IDENTIFIED BY '#{@project.db_pass}';} end end end |
#unexecute ⇒ Object
28 29 30 31 |
# File 'lib/theme-juice/tasks/database.rb', line 28 def unexecute remove_entry drop_database end |