Sha256: a114d36c5d8a780272024b97563df34d0857558ddde231242b6c06dad4d17deb

Contents?: true

Size: 978 Bytes

Versions: 9

Compression:

Stored size: 978 Bytes

Contents

require "fileutils"

namespace :agcod do
  namespace :certification do
    desc "generate a request manifest for certification"
    task :generate_manifest do
      puts "generating manifest"
      i = 1
      prices = [
        12,
        999,
        100,
        50.02,
        999.99,
        600,
        70,
        100000,
        12,
        12,
        1
      ]

      path = File.join(FileUtils.pwd, "features", "support", "certification_requests")
      FileUtils.rm_rf(path)
      FileUtils.mkdir_p(path)

      requests = []
      prices.each do |p|
        random_string_of_numbers = ""
        12.times {random_string_of_numbers << rand(9).to_s}

        request = {"value" => p, 
          "request_id" => i.to_s + random_string_of_numbers}

        File.open(File.join(path, "#{i}.yml"), 'w') do |manifest|
          manifest.puts request.to_yaml
        end
        i += 1
      end
      
      
      puts "Manifest available at #{path}"
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
agcod-0.1.1 lib/agcod/tasks/certification.rake
dpickett-agcod-0.0.0 lib/agcod/tasks/certification.rake
dpickett-agcod-0.0.1 lib/agcod/tasks/certification.rake
dpickett-agcod-0.0.2 lib/agcod/tasks/certification.rake
agcod-0.1.0 lib/agcod/tasks/certification.rake
agcod-0.0.6 lib/agcod/tasks/certification.rake
agcod-0.0.4 lib/agcod/tasks/certification.rake
agcod-0.0.3 lib/agcod/tasks/certification.rake
agcod-0.0.2 lib/agcod/tasks/certification.rake