ardb 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/ardb.rb CHANGED
@@ -6,6 +6,8 @@ require 'ns-options'
6
6
  require 'ardb/version'
7
7
  require 'ardb/root_path'
8
8
 
9
+ ENV['ARDB_DB_FILE'] ||= 'config/db'
10
+
9
11
  module Ardb
10
12
  NotConfiguredError = Class.new(RuntimeError)
11
13
 
@@ -21,6 +23,7 @@ module Ardb
21
23
  end
22
24
 
23
25
  def self.init(establish_connection=true)
26
+ require self.config.db_file
24
27
  validate!
25
28
  Adapter.init
26
29
 
@@ -44,6 +47,7 @@ module Ardb
44
47
  option :password, String, :required => false
45
48
  end
46
49
 
50
+ option :db_file, Pathname, :default => ENV['ARDB_DB_FILE']
47
51
  option :root_path, Pathname, :required => true
48
52
  option :logger, :required => true
49
53
  option :migrations_path, RootPath, :default => proc{ "db/migrations" }
data/lib/ardb/runner.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  require 'ardb'
2
2
 
3
- ENV['ARDB_CONFIG_FILE'] ||= 'config/db'
4
-
5
3
  module Ardb; end
6
4
  class Ardb::Runner
7
5
  UnknownCmdError = Class.new(ArgumentError)
@@ -17,7 +15,8 @@ class Ardb::Runner
17
15
  end
18
16
 
19
17
  def run
20
- setup_run
18
+ Ardb.init(false) # don't establish a connection
19
+
21
20
  case @cmd_name
22
21
  when 'migrate'
23
22
  require 'ardb/runner/migrate_command'
@@ -41,13 +40,6 @@ class Ardb::Runner
41
40
  end
42
41
  end
43
42
 
44
- private
45
-
46
- def setup_run
47
- require ENV['ARDB_CONFIG_FILE']
48
- Ardb.init(false) # don't establish a connection
49
- end
50
-
51
43
  class NullCommand
52
44
  def run
53
45
  # if this was a real command it would do something here
data/lib/ardb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ardb
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/test/helper.rb CHANGED
@@ -7,5 +7,6 @@ $LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
7
7
  # require pry for debugging (`binding.pry`)
8
8
  require 'pry'
9
9
 
10
- ENV['ARDB_CONFIG_FILE'] = 'tmp/testdb/config/db'
11
- require ENV['ARDB_CONFIG_FILE']
10
+ ENV['ARDB_DB_FILE'] = 'tmp/testdb/config/db'
11
+ require 'ardb'
12
+ Ardb.init(false)
@@ -10,6 +10,7 @@ class Ardb::Config
10
10
  subject{ Ardb::Config }
11
11
 
12
12
  should have_namespace :db
13
+ should have_option :db_file, Pathname, :default => ENV['ARDB_DB_FILE']
13
14
  should have_option :root_path, Pathname, :required => true
14
15
  should have_option :logger, :required => true
15
16
  should have_options :migrations_path, :schema_path
@@ -25,6 +25,7 @@ class Ardb::Runner
25
25
  class RunTests < BaseTests
26
26
  desc "when running a command"
27
27
  setup do
28
+ Ardb::Adapter.reset
28
29
  @runner = Ardb::Runner.new(['null', 1, 2], {})
29
30
  end
30
31
  teardown do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ardb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
8
+ - 6
9
9
  - 0
10
- version: 0.5.0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding