Sha256: 03a9870df859930e114a30dcd4682b39fb46e1e09b6ceb09bc3221fea45b31d0

Contents?: true

Size: 1.49 KB

Versions: 13

Compression:

Stored size: 1.49 KB

Contents

#!/usr/bin/env ruby

require_relative '../builder/builder.rb'

module Prick::SubCommand
  def self.fox(database, username, files)
    Command.command "fox --state=#{FOX_STATE_PATH} --exec #{database} #{files.join(" ")}"
  end
end

__END__


    Timer.on! if timer
    time "Prick::Command#build" do
      begin
        super_conn = PgConn.new
        conn = nil
        builder = nil

        time "Load build object" do
          if super_conn.rdbms.exist? database
            conn = PgConn.new(database, username)
            super_conn.rdbms.empty!(database)
          else
            super_conn.rdbms.create database, owner: username
            conn = PgConn.new(database, username)
          end

          builder = Prick::Build::Builder.new(conn, builddir)
          builder.pool.delete_schema(builder.pool.after_schema(schema)) if schema
        end
        
        case dump
          when :nodes; builder.nodes.reject { |node| node.is_a?(Build::BuildNode) }.map &:dump
          when :allnodes; builder.nodes.map &:dump
          when :batches; builder.dump
          when nil;
        else
          Prick.error "Illegal dump type: #{dump.inspect}"
        end && exit

        time "Execute build object" do
          builder.execute conn
        end

      rescue Prick::Error => ex
        $stderr.puts ex.message
        exit 1

      rescue ::Command::Error => ex
        $stderr.puts ex.message
        exit 1

      ensure
        super_conn&.terminate
        conn&.terminate
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
prick-0.39.5 lib/prick/subcommand/prick-fox.rb
prick-0.39.4 lib/prick/subcommand/prick-fox.rb
prick-0.39.3 lib/prick/subcommand/prick-fox.rb
prick-0.39.2 lib/prick/subcommand/prick-fox.rb
prick-0.39.1 lib/prick/subcommand/prick-fox.rb
prick-0.39.0 lib/prick/subcommand/prick-fox.rb
prick-0.36.0 lib/prick/subcommand/prick-fox.rb
prick-0.35.0 lib/prick/subcommand/prick-fox.rb
prick-0.34.0 lib/prick/subcommand/prick-fox.rb
prick-0.33.0 lib/prick/subcommand/prick-fox.rb
prick-0.32.0 lib/prick/subcommand/prick-fox.rb
prick-0.31.0 lib/prick/subcommand/prick-fox.rb
prick-0.30.0 lib/prick/subcommand/prick-fox.rb