paradeiser 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Guardfile +16 -11
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/TODO.md +12 -1
- data/bin/par +5 -2
- data/lib/paradeiser.rb +22 -2
- data/lib/paradeiser/controllers/controller.rb +1 -0
- data/lib/paradeiser/controllers/paradeiser_controller.rb +0 -1
- data/lib/paradeiser/models/hook.rb +4 -0
- data/lib/paradeiser/models/repository.rb +1 -1
- data/lib/paradeiser/models/scheduled.rb +4 -0
- data/lib/paradeiser/version.rb +1 -1
- data/paradeiser.gemspec +1 -6
- data/templates/linux/hooks/after-finish-break +2 -0
- data/templates/linux/hooks/after-finish-pomodoro +2 -0
- data/templates/linux/hooks/after-start-break +2 -0
- data/templates/linux/hooks/after-start-pomodoro +2 -0
- data/templates/mac/hooks/after-finish-break +2 -0
- data/templates/mac/hooks/after-finish-pomodoro +2 -0
- data/templates/mac/hooks/after-start-break +2 -0
- data/templates/mac/hooks/after-start-pomodoro +2 -0
- data/test/helper.rb +14 -36
- data/test/integration/test_annotate.rb +15 -13
- data/test/integration/test_finish.rb +7 -5
- data/test/integration/test_interrupt.rb +7 -5
- data/test/integration/test_log.rb +9 -7
- data/test/integration/test_no_args.rb +5 -3
- data/test/integration/test_start.rb +5 -3
- data/test/integration/test_status.rb +8 -6
- data/test/integration/test_unknown.rb +5 -3
- data/test/lib/controller_test.rb +4 -2
- data/test/lib/integration_test.rb +8 -2
- data/test/lib/paradeiser_controller_test.rb +7 -1
- data/test/lib/token_file_registry.rb +19 -0
- data/test/lib/unit_test.rb +47 -0
- data/test/lib/view_test.rb +13 -8
- data/test/scripts/create-failing-hooks +17 -0
- data/test/scripts/fail +5 -0
- data/test/unit/test_break.rb +43 -40
- data/test/unit/test_break_view.rb +17 -14
- data/test/unit/test_breaks_controller.rb +55 -52
- data/test/unit/test_interrupt.rb +27 -24
- data/test/unit/test_paradeiser_controller_export.rb +103 -100
- data/test/unit/test_paradeiser_controller_init.rb +2 -2
- data/test/unit/test_paradeiser_controller_report.rb +72 -69
- data/test/unit/test_paradeiser_controller_status.rb +78 -75
- data/test/unit/test_paradeiser_view_init.rb +5 -3
- data/test/unit/test_paradeiser_view_report.rb +116 -114
- data/test/unit/test_paradeiser_view_status.rb +14 -11
- data/test/unit/test_pomodori_controller.rb +319 -316
- data/test/unit/test_pomodori_view.rb +40 -37
- data/test/unit/test_pomodoro.rb +116 -113
- data/test/unit/test_pomodoro_hooks.rb +172 -170
- data/test/unit/test_repository.rb +98 -95
- data/test/unit/test_scheduler.rb +39 -30
- data/test/unit/test_token_file_registry.rb +40 -0
- metadata +59 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 456d9290ae49e511ab834fb7230bce40bfb49499
|
4
|
+
data.tar.gz: 25244e3c436466d740dfd34f9d9d6472522fefc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea0ab79272226ec07de5c8d89b09e8045af9c76d9ad22b5be10260e656628fe543b504533b6f62967d34706d3ae9caeb5ad5fcb98d8ca0942046b98d19500988
|
7
|
+
data.tar.gz: 6da4ed5b67a54b24af4cf3dc78d4c0681c22a2d0fef82e8e42eced3ff2e8434548ae11e84670e4fb86db326abf0b8d9fab42e30caf307cfe022b7ba7276c14c0
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -3,16 +3,21 @@ guard 'bundler' do
|
|
3
3
|
watch(%r|^.*\.gemspec|)
|
4
4
|
end
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
group 'unit' do
|
7
|
+
guard 'minitest' do
|
8
|
+
watch(%r|^test/unit/test_(.*)\.rb|){|m| "test/unit/test_#{m[1]}.rb"}
|
9
|
+
watch(%r|^lib/*\.rb|){'test/unit'}
|
10
|
+
watch(%r|^lib/.*/*\.rb|){'test/unit'}
|
11
|
+
watch(%r{^lib/.*/([^/]+)\.rb$}){|m| "test/unit/test_#{m[1]}.rb"}
|
12
|
+
watch(%r|^test/helper\.rb|){'test/unit'}
|
13
|
+
watch(%r{^lib/.*/views/(.*)/[^/]+\.erb$}){|m| "test/unit/test_#{m[1]}_view.rb"}
|
14
|
+
end
|
15
|
+
end
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
group 'integration' do
|
18
|
+
guard 'minitest' do
|
19
|
+
watch(%r{^bin/([^/]+)$}){"test/integration"}
|
20
|
+
watch(%r|^test/integration/test_(.*)\.rb|){|m| "test/integration/test_#{m[1]}.rb"}
|
21
|
+
watch(%r|^test/lib/*\.rb|){'test/integration'}
|
22
|
+
end
|
18
23
|
end
|
data/README.md
CHANGED
@@ -128,7 +128,7 @@ It will appear in the reports and will count towards efficiency calculations. Th
|
|
128
128
|
|
129
129
|
Creates the `$PAR_DIR` directory and the sample hooks in `$PAR_DIR/hooks`. The data store will not be created on `par init`, but when the first write operation happens (e.g. `par pomodoro start`, but not `par report`).
|
130
130
|
|
131
|
-
* Initialize an
|
131
|
+
* Initialize an arbitrary directory
|
132
132
|
|
133
133
|
$ par init /tmp
|
134
134
|
|
data/Rakefile
CHANGED
data/TODO.md
CHANGED
@@ -1,14 +1,25 @@
|
|
1
1
|
# Paradeiser Backlog
|
2
2
|
|
3
|
-
*
|
3
|
+
* Remove the token files generated in TestPomodoroHooks
|
4
|
+
|
5
|
+
* BUG: A failing after-start-pomodoro hook seems to prevent `par start` from running, but it actually should not: Only before-hooks are allowed to cancel actions.
|
4
6
|
|
5
7
|
* Add validations to models. `finished_at` must occur at after created at, etc.
|
6
8
|
|
7
9
|
* There must be no overlap in pomodori, even if we log one.
|
8
10
|
- Logging one while another one is active must fail unless finished at is before the active one's started at.
|
11
|
+
- Could use a range operator with it, e.g. within a pomodoro:
|
12
|
+
|
13
|
+
class Pomodoro
|
14
|
+
def include?(time)
|
15
|
+
(started_at..finished_at).cover?(time)
|
16
|
+
end
|
17
|
+
end
|
9
18
|
|
10
19
|
* `par log` needs options for when the logged pomodoro was started and / or stopped
|
11
20
|
|
21
|
+
* Refactoring: Replace our custom `pluralize` with the one from actionview
|
22
|
+
|
12
23
|
* Improve tests with more doubles
|
13
24
|
- Sandy Metz rules about testing messages:
|
14
25
|
- Incoming: Assert state
|
data/bin/par
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
|
4
5
|
require 'paradeiser'
|
6
|
+
require 'commander/import'
|
7
|
+
|
5
8
|
include Paradeiser
|
6
9
|
|
7
|
-
program :version,
|
10
|
+
program :version, VERSION
|
8
11
|
program :description, "Paradeiser is a command-line tool for the Pomodoro Technique. It keeps track of the current pomodoro and assists the user in managing active and past pomodori as well as breaks. Status commands and reports are provided to get insights."
|
9
12
|
program :help, 'Author', 'Nicholas E. Rabenau <nerab@gmx.at>'
|
10
13
|
|
data/lib/paradeiser.rb
CHANGED
@@ -2,8 +2,28 @@ require 'pstore'
|
|
2
2
|
require 'erb'
|
3
3
|
require 'state_machine'
|
4
4
|
|
5
|
-
require '
|
6
|
-
|
5
|
+
require 'paradeiser/errors'
|
6
|
+
require 'paradeiser/executor'
|
7
|
+
require 'paradeiser/models/scheduled'
|
8
|
+
require 'paradeiser/models/break'
|
9
|
+
require 'paradeiser/models/hook'
|
10
|
+
require 'paradeiser/models/interrupt'
|
11
|
+
require 'paradeiser/models/job'
|
12
|
+
require 'paradeiser/models/pomodoro'
|
13
|
+
require 'paradeiser/models/repository'
|
14
|
+
require 'paradeiser/models/scheduler'
|
15
|
+
require 'paradeiser/models/status'
|
16
|
+
require 'paradeiser/refinements/numeric'
|
17
|
+
require 'paradeiser/refinements/pluralize'
|
18
|
+
require 'paradeiser/router'
|
19
|
+
require 'paradeiser/version'
|
20
|
+
require 'paradeiser/view'
|
21
|
+
require 'paradeiser/controllers/controller'
|
22
|
+
require 'paradeiser/controllers/breaks_controller'
|
23
|
+
require 'paradeiser/controllers/paradeiser_controller'
|
24
|
+
require 'paradeiser/controllers/pomodori_controller'
|
25
|
+
|
26
|
+
require 'paradeiser/initializers/inflections'
|
7
27
|
|
8
28
|
module Paradeiser
|
9
29
|
def self.par_dir
|
@@ -13,6 +13,10 @@ module Paradeiser
|
|
13
13
|
ENV["PAR_#{pom.name.upcase}_STARTED_AT"] = pom.started_at.strftime('%H:%M') if pom.started_at
|
14
14
|
|
15
15
|
out, err, status = Open3.capture3(hook)
|
16
|
+
|
17
|
+
ENV.delete("PAR_#{pom.name.upcase}_ID")
|
18
|
+
ENV.delete("PAR_#{pom.name.upcase}_STARTED_AT")
|
19
|
+
|
16
20
|
raise HookFailedError.new(hook, out, err, status) if 0 != status.exitstatus
|
17
21
|
end
|
18
22
|
end
|
data/lib/paradeiser/version.rb
CHANGED
data/paradeiser.gemspec
CHANGED
@@ -19,19 +19,14 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'commander'
|
22
|
-
spec.add_runtime_dependency 'require_all'
|
23
22
|
spec.add_runtime_dependency 'state_machine'
|
24
23
|
spec.add_runtime_dependency 'activesupport'
|
25
24
|
spec.add_runtime_dependency 'actionpack'
|
26
|
-
# spec.add_runtime_dependency 'actionview'
|
27
25
|
spec.add_runtime_dependency 'activemodel'
|
28
26
|
|
29
|
-
# Moved to the Gemfile so that Travis CI can load the test group
|
30
|
-
# spec.add_development_dependency 'rake'
|
31
|
-
# spec.add_development_dependency 'minitest'
|
32
|
-
|
33
27
|
spec.add_development_dependency 'guard-minitest'
|
34
28
|
spec.add_development_dependency 'guard-bundler'
|
29
|
+
spec.add_development_dependency 'terminal-notifier'
|
35
30
|
spec.add_development_dependency 'terminal-notifier-guard'
|
36
31
|
spec.add_development_dependency 'libnotify'
|
37
32
|
spec.add_development_dependency 'rb-inotify'
|
@@ -7,4 +7,6 @@
|
|
7
7
|
# $PAR_BREAK_ID - the ID of the break that just ended
|
8
8
|
# $PAR_BREAK_STARTED_AT - the time when the break was started
|
9
9
|
#
|
10
|
+
# In order to use this hook, you'll have to chmod +x the hook in ~/paradeiser/hooks/*.
|
11
|
+
#
|
10
12
|
notify-send "Pomodoro" "The break $PAR_BREAK_ID (started at $PAR_BREAK_STARTED_AT) is over." -u critical > /dev/null
|
@@ -7,4 +7,6 @@
|
|
7
7
|
# $PAR_POMODORO_ID - the ID of the pomodoro that just ended
|
8
8
|
# $PAR_POMODORO_STARTED_AT - the time when the pomodoro was started
|
9
9
|
#
|
10
|
+
# In order to use this hook, you'll have to chmod +x the hook in ~/paradeiser/hooks/*.
|
11
|
+
#
|
10
12
|
notify-send "Pomodoro" "The pomodoro $PAR_POMODORO_ID (started at $PAR_POMODORO_STARTED_AT) is over." -u critical > /dev/null
|
@@ -4,4 +4,6 @@
|
|
4
4
|
# Sample after-start-break hook for Paradeiser (called after a break started). It
|
5
5
|
# displays a simple notification.
|
6
6
|
#
|
7
|
+
# In order to use this hook, you'll have to chmod +x the hook in ~/paradeiser/hooks/*.
|
8
|
+
#
|
7
9
|
notify-send "Pomodoro" "A new break started." -u critical > /dev/null
|
@@ -4,4 +4,6 @@
|
|
4
4
|
# Sample after-start-pomodoro hook for Paradeiser (called after a pomodoro started). It
|
5
5
|
# displays a simple notification.
|
6
6
|
#
|
7
|
+
# In order to use this hook, you'll have to chmod +x the hook in ~/paradeiser/hooks/*.
|
8
|
+
#
|
7
9
|
notify-send "Pomodoro" "A new pomodoro started." -u critical > /dev/null
|
@@ -7,4 +7,6 @@
|
|
7
7
|
# $PAR_BREAK_ID - the ID of the break that just ended
|
8
8
|
# $PAR_BREAK_STARTED_AT - the time when the break was started
|
9
9
|
#
|
10
|
+
# In order to use this hook, you'll have to chmod +x the hook in ~/paradeiser/hooks/*.
|
11
|
+
#
|
10
12
|
terminal-notifier-success -message "The break $PAR_BREAK_ID (started at $PAR_BREAK_STARTED_AT) is over." > /dev/null
|
@@ -7,4 +7,6 @@
|
|
7
7
|
# $PAR_POMODORO_ID - the ID of the pomodoro that just ended
|
8
8
|
# $PAR_POMODORO_STARTED_AT - the time when the pomodoro was started
|
9
9
|
#
|
10
|
+
# In order to use this hook, you'll have to chmod +x the hook in ~/paradeiser/hooks/*.
|
11
|
+
#
|
10
12
|
terminal-notifier-success -message "The pomodoro $PAR_POMODORO_ID (started at $PAR_POMODORO_STARTED_AT) is over." > /dev/null
|
@@ -4,4 +4,6 @@
|
|
4
4
|
# Sample after-start-break hook for Paradeiser (called after a break started). It
|
5
5
|
# displays a simple notification.
|
6
6
|
#
|
7
|
+
# In order to use this hook, you'll have to chmod +x the hook in ~/paradeiser/hooks/*.
|
8
|
+
#
|
7
9
|
terminal-notifier-success -message "A new break started." > /dev/null
|
@@ -4,4 +4,6 @@
|
|
4
4
|
# Sample after-start-pomodoro hook for Paradeiser (called after a pomodoro started). It
|
5
5
|
# displays a simple notification.
|
6
6
|
#
|
7
|
+
# In order to use this hook, you'll have to chmod +x the hook in ~/paradeiser/hooks/*.
|
8
|
+
#
|
7
9
|
terminal-notifier-success -message "A new pomodoro started." > /dev/null
|
data/test/helper.rb
CHANGED
@@ -1,40 +1,18 @@
|
|
1
|
-
|
2
|
-
require 'paradeiser'
|
3
|
-
require_rel 'lib'
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
2
|
|
5
3
|
require 'lib/at_mock'
|
6
|
-
|
4
|
+
require 'paradeiser'
|
7
5
|
include Paradeiser
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def interrupt!(type = :internal, pom = @pom)
|
24
|
-
Scheduler.stub(:clear, nil) do
|
25
|
-
pom.interrupt!(type)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def finish!(thing = @pom || @break)
|
30
|
-
Scheduler.stub(:clear, nil) do
|
31
|
-
thing.finish!
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def cancel!(pom = @pom)
|
36
|
-
Scheduler.stub(:clear, nil) do
|
37
|
-
pom.cancel!
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
7
|
+
require_relative 'lib/unit_test'
|
8
|
+
require_relative 'lib/assertions'
|
9
|
+
require_relative 'lib/at_mock'
|
10
|
+
require_relative 'lib/controller_test'
|
11
|
+
require_relative 'lib/integration_test'
|
12
|
+
require_relative 'lib/options_mock'
|
13
|
+
require_relative 'lib/paradeiser_controller_test'
|
14
|
+
require_relative 'lib/process_status_mock'
|
15
|
+
require_relative 'lib/pstore_mock'
|
16
|
+
require_relative 'lib/schedulable_mock'
|
17
|
+
require_relative 'lib/token_file_registry'
|
18
|
+
require_relative 'lib/view_test'
|
@@ -1,19 +1,21 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module ParadeiserTest
|
4
|
+
class TestAnnotateCommand < IntegrationTest
|
5
|
+
def test_annotate_no_previous
|
6
|
+
refute_command('annotate')
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
def test_annotate_active
|
10
|
+
assert_command('start')
|
11
|
+
assert_command('annotate', 0, name.split('_'))
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def test_annotate_second_last_successful
|
15
|
+
assert_command('start')
|
16
|
+
assert_command('finish')
|
17
|
+
assert_command('break')
|
18
|
+
assert_command('annotate', 0, name.split('_'))
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module ParadeiserTest
|
4
|
+
class TestFinishCommand < IntegrationTest
|
5
|
+
def test_finish
|
6
|
+
refute_command('finish')
|
7
|
+
assert_command('start')
|
8
|
+
assert_command('finish')
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module ParadeiserTest
|
4
|
+
class TestInterruptCommand < IntegrationTest
|
5
|
+
def test_interrupt
|
6
|
+
refute_command('interrupt')
|
7
|
+
assert_command('start')
|
8
|
+
assert_command('interrupt')
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module ParadeiserTest
|
4
|
+
class TestLogCommand < IntegrationTest
|
5
|
+
def test_log_inactive
|
6
|
+
assert_command('log', 0, name.split('_'))
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def test_log_active
|
10
|
+
assert_command('start')
|
11
|
+
assert_command('log', 0, name.split('_'))
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|