timeru 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7c934cd4c204aeecebc0f202adb14e901a05ce1124f1e0c9a002ed04b79ccb3b
4
+ data.tar.gz: b983ddd832c6eece7af27916973ccd11b32c2e6cb8697014e13db4b4ef2273e2
5
+ SHA512:
6
+ metadata.gz: 91d3f9b271c9e53d36480ce2b00f7af4d853ff36cd5ec93dd2cafc8ea77e3e19c77d60e108ceaaf067a8954f02664967e0d0b973184aeb90d622103288fbf038
7
+ data.tar.gz: 975cc62892ef351fd82ed490a5b9fbf02581eb0162bace2be4e0114a0835b5a5a01b6bb38e93e18843395031444e59b3b6656c84872911d31662175b63051de3
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in timeru.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "minitest", "~> 5.0"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Damoon Imani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,40 @@
1
+ # Timeru
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/timeru`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'timeru'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install timeru
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/timeru.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "timeru"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'timeru/cli'
4
+
5
+ Timeru::CLI.start
@@ -0,0 +1,7 @@
1
+ require "timeru/version"
2
+ require "timeru/timer"
3
+
4
+ module Timeru
5
+ class Error < StandardError; end
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,14 @@
1
+ require "thor"
2
+ require "timeru/timer"
3
+
4
+ module Timeru
5
+ class CLI < Thor
6
+
7
+ desc "gets ITEM", "Determines human readable address for provided latitude and longitude"
8
+ def start(seconds)
9
+ Timeru::Timer.new(seconds.to_i).start
10
+ end
11
+
12
+ end
13
+
14
+ end
@@ -0,0 +1,38 @@
1
+ require "tty-cursor"
2
+
3
+ module Timeru
4
+ class Timer
5
+
6
+ def initialize hours=0, minutes=0, seconds
7
+ @time = hours * 3600 + minutes * 60 + seconds
8
+ end
9
+
10
+ def start
11
+ puts "..."
12
+ cursor = TTY::Cursor
13
+ @time.downto 0 do |sec|
14
+ print cursor.prev_line
15
+ print cursor.clear_line
16
+ puts create_display(sec)
17
+ sleep 1
18
+ end
19
+ puts "done"
20
+ end
21
+
22
+
23
+ def create_display seconds
24
+ seconds_display = seconds % 60
25
+ minutes_display = (seconds / 60) % 60
26
+ hours_dispaly = (seconds / 60) / 60
27
+ seconds_display = seconds_display.to_i
28
+ minutes_display = minutes_display.to_i
29
+ hours_dispaly = hours_dispaly.to_i
30
+
31
+ string = "%02d:" %[hours_dispaly]
32
+ string << "%02d:" %[minutes_display]
33
+ string << "%02d" %[seconds_display]
34
+
35
+ return string
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+ module Timeru
2
+ VERSION = "0.3.0"
3
+ end
@@ -0,0 +1,40 @@
1
+ require_relative 'lib/timeru/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "timeru"
5
+ spec.version = Timeru::VERSION
6
+ spec.authors = ["Damoon Imani"]
7
+ spec.email = ["damoonimani@pm.me"]
8
+
9
+ spec.summary = %q{Timeru: your tty timer \n}
10
+ spec.description = %q{
11
+
12
+ Timeru : the simple timer for terminal
13
+
14
+ A utility for counting down inside terminal.
15
+
16
+
17
+ }
18
+ spec.homepage = "https://github.com/domimani/timeru"
19
+ spec.license = "MIT"
20
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
21
+
22
+
23
+
24
+ spec.metadata["homepage_uri"] = spec.homepage
25
+ spec.metadata["source_code_uri"] = "https://github.com/domimani/timeru"
26
+
27
+
28
+ # Specify which files should be added to the gem when it is released.
29
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
30
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
31
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
32
+ end
33
+ spec.bindir = "exe"
34
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
35
+ spec.require_paths = ["lib"]
36
+
37
+ spec.add_dependency 'tty-cursor', '~> 0.7.1'
38
+ spec.add_dependency 'thor', '~> 1.0', '>= 1.0.1'
39
+
40
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: timeru
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Damoon Imani
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tty-cursor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.7.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.0.1
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.1
47
+ description: "\n\n Timeru : the simple timer for terminal\n\n A
48
+ utility for counting down inside terminal.\n\n\n "
49
+ email:
50
+ - damoonimani@pm.me
51
+ executables:
52
+ - timeru
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - ".gitignore"
57
+ - ".travis.yml"
58
+ - Gemfile
59
+ - LICENSE.txt
60
+ - README.md
61
+ - Rakefile
62
+ - bin/console
63
+ - bin/setup
64
+ - exe/timeru
65
+ - lib/timeru.rb
66
+ - lib/timeru/cli.rb
67
+ - lib/timeru/timer.rb
68
+ - lib/timeru/version.rb
69
+ - timeru.gemspec
70
+ homepage: https://github.com/domimani/timeru
71
+ licenses:
72
+ - MIT
73
+ metadata:
74
+ homepage_uri: https://github.com/domimani/timeru
75
+ source_code_uri: https://github.com/domimani/timeru
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 2.3.0
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubygems_version: 3.0.8
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: 'Timeru: your tty timer \n'
95
+ test_files: []