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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDYxNjY3NjA1NTU3NmFiZGFiM2Q3YWU4YWNjZjM3NGRhZjJhZjIwOQ==
4
+ MmU5MDQ4ZjEwNDk3MzY5ZTlmZjExNDdkMjczY2I0MmE0NzNiYmU3Ng==
5
5
  data.tar.gz: !binary |-
6
- MjdiZTc0M2UzOTczNjBiOTQxMDdkNTgwY2JmYWQ2OTAzYjc4YjFiNQ==
6
+ NDAxOGUzOTQ4NmIyNmIxZjZiYzIyNTk5N2JhYTlkMTNmOGYzYzhhZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDIwYTk5YWY2ZGZmYWY2MjBmMTNiNWI5ZjI2MTEwMzUwNmY2YzY3ZGEzMjYy
10
- ZDhkNWJlMGRmZDA2MDJhZjA5NjNlN2I1NmIzNzg4MjE2MmEzMDI5MTMyZDEy
11
- MzZmOGQyMWZjMjE4NmJjMDViZjBjNjAxNzg0ODFmZGIyMTQyMzI=
9
+ ZWFjNTM1YmQ0NzU5OTc2MjcxODlkM2E0YjFhN2QxNjMxZmNmODkxOTQwZGU3
10
+ MGI5ZDdmMmM0YTZhYmZkMDA5MGQwMjM4YTAwNzM1ZjA4NGM5NjA3YWFmZGMy
11
+ MTc3ZWNmM2M1ZDcxNTJmYjc5YmJlMTc3YTM5MDgxNGM5YjRjMzU=
12
12
  data.tar.gz: !binary |-
13
- MDg4MjRmYTY0NDI5NmRlYzA4OGQxNTMzMWVmNWFhMGQ4M2QzODU1YThjMmVi
14
- ODYyMDBjNDViYjgwZDg2ZmEwZDUzNjViMWY1ZDZjZjk1ZDIyOTU3YjFlN2Nj
15
- OWQ1MjZlMmE0NzE4NDgwNTI5NWQyN2JlMzRiZjA5MWQzZTE5ZGM=
13
+ YzA3Zjg5NmI5NTdiOTljYWI5ZDFjZDY4N2Q5ZDA1YTQ0ZDNmODdmOThkYWM5
14
+ MWZiODgxZDZhZTBhNmFjMDRiZDgzNGFkOGQwZjBhMDNlM2Y2M2I4ZjRjY2Y2
15
+ MThmYjM2N2Y2ZGZiYjEwZmI4NzhjNzZiY2E3OGJiOTU5ZDVlNjI=
data/UPGRADE.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.3.4
2
+
3
+ * QUGC-154 disable
4
+
5
+
6
+
1
7
  ## 0.3.3
2
8
 
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.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
- ['y','yes'].include?( ask("Are you sure? (y/n)") )
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
@@ -96,7 +96,7 @@ module Threading
96
96
  end
97
97
 
98
98
  def threads
99
- options.threads.to_i || 1
99
+ options.threads.to_i || 10
100
100
  end
101
101
 
102
102
  def exiting?
@@ -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 weekly_scraper.rb --at "7pm Monday"
24
- You have successfully scheduled weekly-scraper.rb.
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: "The name used to reference your scraper in the quandl cloud.",
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
- scrapers.each { |x| script_info x}
40
- end
41
-
42
- def show
43
- script_info scraper
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
- raise "#{Quandl::Command::Presenter.pretty_errors(result.errors.messages).to_s.gsub("\n", ' ')}"
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( scraper.name, 'wb') do |file|
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
- raise "#{Quandl::Command::Presenter.pretty_errors(result.errors.messages).to_s.gsub("\n", ' ')}"
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
- raise "#{Quandl::Command::Presenter.pretty_errors(scraper.errors.messages).to_s.gsub("\n", ' ')}"
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
- raise "#{options.at} is invalid time" if time_value.nil?
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.name if options.name.present?
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( lock: dataset.client.full_code ) do
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.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-21 00:00:00.000000000 Z
11
+ date: 2014-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander