quandl 0.2.22
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.
- checksums.yaml +15 -0
 - data/.gitignore +16 -0
 - data/.travis.yml +20 -0
 - data/Gemfile +14 -0
 - data/Guardfile +8 -0
 - data/LICENSE +7 -0
 - data/README.md +316 -0
 - data/Rakefile +39 -0
 - data/UPGRADE.md +143 -0
 - data/bin/quandl +26 -0
 - data/dist/resources/pkg/Distribution.erb +15 -0
 - data/dist/resources/pkg/PackageInfo.erb +6 -0
 - data/dist/resources/pkg/postinstall +45 -0
 - data/dist/resources/pkg/quandl +25 -0
 - data/dist/resources/ruby/PackageInfo +3 -0
 - data/lib/commander/command/quandl_ext.rb +21 -0
 - data/lib/quandl/command.rb +45 -0
 - data/lib/quandl/command/client_ext.rb +1 -0
 - data/lib/quandl/command/client_ext/user.rb +11 -0
 - data/lib/quandl/command/compatibility_check.rb +11 -0
 - data/lib/quandl/command/qconfig.rb +76 -0
 - data/lib/quandl/command/tasks.rb +15 -0
 - data/lib/quandl/command/tasks/base.rb +263 -0
 - data/lib/quandl/command/tasks/delete.rb +58 -0
 - data/lib/quandl/command/tasks/download.rb +111 -0
 - data/lib/quandl/command/tasks/info.rb +46 -0
 - data/lib/quandl/command/tasks/list.rb +40 -0
 - data/lib/quandl/command/tasks/login.rb +46 -0
 - data/lib/quandl/command/tasks/update.rb +205 -0
 - data/lib/quandl/command/tasks/upload.rb +69 -0
 - data/lib/quandl/command/version.rb +5 -0
 - data/lib/quandl/utility.rb +2 -0
 - data/lib/quandl/utility/config.rb +43 -0
 - data/lib/quandl/utility/ruby_version.rb +143 -0
 - data/quandl.gemspec +39 -0
 - data/scripts/compile_ruby_pkg.sh +34 -0
 - data/scripts/install.sh +51 -0
 - data/scripts/win/quandl_toolbelt.iss +82 -0
 - data/spec/lib/quandl/command/delete_spec.rb +31 -0
 - data/spec/lib/quandl/command/download_spec.rb +42 -0
 - data/spec/lib/quandl/command/upload_spec.rb +39 -0
 - data/spec/lib/quandl/command_spec.rb +46 -0
 - data/spec/spec_helper.rb +20 -0
 - data/tasks/toolbelt.rake +133 -0
 - data/tasks/toolbelt.rb +92 -0
 - data/tasks/toolbelt/build.rb +2 -0
 - data/tasks/toolbelt/build/darwin.rb +71 -0
 - data/tasks/toolbelt/build/ruby.rb +105 -0
 - data/tasks/toolbelt/build/tarball.rb +73 -0
 - data/tasks/toolbelt/build/windows.rb +25 -0
 - data/tasks/toolbelt/push.rb +15 -0
 - data/tasks/toolbelt/storage.rb +28 -0
 - data/tasks/toolbelt/tar.rb +21 -0
 - metadata +354 -0
 
    
        data/UPGRADE.md
    ADDED
    
    | 
         @@ -0,0 +1,143 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## 0.2.22
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * update permits adding new folders
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ## 0.2.21
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            * QUGC-75 darwin build process will compile ruby if its missing
         
     | 
| 
      
 10 
     | 
    
         
            +
            * QUGC-71 Add failing spec for "quandl list not working v 20"
         
     | 
| 
      
 11 
     | 
    
         
            +
            * QUGC-65 Check for updates once every 24 hour period
         
     | 
| 
      
 12 
     | 
    
         
            +
            * QUGC-65 Add QConfig that stores configuration information in  ~/.quandl/config
         
     | 
| 
      
 13 
     | 
    
         
            +
            * QUGC-60 add compatibility check
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ## 0.2.20
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            * QUGC-57 move data validation from Quandl::Format into Quandl::Client.
         
     | 
| 
      
 19 
     | 
    
         
            +
            * QUGC-54 write failing spec for input with nil row value
         
     | 
