class PSGC::RakeTask

Public Class Methods

new(*args) { |self| ... } click to toggle source
# File lib/psgc/rake_task.rb, line 27
def initialize(*args)
  yield self if block_given?

  namespace :psgc do

    directory base_dir

    desc 'Fetch PSGC Web pages from www.ncsb.gov.ph'
    task :import => base_dir do
      reg = PSGC::Import::ImportRegions.new
      reg.fetch
    end

    desc 'Compute md5 hashes of files under web/'
    task :hashes => base_dir do
      puts 'CHECKSUMS = {'
      puts Dir.entries(base_dir).map {|f|
        unless f.start_with?('.')
          p = File.join(base_dir, f)
          if File.file?(p) && File.size(p) > 0
            hash = Digest::MD5.file(File.join(base_dir, f)).hexdigest
            "  '#{f}' => '#{hash}'"
          end
        end
      }.compact.join(",\n")
      puts '}'
    end
  end
end

Public Instance Methods

base_dir() click to toggle source
# File lib/psgc/rake_task.rb, line 11
def base_dir
  PSGC::Import::Base.dir
end
base_dir=(dir) click to toggle source
# File lib/psgc/rake_task.rb, line 15
def base_dir=(dir)
  PSGC::Import::Base.dir = dir
end
base_uri() click to toggle source
# File lib/psgc/rake_task.rb, line 19
def base_uri
  PSGC::Import::Base.uri
end
base_uri=(uri) click to toggle source
# File lib/psgc/rake_task.rb, line 23
def base_uri=(uri)
  PSGC::Import::Base.uri = uri
end