cigarette 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/cigarette.rb +14 -14
  2. metadata +4 -4
@@ -33,26 +33,31 @@ class Cigarette
33
33
  end
34
34
  init_curses
35
35
  deploy_trap
36
- display_version
37
36
  lighter_please!
38
37
  end
39
38
 
40
39
  private
41
40
 
41
+ def display_main_screen
42
+ Curses.clear
43
+ display(0,0, "cigarette - Version #{VERSION}")
44
+ display(2, 10, "#{@banner} - #{@current_time.strftime("at: %T")}")
45
+ display(2, 2, "STATUS:")
46
+ display(4, 0, @output)
47
+ Curses.refresh
48
+ end
49
+
42
50
  def lighter_please!
43
51
  while CANCER_DO_NOT_APPEAR
44
52
  sleep 0.1
45
- if time_to_light_up?
46
- output = `#{@command} 2>&1`
53
+ if @current_time.nil? || time_to_light_up?
54
+ @current_time = Time.now if @current_time.nil?
55
+ @output = `#{@command} 2>&1`
47
56
  status = $?.success? unless defined? status
48
57
  current_status = $?.success?
49
- banner = ($?.success? ? "SUCCESS" : "ERROR(S)")
50
- Curses.clear
51
- display(2, 10, "#{banner} - #{@current_time.strftime("at: %T")}")
52
- display(2, 2, "STATUS")
53
- display(4, 0, output)
58
+ @banner = ($?.success? ? "SUCCESS" : "ERROR(S)")
59
+ display_main_screen
54
60
  status = current_status
55
- Curses.refresh
56
61
  end
57
62
  end
58
63
  end
@@ -94,11 +99,6 @@ class Cigarette
94
99
  Curses.attron(Curses.color_pair(color | DEFAULT)) { Curses.addstr(text) }
95
100
  end
96
101
 
97
- def display_version
98
- display(0,0, "cigarette - Version #{VERSION}")
99
- Curses.refresh
100
- end
101
-
102
102
  def onsig(sig)
103
103
  Curses.close_screen
104
104
  exit sig
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cigarette
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
9
- version: "1.1"
8
+ - 2
9
+ version: "1.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Thibaut Deloffre
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-12-24 00:00:00 Z
17
+ date: 2012-12-26 00:00:00 Z
18
18
  dependencies: []
19
19
 
20
20
  description: Tiny test tool