| 
      
 20 
     | 
    
         
            +
            * QUGC-53 numeric codes require the full code
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## 0.2.19
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            * many bugfixes
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            ## 0.2.18
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            * QUGC-49 Revise installer to use bash shell for [[ bashism
         
     | 
| 
      
 31 
     | 
    
         
            +
            * QUGC-48 rename to toolbelt
         
     | 
| 
      
 32 
     | 
    
         
            +
            * uniform table stdout for consistent parsing
         
     | 
| 
      
 33 
     | 
    
         
            +
            * dont export bin/quandl as an executable. If you want to use quandl cli install the package
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            ## 0.2.17
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            * QUGC-42 Write failing specs for should not have to include data
         
     | 
| 
      
 39 
     | 
    
         
            +
            * QUGC-45 quandl info package versions are sent to debug instead of info. remove user id
         
     | 
| 
      
 40 
     | 
    
         
            +
            * QUGC-44 quandl delete should delete the datasets or raise an error
         
     | 
| 
      
 41 
     | 
    
         
            +
            * QUGC-44 Write failing spec that checks whether delete has succeeeded.
         
     | 
| 
      
 42 
     | 
    
         
            +
            * rake package:release takes an argument for building pre releases
         
     | 
| 
      
 43 
     | 
    
         
            +
            * quandl update has an option called --revision
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            ## 0.2.16
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            * Add quandl update
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            ## 0.2.15
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            * QUGC-37 quandl info: report my username not just my token
         
     | 
| 
      
 54 
     | 
    
         
            +
            * QUGC-37 reject unauthenticated requests
         
     | 
| 
      
 55 
     | 
    
         
            +
            * QUGC-39 Download. added validation for trim_start, trim_end, order, collapse, transform.
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            ## 0.2.14
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            * QUGC-38 Add spec for download with column option failing
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            ## 0.2.13
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            * QUGC-36 Should except null entry in 2 column dataset
         
     | 
| 
      
 66 
     | 
    
         
            +
            * QUGC-35 Pure Meta Data Send or Update
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            ## 0.2.12
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            * add quandl list
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            ## 0.2.10
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            * add specific version requirements
         
     | 
| 
      
 77 
     | 
    
         
            +
            * add info command for displaying quandl package information
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            ## 0.2.9
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            * replace full_code regexp with Quandl::Pattern
         
     | 
| 
      
 83 
     | 
    
         
            +
            * remove --url global option
         
     | 
| 
      
 84 
     | 
    
         
            +
            * add validations
         
     | 
| 
      
 85 
     | 
    
         
            +
            * update token env var
         
     | 
| 
      
 86 
     | 
    
         
            +
            * add shortcuts to global options
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            ## 0.2.8
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            * use updated Quandl::Format::Dataset.each_line to upload dataset's line by line as they become availabe from whichever interface. Allows ruby GC to operate and avoid having 20k datasets in memory ...
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            ## 0.2.7
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            * refactor delete, download, upload
         
     | 
| 
      
 97 
     | 
    
         
            +
            * add convience methods for outputting info
         
     | 
| 
      
 98 
     | 
    
         
            +
            * remove command logger
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
            ## 0.2.6
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
            * add quandl delete quandl delete (SOURCE_CODE/)CODE
         
     | 
| 
      
 104 
     | 
    
         
            +
            * dont try to load from STDIN if file_path was provided.
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
            ## 0.2.4
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
            * refactor authorize to: quandl login login accepts username or email and password login outputs error or auth_token to ~/.quandl
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
            ## 0.2.0
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
            * update gemspec to only require quandl_format
         
     | 
| 
      
 115 
     | 
    
         
            +
            * use Quandl::Commmand::Logger to log messages
         
     | 
| 
      
 116 
     | 
    
         
            +
            * update local gems
         
     | 
| 
      
 117 
     | 
    
         
            +
            * add Quandl::Command::Logger that writes to STDOUT and STDERR
         
     | 
| 
      
 118 
     | 
    
         
            +
            * display dataset.human_errors
         
     | 
| 
      
 119 
     | 
    
         
            +
            * refactor Action#upload into Command::Upload
         
     | 
| 
      
 120 
     | 
    
         
            +
            * refactor download to inherit from Action::Base
         
     | 
| 
      
 121 
     | 
    
         
            +
            * refactor action into Quandl::Command::Download
         
     | 
| 
      
 122 
     | 
    
         
            +
            * add options to download. extend Commander::Command::Options to support #each, #to_a, #[], #to_h
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
            ## 0.1.2
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
            * use quandl_format instead of QDFormat
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
            ## 0.1.1
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
            * bump quandl_operation to support revised QDFormat
         
     | 
| 
      
 132 
     | 
    
         
            +
            * refactor examples
         
     | 
| 
      
 133 
     | 
    
         
            +
            * improve log messages
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            ## 0.1.0
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
            * refactor commands to be more human friendly
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
            ## 0.0.1
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
            * init
         
     | 
    
        data/bin/quandl
    ADDED
    
    | 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            # encoding: UTF-8
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require "pathname"
         
     | 
| 
      
 5 
     | 
    
         
            +
            bin_file = Pathname.new(__FILE__).realpath
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # vendored gems path
         
     | 
| 
      
 8 
     | 
    
         
            +
            gem_dir = File.expand_path("../../vendor/gems", bin_file)
         
     | 
| 
      
 9 
     | 
    
         
            +
            # vendored gems?
         
     | 
| 
      
 10 
     | 
    
         
            +
            if Dir.exists?(gem_dir)
         
     | 
| 
      
 11 
     | 
    
         
            +
              Dir["#{gem_dir}/**/lib"].each do |libdir|
         
     | 
| 
      
 12 
     | 
    
         
            +
                $:.unshift libdir
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            else
         
     | 
| 
      
 15 
     | 
    
         
            +
              require 'rubygems'
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            # add self to libpath
         
     | 
| 
      
 19 
     | 
    
         
            +
            $:.unshift File.expand_path("../../lib", bin_file)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            require 'quandl/command/compatibility_check'
         
     | 
| 
      
 22 
     | 
    
         
            +
            require 'quandl/command'
         
     | 
| 
      
 23 
     | 
    
         
            +
            require 'commander/import'
         
     | 
| 
      
 24 
     | 
    
         
            +
            require 'commander/command/quandl_ext'
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            include Quandl::Command
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <?xml version="1.0" encoding="utf-8"?>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <installer-script minSpecVersion="1.000000" authoringTool="org.ruby-lang.rake" authoringToolVersion="10.1.1">
         
     | 
| 
      
 3 
     | 
    
         
            +
              <title>Quandl Toolbelt <%= version %></title>
         
     | 
| 
      
 4 
     | 
    
         
            +
              <options customize="allow" allow-external-scripts="no"/>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <domains enable_localSystem="true"/>
         
     | 
| 
      
 6 
     | 
    
         
            +
              <choices-outline>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <line choice="quandl-toolbelt"/>
         
     | 
| 
      
 8 
     | 
    
         
            +
              </choices-outline>
         
     | 
| 
      
 9 
     | 
    
         
            +
              <choice id="quandl-toolbelt" title="Quandl Toolbelt <%= version %>">
         
     | 
| 
      
 10 
     | 
    
         
            +
                <pkg-ref id="com.quandl.toolbelt"/>
         
     | 
| 
      
 11 
     | 
    
         
            +
                <pkg-ref id="org.ruby-lang.installer"/>
         
     | 
| 
      
 12 
     | 
    
         
            +
              </choice>
         
     | 
| 
      
 13 
     | 
    
         
            +
              <pkg-ref id="com.quandl.toolbelt" installKBytes="<%= kbytes %>" version="<%= version %>" auth="Root">#quandl-toolbelt.pkg</pkg-ref>
         
     | 
| 
      
 14 
     | 
    
         
            +
              <pkg-ref id="org.ruby-lang.installer" installKBytes="9132" auth="Root">#ruby.pkg</pkg-ref>
         
     | 
| 
      
 15 
     | 
    
         
            +
            </installer-script>
         
     | 
| 
         @@ -0,0 +1,6 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <pkg-info format-version="2" identifier="com.quandl.toolbelt" version="<%= version %>" install-location="/usr/local/quandl" auth="root">
         
     | 
| 
      
 2 
     | 
    
         
            +
              <payload installKBytes="<%= kbytes %>" numberOfFiles="<%= num_files %>"/>
         
     | 
| 
      
 3 
     | 
    
         
            +
              <scripts>
         
     | 
| 
      
 4 
     | 
    
         
            +
                <postinstall file="./postinstall"/>
         
     | 
| 
      
 5 
     | 
    
         
            +
              </scripts>
         
     | 
| 
      
 6 
     | 
    
         
            +
            </pkg-info>
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/bin/sh
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            usershell=$(dscl localhost -read /Local/Default/Users/$USER shell | sed -e 's/[^ ]* //')
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            startup_files() {
         
     | 
| 
      
 6 
     | 
    
         
            +
              case $(basename $usershell) in
         
     | 
| 
      
 7 
     | 
    
         
            +
                zsh)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  echo ".zlogin .zshrc .zprofile .zshenv"
         
     | 
| 
      
 9 
     | 
    
         
            +
                  ;;
         
     | 
| 
      
 10 
     | 
    
         
            +
                bash)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  echo ".bashrc .bash_profile .bash_login .profile"
         
     | 
| 
      
 12 
     | 
    
         
            +
                  ;;
         
     | 
| 
      
 13 
     | 
    
         
            +
                *)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  echo ".bash_profile .zshrc .profile"
         
     | 
