Sha256: 99263d5be41044a24901cd8217568169376ca3aa494cfda7bd944d7a4d1c7a81

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'jeka'

def build(files)
  Dir.glob(files).each do |d|
    require File.join(File.join(Dir.getwd, d))
  end
  
  error = false
  Jeka::Algorithm.build_all do |p, t, o|
    case t
      when :step
        p = p.to_s
        while p.length < 3
          p = " " + p
        end
        puts "[#{p}%] #{o}"
      when :output
        o = o.join
        if o.length > 0
          puts o
        end
      when :error
        o = o.join
        if o.length > 0
          puts o
        end
        error = true
      when :done
        if error
          puts "[100%] Some error occurs..."
        else
          puts "[100%] Done!"
        end
    end
  end
end

def run(files)
  Dir.glob(files).each do |d|
    require File.join(File.join(Dir.getwd, d))
  end
  
  error = false
  Jeka::Algorithm.run_all do |p, t, o|
    case t
      when :step
        p = p.to_s
        while p.length < 3
          p = " " + p
        end
        puts "[#{p}%] #{o}"
      when :error
        o = o.join
        if o.length > 0
          puts o
        end
        error = true
      when :done
        if error
          puts "[100%] Some error occurs..."
        else
          puts "[100%] Done!"
        end
    end
  end
end

def help
  puts "usage: jeka [build|run] [regexp|file|dir]"
end

if ARGV.length == 2
  case ARGV[0]
    when "build"
      build(ARGV[1])
    when "run"
      run(ARGV[1])
    else
      help()
  end
else
  help()
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jeka-0.2.0 bin/jeka