Module: Jeka::Console

Defined in:
lib/jeka/console.rb

Class Method Summary collapse

Class Method Details

._show(p, t, o, s) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/jeka/console.rb', line 35

def self._show(p, t, o, s)
  case t
    when :step
      p = p.to_s
      while p.length < 3
        p = " " + p
      end
      puts "[#{p}%] #{o}"
    when :output
      if s
        o = o.join
        if o.length > 0
          puts o
        end
      end
    when :test
      puts "       > #{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

.add_algorithms(dir) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/jeka/console.rb', line 4

def self.add_algorithms(dir)
  Jeka::Algorithm.reset
  ok = false
  Dir.glob(dir).each do |d|
    ok = true
    load d
  end
  ok
end

.buildObject



21
22
23
24
25
26
# File 'lib/jeka/console.rb', line 21

def self.build
  error = false
  Jeka::Algorithm.build_all do |p, t, o|
    self._show(p, t, o, true)
  end
end

.run(n = 1, output = "analysis.jeka") ⇒ Object



14
15
16
17
18
19
# File 'lib/jeka/console.rb', line 14

def self.run(n=1, output="analysis.jeka")
  error = false
  Jeka::Algorithm.run_all(n, output) do |p, t, o|
    self._show(p, t, o, false)
  end
end

.testObject



28
29
30
31
32
33
# File 'lib/jeka/console.rb', line 28

def self.test
  error = false
  Jeka::Algorithm.test_all do |p, t, o|
    self._show(p, t, o, false)
  end
end