| 
      
 15 
     | 
    
         
            +
                  ;;
         
     | 
| 
      
 16 
     | 
    
         
            +
              esac
         
     | 
| 
      
 17 
     | 
    
         
            +
            }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            install_path() {
         
     | 
| 
      
 20 
     | 
    
         
            +
              for file in $(startup_files); do
         
     | 
| 
      
 21 
     | 
    
         
            +
                [ -f $HOME/$file ] || continue
         
     | 
| 
      
 22 
     | 
    
         
            +
                (grep "Added by the Quandl" $HOME/$file >/dev/null) && break
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                cat <<MESSAGE >>$HOME/$file
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ### Added by the Quandl Toolbelt
         
     | 
| 
      
 27 
     | 
    
         
            +
            export PATH="/usr/local/quandl/bin:\$PATH"
         
     | 
| 
      
 28 
     | 
    
         
            +
            MESSAGE
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                # done after we add to one file
         
     | 
| 
      
 31 
     | 
    
         
            +
                break
         
     | 
| 
      
 32 
     | 
    
         
            +
              done
         
     | 
| 
      
 33 
     | 
    
         
            +
            }
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            # if the toolbelt is not returned by `which`, let's add to the PATH
         
     | 
| 
      
 36 
     | 
    
         
            +
            case $(which quandl) in
         
     | 
