Sha256: d54e0477afb7622252ffcded205ffc5b277364ffdf698bac831fb608a2741333

Contents?: true

Size: 1.91 KB

Versions: 9

Compression:

Stored size: 1.91 KB

Contents

module Tasks
class Toolbelt
  include RakeFileUtils
  
  extend ActiveModel::Callbacks
  define_model_callbacks :ensure
  
  class << self
  
    def execute(*args, &block)
      self.new(*args, &block).execute
    end

    def resource_path
      @resource_path ||= File.join(root_path, "dist/resources/")
    end
  
    def release_path
      @release_path ||= File.join(tarball_path, "quandl-command" )
    end
    
    def pkg_path
      @pkg_path ||= File.join(build_path, "pkg/")
    end

    def tarball_path
      @tarball_path ||= File.join(build_path, "tarball/")
    end
    
    def ruby_pkg_path
      @ruby_pkg_path ||= File.join(build_path, 'ruby.pkg')
    end

    def build_path
      @build_path ||= File.join(root_path, "build")
    end
    
    def tmp_path
      @tmp_path ||= File.join(root_path, "tmp")
    end
    
    def root_path
      @root_path ||= File.expand_path(File.join(File.dirname(__FILE__), '../'))
    end

    def trace?
      Rake.application.options.trace == true
    end
    
  end
  
  attr_accessor :args, :options, :block
  
  delegate :root_path, :ruby_pkg_path, :pkg_path, :tmp_path, :build_path, :tarball_path, :release_path, :resource_path, :trace?, to: :class
  
  def initialize(*args, &block)
    self.options = OpenStruct.new(args.extract_options!)
    self.args = args
    self.block = block
  end
  
  def wipe_dir(p)
    rm_rf p
    mkdir p
  end
  
  def execute
    begin
      puts "args: #{args}, options: #{options}" if trace?
      call
    ensure
      run_callbacks(:ensure)
    end
  end
  
  def revision
    @revision ||= options.revision.to_s.gsub("/","-") || "master"
  end
  
  def resource(path)
    File.join(resource_path, path)
  end
  
  def version
    Quandl::Command::VERSION
  end
  
end
end

Dir.glob( File.join( Tasks::Toolbelt.root_path, 'tasks/toolbelt/*.rb') ){|f| require(f) }
Dir.glob( File.join( Tasks::Toolbelt.root_path, 'tasks/toolbelt/**/*.rb') ){|f| require(f) }

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
quandl-0.3.7 tasks/toolbelt.rb
quandl-0.3.6 tasks/toolbelt.rb
quandl-0.3.4 tasks/toolbelt.rb
quandl-0.3.3 tasks/toolbelt.rb
quandl-0.3.0 tasks/toolbelt.rb
quandl-0.2.27 tasks/toolbelt.rb
quandl-0.2.26 tasks/toolbelt.rb
quandl-0.2.25 tasks/toolbelt.rb
quandl-0.2.24 tasks/toolbelt.rb