Sha256: d579f9b1a7e797a76313388601c4d917878eb9d31a6fed26f6f0bf6741ee9405

Contents?: true

Size: 910 Bytes

Versions: 3

Compression:

Stored size: 910 Bytes

Contents

require 'rake/tasklib'

module Analects
  class RakeTasks < Rake::TaskLib
    def initialize(name = :analects, &blk)
      @name = name
      if block_given?
        if blk.arity == 0
          self.instance_eval(&blk)
        else
          yield self
        end
      end
      define
    end

    def library
      @library ||= Analects::Library.new(options)
    end

    def options
      @options ||= {}
    end

    def data_dir(dir)
      options[:data_dir] = dir
    end

    def define
      namespace @name do
        namespace :download do
          desc 'download CC-CEDICT'
          task :cedict do
            library.cedict.retrieve!
          end

          desc 'download Chise-IDS'
          task :chise_ids do
            library.chise_ids.retrieve!
          end

          desc 'download all sources'
          task :all => [:cedict, :chise_ids]
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
analects-0.3.1 lib/analects/rake_tasks.rb
analects-0.2.1 lib/analects/rake_tasks.rb
analects-0.2.0 lib/analects/rake_tasks.rb