pqdl 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. data/bin/pqdl +8 -11
  2. metadata +2 -2
data/bin/pqdl CHANGED
@@ -8,7 +8,7 @@ require "zip/zip"
8
8
  CONFIG_PATH = File.expand_path("~/.pqdl.yml")
9
9
 
10
10
  trap "INT" do
11
- $session.close if $session and $session.open?
11
+ $session.close rescue Geocaching::Error if $session and $session.open?
12
12
  exit 1
13
13
  end
14
14
 
@@ -31,7 +31,7 @@ def configure
31
31
 
32
32
  File.open(CONFIG_PATH, "w") do |f|
33
33
  f.write({ "username" => ARGV[1], "password" => ARGV[2] }.to_yaml)
34
- f.chmod(0700)
34
+ f.chmod(0600)
35
35
  end
36
36
  end
37
37
 
@@ -92,7 +92,7 @@ def pocket_query_select
92
92
  end
93
93
 
94
94
  if pocket_queries.size == 0
95
- $stderr.puts "There are not Pocket Queries available for download"
95
+ $stderr.puts "There are no Pocket Queries available for download"
96
96
  exit
97
97
  end
98
98
 
@@ -109,14 +109,13 @@ def pocket_query_select
109
109
  break if id > 0 and id <= pocket_queries.size
110
110
  end
111
111
 
112
- pocket_queries[id - 1].guid if id
112
+ pocket_queries[id - 1].guid
113
113
  end
114
114
 
115
115
  def download
116
116
  guid = ARGV[1] || pocket_query_select
117
- fatal "Oops" unless guid
118
-
119
117
  download_to_stdout = !$stdout.isatty
118
+
120
119
  puts "Downloading Pocket Query..." unless download_to_stdout
121
120
 
122
121
  pq = begin
@@ -125,6 +124,8 @@ def download
125
124
  fatal "Could not download Pocket Query from geocaching.com"
126
125
  end
127
126
 
127
+ fatal "Pocket Query not available for download" unless pq
128
+
128
129
  filename = nil
129
130
 
130
131
  tempfile = Tempfile.new(guid)
@@ -159,8 +160,4 @@ end
159
160
 
160
161
  send(ARGV.first || "download")
161
162
 
162
- begin
163
- $session.close if $session
164
- rescue Geocaching::Error
165
- #
166
- end
163
+ $session.close rescue Geocaching::Error if $session
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: pqdl
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thomas Cyron
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-24 00:00:00 +02:00
13
+ date: 2011-06-07 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency