Sha256: 9d983dc84752cf720b1afc294b4707e9ad98da59f2a8ae14814fa0bcb080f657

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

#!/usr/bin/env rake
require "bundler/gem_tasks"

# RSpec
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec')
task :default => :spec

# Compile
namespace :aspm do
  desc "Parse PDF and generate files"
  task :generate do
    Dir['input/*.txt'].each do |file|
      currency = File.basename(file, '.txt')
      body = File.read file
      array = body.split(/\s/)

      amount = []
      amount_pro = []

      unless currency == 'gbp'
        array.each_slice(2) do |slice|
          amount << slice.first
          amount_pro << slice.last
        end
      else
        amount = array[0..87]
        amount_pro = array[88..-1]
      end

      File.write("lib/prices/#{currency}", amount.join("\n"))
      File.write("lib/prices/#{currency}_pro", amount_pro.join("\n"))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
app_store_pricing_matrix-2.0.0 Rakefile