| 
      
 37 
     | 
    
         
            +
              /usr/bin/quandl|/usr/local/quandl/bin/quandl)
         
     | 
| 
      
 38 
     | 
    
         
            +
                ;;
         
     | 
| 
      
 39 
     | 
    
         
            +
              *)
         
     | 
| 
      
 40 
     | 
    
         
            +
                install_path
         
     | 
| 
      
 41 
     | 
    
         
            +
                ;;
         
     | 
| 
      
 42 
     | 
    
         
            +
            esac
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            # symlink binary to /usr/bin/quandl
         
     | 
| 
      
 45 
     | 
    
         
            +
            ln -sf /usr/local/quandl/bin/quandl /usr/bin/quandl
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/local/quandl/ruby/bin/ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            # encoding: UTF-8
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require "pathname"
         
     | 
| 
      
 5 
     | 
    
         
            +
            bin_file = Pathname.new(__FILE__).realpath
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # vendored gems path
         
     | 
| 
      
 8 
     | 
    
         
            +
            gem_dir = File.expand_path("../../vendor/gems", bin_file)
         
     | 
| 
      
 9 
     | 
    
         
            +
            # vendored gems?
         
     | 
| 
      
 10 
     | 
    
         
            +
            if Dir.exists?(gem_dir)
         
     | 
| 
      
 11 
     | 
    
         
            +
              Dir["#{gem_dir}/**/lib"].each do |libdir|
         
     | 
| 
      
 12 
     | 
    
         
            +
                $:.unshift libdir
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            else
         
     | 
| 
      
 15 
     | 
    
         
            +
              require 'rubygems'
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            # add self to libpath
         
     | 
| 
      
 19 
     | 
    
         
            +
            $:.unshift File.expand_path("../../lib", bin_file)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            require 'quandl/command'
         
     | 
| 
      
 22 
     | 
    
         
            +
            require 'commander/import'
         
     | 
| 
      
 23 
     | 
    
         
            +
            require 'commander/command/quandl_ext'
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            include Quandl::Command
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Commander
         
     | 
| 
      
 2 
     | 
    
         
            +
            class Command
         
     | 
| 
      
 3 
     | 
    
         
            +
            class Options
         
     | 
