Class: Tomo::Plugin::Rails::Tasks

Inherits:
TaskLibrary show all
Defined in:
lib/tomo/plugin/rails/tasks.rb

Instance Method Summary collapse

Methods inherited from TaskLibrary

#initialize

Constructor Details

This class inherits a constructor from Tomo::TaskLibrary

Instance Method Details

#assets_precompileObject



5
6
7
# File 'lib/tomo/plugin/rails/tasks.rb', line 5

def assets_precompile
  remote.rake("assets:precompile")
end

#consoleObject



9
10
11
# File 'lib/tomo/plugin/rails/tasks.rb', line 9

def console
  remote.rails("console", settings[:run_args], attach: true)
end

#db_consoleObject



17
18
19
# File 'lib/tomo/plugin/rails/tasks.rb', line 17

def db_console
  remote.rails("dbconsole", "--include-password", settings[:run_args], attach: true)
end

#db_createObject



29
30
31
32
33
# File 'lib/tomo/plugin/rails/tasks.rb', line 29

def db_create
  return remote.rake("db:create") unless database_exists?

  logger.info "Database already exists; skipping db:create."
end

#db_migrateObject



21
22
23
# File 'lib/tomo/plugin/rails/tasks.rb', line 21

def db_migrate
  remote.rake("db:migrate")
end

#db_schema_loadObject



41
42
43
44
45
46
47
48
49
# File 'lib/tomo/plugin/rails/tasks.rb', line 41

def db_schema_load
  if !schema_rb_present?
    logger.warn "db/schema.rb is not present; skipping schema:load."
  elsif database_schema_loaded?
    logger.info "Database schema already loaded; skipping db:schema:load."
  else
    remote.rake("db:schema:load")
  end
end

#db_seedObject



25
26
27
# File 'lib/tomo/plugin/rails/tasks.rb', line 25

def db_seed
  remote.rake("db:seed")
end

#db_setupObject



35
36
37
38
39
# File 'lib/tomo/plugin/rails/tasks.rb', line 35

def db_setup
  return remote.rake("db:setup") unless database_exists?

  logger.info "Database already exists; skipping db:setup."
end

#db_structure_loadObject



51
52
53
54
55
56
57
58
59
# File 'lib/tomo/plugin/rails/tasks.rb', line 51

def db_structure_load
  if !structure_sql_present?
    logger.warn "db/structure.sql is not present; skipping db:structure:load."
  elsif database_schema_loaded?
    logger.info "Database structure already loaded; skipping db:structure:load."
  else
    remote.rake("db:structure:load")
  end
end

#queryObject



13
14
15
# File 'lib/tomo/plugin/rails/tasks.rb', line 13

def query
  remote.rails("query", settings[:run_args], attach: true)
end