Sha256: 5b4f137ecc8e90d284cc426fcd08c4e29d7f3d66404d5184e1e7287c70c65fad

Contents?: true

Size: 1022 Bytes

Versions: 5

Compression:

Stored size: 1022 Bytes

Contents

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec

desc "build the list of names and pack it into a pstore"
task "names:build" do
  require "pstore"
  adjective_file = File.expand_path "../app/providers/naming/adj.txt", __FILE__
  noun_file = File.expand_path "../app/providers/naming/nouns.txt", __FILE__
  PStore.new(File.expand_path("../app/providers/naming/dictionary.pstore", __FILE__)).tap do |store|
    store.transaction do
      adjectives = store["adjectives"] = {}
      File.open(adjective_file) do |file|
        file.each_line do |line|
          first_letter = line[0]
          adjectives[first_letter] ||= []
          adjectives[first_letter] << line.chomp
        end
      end
      nouns = store["nouns"] = {}
      File.open(noun_file) do |file|
        file.each_line do |line|
          first_letter = line[0]
          nouns[first_letter] ||= []
          nouns[first_letter] << line.chomp
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rumm-0.1.0 Rakefile
rumm-0.0.24 Rakefile
rumm-0.0.23 Rakefile
rumm-0.0.22 Rakefile
rumm-0.0.21 Rakefile