Module: DbAgile

Defined in:
lib/dbagile.rb,
lib/dbagile/io.rb,
lib/dbagile/errors.rb,
lib/dbagile/io/csv.rb,
lib/dbagile/io/xml.rb,
lib/dbagile/plugin.rb,
lib/dbagile/adapter.rb,
lib/dbagile/command.rb,
lib/dbagile/io/html.rb,
lib/dbagile/io/json.rb,
lib/dbagile/io/ruby.rb,
lib/dbagile/io/text.rb,
lib/dbagile/io/yaml.rb,
lib/dbagile/restful.rb,
lib/dbagile/core/chain.rb,
lib/dbagile/robustness.rb,
lib/dbagile/tools/math.rb,
lib/dbagile/tools/ruby.rb,
lib/dbagile/command/api.rb,
lib/dbagile/command/dba.rb,
lib/dbagile/core/io/dsl.rb,
lib/dbagile/core/schema.rb,
lib/dbagile/environment.rb,
lib/dbagile/tools/tuple.rb,
lib/dbagile/command/help.rb,
lib/dbagile/io/type_safe.rb,
lib/dbagile/tools/string.rb,
lib/dbagile/command/db/rm.rb,
lib/dbagile/core/database.rb,
lib/dbagile/adapter/sequel.rb,
lib/dbagile/command/db/add.rb,
lib/dbagile/command/db/use.rb,
lib/dbagile/command/robust.rb,
lib/dbagile/restful/client.rb,
lib/dbagile/restful/server.rb,
lib/dbagile/command/db/list.rb,
lib/dbagile/command/db/ping.rb,
lib/dbagile/contract/robust.rb,
lib/dbagile/core/connection.rb,
lib/dbagile/core/repository.rb,
lib/dbagile/io/pretty_table.rb,
lib/dbagile/command/db/stage.rb,
lib/dbagile/command/sql/drop.rb,
lib/dbagile/command/sql/send.rb,
lib/dbagile/command/sql/show.rb,
lib/dbagile/core/schema/part.rb,
lib/dbagile/core/transaction.rb,
lib/dbagile/command/web/tools.rb,
lib/dbagile/tools/file_system.rb,
lib/dbagile/core/io/robustness.rb,
lib/dbagile/core/schema/errors.rb,
lib/dbagile/restful/client/get.rb,
lib/dbagile/restful/middleware.rb,
lib/dbagile/tools/ordered_hash.rb,
lib/dbagile/command/bulk/export.rb,
lib/dbagile/command/bulk/import.rb,
lib/dbagile/command/repo/create.rb,
lib/dbagile/command/schema/diff.rb,
lib/dbagile/command/schema/dump.rb,
lib/dbagile/command/sql/heading.rb,
lib/dbagile/contract/connection.rb,
lib/dbagile/contract/utils/full.rb,
lib/dbagile/core/schema/builder.rb,
lib/dbagile/core/schema/logical.rb,
lib/dbagile/environment/testing.rb,
lib/dbagile/restful/client/post.rb,
lib/dbagile/command/bulk/commons.rb,
lib/dbagile/command/schema/check.rb,
lib/dbagile/command/schema/merge.rb,
lib/dbagile/core/schema/physical.rb,
lib/dbagile/environment/on_error.rb,
lib/dbagile/restful/client/utils.rb,
lib/dbagile/command/class_methods.rb,
lib/dbagile/contract/data/dataset.rb,
lib/dbagile/core/schema/composite.rb,
lib/dbagile/environment/buffering.rb,
lib/dbagile/environment/delegator.rb,
lib/dbagile/restful/client/delete.rb,
lib/dbagile/command/schema/commons.rb,
lib/dbagile/core/schema/robustness.rb,
lib/dbagile/environment/repository.rb,
lib/dbagile/environment/robustness.rb,
lib/dbagile/restful/middleware/get.rb,
lib/dbagile/robustness/file_system.rb,
lib/dbagile/contract/robust/helpers.rb,
lib/dbagile/contract/utils/delegate.rb,
lib/dbagile/core/repository/builder.rb,
lib/dbagile/restful/middleware/post.rb,
lib/dbagile/robustness/dependencies.rb,
lib/dbagile/environment/interactions.rb,
lib/dbagile/restful/middleware/utils.rb,
lib/dbagile/adapter/sequel/connection.rb,
lib/dbagile/command/schema/sql_script.rb,
lib/dbagile/core/schema/schema_object.rb,
lib/dbagile/restful/middleware/delete.rb,
lib/dbagile/contract/data/table_driven.rb,
lib/dbagile/contract/robust/optimistic.rb,
lib/dbagile/core/schema/logical/relvar.rb,
lib/dbagile/core/schema/migrate/stager.rb,
lib/dbagile/core/schema/physical/index.rb,
lib/dbagile/core/schema/database_schema.rb,
lib/dbagile/core/schema/logical/heading.rb,
lib/dbagile/core/schema/logical/relview.rb,
lib/dbagile/adapter/sequel/class_methods.rb,
lib/dbagile/adapter/sequel/sequel_tracer.rb,
lib/dbagile/contract/schema/table_driven.rb,
lib/dbagile/core/repository/yaml_methods.rb,
lib/dbagile/core/schema/builder/coercion.rb,
lib/dbagile/core/schema/physical/indexes.rb,
lib/dbagile/core/schema/logical/attribute.rb,
lib/dbagile/core/schema/migrate/drop_view.rb,
lib/dbagile/core/schema/migrate/operation.rb,
lib/dbagile/core/schema/computations/merge.rb,
lib/dbagile/core/schema/computations/minus.rb,
lib/dbagile/core/schema/computations/split.rb,
lib/dbagile/core/schema/logical/constraint.rb,
lib/dbagile/core/schema/migrate/drop_table.rb,
lib/dbagile/core/schema/computations/filter.rb,
lib/dbagile/core/schema/logical/constraints.rb,
lib/dbagile/core/schema/migrate/create_view.rb,
lib/dbagile/restful/middleware/one_database.rb,
lib/dbagile/adapter/sequel/data/table_driven.rb,
lib/dbagile/contract/data/transaction_driven.rb,
lib/dbagile/core/schema/migrate/create_table.rb,
lib/dbagile/core/schema/migrate/expand_table.rb,
lib/dbagile/adapter/sequel/schema/table_driven.rb,
lib/dbagile/contract/schema/transaction_driven.rb,
lib/dbagile/core/schema/migrate/collapse_table.rb,
lib/dbagile/adapter/sequel/schema/physical_dump.rb,
lib/dbagile/core/schema/builder/concept_factory.rb,
lib/dbagile/core/schema/migrate/abstract_script.rb,
lib/dbagile/adapter/sequel/schema/concrete_script.rb,
lib/dbagile/adapter/sequel/data/transaction_driven.rb,
lib/dbagile/adapter/sequel/schema/schema2sequel_args.rb,
lib/dbagile/adapter/sequel/schema/transaction_driven.rb,
lib/dbagile/core/schema/logical/constraint/foreign_key.rb,
lib/dbagile/contract/robust/optimistic/data/table_driven.rb,
lib/dbagile/core/schema/logical/constraint/candidate_key.rb,
lib/dbagile/contract/robust/optimistic/schema/table_driven.rb,
lib/dbagile/contract/robust/optimistic/data/transaction_driven.rb,
lib/dbagile/contract/robust/optimistic/schema/transaction_driven.rb

