pomme 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/console +2 -9
- data/exe/pomme +5 -0
- data/lib/pomme/cli.rb +52 -0
- data/lib/pomme/version.rb +1 -1
- data/lib/pomme.rb +4 -2
- data/pomme.gemspec +3 -0
- metadata +34 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ad1b7292ec90b2e5a379b83b2dc4861567fa18c
|
4
|
+
data.tar.gz: 9fb9e8873bc1438bffaf0a57bbdd5528e2289264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3160b587c99be5efd26046f02538183c13067742ae64b895c801db178837a33ccd359b1b3296865a111ad9303889453f6665da82219c641c416bb5d38660bb4d
|
7
|
+
data.tar.gz: ae61e5ab73e4c5bff8676467a0d4512ad94adb04747306f8fce81e3cda653a3dc7d68358be4f445bab44b8254f2c6111e2c57618eb4708b561db830f6a5e6993
|
data/bin/console
CHANGED
@@ -3,12 +3,5 @@
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "pomme"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
6
|
+
require "pry"
|
7
|
+
Pry.start
|
data/exe/pomme
ADDED
data/lib/pomme/cli.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
module Pomme
|
2
|
+
class Cli < Thor
|
3
|
+
desc "start [TASK]", "Start a task with a name."
|
4
|
+
def start(task)
|
5
|
+
dump = Marshal.dump({ start: Time.now, name: task })
|
6
|
+
File.open(pomme_path, 'w') do |f|
|
7
|
+
f.write(dump)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "status", "Print the current pomme status."
|
12
|
+
def status
|
13
|
+
print_status(load_task)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "poll", "Print the status every second."
|
17
|
+
def poll
|
18
|
+
loop do
|
19
|
+
task = load_task
|
20
|
+
30.times do
|
21
|
+
print_status(task)
|
22
|
+
sleep 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def twenty_five_minutes
|
30
|
+
25 * 60
|
31
|
+
end
|
32
|
+
|
33
|
+
def pomme_path
|
34
|
+
File.expand_path("~/.pomme")
|
35
|
+
end
|
36
|
+
|
37
|
+
def load_task
|
38
|
+
Marshal.load(File.read(pomme_path))
|
39
|
+
end
|
40
|
+
|
41
|
+
def print_status(task)
|
42
|
+
seconds_since_start = (Time.now - task[:start]).to_i
|
43
|
+
if seconds_since_start < twenty_five_minutes
|
44
|
+
percentage = ((seconds_since_start / twenty_five_minutes.to_f) * 100).to_i
|
45
|
+
puts "#{task[:name]} (#{percentage}%)"
|
46
|
+
else
|
47
|
+
seconds_breaking = seconds_since_start - twenty_five_minutes
|
48
|
+
puts "Break: #{Time.at(seconds_breaking).utc.strftime("%H:%M:%S")}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/pomme/version.rb
CHANGED
data/lib/pomme.rb
CHANGED
data/pomme.gemspec
CHANGED
@@ -21,4 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.12"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency "minitest", "~> 5.0"
|
24
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
25
|
+
|
26
|
+
spec.add_dependency "thor", "~> 0.19.1"
|
24
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pomme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Norman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,10 +52,39 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.19.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.19.1
|
55
83
|
description: '"Pomme" is French for "pomodoro" which means "potato."'
|
56
84
|
email:
|
57
85
|
- jared@creepywizard.com
|
58
|
-
executables:
|
86
|
+
executables:
|
87
|
+
- pomme
|
59
88
|
extensions: []
|
60
89
|
extra_rdoc_files: []
|
61
90
|
files:
|
@@ -67,7 +96,9 @@ files:
|
|
67
96
|
- Rakefile
|
68
97
|
- bin/console
|
69
98
|
- bin/setup
|
99
|
+
- exe/pomme
|
70
100
|
- lib/pomme.rb
|
101
|
+
- lib/pomme/cli.rb
|
71
102
|
- lib/pomme/version.rb
|
72
103
|
- pomme.gemspec
|
73
104
|
homepage: https://github.com/jarednorman/pomme
|