pasqual 0.0.1
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.
- checksums.yaml +7 -0
 - data/.gitignore +14 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +31 -0
 - data/Rakefile +2 -0
 - data/bin/rspec +16 -0
 - data/lib/pasqual/arglist.rb +14 -0
 - data/lib/pasqual/command.rb +54 -0
 - data/lib/pasqual/createdb.rb +22 -0
 - data/lib/pasqual/database.rb +33 -0
 - data/lib/pasqual/dropdb.rb +20 -0
 - data/lib/pasqual/version.rb +3 -0
 - data/lib/pasqual.rb +14 -0
 - data/pasqual.gemspec +26 -0
 - data/spec/pasqual/database_spec.rb +29 -0
 - data/spec/pasqual_spec.rb +17 -0
 - data/spec/spec_helper.rb +5 -0
 - metadata +122 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1b72c3b9c9bf68e2d65a72a8e52c21b23bae4d3c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: baf933fc8e884fd46773c521c1b9b7daffed2443
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: dddc6b3cf7f6c86a1974c53aabc1db702b7f4cb5ae16a0adfee30f51abd63b3d921a3bb2480aea3db856ecb4b21fbbe2351b37b2379a3ff30c53f108e6db473a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c5e077062401bc2e0bc42d0f29839453715680070bab6582f03474af57f91912265954aa8cb50db5fb4ead9f66d5ad404ab6b9802eea20d4801fccca0c6cddef
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2014 Derek Kastner
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Pasqual
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            TODO: Write a gem description
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 10 
     | 
    
         
            +
            gem 'pasqual'
         
     | 