| 
      
 4 
     | 
    
         
            +
              
         
     | 
| 
      
 5 
     | 
    
         
            +
              delegate :each, :to_a, :[], to: :to_h
         
     | 
| 
      
 6 
     | 
    
         
            +
              
         
     | 
| 
      
 7 
     | 
    
         
            +
              def class
         
     | 
| 
      
 8 
     | 
    
         
            +
                Commander::Command::Options
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
              
         
     | 
| 
      
 11 
     | 
    
         
            +
              def try(key)
         
     | 
| 
      
 12 
     | 
    
         
            +
                self.to_h[key.to_sym]
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
              
         
     | 
| 
      
 15 
     | 
    
         
            +
              def to_h
         
     | 
| 
      
 16 
     | 
    
         
            +
                __hash__
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
              
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pry' if ENV['BUNDLE_LOCAL_GEMS']
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "quandl/command/version"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'quandl/format'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'quandl/command/qconfig'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'quandl/command/tasks'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'quandl/command/client_ext'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # update tracking information
         
     | 
| 
      
 10 
     | 
    
         
            +
            Quandl::Client.request_source = 'quandl_command'
         
     | 
| 
      
 11 
     | 
    
         
            +
            Quandl::Client.request_version = Quandl::Command::VERSION
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            Quandl::Logger.use(Quandl::Logger::Outputs)
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            module Quandl::Command
         
     | 
| 
      
 16 
     | 
    
         
            +
              
         
     | 
| 
      
 17 
     | 
    
         
            +
              extend ActiveSupport::Concern
         
     | 
| 
      
 18 
     | 
    
         
            +
              
         
     | 
| 
      
 19 
     | 
    
         
            +
              included do
         
     | 
| 
      
 20 
     | 
    
         
            +
                
         
     | 
| 
      
 21 
     | 
    
         
            +
                program :name, 'Quandl Toolbelt'
         
     | 
| 
      
 22 
     | 
    
         
            +
                program :description, 'http://quandl.com/ command line interface.'
         
     | 
| 
      
 23 
     | 
    
         
            +
                program :version, Quandl::Command::VERSION
         
     | 
| 
      
 24 
     | 
    
         
            +
                
         
     | 
| 
      
 25 
     | 
    
         
            +
                default_command :help
         
     | 
| 
      
 26 
     | 
    
         
            +
                
         
     | 
| 
      
 27 
     | 
    
         
            +
                global_option '-T', '--token STRING', 'secret token used to authenticate requests.'
         
     | 
| 
      
 28 
     | 
    
         
            +
                global_option '-V', '--verbose', 'display detailed log messages'
         
     | 
| 
      
 29 
     | 
    
         
            +
                global_option '-U', '--url STRING', 'API url.'
         
     | 
| 
      
 30 
     | 
    
         
            +
                global_option '--force-yes', 'force y/n with yes'
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                [
         
     | 
| 
      
 33 
     | 
    
         
            +
                  Tasks::Delete,
         
     | 
| 
      
 34 
     | 
    
         
            +
                  Tasks::Download,
         
     | 
| 
      
 35 
     | 
    
         
            +
                  Tasks::Info,
         
     | 
| 
      
 36 
     | 
    
         
            +
                  Tasks::List,
         
     | 
| 
      
 37 
     | 
    
         
            +
                  Tasks::Login,
         
     | 
| 
      
 38 
     | 
    
         
            +
                  Tasks::Update,
         
     | 
| 
      
 39 
     | 
    
         
            +
                  Tasks::Upload,
         
     | 
| 
      
 40 
     | 
    
         
            +
                # register each task
         
     | 
| 
      
 41 
     | 
    
         
            +
                ].each{|task| task.configure(self) }
         
     | 
| 
      
 42 
     | 
    
         
            +
                
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
              
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'quandl/command/client_ext/user'
         
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'quandl/utility/ruby_version'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            err = "UNSUPPORTED ruby version (#{Quandl::Utility::RubyVersion.full_version}) Quandl Toolbelt requires ruby >="
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            if Quandl::Utility::RubyVersion <= '1.9.2'
         
     | 
| 
      
 6 
     | 
    
         
            +
              puts "#{err} 1.9.3"
         
     | 
| 
      
 7 
     | 
    
         
            +
              raise LoadError, "#{err} 1.9.3"
         
     | 
