ardb 0.2.0 → 0.3.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/runner.rb CHANGED
@@ -30,6 +30,9 @@ class Ardb::Runner
30
30
  when 'drop'
31
31
  require 'ardb/runner/drop_command'
32
32
  DropCommand.new.run
33
+ when 'connect'
34
+ require 'ardb/runner/connect_command'
35
+ ConnectCommand.new.run
33
36
  when 'null'
34
37
  NullCommand.new.run
35
38
  else
@@ -0,0 +1,19 @@
1
+ require 'ardb/runner'
2
+
3
+ class Ardb::Runner::ConnectCommand
4
+
5
+ def run
6
+ begin
7
+ Ardb.init
8
+ $stdout.puts "connected to #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`"
9
+ rescue Ardb::Runner::CmdError => e
10
+ raise e
11
+ rescue Exception => e
12
+ $stderr.puts e, *e.backtrace
13
+ $stderr.puts "error connecting to #{Ardb.config.db.database.inspect} database"\
14
+ " with #{Ardb.config.db.to_hash.inspect}"
15
+ raise Ardb::Runner::CmdFail
16
+ end
17
+ end
18
+
19
+ end
@@ -15,7 +15,7 @@ class Ardb::Runner::CreateCommand
15
15
  raise e
16
16
  rescue Exception => e
17
17
  $stderr.puts e
18
- $stderr.puts "error dropping #{Ardb.config.db.database.inspect} database"
18
+ $stderr.puts "error creating #{Ardb.config.db.database.inspect} database"
19
19
  raise Ardb::Runner::CmdFail
20
20
  end
21
21
  end
data/lib/ardb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ardb
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,17 @@
1
+ require 'assert'
2
+ require 'ardb/runner/connect_command'
3
+
4
+ class Ardb::Runner::CreateCommand
5
+
6
+ class BaseTests < Assert::Context
7
+ desc "Ardb::Runner::ConnectCommand"
8
+ setup do
9
+ @cmd = Ardb::Runner::ConnectCommand.new
10
+ end
11
+ subject{ @cmd }
12
+
13
+ should have_instance_methods :run
14
+
15
+ end
16
+
17
+ end
@@ -1,5 +1,4 @@
1
1
  require 'assert'
2
- require 'fileutils'
3
2
  require 'ardb/runner/create_command'
4
3
 
5
4
  class Ardb::Runner::CreateCommand
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: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding
@@ -105,6 +105,7 @@ files:
105
105
  - lib/ardb/migration_helpers.rb
106
106
  - lib/ardb/root_path.rb
107
107
  - lib/ardb/runner.rb
108
+ - lib/ardb/runner/connect_command.rb
108
109
  - lib/ardb/runner/create_command.rb
109
110
  - lib/ardb/runner/drop_command.rb
110
111
  - lib/ardb/runner/generate_command.rb
@@ -120,6 +121,7 @@ files:
120
121
  - test/unit/ardb_tests.rb
121
122
  - test/unit/config_tests.rb
122
123
  - test/unit/migration_helpers_tests.rb
124
+ - test/unit/runner/connect_command_tests.rb
123
125
  - test/unit/runner/create_command_tests.rb
124
126
  - test/unit/runner/drop_command_tests.rb
125
127
  - test/unit/runner/generate_command_tests.rb
@@ -178,6 +180,7 @@ test_files:
178
180
  - test/unit/ardb_tests.rb
179
181
  - test/unit/config_tests.rb
180
182
  - test/unit/migration_helpers_tests.rb
183
+ - test/unit/runner/connect_command_tests.rb
181
184
  - test/unit/runner/create_command_tests.rb
182
185
  - test/unit/runner/drop_command_tests.rb
183
186
  - test/unit/runner/generate_command_tests.rb