romodoro 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/romodoro.rb +44 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f537db5250ee71c55aeaf146e8d9c7ed630c60691e1cd57789a8482e1cdcfbf4
4
+ data.tar.gz: a3b90b788d912dd443164489ec5cbef0193149d830ebef50e40d5912f1c12d99
5
+ SHA512:
6
+ metadata.gz: 7b88916c5e58af1a11f35d0a9f73d8b76080001a271a97c8181124f3bd4daf8b905e87bf1aa0124ae7c681e5e58f04ceaba6aa656fe0d7f4d4057d4a557a08a6
7
+ data.tar.gz: 514696dfe1ba7c71ef84f21848862fde48b69a5f134bf42c5787d1e8daa7bb6d85a53d76fda146272ab2e83c336dc08952a724be1cb52d2b092b13dc2e187446
data/lib/romodoro.rb ADDED
@@ -0,0 +1,44 @@
1
+ class Romodoro
2
+ def initialize(time = 15)
3
+ @timer_time_in_seconds = time * 60
4
+ @sound_path = "/System/Library/Sounds/Ping.aiff"
5
+ @picture_path = "~/Dropbox/images/ERy2M_MXsAA835B.jpg"
6
+ @how_many_times = 5
7
+ # TODO add picture and sound directories. randomise
8
+ end
9
+
10
+ def start
11
+ start = Time.now
12
+ puts "start: #{start}"
13
+ seconds_passed = 0
14
+ puts "Timer started"
15
+ # do something every x seconds
16
+ wait_time = 1 # second
17
+ while true
18
+ sleep wait_time
19
+ seconds_passed += 1
20
+ puts "a second passed. seconds passed: #{seconds_passed}"
21
+ time_diff = Time.now - start
22
+ puts "start time minus Time.now: #{time_diff}"
23
+ puts "@timer_time_in_seconds: #{@timer_time_in_seconds}"
24
+ if time_diff >= @timer_time_in_seconds
25
+ open_picture
26
+ play_sound(@sound_path)
27
+ break
28
+ end
29
+ end
30
+ puts "opertation done"
31
+ elapse = Time.now - start
32
+ puts "Took #{elapsed} seconds."
33
+ end
34
+
35
+ def play_sound(path_to_sound)
36
+ # TODO check if system has afplay
37
+ command = "afplay #{path_to_sound}"
38
+ system command
39
+ end
40
+
41
+ def open_picture
42
+ system "open #{@picture_path}"
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: romodoro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Kaczmarczyk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Start it. Wait. Beep.
14
+ email: daniel.kacz@protonmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/romodoro.rb
20
+ homepage: https://danielk.co.uk
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.0.6
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Pomodoro Ruby timer. Romodoro.
43
+ test_files: []