time_block 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/time_block/agent.rb +27 -0
- data/lib/time_block/cli.rb +5 -8
- data/lib/time_block/version.rb +1 -1
- data/time_block.gemspec +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f28e03f24679b200a951719f22b947ff78118fd
|
4
|
+
data.tar.gz: d8957de296fa34a5409a4f93ca956279726cc2c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5268e38b822c9aad007ae5a8dc2ab5959bba9554da5d1466ab29dcfe669d7ba20112aeded0d2bf07c4c5409b16ff0f7f246333b36f38b22a06811a7c85722e3
|
7
|
+
data.tar.gz: 6658811d2186855e182683c4291c23f2785b75fcdaffa08beeb9d04ed6cc3e8bf2dd539e4ace4e4d0383132bb8680c0a2817096625aacf1ddf914e4e87fa0ca4
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class TimeBlock::Agent
|
2
|
+
def initialize(time)
|
3
|
+
fail 'No terminal-notifier, please install it, brew install terminal-notifier' unless terminal_notifier_exist?
|
4
|
+
@time = time
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
pre_callback
|
9
|
+
sleep @time
|
10
|
+
post_callback
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def terminal_notifier_exist?
|
16
|
+
`which terminal-notifier`
|
17
|
+
$? == 0
|
18
|
+
end
|
19
|
+
|
20
|
+
def pre_callback
|
21
|
+
`terminal-notifier -message #{"Time is starting !!!".dump} -title "TimeBlock - #{@time}s" -sound "default"`
|
22
|
+
end
|
23
|
+
|
24
|
+
def post_callback
|
25
|
+
`terminal-notifier -message #{"Time is out dude !!!".dump} -title "TimeBlock - #{@time}s" -sound "default"`
|
26
|
+
end
|
27
|
+
end
|
data/lib/time_block/cli.rb
CHANGED
@@ -1,18 +1,15 @@
|
|
1
|
+
require 'dante'
|
1
2
|
require 'time_block'
|
3
|
+
require 'time_block/agent'
|
2
4
|
|
3
5
|
class TimeBlock::CLI
|
4
6
|
def self.start(*args)
|
5
|
-
fail 'No terminal-notifier, please install it, brew install terminal-notifier' unless terminal_notifier_exist?
|
6
7
|
time = args.shift.strip.to_i
|
7
|
-
|
8
|
-
|
8
|
+
Dante::Runner.new('timeblock').execute(daemonize: true, pid_path: '/tmp/timeblock.pid', log_path: '/tmp/timblock.log') do |opts|
|
9
|
+
TimeBlock::Agent.new(time).run
|
10
|
+
end
|
9
11
|
rescue => e
|
10
12
|
puts e.message
|
11
13
|
exit(1)
|
12
14
|
end
|
13
|
-
|
14
|
-
def self.terminal_notifier_exist?
|
15
|
-
`which terminal-notifier`
|
16
|
-
$? == 0
|
17
|
-
end
|
18
15
|
end
|
data/lib/time_block/version.rb
CHANGED
data/time_block.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_block
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Faizal Zakaria
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dante
|
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'
|
55
69
|
description: Notifier to notify you when your time block is ended
|
56
70
|
email:
|
57
71
|
- phaibusiness@gmail.com
|
@@ -67,6 +81,7 @@ files:
|
|
67
81
|
- Rakefile
|
68
82
|
- bin/timeblock
|
69
83
|
- lib/time_block.rb
|
84
|
+
- lib/time_block/agent.rb
|
70
85
|
- lib/time_block/cli.rb
|
71
86
|
- lib/time_block/version.rb
|
72
87
|
- time_block.gemspec
|