lib/subcommand/prick-build.rb in prick-0.28.1 vs lib/subcommand/prick-build.rb in prick-0.29.0
- old
+ new
@@ -1,11 +1,14 @@
#!/usr/bin/env ruby
require 'builder/builder.rb'
module Prick::SubCommand
- def self.build(database, username, schema, builddir: "schema", force: false, timer: nil, dump: nil)
+ def self.build(
+ database, username, schema,
+ builddir: "schema", force: false, timer: nil, dump: nil)
+
Timer.on! if timer
time "Prick::Command#build" do
begin
super_conn = PgConn.new # Used to create new databases (doesn't make a
# difference right now as the mikras user is
@@ -13,25 +16,23 @@
conn = nil
builder = nil
time "Load build object" do
if super_conn.rdbms.exist? database
- conn = PgConn.new(database, username)
exist = true
else
super_conn.rdbms.create database, owner: username
- conn = PgConn.new(database, username)
exist = false
end
+ conn = PgConn.new(database, username)
builder = Prick::Build::Builder.new(conn, builddir)
if exist
if force
# Drop all schemas but re-creates the public schema
- super_conn.rdbms.empty!(database)
- conn.schema.drop("public") # drop it again FIXME
+ super_conn.rdbms.empty!(database, public: false)
else
# Find schemas to refresh. This includes all schemas in the
# database
refresh_schemas = conn.schema.list
@@ -67,12 +68,12 @@
time "Execute build object" do
builder.execute conn
end
- rescue Prick::Error => ex
- $stderr.puts ex.message
- exit 1
+# rescue Prick::Error => ex
+# $stderr.puts ex.message
+# exit 1
rescue ::Command::Error => ex
$stderr.puts ex.message
exit 1