rbtclk 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a3c9b57428f78ebcefe2a9bde7262c721828f781
4
+ data.tar.gz: b1029c699e2ddf72a146a9b4cc6c15421091ba84
5
+ SHA512:
6
+ metadata.gz: bc5b0278b36aa82f6ee970d48d4000c92ffd0ab1120fe4fc6d08f2eb389c475e841da3d5850191f08ea9f9ed66eea953f4d9453112a651c5a6ca43197df52c8d
7
+ data.tar.gz: c5a645c447c1d2250ca88ce433291034ff885229dd4dd99a0cdcec2232c0c7e80ee832967753248db763148ab3bc489810771c17dde24c3d8e7ce8c52e849a1c
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rbtclk.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Moza USANE
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Rbtclk
2
+
3
+ The light-weight timer application that can run in terminal.
4
+
5
+ ## Requirement
6
+
7
+ - Ruby 2.0 or later.
8
+
9
+ ## Installation
10
+
11
+ ```shell
12
+ $ (sudo) gem install 'rbtclk'
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### Basic usage
18
+
19
+ ```shell
20
+ $ rbtclk
21
+ ```
22
+
23
+ ### Mode
24
+
25
+ Now we support only a clock mode.
26
+ Countdown timer mode and countup timer mode are our future works.
27
+
28
+ #### Example
29
+
30
+ ```shell
31
+ $ rbtclk --mode clock
32
+ $ rbtclk -m clock
33
+ ```
34
+
35
+ ### Change font
36
+
37
+ This application depends on artii library (https://github.com/miketierney/artii).
38
+ You can use any fonts that are supported by artii.
39
+
40
+ #### Example
41
+
42
+ ```shell
43
+ $ rbtclk --font clb8x8 # default
44
+ $ rbtclk --font univers
45
+ $ rbtclk --font doh
46
+ $ rbtclk --font smkeyboard
47
+ ```
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it ( https://github.com/mozamimy/rbtclk/fork )
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/rbtclk ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rbtclk"
4
+
5
+ Rbtclk.run(ARGV)
@@ -0,0 +1,46 @@
1
+ require "artii"
2
+ require "curses"
3
+
4
+ module Rbtclk
5
+ class Clock
6
+ def initialize(font: "clb8x8", format: "%X")
7
+ @artii = Artii::Base.new(font: font)
8
+ @format = format
9
+ end
10
+
11
+ def show
12
+ Curses.init_screen
13
+
14
+ begin
15
+ view_thread = Thread.new do
16
+ loop do
17
+ refresh
18
+ sleep(1)
19
+ end
20
+ end
21
+
22
+ input_thread = Thread.new do
23
+ loop do
24
+ case Curses.getch
25
+ when "q"
26
+ exit
27
+ end
28
+ end
29
+ end
30
+
31
+ view_thread.join
32
+ input_thread.join
33
+ ensure
34
+ Curses.close_screen
35
+ end
36
+ end
37
+
38
+ private
39
+ def refresh
40
+ Curses.clear
41
+ Curses.setpos(0, 0)
42
+ Curses.addstr(@artii.asciify(Time.now.strftime(@format)))
43
+ Curses.refresh
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ module Rbtclk
2
+ VERSION = "0.0.1"
3
+ end
data/lib/rbtclk.rb ADDED
@@ -0,0 +1,30 @@
1
+ require "curses"
2
+ require "optparse"
3
+ require "rbtclk/version"
4
+ require "rbtclk/clock"
5
+
6
+ module Rbtclk
7
+ class << self
8
+ def run(args)
9
+ params = {}
10
+
11
+ OptionParser.new do |opt|
12
+ opt.on("--mode MODE") { |m| params[:mode] = m }
13
+ opt.on("--format FORMAT") { |f| params[:format] = f }
14
+ opt.on("--font FONT") { |f| params[:font] = f }
15
+
16
+ opt.parse!(args)
17
+ end
18
+
19
+ case params[:mode] || "clock"
20
+ when "clock"
21
+ timer = Clock.new(font: params[:font] || "clb8x8", format: params[:format] || "%X")
22
+ timer.show
23
+ else
24
+ warn "#{params[:mode]} mode is not supported."
25
+ warn "You can use [clock]."
26
+ exit(1)
27
+ end
28
+ end
29
+ end
30
+ end
data/rbtclk.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'rbtclk/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rbtclk"
7
+ spec.version = Rbtclk::VERSION
8
+ spec.authors = ["Moza USANE"]
9
+ spec.email = ["mozamimy@quellencode.org"]
10
+ spec.summary = %q{The light-weight timer application that can run in terminal.}
11
+ spec.description = %q{The light-weight timer application that can run in terminal.}
12
+ spec.homepage = "http://quellencode.org/"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "rspec"
23
+ spec.add_dependency "artii"
24
+ spec.add_dependency "curses"
25
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Rbtclk do
4
+ pending "Write later."
5
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'rbtclk'
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rbtclk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Moza USANE
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: artii
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: curses
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: The light-weight timer application that can run in terminal.
84
+ email:
85
+ - mozamimy@quellencode.org
86
+ executables:
87
+ - rbtclk
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/rbtclk
99
+ - lib/rbtclk.rb
100
+ - lib/rbtclk/clock.rb
101
+ - lib/rbtclk/version.rb
102
+ - rbtclk.gemspec
103
+ - spec/rbtclk_spec.rb
104
+ - spec/spec_helper.rb
105
+ homepage: http://quellencode.org/
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.2.2
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: The light-weight timer application that can run in terminal.
129
+ test_files:
130
+ - spec/rbtclk_spec.rb
131
+ - spec/spec_helper.rb