| 
      
 8 
     | 
    
         
            +
            elsif Quandl::Utility::RubyVersion.is?(2.0) && Quandl::Utility::RubyVersion.patchlevel < 353
         
     | 
| 
      
 9 
     | 
    
         
            +
              puts "#{err} 2.0.0-p353"
         
     | 
| 
      
 10 
     | 
    
         
            +
              raise LoadError, "#{err} 2.0.0-p353"
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,76 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Quandl
         
     | 
| 
      
 5 
     | 
    
         
            +
            module Command
         
     | 
| 
      
 6 
     | 
    
         
            +
            class QConfig
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 9 
     | 
    
         
            +
                
         
     | 
| 
      
 10 
     | 
    
         
            +
                def configuration
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @configuration ||= self.new( config_file: config_file )
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
                
         
     | 
| 
      
 14 
     | 
    
         
            +
                def convert_legacy_config
         
     | 
| 
      
 15 
     | 
    
         
            +
                  return if File.directory?(root_path)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # otherwise move the old .quandl into .quandl/config
         
     | 
| 
      
 17 
     | 
    
         
            +
                  FileUtils.mv(root_path, "#{root_path}.old")
         
     | 
| 
      
 18 
     | 
    
         
            +
                  FileUtils.mkdir(root_path)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  token = File.read("#{root_path}.old")
         
     | 
| 
      
 20 
     | 
    
         
            +
                  File.write(config_file, "token: #{token}")
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
      
 23 
     | 
    
         
            +
                def config_file
         
     | 
| 
      
 24 
     | 
    
         
            +
                  convert_legacy_config
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @config_file ||= File.join(root_path, 'config')
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
                
         
     | 
| 
      
 28 
     | 
    
         
            +
                def root_path
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @root_path ||= File.join(ENV['HOME'], '.quandl')
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                protected
         
     | 
| 
      
 33 
     | 
    
         
            +
                
         
     | 
| 
      
 34 
     | 
    
         
            +
                def define_attributes(*attr_names)
         
     | 
| 
      
 35 
     | 
    
         
            +
                  attr_names.each do |attr_name|
         
     | 
| 
      
 36 
     | 
    
         
            +
                    define_attribute(attr_name)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
                
         
     | 
| 
      
 40 
     | 
    
         
            +
                def define_attribute(name)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  define_method(name){ read_attribute(name) }
         
     | 
| 
      
 42 
     | 
    
         
            +
                  define_method("#{name}="){|v| write_attribute(name, v) }
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
                
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
              
         
     | 
| 
      
 47 
     | 
    
         
            +
              attr_accessor :options
         
     | 
| 
      
 48 
     | 
    
         
            +
              
         
     | 
| 
      
 49 
     | 
    
         
            +
              define_attributes :token, :quandl_url, :last_checked_for_update
         
     | 
| 
      
 50 
     | 
    
         
            +
              
         
     | 
| 
      
 51 
     | 
    
         
            +
              def initialize(*args)
         
     | 
| 
      
 52 
     | 
    
         
            +
                self.options = OpenStruct.new(args.extract_options!)
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
              
         
     | 
| 
      
 55 
     | 
    
         
            +
              def config
         
     | 
| 
      
 56 
     | 
    
         
            +
                @config ||= OpenStruct.new(YAML.load(File.read(options.config_file)))
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
              
         
     | 
| 
      
 59 
     | 
    
         
            +
              private
         
     | 
| 
      
 60 
     | 
    
         
            +
              
         
     | 
| 
      
 61 
     | 
    
         
            +
              def read_attribute(name)
         
     | 
| 
      
 62 
     | 
    
         
            +
                config.send(name)
         
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
              
         
     | 
| 
      
 65 
     | 
    
         
            +
              def write_attribute(name, value)
         
     | 
| 
      
 66 
     | 
    
         
            +
                config.send("#{name}=", value)
         
     | 
| 
      
 67 
     | 
    
         
            +
                commit_config
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
              
         
     | 
| 
      
 70 
     | 
    
         
            +
              def commit_config
         
     | 
| 
      
 71 
     | 
    
         
            +
                File.write( options.config_file, YAML.dump(config.marshal_dump) )
         
     | 
| 
      
 72 
     | 
    
         
            +
              end
         
     | 
| 
      
 73 
     | 
    
         
            +
              
         
     | 
| 
      
 74 
     | 
    
         
            +
            end
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
      
 76 
     | 
    
         
            +
            end
         
     |