ath 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ath/cli.rb +36 -29
  3. data/lib/ath/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5a50c633facd053d721acff0fb97f8f5d0adb82
4
- data.tar.gz: dc576e3a4548ac632b145281aa0e0786252bf6e7
3
+ metadata.gz: 42da3723a1c3f60623c4b20943452062c8789d93
4
+ data.tar.gz: 3205352665c60c5fc979bb1bde149c08f165c101
5
5
  SHA512:
6
- metadata.gz: bc8524c18109b05bc5610749434381dea009e13dd18e3d23a73e6b0f0f2eec0897302ae9df8e09a42da737ee7cfaf3b193d1a6dbb73953856ab684732a8f3a45
7
- data.tar.gz: 737154660475921c40bd7fcea791dab6ac87c95ad26d59cde4c857381582a13b5e195d1b44c145b4ff16f44f0afc4a81cf23f87ca36d013423a2503c50c2d015
6
+ metadata.gz: bb69186162a3ab810177f11e10015dbd12e75ba954293526a2d6cfcaac9262e77f878df35a67ead57092bae922a45032a41f4a03df5ac4db057f27b325af2c51
7
+ data.tar.gz: 5b9318386d31b7a0437c44f3d4c49dcbb17e9d29be990aab4cb6bb84b70993d1ae79ade1f578363b6e5690bc1416fbeb195f2bd4fc38f228e3fd446010484b7d
@@ -60,7 +60,12 @@ class Ath::CLI
60
60
  )
61
61
  end
62
62
 
63
- options[:output_location] = ERB.new(options[:output_location]).result
63
+ begin
64
+ options[:output_location] = ERB.new(options[:output_location]).result
65
+ rescue => e
66
+ $stderr.puts("[ERROR] Eval output-location failed: #{e.message}")
67
+ exit 1
68
+ end
64
69
 
65
70
  return [options, query, query_file]
66
71
  end
@@ -68,37 +73,39 @@ class Ath::CLI
68
73
  def main
69
74
  options, query, query_file = parse_options
70
75
 
71
- shell = Ath::Shell.new(
72
- output_location: options.delete(:output_location),
73
- database: options.delete(:database),
74
- pager: options.delete(:pager),
75
- options: options)
76
+ begin
77
+ shell = Ath::Shell.new(
78
+ output_location: options.delete(:output_location),
79
+ database: options.delete(:database),
80
+ pager: options.delete(:pager),
81
+ options: options)
76
82
 
77
- if query_file
78
- if query_file == '-'
79
- query = $stdin.read
80
- else
81
- query = File.read(query_file)
83
+ if query_file
84
+ if query_file == '-'
85
+ query = $stdin.read
86
+ else
87
+ query = File.read(query_file)
88
+ end
82
89
  end
83
- end
84
90
 
85
- if query
86
- options[:progress] = false unless options.has_key?(:progress)
87
- query.strip!
88
- query << ';' if query !~ /[;&]\z/
89
- shell.oneshot(query)
90
- else
91
- options[:progress] = true unless options.has_key?(:progress)
92
- shell.start
93
- end
94
- rescue Interrupt
95
- # nothing to do
96
- rescue => e
97
- if options[:debug]
98
- raise e
99
- else
100
- $stderr.puts("[ERROR] #{[e.message, e.backtrace.first].join("\n\t")}")
101
- exit 1
91
+ if query
92
+ options[:progress] = false unless options.has_key?(:progress)
93
+ query.strip!
94
+ query << ';' if query !~ /[;&]\z/
95
+ shell.oneshot(query)
96
+ else
97
+ options[:progress] = true unless options.has_key?(:progress)
98
+ shell.start
99
+ end
100
+ rescue Interrupt
101
+ # nothing to do
102
+ rescue => e
103
+ if options[:debug]
104
+ raise e
105
+ else
106
+ $stderr.puts("[ERROR] #{[e.message, e.backtrace.first].join("\n\t")}")
107
+ exit 1
108
+ end
102
109
  end
103
110
  end
104
111
  end
@@ -1,3 +1,3 @@
1
1
  module Ath
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel