quandl 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/UPGRADE.md +6 -0
- data/VERSION +1 -1
- data/lib/quandl/command/task/configurable.rb +5 -4
- data/lib/quandl/command/task/threading.rb +1 -1
- data/lib/quandl/command/tasks/delete.rb +1 -1
- data/lib/quandl/command/tasks/schedule.rb +19 -22
- data/lib/quandl/command/tasks/upload.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmU5MDQ4ZjEwNDk3MzY5ZTlmZjExNDdkMjczY2I0MmE0NzNiYmU3Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDAxOGUzOTQ4NmIyNmIxZjZiYzIyNTk5N2JhYTlkMTNmOGYzYzhhZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWFjNTM1YmQ0NzU5OTc2MjcxODlkM2E0YjFhN2QxNjMxZmNmODkxOTQwZGU3
|
10
|
+
MGI5ZDdmMmM0YTZhYmZkMDA5MGQwMjM4YTAwNzM1ZjA4NGM5NjA3YWFmZGMy
|
11
|
+
MTc3ZWNmM2M1ZDcxNTJmYjc5YmJlMTc3YTM5MDgxNGM5YjRjMzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzA3Zjg5NmI5NTdiOTljYWI5ZDFjZDY4N2Q5ZDA1YTQ0ZDNmODdmOThkYWM5
|
14
|
+
MWZiODgxZDZhZTBhNmFjMDRiZDgzNGFkOGQwZjBhMDNlM2Y2M2I4ZjRjY2Y2
|
15
|
+
MThmYjM2N2Y2ZGZiYjEwZmI4NzhjNzZiY2E3OGJiOTU5ZDVlNjI=
|
data/UPGRADE.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
@@ -35,17 +35,18 @@ module Configurable
|
|
35
35
|
options.trace == true
|
36
36
|
end
|
37
37
|
|
38
|
-
def confirmed?
|
38
|
+
def confirmed?(message=nil)
|
39
39
|
return true if force_yes?
|
40
|
-
ask_for_confirmation!
|
40
|
+
ask_for_confirmation!(message)
|
41
41
|
end
|
42
42
|
|
43
43
|
def force_yes?
|
44
44
|
options.force_yes == true
|
45
45
|
end
|
46
46
|
|
47
|
-
def ask_for_confirmation!
|
48
|
-
|
47
|
+
def ask_for_confirmation!(message=nil)
|
48
|
+
message = "Are you sure?" if message.blank?
|
49
|
+
['y','yes'].include?( ask("#{message} (y/n)") )
|
49
50
|
end
|
50
51
|
|
51
52
|
def page
|
@@ -25,7 +25,7 @@ class Quandl::Command::Tasks::Delete < Quandl::Command::Task
|
|
25
25
|
# find
|
26
26
|
dataset = Quandl::Client::Dataset.find( code )
|
27
27
|
# destroy
|
28
|
-
dataset.destroy if dataset.respond_to?(:destroy) && dataset.exists?
|
28
|
+
dataset.destroy if dataset.respond_to?(:destroy) && dataset.exists? && confirmed?("Are you sure you want to delete #{dataset.full_code}?")
|
29
29
|
# present
|
30
30
|
present dataset
|
31
31
|
end
|
@@ -9,26 +9,25 @@ class Quandl::Command::Tasks::Schedule < Quandl::Command::Task
|
|
9
9
|
|
10
10
|
COMMANDS:
|
11
11
|
|
12
|
-
schedule list
|
13
|
-
schedule add file
|
14
|
-
schedule show file
|
12
|
+
schedule list [file]
|
13
|
+
schedule add file [--at TIME]
|
15
14
|
schedule delete file
|
16
|
-
schedule replace file
|
15
|
+
schedule replace file [--at NEW_TIME]
|
17
16
|
|
18
17
|
EXAMPLES:
|
19
18
|
|
20
19
|
$ quandl schedule add scraper.rb
|
21
20
|
You have successfully scheduled scraper.rb.
|
22
21
|
|
23
|
-
$ quandl schedule add scraper.rb --name
|
24
|
-
You have successfully scheduled
|
22
|
+
$ quandl schedule add scraper.rb --remote-name scraper.rb --at "7pm Monday"
|
23
|
+
You have successfully scheduled scraper.rb. [weekly scraper]
|
25
24
|
|
26
25
|
$ quandl schedule replace scraper.rb --at "13:00"
|
27
|
-
You have successfully replaced scraper.rb}
|
26
|
+
You have successfully replaced scraper.rb. [daily scraper]}
|
28
27
|
|
29
28
|
options({
|
30
29
|
String => {
|
31
|
-
name
|
30
|
+
:'remote-name' => "The name used to reference your scraper in the quandl cloud.",
|
32
31
|
at: "Time to run your script in UTC timezone. e.g. '14:30','7pm Monday', 'friday 13:00'"
|
33
32
|
}
|
34
33
|
})
|
@@ -36,29 +35,28 @@ class Quandl::Command::Tasks::Schedule < Quandl::Command::Task
|
|
36
35
|
DAYS_OF_THE_WEEK = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
|
37
36
|
|
38
37
|
def list
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
if args.first
|
39
|
+
script_info scraper
|
40
|
+
else
|
41
|
+
scrapers.each { |x| script_info x}
|
42
|
+
end
|
44
43
|
end
|
45
44
|
|
45
|
+
|
46
46
|
def add
|
47
47
|
result=Quandl::Client::Scraper.create( name: name, scraper: args.first, schedule_at: cron_at)
|
48
48
|
if result.valid?
|
49
49
|
info("You have successfully scheduled '#{scraper.name}'.")
|
50
50
|
info("#{schedule_message}")
|
51
51
|
else
|
52
|
-
|
52
|
+
error "#{Quandl::Command::Presenter.pretty_errors(result.errors.messages).to_s.gsub("\n", ' ')}"
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
def download
|
57
57
|
begin
|
58
58
|
require 'open-uri'
|
59
|
-
open(
|
60
|
-
$stdout << open(scraper.scraper_url, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read
|
61
|
-
end
|
59
|
+
$stdout << open(scraper.scraper_url, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read
|
62
60
|
rescue => err
|
63
61
|
present err
|
64
62
|
end
|
@@ -72,7 +70,7 @@ class Quandl::Command::Tasks::Schedule < Quandl::Command::Task
|
|
72
70
|
if result.valid?
|
73
71
|
info("You have successfully deleted '#{scraper.name}'")
|
74
72
|
else
|
75
|
-
|
73
|
+
error "#{Quandl::Command::Presenter.pretty_errors(result.errors.messages).to_s.gsub("\n", ' ')}"
|
76
74
|
end
|
77
75
|
|
78
76
|
end
|
@@ -90,8 +88,7 @@ class Quandl::Command::Tasks::Schedule < Quandl::Command::Task
|
|
90
88
|
info("You have successfully replaced '#{scraper.name}'.")
|
91
89
|
info("#{schedule_message}")
|
92
90
|
else
|
93
|
-
|
94
|
-
|
91
|
+
error "#{Quandl::Command::Presenter.pretty_errors(scraper.errors.messages).to_s.gsub("\n", ' ')}"
|
95
92
|
end
|
96
93
|
end
|
97
94
|
|
@@ -148,13 +145,13 @@ Check your scrapers run status at #{quandl_url.gsub(/\/api\/?/,'')}/scrapers"
|
|
148
145
|
def cron_at
|
149
146
|
return nil unless options.at
|
150
147
|
time_value=Chronic.parse(options.at)
|
151
|
-
|
148
|
+
error "#{options.at} is invalid time" if time_value.nil?
|
152
149
|
day_of_the_week = options.at =~ (/Mon|Tue|Wed|Thu|Fri|Sat|Sun/i) ? time_value.wday : '*'
|
153
150
|
"#{time_value.min} #{time_value.hour} * * #{day_of_the_week}"
|
154
151
|
end
|
155
152
|
|
156
153
|
def name
|
157
|
-
return options.
|
154
|
+
return options.remote_name if options.remote_name.present?
|
158
155
|
return File.basename(args.first) if args.first.present?
|
159
156
|
end
|
160
157
|
|
@@ -36,7 +36,7 @@ class Quandl::Command::Tasks::Upload < Quandl::Command::Task
|
|
36
36
|
# present error if given
|
37
37
|
next present( error ) unless error.nil?
|
38
38
|
# process in background using thread key
|
39
|
-
background_job
|
39
|
+
background_job do
|
40
40
|
# upload
|
41
41
|
upload( dataset )
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quandl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Hilscher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|