Sha256: c58cffbae3e4b986fcfe35eefa8bbe287da2501d23e46c0320561795a0a7b7cd

Contents?: true

Size: 616 Bytes

Versions: 3

Compression:

Stored size: 616 Bytes

Contents

# Simple demo Rakefile to autorun samples in current directory
# adjust path to k9 executable, and or opts as required

SAMPLES_DIR = './'

desc 'run demo'
task default: [:demo]

desc 'demo'
task :demo do
  samples_list.shuffle.each { |sample| run_sample sample }
end

def samples_list
  files = []
  Dir.chdir(SAMPLES_DIR)
  Dir.glob('*.rb').each do |file|
    files << File.join(SAMPLES_DIR, file)
  end
  return files
end

def run_sample(sample_name)
  puts "Running #{sample_name}...quit to run next sample"
  open("|k9 -r #{sample_name}", 'r') do |io|
    while l = io.gets
      puts(l.chop)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cf3-1.2.0 samples/Rakefile
cf3-1.0.1 samples/Rakefile
cf3-1.0.0 samples/Rakefile