quandl 0.4.4 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +133 -318
- data/lib/quandl.rb +27 -0
- data/lib/quandl/api_config.rb +33 -0
- data/lib/quandl/connection.rb +75 -0
- data/lib/quandl/errors/quandl_error.rb +56 -0
- data/lib/quandl/model/base.rb +31 -0
- data/lib/quandl/model/data.rb +32 -0
- data/lib/quandl/model/database.rb +62 -0
- data/lib/quandl/model/dataset.rb +24 -0
- data/lib/quandl/model/list.rb +45 -0
- data/lib/quandl/operations/base.rb +17 -0
- data/lib/quandl/operations/get.rb +21 -0
- data/lib/quandl/operations/list.rb +23 -0
- data/lib/quandl/util.rb +35 -0
- data/lib/quandl/version.rb +3 -0
- metadata +78 -319
- data/.gitignore +0 -16
- data/.travis.yml +0 -20
- data/Gemfile +0 -14
- data/Guardfile +0 -8
- data/LICENSE +0 -7
- data/Rakefile +0 -27
- data/UPGRADE.md +0 -262
- data/VERSION +0 -1
- data/bin/quandl +0 -25
- data/config/locales/en.yml +0 -26
- data/dist/resources/pkg/Distribution.erb +0 -15
- data/dist/resources/pkg/PackageInfo.erb +0 -6
- data/dist/resources/pkg/postinstall.erb +0 -47
- data/dist/resources/pkg/quandl +0 -25
- data/dist/resources/ruby/PackageInfo +0 -3
- data/dist/resources/windows/quandl +0 -25
- data/lib/commander/command/quandl_ext.rb +0 -21
- data/lib/quandl/command.rb +0 -47
- data/lib/quandl/command/client.rb +0 -0
- data/lib/quandl/command/client_ext.rb +0 -1
- data/lib/quandl/command/client_ext/user.rb +0 -11
- data/lib/quandl/command/compatibility_check.rb +0 -11
- data/lib/quandl/command/config.rb +0 -92
- data/lib/quandl/command/presenter.rb +0 -75
- data/lib/quandl/command/presenter/helper.rb +0 -19
- data/lib/quandl/command/presenter/record.rb +0 -113
- data/lib/quandl/command/presenters/dataset_presenter.rb +0 -19
- data/lib/quandl/command/presenters/error_presenter.rb +0 -31
- data/lib/quandl/command/presenters/nil_class_presenter.rb +0 -10
- data/lib/quandl/command/presenters/scraper_presenter.rb +0 -25
- data/lib/quandl/command/presenters/superset_presenter.rb +0 -10
- data/lib/quandl/command/task.rb +0 -44
- data/lib/quandl/command/task/callbacks.rb +0 -28
- data/lib/quandl/command/task/clientable.rb +0 -51
- data/lib/quandl/command/task/commandable.rb +0 -103
- data/lib/quandl/command/task/configurable.rb +0 -80
- data/lib/quandl/command/task/dependable.rb +0 -71
- data/lib/quandl/command/task/inputable.rb +0 -37
- data/lib/quandl/command/task/logging.rb +0 -83
- data/lib/quandl/command/task/presentation.rb +0 -36
- data/lib/quandl/command/task/reportable.rb +0 -35
- data/lib/quandl/command/task/threading.rb +0 -123
- data/lib/quandl/command/task/translations.rb +0 -37
- data/lib/quandl/command/task/updatable.rb +0 -80
- data/lib/quandl/command/task/validations.rb +0 -25
- data/lib/quandl/command/tasks.rb +0 -24
- data/lib/quandl/command/tasks/delete.rb +0 -34
- data/lib/quandl/command/tasks/download.rb +0 -44
- data/lib/quandl/command/tasks/info.rb +0 -48
- data/lib/quandl/command/tasks/list.rb +0 -31
- data/lib/quandl/command/tasks/login.rb +0 -47
- data/lib/quandl/command/tasks/replace.rb +0 -58
- data/lib/quandl/command/tasks/schedule.rb +0 -211
- data/lib/quandl/command/tasks/search.rb +0 -39
- data/lib/quandl/command/tasks/superset.rb +0 -66
- data/lib/quandl/command/tasks/uninstall.rb +0 -17
- data/lib/quandl/command/tasks/update.rb +0 -249
- data/lib/quandl/command/tasks/upload.rb +0 -60
- data/lib/quandl/command/version.rb +0 -5
- data/lib/quandl/lang.rb +0 -45
- data/lib/quandl/utility.rb +0 -2
- data/lib/quandl/utility/config.rb +0 -43
- data/lib/quandl/utility/ruby_version.rb +0 -143
- data/quandl.gemspec +0 -43
- data/scripts/compile_ruby_pkg.sh +0 -34
- data/scripts/install.sh +0 -51
- data/scripts/win/quandl_toolbelt.iss +0 -89
- data/spec/config/output.rb +0 -21
- data/spec/config/quandl.rb +0 -67
- data/spec/factories/dataset.rb +0 -10
- data/spec/factories/source.rb +0 -10
- data/spec/fixtures/scraper-test-file.rb +0 -6
- data/spec/lib/quandl/command/delete_spec.rb +0 -45
- data/spec/lib/quandl/command/download_spec.rb +0 -49
- data/spec/lib/quandl/command/replace_spec.rb +0 -22
- data/spec/lib/quandl/command/schedule_spec.rb +0 -45
- data/spec/lib/quandl/command/superset_spec.rb +0 -28
- data/spec/lib/quandl/command/upload_spec.rb +0 -86
- data/spec/lib/quandl/command_spec.rb +0 -38
- data/spec/spec_helper.rb +0 -43
- data/tasks/toolbelt.rake +0 -138
- data/tasks/toolbelt.rb +0 -116
- data/tasks/toolbelt/build.rb +0 -2
- data/tasks/toolbelt/build/darwin.rb +0 -118
- data/tasks/toolbelt/build/ruby.rb +0 -105
- data/tasks/toolbelt/build/tarball.rb +0 -79
- data/tasks/toolbelt/build/windows.rb +0 -25
- data/tasks/toolbelt/push.rb +0 -18
- data/tasks/toolbelt/storage.rb +0 -28
- data/tasks/toolbelt/tar.rb +0 -21
data/spec/factories/dataset.rb
DELETED
data/spec/factories/source.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
|
3
|
-
factory :source do
|
4
|
-
sequence(:code) { |n| "QUANDL_CLIENT_#{(Time.now.to_f * 1000).to_i}_#{n}" }
|
5
|
-
name "Quandl Client Source"
|
6
|
-
description "Quandl Client Source Spec"
|
7
|
-
sequence(:host) { |n| "http://quandl.com/host/#{(Time.now.to_f * 1000).to_i}_#{n}" }
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe "./bin/quandl delete" do
|
5
|
-
|
6
|
-
let(:command){ self.class.superclass.description }
|
7
|
-
subject{ quandl("delete #{command}") }
|
8
|
-
|
9
|
-
|
10
|
-
context "DOES_NOT_EXIST" do
|
11
|
-
its(:stdout){ should match 'Not Found' }
|
12
|
-
end
|
13
|
-
|
14
|
-
context "DATASET_1" do
|
15
|
-
before(:each){ create(:dataset, code: 'DATASET_1') }
|
16
|
-
its(:stdout){ should match 'Deleted' }
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
describe Quandl::Command::Tasks::Delete do
|
22
|
-
|
23
|
-
let(:subject_args){ [] }
|
24
|
-
subject{ Quandl::Command::Tasks::Delete.call(*subject_args) }
|
25
|
-
|
26
|
-
context "spec/fixtures/data/datasets.qdf" do
|
27
|
-
|
28
|
-
before(:each){ Quandl::Command::Tasks::Upload.call( 'spec/fixtures/data/datasets.qdf' ) }
|
29
|
-
|
30
|
-
it "should delete spec/fixtures/data/datasets.qdf" do
|
31
|
-
Spec::Config::Output.should_receive(:info).with(/Deleted/).at_least(4).times
|
32
|
-
datasets = Quandl::Format::Dataset.load_from_file('spec/fixtures/data/datasets.qdf')
|
33
|
-
datasets.each{|d| Quandl::Command::Tasks::Delete.call( d.code, force_yes: true ) }
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should not download" do
|
37
|
-
datasets = Quandl::Format::Dataset.load_from_file('spec/fixtures/data/datasets.qdf')
|
38
|
-
datasets.each{|d| Quandl::Command::Tasks::Delete.call( d.code, force_yes: true ) }
|
39
|
-
Spec::Config::Output.should_receive(:info).with(nil).at_least(4).times
|
40
|
-
datasets.each{|d| Quandl::Command::Tasks::Download.call( d.code ) }
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Quandl::Command::Tasks::Download do
|
5
|
-
|
6
|
-
def self.it_should_download(code, options={})
|
7
|
-
it "should download #{code}, #{options}" do
|
8
|
-
Quandl::Logger.should_receive(:info).with(/code: #{code}/)
|
9
|
-
Quandl::Command::Tasks::Download.call( code, options )
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
context "spec/fixtures/data/datasets.qdf" do
|
14
|
-
|
15
|
-
before(:all){ Quandl::Command::Tasks::Upload.call( 'spec/fixtures/data/datasets.qdf' ) }
|
16
|
-
|
17
|
-
it_should_download 'TEST_1'
|
18
|
-
it_should_download 'TEST_2'
|
19
|
-
it_should_download 'TEST_4', column: 2
|
20
|
-
it_should_download 'TEST_4', order: 'asc'
|
21
|
-
it_should_download 'TEST_4', order: 'desc'
|
22
|
-
it_should_download 'TEST_4', limit: 10
|
23
|
-
it_should_download 'TEST_4', row: 10
|
24
|
-
it_should_download 'TEST_4', offset: 10
|
25
|
-
# test each transformation
|
26
|
-
Quandl::Operation::Transform.valid_transformations.each{|v| it_should_download('TEST_4', transformation: v.to_s ) }
|
27
|
-
# test each collapse
|
28
|
-
Quandl::Operation::Collapse.valid_collapses.each{|v| it_should_download('TEST_4', collapse: v.to_s ) }
|
29
|
-
|
30
|
-
after(:all){
|
31
|
-
Quandl::Format::Dataset.load_from_file('spec/fixtures/data/datasets.qdf').each{|d|
|
32
|
-
Quandl::Command::Tasks::Delete.call( d.code, force_yes: true ) }
|
33
|
-
}
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
describe "./bin/quandl download" do
|
41
|
-
|
42
|
-
let(:command){ self.class.superclass.description }
|
43
|
-
subject{ quandl("download #{command}") }
|
44
|
-
|
45
|
-
context "TEST_DOES_NOT_EXIST" do
|
46
|
-
its(:stdout){ should be_blank }
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe "./bin/quandl replace" do
|
5
|
-
|
6
|
-
let(:prefix){ "replace" }
|
7
|
-
let(:command){ self.class.superclass.description }
|
8
|
-
subject{ quandl( [prefix, command].flatten.join(" ") ) }
|
9
|
-
|
10
|
-
context data_path("replace.qdf") do
|
11
|
-
its(:stdout){ should match /Updated|Created/ }
|
12
|
-
its(:stderr){ should be_blank }
|
13
|
-
end
|
14
|
-
|
15
|
-
context "SCRAPER_TEST_1394485290783983" do
|
16
|
-
let(:prefix){ "download" }
|
17
|
-
|
18
|
-
its(:stdout){ should match "code: SCRAPER_TEST_1394485290783983" }
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'open3'
|
4
|
-
require 'chronic'
|
5
|
-
|
6
|
-
describe "Quandl::Command::Tasks::Schedule" do
|
7
|
-
let(:schedule) { Quandl::Command::Tasks::Schedule.new(nil, nil)}
|
8
|
-
|
9
|
-
its "should parse 'at' time to cron correctly " do
|
10
|
-
schedule.stub_chain(:options, :at){'13:00'}
|
11
|
-
schedule.instance_eval{cron_at}.should == "* 0 13 * * *"
|
12
|
-
end
|
13
|
-
|
14
|
-
its "should parse 'at' time to cron correctly " do
|
15
|
-
schedule.stub_chain(:options, :at){'7pm monday'}
|
16
|
-
schedule.instance_eval{cron_at}.should == "* 0 19 * * 1"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "./bin/quandl schedule" do
|
21
|
-
|
22
|
-
let(:command){ self.class.superclass.description }
|
23
|
-
subject{ quandl("schedule #{command}") }
|
24
|
-
|
25
|
-
context "list" do
|
26
|
-
its(:stdout){ should_not match "scraper-test-file.rb" }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "add spec/fixtures/scraper-test-file.rb" do
|
30
|
-
its(:stdout){ should match "You have successfully scheduled 'scraper-test-file.rb'" }
|
31
|
-
end
|
32
|
-
|
33
|
-
context "delete scraper-test-file.rb --force-yes" do
|
34
|
-
its(:stdout){ should match "You have successfully deleted 'scraper-test-file.rb'" }
|
35
|
-
end
|
36
|
-
|
37
|
-
context "add spec/fixtures/scraper-test-file.rb --at 7pm" do
|
38
|
-
its(:stdout){ should match "You have successfully scheduled 'scraper-test-file.rb'" }
|
39
|
-
end
|
40
|
-
|
41
|
-
context "delete scraper-test-file.rb --force-yes" do
|
42
|
-
its(:stdout){ should match "You have successfully deleted 'scraper-test-file.rb'" }
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'open3'
|
4
|
-
require 'quandl/client'
|
5
|
-
require 'quandl/format'
|
6
|
-
|
7
|
-
describe "./bin/quandl superset" do
|
8
|
-
|
9
|
-
let(:command){ self.class.superclass.description }
|
10
|
-
subject{ quandl("superset #{command}") }
|
11
|
-
|
12
|
-
context "new" do
|
13
|
-
its(:stdout){ should match Quandl::Client::Superset.example.to_qdf }
|
14
|
-
end
|
15
|
-
|
16
|
-
context "upload spec/fixtures/superset.qdf" do
|
17
|
-
its(:stdout){ should match /Created|Updated/ }
|
18
|
-
end
|
19
|
-
|
20
|
-
context "download SUPERSET_EXAMPLE" do
|
21
|
-
its(:stdout){ should match /SUPERSET_EXAMPLE/ }
|
22
|
-
end
|
23
|
-
|
24
|
-
context "delete SUPERSET_EXAMPLE" do
|
25
|
-
its(:stdout){ should match /Deleted/ }
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe "./bin/quandl upload" do
|
5
|
-
|
6
|
-
let(:prefix){ "upload" }
|
7
|
-
let(:command){ self.class.superclass.description }
|
8
|
-
subject{ quandl( [prefix, command].flatten.join(" ") ) }
|
9
|
-
|
10
|
-
context data_path("datasets.qdf") do
|
11
|
-
its(:stdout){ should match /Updated|Created/ }
|
12
|
-
its(:stderr){ should be_blank }
|
13
|
-
end
|
14
|
-
|
15
|
-
context data_path("metadata.qdf") do
|
16
|
-
its(:stdout){ should match /Updated|Created/ }
|
17
|
-
its(:stderr){ should be_blank }
|
18
|
-
end
|
19
|
-
|
20
|
-
context data_path("QUGC-42.qdf") do
|
21
|
-
its(:stdout){ should match /Updated|Created/ }
|
22
|
-
its(:stderr){ should be_blank }
|
23
|
-
end
|
24
|
-
|
25
|
-
context error_path("invalid_code.qdf") do
|
26
|
-
its(:stdout){ should match /Unprocessable Entity/ }
|
27
|
-
end
|
28
|
-
|
29
|
-
context error_path("column_count_mismatch.qdf") do
|
30
|
-
its(:stdout){ should match /Found 4 but expected 3 based on/ }
|
31
|
-
end
|
32
|
-
|
33
|
-
context error_path("date_parse_error.qdf") do
|
34
|
-
its(:stdout){ should match /Invalid date segments/ }
|
35
|
-
end
|
36
|
-
|
37
|
-
context error_path("invalid_date.qdf") do
|
38
|
-
its(:stdout){ should match /Invalid date/ }
|
39
|
-
end
|
40
|
-
|
41
|
-
context error_path("invalid_dash.qdf") do
|
42
|
-
its(:stdout){ should match /Unprocessable Entity | Error | Psych::SyntaxError | Error parsing metadata. Could not find expected ':' on line 3./ }
|
43
|
-
end
|
44
|
-
|
45
|
-
context error_path("psych.qdf") do
|
46
|
-
its(:stdout){ should match /Could not find expected ':'/ }
|
47
|
-
end
|
48
|
-
|
49
|
-
context error_path("unknown_attribute.qdf") do
|
50
|
-
its(:stdout){ should match /UnknownAttribute/ }
|
51
|
-
end
|
52
|
-
|
53
|
-
context "json" do
|
54
|
-
|
55
|
-
let(:prefix){ "upload" }
|
56
|
-
let(:command){ self.class.superclass.description }
|
57
|
-
subject{
|
58
|
-
result = quandl( [prefix, command, "-F json"].flatten.join(" ") )
|
59
|
-
OpenStruct.new(
|
60
|
-
stdout: result.stdout,
|
61
|
-
stderr: result.stderr,
|
62
|
-
stdout_json: result.stdout.split("\n").collect{|l| JSON.parse(l) },
|
63
|
-
)
|
64
|
-
}
|
65
|
-
|
66
|
-
context data_path("metadata.qdf") do
|
67
|
-
its(:stderr){ should be_blank }
|
68
|
-
its(:stdout_json){ should be_a Array }
|
69
|
-
its('stdout_json.first'){ should have_key 'status' }
|
70
|
-
its('stdout_json.first'){ should have_key 'id' }
|
71
|
-
its('stdout_json.first'){ should have_key 'detail' }
|
72
|
-
its('stdout_json.first'){ should have_key 'message' }
|
73
|
-
its('stdout_json.first'){ should have_key 'attributes' }
|
74
|
-
end
|
75
|
-
|
76
|
-
context error_path("unknown_attribute.qdf") do
|
77
|
-
its('stdout_json.first'){ should have_key 'status' }
|
78
|
-
its('stdout_json.first'){ should have_key 'id' }
|
79
|
-
its('stdout_json.first'){ should have_key 'detail' }
|
80
|
-
its('stdout_json.first'){ should have_key 'message' }
|
81
|
-
its(:stdout_json){ should eq([{"status"=>"Unprocessable Entity", "id"=>"Error", "detail"=>"Quandl::Error::UnknownAttribute", "message"=>"UNKNOWN_ATTRIBUTE_CODE_2 error around line 13\nUnknown Field 'this_attribute_does_not_exist' valid fields are: source_code, code, name, description, private, reference_url, frequency (Quandl::Error::UnknownAttribute)\n"}, {"status"=>"Unprocessable Entity", "id"=>"Error", "detail"=>"Quandl::Error::UnknownAttribute", "message"=>"UNKNOWN_ATTRIBUTE_CODE_3 error around line 25\nUnknown Field 'horse' valid fields are: source_code, code, name, description, private, reference_url, frequency (Quandl::Error::UnknownAttribute)\n"}, {"status"=>"Unprocessable Entity", "id"=>"Error", "detail"=>"Quandl::Error::UnknownAttribute", "message"=>"UNKNOWN_ATTRIBUTE_CODE_4 error around line 37\nUnknown Field 'mouse' valid fields are: source_code, code, name, description, private, reference_url, frequency (Quandl::Error::UnknownAttribute)\n"}]) }
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'open3'
|
4
|
-
|
5
|
-
describe "./bin/quandl" do
|
6
|
-
|
7
|
-
let(:command){ self.class.superclass.description }
|
8
|
-
subject{ quandl(command) }
|
9
|
-
|
10
|
-
context "help" do
|
11
|
-
its(:stdout){ should match 'http://quandl.com/ command line interface' }
|
12
|
-
its(:stderr){ should be_blank }
|
13
|
-
end
|
14
|
-
|
15
|
-
context "upload spec/fixtures/data/metadata.qdf" do
|
16
|
-
its(:stdout){ should match /Created|Updated/ }
|
17
|
-
its(:stderr){ should be_blank }
|
18
|
-
end
|
19
|
-
|
20
|
-
context "download TEST_1" do
|
21
|
-
its(:stdout){ should match 'The description of TEST_1 is here' }
|
22
|
-
its(:stderr){ should be_blank }
|
23
|
-
end
|
24
|
-
|
25
|
-
context "delete TEST_1 TEST_5 TEST_15 --force-yes" do
|
26
|
-
its(:stdout){ should match 'Deleted' }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "info" do
|
30
|
-
its(:stdout){ should match Spec::Config::Quandl.quandl_url }
|
31
|
-
its(:stderr){ should be_blank }
|
32
|
-
end
|
33
|
-
|
34
|
-
context "list" do
|
35
|
-
its(:stderr){ should be_blank }
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
2
|
-
|
3
|
-
require 'yaml'
|
4
|
-
require 'ostruct'
|
5
|
-
|
6
|
-
# require and configure quandl_client with test config
|
7
|
-
require_relative 'config/quandl'
|
8
|
-
|
9
|
-
ENV['QUANDL_TOKEN'] = Spec::Config::Quandl.token
|
10
|
-
ENV['QUANDL_URL'] = Spec::Config::Quandl.quandl_url
|
11
|
-
|
12
|
-
require "rspec"
|
13
|
-
require 'factory_girl'
|
14
|
-
require 'pry'
|
15
|
-
require 'commander'
|
16
|
-
require 'quandl/command'
|
17
|
-
require 'open3'
|
18
|
-
|
19
|
-
# configure Quandl::Logger to use Config::Output
|
20
|
-
require_relative 'config/output'
|
21
|
-
|
22
|
-
factory_dir = File.join( File.dirname(__FILE__), 'factories/**/*.rb' )
|
23
|
-
Dir.glob( factory_dir ).each{|f| require(f); puts f }
|
24
|
-
|
25
|
-
RSpec.configure do |config|
|
26
|
-
config.include FactoryGirl::Syntax::Methods
|
27
|
-
end
|
28
|
-
|
29
|
-
def quandl(statement)
|
30
|
-
version = "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
|
31
|
-
path = File.join(Quandl::Command::Tasks.root, 'bin/quandl')
|
32
|
-
command = "bundle exec #{path} #{statement} --token #{Spec::Config::Quandl.token} --url #{Spec::Config::Quandl.quandl_url} --threads 1 --force-yes --trace --sandbox"
|
33
|
-
stdin, stdout, stderr = Open3.popen3(command)
|
34
|
-
OpenStruct.new( stderr: stderr.read, stdout: stdout.read )
|
35
|
-
end
|
36
|
-
|
37
|
-
def data_path(path)
|
38
|
-
File.join("spec/fixtures/data/", path)
|
39
|
-
end
|
40
|
-
|
41
|
-
def error_path(path)
|
42
|
-
File.join("spec/fixtures/data/errors/", path)
|
43
|
-
end
|
data/tasks/toolbelt.rake
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
require 'zlib'
|
2
|
-
require 'archive/tar/minitar'
|
3
|
-
|
4
|
-
require 'rake/packagetask'
|
5
|
-
require 'open-uri'
|
6
|
-
|
7
|
-
require_relative 'toolbelt'
|
8
|
-
|
9
|
-
include Tasks
|
10
|
-
|
11
|
-
def bash(cmd)
|
12
|
-
puts(cmd)
|
13
|
-
system(cmd)
|
14
|
-
end
|
15
|
-
|
16
|
-
def inno_path
|
17
|
-
@inno_path ||= ENV["INNO_DIR"] || File.join(windows_root, "Program Files (x86)\\Inno Setup 5\\")
|
18
|
-
end
|
19
|
-
|
20
|
-
def windows_root
|
21
|
-
return @windows_root if defined?(@windows_root)
|
22
|
-
# cygwin?
|
23
|
-
if Dir.exists?('/cygdrive')
|
24
|
-
@windows_root = '/cygdrive/c/'
|
25
|
-
else
|
26
|
-
@windows_root = "C:\\"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
namespace :quandl do
|
31
|
-
|
32
|
-
namespace :release do
|
33
|
-
|
34
|
-
desc "Build tarball, windows, and darwin and push to storage"
|
35
|
-
task :all do |t, args|
|
36
|
-
# build tarball
|
37
|
-
Rake::Task["quandl:release:tarball"].execute args.to_hash
|
38
|
-
# build windows exe
|
39
|
-
Rake::Task["quandl:release:windows"].execute args.to_hash
|
40
|
-
# build darwin pkg
|
41
|
-
Rake::Task["quandl:release:darwin"].execute args.to_hash
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "Build tarball and push to storage"
|
45
|
-
task :tarball do
|
46
|
-
revision = `git branch | grep '*'`.gsub("*", '').strip.rstrip
|
47
|
-
args = {}
|
48
|
-
args[:revision] = revision unless revision == 'master'
|
49
|
-
# build package
|
50
|
-
Rake::Task["quandl:build:tarball"].execute args
|
51
|
-
# push package to s3
|
52
|
-
Rake::Task["quandl:push:tarball"].execute args
|
53
|
-
end
|
54
|
-
|
55
|
-
desc "Build darwin and push to storage"
|
56
|
-
task :darwin do |t, args|
|
57
|
-
# build package
|
58
|
-
Rake::Task["quandl:build:darwin"].execute args.to_hash
|
59
|
-
# push package to s3
|
60
|
-
Rake::Task["quandl:push:darwin"].execute args.to_hash
|
61
|
-
end
|
62
|
-
|
63
|
-
desc "Build windows executable and push to storage"
|
64
|
-
task :windows do |t, args|
|
65
|
-
revision = `git branch | grep '*'`.gsub("*", '').strip.rstrip
|
66
|
-
args = {}
|
67
|
-
args[:revision] = revision unless revision == 'master'
|
68
|
-
# build tarball
|
69
|
-
Rake::Task["quandl:build:tarball"].execute args.to_hash.merge({ platform: 'windows' })
|
70
|
-
# push tarball to s3
|
71
|
-
Rake::Task["quandl:push:tarball"].execute args.to_hash.merge( platform: 'windows' )
|
72
|
-
# prereleases should not build Quandl Setup
|
73
|
-
unless args[:revision].present?
|
74
|
-
# inno is required
|
75
|
-
unless Dir.exists?( inno_path )
|
76
|
-
puts "Inno not found.\nExpected installation at: #{inno_path}\nDownload and install: http://jrsoftware.org/download.php/is.exe?site=1"
|
77
|
-
puts "Cannot build 'Quandl Setup.exe'"
|
78
|
-
else
|
79
|
-
# create windows exe setup
|
80
|
-
Rake::Task["quandl:build:windows"].execute
|
81
|
-
# push windows-package to s3
|
82
|
-
input_file = File.join( Toolbelt.pkg_path, 'Quandl Setup.exe')
|
83
|
-
# upload to s3
|
84
|
-
Toolbelt::Storage.create( 'Quandl Setup.exe', File.open(input_file) )
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
task :installer do
|
90
|
-
Toolbelt::Storage.create('install.sh', File.open( File.join( Toolbelt.root_path, 'scripts/install.sh')) )
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
namespace :build do
|
96
|
-
|
97
|
-
task :windows do |t, args|
|
98
|
-
Toolbelt::Build::Windows.execute args.to_hash
|
99
|
-
end
|
100
|
-
|
101
|
-
task :tarball, :revision, :platform do |t, args|
|
102
|
-
Toolbelt::Build::Tarball.execute args.to_hash
|
103
|
-
end
|
104
|
-
|
105
|
-
task :darwin, :revision do |t, args|
|
106
|
-
Toolbelt::Build::Darwin.execute args.to_hash
|
107
|
-
end
|
108
|
-
|
109
|
-
task :ruby do |t, args|
|
110
|
-
Toolbelt::Build::Ruby.execute args.to_hash
|
111
|
-
end
|
112
|
-
|
113
|
-
task :clean do |t,args|
|
114
|
-
rm_rf Toolbelt.tmp_path
|
115
|
-
rm_rf Toolbelt.build_path
|
116
|
-
mkdir Toolbelt.tmp_path
|
117
|
-
mkdir Toolbelt.build_path
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
|
122
|
-
namespace :push do
|
123
|
-
|
124
|
-
task :tarball, :revision, :platform do |t,args|
|
125
|
-
Toolbelt::Push.execute args.to_hash
|
126
|
-
end
|
127
|
-
|
128
|
-
task :darwin, :revision, :platform do |t,args|
|
129
|
-
name = "quandl-toolbelt"
|
130
|
-
name += "-#{args[:revision]}" if args[:revision].present?
|
131
|
-
Toolbelt::Storage.create( "#{name}.pkg", File.open( File.join(Toolbelt.build_path, 'quandl-toolbelt.pkg') ) )
|
132
|
-
Toolbelt::Storage.create( "VERSION", File.open( File.join(Toolbelt.root_path, 'VERSION') ) )
|
133
|
-
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|