pry-sql 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f816183ad1dd149ebd4273c7d901dae77f77825d
4
- data.tar.gz: 0b194da2eca61d2fd869e9fb16348d3eb7bca9a0
3
+ metadata.gz: 268282c423a113c7ce023984a61a00a702752c23
4
+ data.tar.gz: d8e4ea0f2207c3382cb5353ff2176137191a6ccc
5
5
  SHA512:
6
- metadata.gz: 91f480558462486ce80e6655c2de03e3236a3c3ba41db0f9e800f29de845005241ac9293111e8304524cb0b388e0b1116baf63de1a2a1cb6e70fc898a39e17d6
7
- data.tar.gz: 1fda526b213d4942f692b10946c87c1f91c232b857efafaa3cf34251f52e5ca6d76e370a35f2fdd1ddad5874fb1d2b9e7b9f9173389c2bcedb0143bd1a835c6d
6
+ metadata.gz: 8ba0f40af8e2dd7072b1c790adf5a22c0a78f834e97ee1882aab667d1ba9f730f09df46123cbed6e40b2e64b80dc98e625dc0fc0dec41e296092665e67b717cf
7
+ data.tar.gz: dcd2756086848c334ff19acbef16f0bcae22fee51b936db086a74c0753a040d4a272c0ee439e42c6d63b724d13ba79934311ebc1964af41fb38ecee23a7e2624
data/README.md CHANGED
@@ -1,34 +1,23 @@
1
1
  # pry-sql
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pry-sql`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Execute SQL commands from the pry command line.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ```
6
+ $ pry
7
+ [1] pry(main)> connect example.sqlite
8
+ [2] pry(main)> CREATE TABLE examples (text TEXT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP)
9
+ [3] pry(main)> INSERT INTO examples (text) VALUES ("Hello, worlds!")
10
+ [4] pry(main)> SELECT * FROM examples
11
+ => [["Hello, worlds!", "2015-07-26 08:30:00"]]
12
+ ```
6
13
 
7
14
  ## Installation
8
15
 
9
- Add this line to your application's Gemfile:
16
+ Install the gem globally or inside the :development group of your gemfile:
10
17
 
11
- ```ruby
12
- gem 'pry-sql'
13
18
  ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install pry-sql
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
19
+ gem install 'pry-sql'
20
+ ```
32
21
 
33
22
  ## Contributing
34
23
 
data/lib/pry-sql.rb CHANGED
@@ -7,9 +7,8 @@ module PrySQL
7
7
  end
8
8
 
9
9
  def self.connect(cmd, fname)
10
- unless fname == ':memory:' || fname.ends_with?('.sqlite') || File.exist?(fname)
11
- cmd.output.puts "Error: file '#{fname}' not found."
12
- return
10
+ if fname != ':memory:' && !File.exist?(fname)
11
+ raise Pry::CommandError, "database file not found: #{fname}"
13
12
  end
14
13
  require "sqlite3"
15
14
  @database = SQLite3::Database.new(fname)
@@ -1,3 +1,3 @@
1
1
  module PrySQL
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Kuhn