time-tracker 0.1

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.
data/bin/track ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require 'time-tracker'
3
+
4
+ @activity = ARGV[0] || "pomodoro"
5
+ @time = (ARGV[1] || 30).to_i
6
+
7
+ start @time, @activity
8
+ loop! @time
9
+ finish_up @activity
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ require 'time-tracker/pluralize'
3
+
4
+ def start time, activity
5
+ `notify-send -t #{time} "Starting work on #{activity}" "#{"minute".pluralize(time)} left"`
6
+ end
7
+
8
+ def end activity
9
+ end
10
+
11
+ def loop! time
12
+ time.times do |index|
13
+ `sleep 60`
14
+ puts "You've worked #{"minute".pluralize(index + 1)} out of #{time}"
15
+ end
16
+ end
17
+
18
+ def finish_up activity
19
+ `notify-send "Finish up #{activity}" "Time's up"`
20
+ puts "Time is up"
21
+ `aplay -q #{File.expand_path(File.dirname(__FILE__))}/time-tracker/bell.wav`
22
+ end
Binary file
@@ -0,0 +1,9 @@
1
+ class String
2
+ def pluralize(count)
3
+ if count == 1
4
+ "1 #{to_s}"
5
+ else
6
+ "#{count} #{to_s}s"
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: time-tracker
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Matthieu Tanguay-Carel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-16 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Tested on Ubuntu
15
+ email:
16
+ executables:
17
+ - track
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/time-tracker.rb
22
+ - lib/time-tracker/pluralize.rb
23
+ - lib/time-tracker/bell.wav
24
+ - bin/track
25
+ homepage: https://github.com/matstc/time-tracker
26
+ licenses:
27
+ - CC Attribution Non-Commercial
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 1.8.23
47
+ signing_key:
48
+ specification_version: 3
49
+ summary: Tracks time spent on small tasks
50
+ test_files: []