rbtclk 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +99 -4
- data/lib/rbtclk/countup_timer.rb +48 -0
- data/lib/rbtclk/version.rb +1 -1
- data/lib/rbtclk.rb +4 -0
- data/rbtclk.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f82af384fb0bca1429fab241ebe28c44660fe5b
|
4
|
+
data.tar.gz: d58d110dff90dcfa066fbea3dcfa306aaa1e9920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 801d37f245ba48e915c3d357d002fb64f6f10758527caa132f0fbbd9435c8dceff16618d6d3d6a35e627c11cc62afaf101acd392dc6e316d23c311cbde0cb27a
|
7
|
+
data.tar.gz: 79c038fbf82b43f653397d1d2dd995f4a952de3db935c3eed5a134559de09fd675e72f43cd73771e506a9a05749f12adbbbe7b589389a43a64ee8c27aa5e0a1f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Rbtclk
|
2
2
|
|
3
|
-
|
3
|
+
A light-weight timer application that can run in terminal emulators :rabbit:
|
4
4
|
|
5
5
|
## Requirement
|
6
6
|
|
@@ -20,10 +20,20 @@ $ (sudo) gem install 'rbtclk'
|
|
20
20
|
$ rbtclk
|
21
21
|
```
|
22
22
|
|
23
|
+
```
|
24
|
+
## ###### ###### #### ## ###
|
25
|
+
### ## ## ## ## ## ## ### ##
|
26
|
+
## ##### ## ##### ## ## ## #### ##
|
27
|
+
## ## ## ## ## ## ## #####
|
28
|
+
## ## ## ## ## ###### ## ##
|
29
|
+
## ## ## ## ## ## ## ## ## ## ## ##
|
30
|
+
## #### ## #### #### ## #### ####
|
31
|
+
```
|
32
|
+
|
23
33
|
### Mode
|
24
34
|
|
25
|
-
Now we support only
|
26
|
-
Countdown timer mode
|
35
|
+
Now we support only clock mode and countup mode.
|
36
|
+
Countdown timer mode is our future works.
|
27
37
|
|
28
38
|
#### Example
|
29
39
|
|
@@ -32,6 +42,31 @@ $ rbtclk --mode clock
|
|
32
42
|
$ rbtclk -m clock
|
33
43
|
```
|
34
44
|
|
45
|
+
```
|
46
|
+
## ###### ###### #### ## ###
|
47
|
+
### ## ## ## ## ## ## ### ##
|
48
|
+
## ##### ## ##### ## ## ## #### ##
|
49
|
+
## ## ## ## ## ## ## #####
|
50
|
+
## ## ## ## ## ###### ## ##
|
51
|
+
## ## ## ## ## ## ## ## ## ## ## ##
|
52
|
+
## #### ## #### #### ## #### ####
|
53
|
+
```
|
54
|
+
|
55
|
+
```shell
|
56
|
+
$ rbtclk --mode countup
|
57
|
+
$ rbtclk -m countup
|
58
|
+
```
|
59
|
+
|
60
|
+
```
|
61
|
+
#### #### #### #### ## ####
|
62
|
+
## ## ## ## ## ## ## ## ## ## ### ## ##
|
63
|
+
## ## ## ## ## ## ## ## ## ## ## ##
|
64
|
+
## ## ## ## ## ## ## ## ## ###
|
65
|
+
## ## ## ## ## ## ## ## ## ##
|
66
|
+
## ## ## ## ## ## ## ## ## ## ## ## ##
|
67
|
+
#### #### ## #### #### ## ## ####
|
68
|
+
```
|
69
|
+
|
35
70
|
### Change font
|
36
71
|
|
37
72
|
This application depends on artii library (https://github.com/miketierney/artii).
|
@@ -41,11 +76,71 @@ You can use any fonts that are supported by artii.
|
|
41
76
|
|
42
77
|
```shell
|
43
78
|
$ rbtclk --font clb8x8 # default
|
79
|
+
```
|
80
|
+
|
81
|
+
```
|
82
|
+
## ###### ###### #### ## ###
|
83
|
+
### ## ## ## ## ## ## ### ##
|
84
|
+
## ##### ## ##### ## ## ## #### ##
|
85
|
+
## ## ## ## ## ## ## #####
|
86
|
+
## ## ## ## ## ###### ## ##
|
87
|
+
## ## ## ## ## ## ## ## ## ## ## ##
|
88
|
+
## #### ## #### #### ## #### ####
|
89
|
+
```
|
90
|
+
|
91
|
+
```shell
|
44
92
|
$ rbtclk --font univers
|
45
|
-
|
93
|
+
```
|
94
|
+
|
95
|
+
```
|
96
|
+
88 8888888888 8888888888 ad8888ba, ,a8888a, ad8888ba,
|
97
|
+
,d88 88 88 8P' "Y8 ,8P"' `"Y8, 8P' "Y8
|
98
|
+
888888 88 ____ 88 ____ d8 ,8P Y8, d8
|
99
|
+
88 88a8PPPP8b, 888 88a8PPPP8b, 88,dd888bb, 888 88 88 88,dd888bb,
|
100
|
+
88 PP" `8b 888 PP" `8b 88P' `8b 888 88 88 88P' `8b
|
101
|
+
88 d8 d8 88 d8 `8b d8' 88 d8
|
102
|
+
88 Y8a a8P 888 Y8a a8P 88a a8P 888 `8ba, ,ad8' 88a a8P
|
103
|
+
88 "Y88888P" 888 "Y88888P" "Y88888P" 888 "Y8888P" "Y88888P"
|
104
|
+
```
|
105
|
+
|
106
|
+
```shell
|
46
107
|
$ rbtclk --font smkeyboard
|
47
108
|
```
|
48
109
|
|
110
|
+
```
|
111
|
+
____ ____ ____ ____ ____ ____ ____ ____
|
112
|
+
||1 |||5 |||: |||5 |||6 |||: |||4 |||6 ||
|
113
|
+
||__|||__|||__|||__|||__|||__|||__|||__||
|
114
|
+
|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|
|
115
|
+
```
|
116
|
+
|
117
|
+
### Specify format
|
118
|
+
|
119
|
+
You can specify format of time by Time#strftime style.
|
120
|
+
Default format is "%X".
|
121
|
+
|
122
|
+
#### Example
|
123
|
+
|
124
|
+
```shell
|
125
|
+
$ rbtclk --format "* %H:%M *"
|
126
|
+
```
|
127
|
+
|
128
|
+
```
|
129
|
+
# ## ### #### ## #
|
130
|
+
# ### ## ## ## ## ### #
|
131
|
+
## # ## ## ## ## ## ## #### ## # ##
|
132
|
+
### ## ##### ## ## ## ## ###
|
133
|
+
# ## ## ## ## ## ###### #
|
134
|
+
# # ## ## ## ## ## ## ## # #
|
135
|
+
# # ## #### ## #### #### # #
|
136
|
+
```
|
137
|
+
|
138
|
+
## Progress Report
|
139
|
+
|
140
|
+
- [x] Clock
|
141
|
+
- [x] Countup Timer
|
142
|
+
- [ ] Countdown Timer
|
143
|
+
|
49
144
|
## Code Status
|
50
145
|
|
51
146
|
- [![Build Status](https://travis-ci.org/mozamimy/rbtclk.svg?branch=master)](https://travis-ci.org/mozamimy/rbtclk)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "artii"
|
2
|
+
require "curses"
|
3
|
+
|
4
|
+
module Rbtclk
|
5
|
+
class CountupTimer
|
6
|
+
def initialize(font: "clb8x8", format: "%X")
|
7
|
+
@artii = Artii::Base.new(font: font, format: "%X")
|
8
|
+
@format = format
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
Curses.init_screen
|
13
|
+
Curses.curs_set(0)
|
14
|
+
@start_time = Time.now
|
15
|
+
|
16
|
+
begin
|
17
|
+
view_thread = Thread.new do
|
18
|
+
loop do
|
19
|
+
refresh
|
20
|
+
sleep(1)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
input_thread = Thread.new do
|
25
|
+
loop do
|
26
|
+
case Curses.getch
|
27
|
+
when "q"
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
view_thread.join
|
34
|
+
input_thread.join
|
35
|
+
ensure
|
36
|
+
Curses.close_screen
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def refresh
|
42
|
+
Curses.clear
|
43
|
+
Curses.setpos(0, 0)
|
44
|
+
Curses.addstr(@artii.asciify((Time.parse("1/1") + (Time.now - @start_time)).strftime(@format)))
|
45
|
+
Curses.refresh
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/rbtclk/version.rb
CHANGED
data/lib/rbtclk.rb
CHANGED
@@ -2,6 +2,7 @@ require "curses"
|
|
2
2
|
require "optparse"
|
3
3
|
require "rbtclk/version"
|
4
4
|
require "rbtclk/clock"
|
5
|
+
require "rbtclk/countup_timer"
|
5
6
|
|
6
7
|
module Rbtclk
|
7
8
|
class << self
|
@@ -20,6 +21,9 @@ module Rbtclk
|
|
20
21
|
when "clock"
|
21
22
|
timer = Clock.new(font: params[:font] || "clb8x8", format: params[:format] || "%X")
|
22
23
|
timer.show
|
24
|
+
when "countup"
|
25
|
+
timer = CountupTimer.new(font: params[:font] || "clb8x8", format: params[:format] || "%X")
|
26
|
+
timer.show
|
23
27
|
else
|
24
28
|
warn "#{params[:mode]} mode is not supported."
|
25
29
|
warn "You can use [clock]."
|
data/rbtclk.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = Rbtclk::VERSION
|
8
8
|
spec.authors = ["Moza USANE"]
|
9
9
|
spec.email = ["mozamimy@quellencode.org"]
|
10
|
-
spec.summary = %q{
|
11
|
-
spec.description = %q{
|
10
|
+
spec.summary = %q{A light-weight timer application that can run in terminal emulators.}
|
11
|
+
spec.description = %q{A light-weight timer application that can run in terminal emulators.}
|
12
12
|
spec.homepage = "http://quellencode.org/"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbtclk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moza USANE
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description:
|
83
|
+
description: A light-weight timer application that can run in terminal emulators.
|
84
84
|
email:
|
85
85
|
- mozamimy@quellencode.org
|
86
86
|
executables:
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- bin/rbtclk
|
99
99
|
- lib/rbtclk.rb
|
100
100
|
- lib/rbtclk/clock.rb
|
101
|
+
- lib/rbtclk/countup_timer.rb
|
101
102
|
- lib/rbtclk/version.rb
|
102
103
|
- rbtclk.gemspec
|
103
104
|
- spec/rbtclk_spec.rb
|
@@ -125,7 +126,7 @@ rubyforge_project:
|
|
125
126
|
rubygems_version: 2.2.2
|
126
127
|
signing_key:
|
127
128
|
specification_version: 4
|
128
|
-
summary:
|
129
|
+
summary: A light-weight timer application that can run in terminal emulators.
|
129
130
|
test_files:
|
130
131
|
- spec/rbtclk_spec.rb
|
131
132
|
- spec/spec_helper.rb
|