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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2f468420a7097015fb3383c9fd3144565eb00f1
4
- data.tar.gz: 7c9061347830c278a65f70f2bd5058b654cac6b5
3
+ metadata.gz: 0ad1b7292ec90b2e5a379b83b2dc4861567fa18c
4
+ data.tar.gz: 9fb9e8873bc1438bffaf0a57bbdd5528e2289264
5
5
  SHA512:
6
- metadata.gz: a05787513159329f5ca7ef614260c9a6a162c4353f44ac935701faa253ebdb4b9b91645e2a4943ac4898e899ccac99fc971cbcc989e0cd87274958af860285ee
7
- data.tar.gz: 8bcf99a0b5cdf47058a2cda474c2871666a1375099c6f9f0c824e5fddff078e34c19ff2987e22f34a09004e2849e763b7d42e44416b3348f58008b1622afdbeb
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
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
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
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pomme'
4
+
5
+ Pomme::Cli.start(ARGV)
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
@@ -1,3 +1,3 @@
1
1
  module Pomme
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/pomme.rb CHANGED
@@ -1,5 +1,7 @@
1
- require "pomme/version"
1
+ require 'thor'
2
+
3
+ require 'pomme/version'
4
+ require 'pomme/cli'
2
5
 
3
6
  module Pomme
4
- # Your code goes here...
5
7
  end
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: 0.1.0
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-07 00:00:00.000000000 Z
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