Defined Under Namespace

Modules: Contract, Core, FileSystemTools, IO, MathTools, Restful, Robustness, RubyTools, StringTools, Tools Classes: AbordTransactionError, Adapter, AssumptionFailedError, CandidateKeyNotFoundError, Command, ContractError, CorruptedRepositoryError, DatabaseNameConflictError, DependencyError, Environment, Error, InteractiveModeRequiredError, InternalError, InvalidDatabaseName, InvalidDatabaseUri, InvalidFormatError, KeyViolationError, NoDefaultDatabaseError, NoSchemaFilesError, NoSuchCommandError, NoSuchDatabaseError, NoSuchTableError, Plugin, SchemaConflictError, SchemaError, SchemaInternalError, SchemaSemanticsError, SchemaSyntaxError, SequelAdapter, TableAlreadyExistsError

Constant Summary collapse

VERSION =

Version of the DbAgile interface

"0.0.2".freeze
RECOGNIZED_DOMAINS =

Domains recognized as valid domains inside a SQL database

[
  ::SByC::TypeSystem::Ruby::Boolean,
  TrueClass, FalseClass, 
  String, 
  Fixnum, Bignum, Integer,
  Float,
  Time, 
  Date
]

Class Method Summary collapse

Class Method Details

.dba(environment = nil) ⇒ Object

Builds a DbAgile::Command::API instance and yields the block with the api instance.

A fresh new default environement is created if no one is given.

Example

DbAgile::dba do |dba|
  # Override environment default values (~/.dbagile, ...)
  dba.repository_path  = ...     # your application own repository
  dba.output_buffer     = ...    # keep messages in any object supporting :<< (STDOUT by default)

  # Start using dbagile commands
  dba.bulk_export %w{--csv --type-safe contacts}  # each line pushed in buffer
  dba.bulk_export %w{--ruby contacts}             # each record pushed as a Hash in buffer

end



35
36
37
38
39
40
41
42
43
# File 'lib/dbagile.rb', line 35

def dba(environment = nil)
  environment ||= default_environment
  dba = DbAgile::Command::API.new(environment)
  if block_given?
    yield(dba)
  else
    dba
  end
end

.default_environmentObject

Builds a default environment instance.

See Also:

  • DbAgile::Core::Repository.default


51
52
53
# File 'lib/dbagile.rb', line 51

def default_environment
  DbAgile::Environment.default
end