ardb 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,10 @@
1
- require 'active_record'
2
- require 'ns-options'
3
1
  require 'pathname'
4
2
  require 'singleton'
3
+ require 'active_record'
4
+ require 'ns-options'
5
5
 
6
- require "ardb/version"
6
+ require 'ardb/version'
7
+ require 'ardb/root_path'
7
8
 
8
9
  module Ardb
9
10
  NotConfiguredError = Class.new(RuntimeError)
@@ -42,11 +43,8 @@ module Ardb
42
43
 
43
44
  option :root_path, Pathname, :required => true
44
45
  option :logger, :required => true
45
- option :migrations_path, String, :default => proc{ default_migrations_path }
46
- option :schema_path, String, :default => proc{ default_schema_path }
47
-
48
- def self.default_migrations_path; root_path.join("db/migrations"); end
49
- def self.default_schema_path; root_path.join("db/schema.rb"); end
46
+ option :migrations_path, RootPath, :default => proc{ "db/migrations" }
47
+ option :schema_path, RootPath, :default => proc{ "db/schema.rb" }
50
48
 
51
49
  end
52
50
 
@@ -0,0 +1,12 @@
1
+ # This takes a path string relative to the configured root path and tranforms
2
+ # to the full qualifed root path. The goal here is to specify path options
3
+ # with root-relative path strings.
4
+
5
+ module Ardb; end
6
+ class Ardb::RootPath < String
7
+
8
+ def initialize(path_string)
9
+ super(Ardb.config.root_path.join(path_string).to_s)
10
+ end
11
+
12
+ end
@@ -14,6 +14,8 @@ class Ardb::Runner::CreateCommand
14
14
  rescue Ardb::Runner::CmdError => e
15
15
  raise e
16
16
  rescue Exception => e
17
+ $stderr.puts e
18
+ $stderr.puts "error dropping #{Ardb.config.db.database.inspect} database"
17
19
  raise Ardb::Runner::CmdFail
18
20
  end
19
21
  end
@@ -14,6 +14,8 @@ class Ardb::Runner::DropCommand
14
14
  rescue Ardb::Runner::CmdError => e
15
15
  raise e
16
16
  rescue Exception => e
17
+ $stderr.puts e
18
+ $stderr.puts "error dropping #{Ardb.config.db.database.inspect} database"
17
19
  raise Ardb::Runner::CmdFail
18
20
  end
19
21
  end
@@ -22,7 +22,7 @@ class Ardb::Runner::GenerateCommand
22
22
  rescue Ardb::Runner::CmdError => e
23
23
  raise e
24
24
  rescue Exception => e
25
- $stderr.puts e, *(e.backtrace)
25
+ $stderr.puts e
26
26
  $stderr.puts "error generating #{@item}."
27
27
  raise Ardb::Runner::CmdFail
28
28
  end
@@ -21,7 +21,7 @@ class Ardb::Runner::MigrateCommand
21
21
  rescue Ardb::Runner::CmdError => e
22
22
  raise e
23
23
  rescue Exception => e
24
- $stderr.puts e, *(e.backtrace)
24
+ $stderr.puts e
25
25
  $stderr.puts "error migrating #{Ardb.config.db.database.inspect} database"
26
26
  raise Ardb::Runner::CmdFail
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module Ardb
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-04-03 00:00:00 Z
19
+ date: 2013-04-05 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: assert
@@ -103,6 +103,7 @@ files:
103
103
  - lib/ardb/adapter/sqlite.rb
104
104
  - lib/ardb/cli.rb
105
105
  - lib/ardb/migration_helpers.rb
106
+ - lib/ardb/root_path.rb
106
107
  - lib/ardb/runner.rb
107
108
  - lib/ardb/runner/create_command.rb
108
109
  - lib/ardb/runner/drop_command.rb