doro 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3667c3eb9700f16c394fa7146658d84898eca76d
4
- data.tar.gz: 3df19758ab2f9269019b72762dba1c49f3d322c3
3
+ metadata.gz: 792149da11730576f2d234760321ec94918e6357
4
+ data.tar.gz: 4ce5187a36584f13c307832808452ae2f6766ee5
5
5
  SHA512:
6
- metadata.gz: 34ce48b740896a1dcab654472651540de65fc406e52c1382e29c0c3f9547e85119565440aeec0085d369e79901eb2d8b01b3fbb82076a71a33ae6752c75cfb5f
7
- data.tar.gz: d96845e0a919626da1b9c7f74c1c611ac22e6251a8ec4fe2b30f72959d55d3ced45ec93967c7198a9e3d44f1ba72cdb1cede979b64699f7371eccabe8b7d5bd1
6
+ metadata.gz: 1631c6a0222f08c602953d6d15d06761b553ce3ae44edea8d3f25b4d29761cbd97e0fb76aaadef6dfbd85f3ab92c2e42783c278be0b441da98e5ef6d5f03e829
7
+ data.tar.gz: 3e920b045ff6d83e2a1f77c0ad375dba5193825eed7b27c1190303773097ff666c33acc84d284c4cc170e2bcfcc0804f0aadf6f16ba5dc3f9b962b391d1a7729
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doro (0.2.0)
4
+ doro (0.2.2)
5
5
  gli (= 2.13.4)
6
6
  notifier (~> 0.5)
7
7
  terminal-notifier (~> 1.6)
data/README.md CHANGED
@@ -29,7 +29,7 @@ For detailed information.
29
29
  ## Todo
30
30
 
31
31
  - [ ] number flag on list
32
- - [ ] remove dependencies
32
+ - [ ] .dororc
33
33
 
34
34
  ### Notifications
35
35
 
data/bin/doro CHANGED
@@ -3,7 +3,6 @@ require 'gli'
3
3
  require 'fileutils'
4
4
  require 'csv'
5
5
  require 'date'
6
- require 'notifier'
7
6
 
8
7
  require 'doro'
9
8
 
@@ -32,8 +31,6 @@ command :list do |c|
32
31
  end
33
32
  end
34
33
 
35
-
36
-
37
34
  desc 'Begins a pomodoro timer'
38
35
  arg_name '*description of task* (eg. cool task)'
39
36
  command :start do |c|
@@ -44,30 +41,12 @@ command :start do |c|
44
41
 
45
42
  c.action do |global_options,options,args|
46
43
  raise "You didn't specify a task" if args.empty?
47
- interrupt = false
48
44
  task_name = args.join(' ')
49
45
  start_time = Time.now
50
46
  seconds = 0
51
47
 
52
- ProgressBar.new(task_name, 1500).start
53
-
54
- Signal.trap("INT") { interrupt = true }
55
-
56
- 1500.times do
57
- break if interrupt == true
58
- bar.increment
59
- seconds += 1
60
- sleep 1
61
- end
62
-
63
- print("\r")
64
-
65
- if interrupt == false
66
- Notifier.notify(
67
- :image => "logo.png",
68
- :title => task_name,
69
- :message => "Your timer is up! Take a break!"
70
- )
48
+ ProgressBar.new(task_name, 1500).start do
49
+ seconds +=1
71
50
  end
72
51
 
73
52
  Doro::Entries::add_entry(
@@ -77,11 +56,10 @@ command :start do |c|
77
56
  start_time: start_time,
78
57
  tag: options[:t]
79
58
  )
59
+
80
60
  end
81
61
  end
82
62
 
83
-
84
-
85
63
  desc 'Begins a break timer'
86
64
  arg_name '*none*'
87
65
  command :break do |c|
@@ -94,33 +72,15 @@ command :break do |c|
94
72
  c.flag :t, type: Integer
95
73
 
96
74
  c.action do |global_options,options,args|
97
- interrupt = false
98
75
 
99
76
  minutes = options[:t]
100
77
  options[:long]? minutes = 15 : nil
101
78
 
102
79
  ProgressBar.new('Break', minutes * 60).start
103
80
 
104
- Signal.trap("INT") { interrupt = true }
105
-
106
- (minutes * 60).times do
107
- break if interrupt == true
108
- bar.increment
109
- sleep 1
110
- end
111
-
112
- if interrupt == false
113
- Notifier.notify(
114
- :image => "logo.png",
115
- :title => 'Break',
116
- :message => "Break time's over! Back to work!"
117
- )
118
- end
119
81
  end
120
82
  end
121
83
 
122
-
123
-
124
84
  pre do |global,command,options,args|
125
85
  FileUtils::touch doro_file unless File.file? doro_file
126
86
  true
@@ -1,5 +1,6 @@
1
1
  require 'io/console'
2
2
  require 'time'
3
+ require 'notifier'
3
4
 
4
5
  class ProgressBar
5
6
  def initialize(title, max_progress)
@@ -7,14 +8,22 @@ class ProgressBar
7
8
  @max_progress = max_progress
8
9
  @title = title
9
10
  @start_time = Time.now
11
+ @interrupt = false
10
12
  end
11
13
 
12
14
  def start
13
- while (@progress <= @max_progress)
15
+ Signal.trap("INT") { @interrupt = true }
16
+
17
+ while (@progress <= @max_progress && @interrupt == false )
14
18
  render_progress
15
- sleep 1
16
19
  @progress += 1
20
+ yield
21
+ sleep 1
17
22
  end
23
+
24
+ print("\r")
25
+
26
+ display_notification
18
27
  end
19
28
 
20
29
  private
@@ -30,7 +39,6 @@ class ProgressBar
30
39
  end
31
40
 
32
41
  # Methods for determing time
33
-
34
42
  def display_time
35
43
  Time.at((Time.now - @start_time)).utc.strftime("%M:%S")
36
44
  end
@@ -52,7 +60,6 @@ class ProgressBar
52
60
  @title.size + 10
53
61
  end
54
62
 
55
-
56
63
  # Methods for determining terminal length
57
64
  def terminal_length
58
65
  return 80 unless unix?
@@ -72,4 +79,12 @@ class ProgressBar
72
79
  def unix?
73
80
  RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
74
81
  end
82
+
83
+ # Methods for notifications
84
+ def display_notification
85
+ unless @interrupt
86
+ Notifier.notify(image: "logo.png", title: @title, message: "")
87
+ end
88
+ end
89
+
75
90
  end
data/lib/doro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doro
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Orochena
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-29 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -101,6 +101,7 @@ executables:
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".gitignore"
104
105
  - Gemfile
105
106
  - Gemfile.lock
106
107
  - README.md
@@ -164,7 +165,6 @@ files:
164
165
  - doc/js/search_index.js
165
166
  - doc/js/searcher.js
166
167
  - doc/table_of_contents.html
167
- - doro-0.1.0.gem
168
168
  - doro.gemspec
169
169
  - doro.rdoc
170
170
  - features/doro.feature
data/doro-0.1.0.gem DELETED
Binary file