Sha256: 4636cc7e57141376378fa1f48127806228d1232520d5343e61b89ce7687cb794

Contents?: true

Size: 1.49 KB

Versions: 44

Compression:

Stored size: 1.49 KB

Contents

#!/usr/bin/env ruby

require '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
          raise 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

44 entries across 44 versions & 1 rubygems

Version Path
prick-0.29.1 lib/prick/subcommand/prick-fox.rb
prick-0.29.0 lib/subcommand/prick-fox.rb
prick-0.28.1 lib/subcommand/prick-fox.rb
prick-0.28.0 lib/subcommand/prick-fox.rb
prick-0.27.2 lib/subcommand/prick-fox.rb
prick-0.27.1 lib/subcommand/prick-fox.rb
prick-0.27.0 lib/subcommand/prick-fox.rb
prick-0.26.0 lib/subcommand/prick-fox.rb
prick-0.25.2 lib/subcommand/prick-fox.rb
prick-0.25.1 lib/subcommand/prick-fox.rb
prick-0.25.0 lib/subcommand/prick-fox.rb
prick-0.24.0 lib/subcommand/prick-fox.rb
prick-0.23.0 lib/subcommand/prick-fox.rb
prick-0.22.0 lib/subcommand/prick-fox.rb
prick-0.21.3 lib/subcommand/prick-fox.rb
prick-0.21.2 lib/subcommand/prick-fox.rb
prick-0.21.1 lib/subcommand/prick-fox.rb
prick-0.21.0 lib/subcommand/prick-fox.rb
prick-0.20.28 lib/subcommand/prick-fox.rb
prick-0.20.27 lib/subcommand/prick-fox.rb