Module: SequelTools
- Defined in:
- lib/sequel_tools.rb,
lib/sequel_tools/version.rb,
lib/sequel_tools/actions_manager.rb,
lib/sequel_tools/sequel_tools_logger.rb
Defined Under Namespace
Classes: ActionsManager, MissingConfigError, SequelToolsLogger
Constant Summary collapse
- DEFAULT_CONFIG =
{ project_root: nil, pg_dump: 'pg_dump', # command used to run pg_dump maintenancedb: 'postgres', # DB to connect to for creating/dropping databases db_migrations_location: 'db/migrations', schema_location: 'db/migrations/schema.sql', seeds_location: 'db/seeds.rb', dbname: nil, dbhost: 'localhost', dbadapter: 'postgres', dbport: nil, username: nil, password: nil, dump_schema_on_migrate: false, log_level: nil, sql_log_level: :debug, }
- REQUIRED_KEYS =
unfrozen on purpose so that one might want to update the defaults
[ :project_root, :dbadapter, :dbname, :username ]
- VERSION =
'0.1.1'
Class Method Summary collapse
Class Method Details
.base_config(extra_config = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sequel_tools.rb', line 26 def self.base_config(extra_config = {}) config = DEFAULT_CONFIG.merge extra_config REQUIRED_KEYS.each do |key| raise MissingConfigError, "Expected value for #{key} config is missing" if config[key].nil? end [:db_migrations_location, :schema_location, :seeds_location].each do |k| config[k] = File. config[k], config[:project_root] end config end |
.inject_rake_tasks(config = {}, rake_context) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/sequel_tools.rb', line 37 def self.inject_rake_tasks(config = {}, rake_context) require_relative 'sequel_tools/actions_manager' require_relative 'sequel_tools/all_actions' actions_manager = ActionsManager.new config actions_manager.load_all actions_manager.export_as_rake_tasks rake_context end |