termodoro 0.0.3 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/termodoro +6 -0
- data/lib/run.rb +7 -0
- data/lib/termodoro.rb +63 -37
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bedddd976063c2aff3aa487dc6040c547c062a9b
|
4
|
+
data.tar.gz: 8e8f652f79d584c05cf98ffabd374b159cb6f80f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a809c70f16150e9fb6abaffa20bfd56eef33973c104d2157ce3f88858eda9f3e827a62a9f21c80b8d48c3289e514f481d5230e39d598d911812b1edad2fccf3c
|
7
|
+
data.tar.gz: ab177bd909c3a0f467fe099db214934d7a0f4a1489daabe450608b0d92e2191c578ee0d63722c94a443613666b1d6dbc80be9b6c9942e668e27f7c4d20e3ad0c
|
data/bin/termodoro
CHANGED
data/lib/run.rb
ADDED
data/lib/termodoro.rb
CHANGED
@@ -1,51 +1,77 @@
|
|
1
|
-
require 'pry'
|
2
1
|
|
3
2
|
class Termodoro
|
3
|
+
attr_accessor :time_part, :number_part, :message
|
4
|
+
|
5
|
+
SECS_IN_MIN = 60
|
6
|
+
SECS_IN_HOUR = 3600
|
7
|
+
|
8
|
+
def initialize(arguments)
|
9
|
+
@arguments = arguments
|
4
10
|
|
5
|
-
def initialize
|
6
|
-
@desired_length
|
7
11
|
# message
|
8
|
-
# title on/off
|
12
|
+
# title on/off -- probably going to drop this
|
9
13
|
end
|
10
14
|
|
11
|
-
def
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
# take duration and make into seconds
|
16
|
-
# return total seconds
|
17
|
-
duration
|
15
|
+
def parse_time_part
|
16
|
+
segment = @arguments.scan(/[\D]+[^\w]/).first.split(" ").first
|
17
|
+
self.time_part = segment
|
18
|
+
#=> hours/minutes/seconds, etc.
|
18
19
|
end
|
19
20
|
|
20
|
-
def
|
21
|
-
|
22
|
-
|
21
|
+
def parse_number_part
|
22
|
+
number = @arguments.scan(/[\d]+/).first.strip.to_i
|
23
|
+
self.number_part = number
|
24
|
+
#=> the number of time_parts given
|
23
25
|
end
|
24
26
|
|
25
|
-
|
27
|
+
def parse_message
|
28
|
+
# .split(/[\d]+.[\w]+/).last
|
29
|
+
parsed_message = @arguments.split(/^\s*[\d]+\s*[\w]+/).last.strip
|
30
|
+
self.message = parsed_message
|
31
|
+
end
|
26
32
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
def calculate_time
|
34
|
+
if minutes?
|
35
|
+
seconds = parse_number_part * SECS_IN_MIN
|
36
|
+
elsif hours?
|
37
|
+
seconds = parse_number_part * SECS_IN_HOUR
|
38
|
+
elsif seconds?
|
39
|
+
seconds = parse_number_part
|
40
|
+
end
|
41
|
+
|
42
|
+
seconds #=> returns seconds
|
43
|
+
end
|
44
|
+
|
45
|
+
def seconds?
|
46
|
+
seconds = %w[s sec secs second seconds]
|
47
|
+
true if seconds.include?(parse_time_part)
|
48
|
+
#=> true/false
|
49
|
+
end
|
40
50
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
51
|
+
def minutes?
|
52
|
+
minutes = %w[m min mins minute minutes]
|
53
|
+
true if minutes.include?(parse_time_part)
|
54
|
+
#=> true/false
|
55
|
+
end
|
56
|
+
|
57
|
+
def hours?
|
58
|
+
hours = %w[h hr hrs hour hours]
|
59
|
+
true if hours.include?(parse_time_part)
|
60
|
+
#=> true/false
|
61
|
+
end
|
62
|
+
|
63
|
+
def clean_message
|
64
|
+
parse_message
|
65
|
+
# will need something to sanitize apostrophes and stuff
|
66
|
+
#=> return sanitized message to insert into terminal
|
67
|
+
end
|
68
|
+
|
69
|
+
def command
|
70
|
+
# title = "title" -- leaving off title for now.
|
71
|
+
# if title on/off call one or the other
|
72
|
+
|
73
|
+
"sleep #{calculate_time} && terminal-notifier -message '#{parse_message}' -title 'Termodoro' & disown"
|
74
|
+
#=> return the fully-formed command string for Bash
|
75
|
+
end
|
46
76
|
|
47
|
-
if title == ""
|
48
|
-
system("sleep #{duration} && terminal-notifier -message '#{message}' & disown && exit")
|
49
|
-
else
|
50
|
-
system("sleep #{duration} && terminal-notifier -message '#{message}' -title '#{title}' & disown && exit")
|
51
77
|
end
|
metadata
CHANGED
@@ -1,22 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: termodoro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vinney Cavallo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
12
|
-
dependencies:
|
13
|
-
|
11
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: terminal-notifier
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Use this little utility to set simple reminders from the command line.
|
28
|
+
See the github page below for more information
|
14
29
|
email: vcavallo@gmail.com
|
15
|
-
executables:
|
30
|
+
executables:
|
31
|
+
- termodoro
|
16
32
|
extensions: []
|
17
33
|
extra_rdoc_files: []
|
18
34
|
files:
|
19
35
|
- lib/termodoro.rb
|
36
|
+
- lib/run.rb
|
20
37
|
- bin/termodoro
|
21
38
|
homepage: https://github.com/vcavallo/termodoro
|
22
39
|
licenses:
|
@@ -41,5 +58,5 @@ rubyforge_project:
|
|
41
58
|
rubygems_version: 2.0.6
|
42
59
|
signing_key:
|
43
60
|
specification_version: 4
|
44
|
-
summary:
|
61
|
+
summary: A lightweight CL reminder app
|
45
62
|
test_files: []
|