| 
      
 11 
     | 
    
         
            +
            ```
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                $ gem install pasqual
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            TODO: Write usage instructions here
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            1. Fork it ( https://github.com/[my-github-username]/pasqual/fork )
         
     | 
| 
      
 28 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 29 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 30 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 31 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/rspec
    ADDED
    
    | 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            # This file was generated by Bundler.
         
     | 
| 
      
 4 
     | 
    
         
            +
            #
         
     | 
| 
      
 5 
     | 
    
         
            +
            # The application 'rspec' is installed as part of a gem, and
         
     | 
| 
      
 6 
     | 
    
         
            +
            # this file is here to facilitate running it.
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            require 'pathname'
         
     | 
| 
      
 10 
     | 
    
         
            +
            ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
         
     | 
| 
      
 11 
     | 
    
         
            +
              Pathname.new(__FILE__).realpath)
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 14 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            load Gem.bin_path('rspec-core', 'rspec')
         
     | 
| 
         @@ -0,0 +1,54 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pasqual/arglist'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Pasqual
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              class Command
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def self.execute(program, username, password, host, port, name)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  new(program, username, password, host, port, name).tap { |c| c.execute }
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                attr_accessor :program, :username, :password, :host, :port, :name,
         
     | 
| 
      
 12 
     | 
    
         
            +
                  :output, :status
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                def initialize(program, username, password, host, port, name)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  self.program = program
         
     | 
| 
      
 16 
     | 
    
         
            +
                  self.username = username
         
     | 
| 
      
 17 
     | 
    
         
            +
                  self.password = password
         
     | 
| 
      
 18 
     | 
    
         
            +
                  self.host = host
         
     | 
| 
      
 19 
     | 
    
         
            +
                  self.port = port
         
     | 
| 
      
 20 
     | 
    
         
            +
                  self.name = name
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 24 
     | 
    
         
            +
                  outfile = Tempfile.new("pasqual-#{name}")
         
     | 
| 
      
 25 
     | 
    
         
            +
                  outfile.sync = true
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  process = ChildProcess.build program,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    *Arglist.args(username, password, host, port, name)
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  process.io.stdout = process.io.stderr = outfile
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  if password
         
     | 
| 
      
 33 
     | 
    
         
            +
                    # TODO: find out why piping to stdin doesn't work :(
         
     | 
| 
      
 34 
     | 
    
         
            +
                    ENV['PGPASSWORD'] = password
         
     | 
| 
      
 35 
     | 
    
         
            +
                    process.start
         
     | 
| 
      
 36 
     | 
    
         
            +
                    process.poll_for_exit(30)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    ENV['PGPASSWORD'] = nil
         
     | 
| 
      
 38 
     | 
    
         
            +
                  else
         
     | 
| 
      
 39 
     | 
    
         
            +
                    process.start
         
     | 
| 
      
 40 
     | 
    
         
            +
                    process.poll_for_exit(30)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  outfile.rewind
         
     | 
| 
      
 44 
     | 
    
         
            +
                  self.output = outfile.read
         
     | 
| 
      
 45 
     | 
    
         
            +
                  self.status = process.exit_code
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                def success?
         
     | 
| 
      
 49 
     | 
    
         
            +
                  status == 0
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'childprocess'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'tempfile'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require 'pasqual/command'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Pasqual
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              module Createdb
         
     | 
| 
      
 9 
     | 
    
         
            +
                class AlreadyExists < StandardError; end
         
     | 
| 
      
 10 
     | 
    
         
            +
                class Failed < StandardError; end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def self.execute(username, password, host, port, name)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  cmd = Command.execute 'createdb', username, password, host, port, name
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  raise AlreadyExists if cmd.output =~ /already exists/
         
     | 
| 
      
 16 
     | 
    
         
            +
                  raise Failed unless cmd.success?
         
     | 
| 
      
 17 
     | 
    
         
            +
                  true
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'pasqual/createdb'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'pasqual/dropdb'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Pasqual
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              class Database
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :username, :password, :host, :port, :name
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                def initialize(url)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  uri = URI.parse url
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @username = uri.user
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @password = uri.password
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @host = uri.host
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @port = uri.port
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @name = uri.path.sub(/^\//, '')
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def port
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @port ||= 5432
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                def createdb(name)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  Createdb.execute username, password, host, port, name
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def dropdb(name)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Dropdb.execute username, password, host, port, name
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'childprocess'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'tempfile'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require 'pasqual/command'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Pasqual
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              module Dropdb
         
     | 
| 
      
 9 
     | 
    
         
            +
                class Failed < StandardError; end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def self.execute(username, password, host, port, name)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  cmd = Command.execute 'dropdb', username, password, host, port, name
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  raise Failed unless cmd.success?
         
     | 
| 
      
 15 
     | 
    
         
            +
                  true
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/pasqual.rb
    ADDED
    
    
    
        data/pasqual.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'pasqual/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "pasqual"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = Pasqual::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["Derek Kastner"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["dkastner@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary       = %q{Interface easily with postgres CLI tools}
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description   = %q{Shortcuts for postgres commands, with option to use ENV-configured conenction URLs}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.homepage      = ""
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_runtime_dependency "childprocess", "~> 0.5"
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.6"
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency "rspec", "~> 3.0.0"
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'pasqual/database'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            describe Pasqual::Database do
         
     | 
| 
      
 5 
     | 
    
         
            +
              let(:database) { Pasqual::Database.new ENV['DATABASE_URL'] }
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              describe '#createdb' do
         
     | 
| 
      
 8 
     | 
    
         
            +
                let(:name) { SecureRandom.hex(10) }
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                after :each do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  database.dropdb name
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                it 'creates a database' do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  expect(database.createdb(name)).to be true
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                it 'raises an error if a database already exists' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  database.createdb name
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  expect do
         
     | 
| 
      
 22 
     | 
    
         
            +
                    database.createdb name
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end.to raise_error(Pasqual::Createdb::AlreadyExists)
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'securerandom'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'pasqual'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            describe Pasqual do
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              describe '.new' do
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                it 'returns a Pasqual::Database configured for a URL' do
         
     | 
| 
      
 10 
     | 
    
         
            +
                  p = Pasqual.new
         
     | 
| 
      
 11 
     | 
    
         
            +
                  expect(p).to be_a(Pasqual::Database)
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,122 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: pasqual
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Derek Kastner
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-09-01 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: childprocess
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0.5'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0.5'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 3.0.0
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: 3.0.0
         
     | 
| 
      
 69 
     | 
    
         
            +
            description: Shortcuts for postgres commands, with option to use ENV-configured conenction
         
     | 
| 
      
 70 
     | 
    
         
            +
              URLs
         
     | 
| 
      
 71 
     | 
    
         
            +
            email:
         
     | 
| 
      
 72 
     | 
    
         
            +
            - dkastner@gmail.com
         
     | 
| 
      
 73 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 74 
     | 
    
         
            +
            - rspec
         
     | 
| 
      
 75 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 76 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 77 
     | 
    
         
            +
            files:
         
     | 
| 
      
 78 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 79 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 80 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 81 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 82 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 83 
     | 
    
         
            +
            - bin/rspec
         
     | 
| 
      
 84 
     | 
    
         
            +
            - lib/pasqual.rb
         
     | 
| 
      
 85 
     | 
    
         
            +
            - lib/pasqual/arglist.rb
         
     | 
| 
      
 86 
     | 
    
         
            +
            - lib/pasqual/command.rb
         
     | 
| 
      
 87 
     | 
    
         
            +
            - lib/pasqual/createdb.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - lib/pasqual/database.rb
         
     | 
| 
      
 89 
     | 
    
         
            +
            - lib/pasqual/dropdb.rb
         
     | 
| 
      
 90 
     | 
    
         
            +
            - lib/pasqual/version.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - pasqual.gemspec
         
     | 
| 
      
 92 
     | 
    
         
            +
            - spec/pasqual/database_spec.rb
         
     | 
| 
      
 93 
     | 
    
         
            +
            - spec/pasqual_spec.rb
         
     | 
| 
      
 94 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 95 
     | 
    
         
            +
            homepage: ''
         
     | 
| 
      
 96 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 97 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 98 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 99 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 100 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 101 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 103 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 104 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 105 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 106 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 107 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 108 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 109 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 110 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 111 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 112 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 113 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 114 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 115 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
      
 116 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 117 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 118 
     | 
    
         
            +
            summary: Interface easily with postgres CLI tools
         
     | 
| 
      
 119 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 120 
     | 
    
         
            +
            - spec/pasqual/database_spec.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - spec/pasqual_spec.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |