termodoro 0.2.6 → 0.3.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: 7682de14275ca02cf30abbe59667d3da687c0efe
4
- data.tar.gz: a70da49bae67f5e40bbf256d7037b47350e5d85e
3
+ metadata.gz: f1b179dbc003a27c93f537e8a32f92319bc3e936
4
+ data.tar.gz: 849572b7195a5c66f6ead2cdd10ad4ed729cd1b3
5
5
  SHA512:
6
- metadata.gz: c4008f442898bffc655229d1f949d148ea4dcf0ccce288925c89925e0413d27fe4e30a4b4c115bd38dc40445f93028d77b36fcb7e4a5c171b88ed492dbc6d199
7
- data.tar.gz: d83df704e3cd2fc09b335c16d69afbae37734392c96dbe91a7472298e0f39dae87defd28d878db263ea61e282b093ab5db2c649e3f5fbef313ca58c3eda9191d
6
+ metadata.gz: 3247afeda64d043008398073db375b3485618826ecc8d88594e02a1e3309e64bcf00ce1b9a66835d0f958fc30d01f8770896e5a816936ce543c30f8cb4482e74
7
+ data.tar.gz: 5b8014bdcb94f277f4a7facece051e3582b35e8931db0a1a95b7c1c478fa5690f4e73faabe1e57ff158a2e62f541856dc8b54de6a9e8de42d9d2da43d9335a0b
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ### 0.3.0 (10/30/2013)
2
+
3
+ - Now with tests! - [@vcavallo](http://github.com/vcavallo)
4
+
1
5
  ### 0.2.6 (10/29/2013)
2
6
 
3
- - Fully-document using YARD. Updated variable names (`time_part` --> `time_unit`, `number_part` --> `number_of_units`). Minor readme updates.
7
+ - Fully-document using YARD. Updated variable names (`time_part` --> `time_unit`, `number_part` --> `number_of_units`). Minor readme updates. - [@vcavallo](http://github.com/vcavallo)
4
8
 
5
9
  ### 0.2.5 (10/29/2013)
6
10
 
@@ -1,5 +1,4 @@
1
1
 
2
-
3
2
  # A new instance of this class takes user-input as command line arguments and
4
3
  # prepares a string to be execute as a Bash system command. The user specifies an
5
4
  # amount of time and an optional message to display. After the amount of time elapses
@@ -7,6 +6,7 @@
7
6
  # the word "Termodoro" appears instead.
8
7
  class Termodoro
9
8
  attr_accessor :time_unit, :number_of_units, :message
9
+ attr_reader :arguments
10
10
  # @!attribute time_unit
11
11
  # @return [String] the unit of time specified by the user.
12
12
  # @!attribute number_of_units
@@ -101,9 +101,9 @@ class Termodoro
101
101
  # PENDING - will eventually be used to ensure user input is safe to run as terminal
102
102
  # command. (i.e. remove special punctuation and the like).
103
103
  # @return [String] sanitized message.
104
- def clean_message
105
- parse_message
106
- end
104
+ # def clean_message
105
+ # parse_message
106
+ # end
107
107
 
108
108
  # Workhorse method: Runs #calculate_time and #parse_message, taking the results
109
109
  # of those methods and creating the string to execute.
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013 Vinney Cavallo
3
+ Copyright (c) 2013 Vinney Cavallo and Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
21
+ THE SOFTWARE.
data/spec/spec_helper.rb CHANGED
@@ -14,5 +14,5 @@ RSpec.configure do |config|
14
14
  # order dependency and want to debug it, you can fix the order by providing
15
15
  # the seed, which is printed after each run.
16
16
  # --seed 1234
17
- config.order = 'random'
17
+ # config.order = 'random'
18
18
  end
@@ -1,15 +1,98 @@
1
1
  require_relative 'spec_helper'
2
2
 
3
3
  describe "Termodoro" do
4
- it "takes a well-formed time and message string" do
5
- arg = "10 seconds do something"
6
- term = Termodoro.new(arg)
7
- term.command.should be_an_instance_of(String)
4
+ let(:input) {"10 minutes show this message"}
5
+ let(:term) {Termodoro.new(input)}
6
+
7
+ it "can be initialized" do
8
+ expect(Termodoro.new("test")).to be_an_instance_of(Termodoro)
9
+ end
10
+
11
+ it "can accept user input" do
12
+ expect(term.arguments).to eq(input)
13
+ end
14
+
15
+ it "ends up with a well-formed string to be issued as a system command" do
16
+ expect(term.command).to be_an_instance_of(String)
17
+ end
18
+
19
+ describe "Constants" do
20
+ it "has a constant that represents number of seconds in a minute" do
21
+ expect(Termodoro::SECS_IN_MIN / 60).to eq(1)
22
+ end
23
+
24
+ it "has a constant that represents number of seconds in an hour" do
25
+ expect(Termodoro::SECS_IN_HOUR / 3600).to eq(1)
26
+ end
27
+ end
28
+
29
+ describe "Methods on user input" do
30
+
31
+ it "can parse and retreive the decimal provided" do
32
+ expect(term.parse_number_of_units).to eq(10)
33
+ end
34
+
35
+ it "can parse and retreive the unti of time provided" do
36
+ expect(term.parse_time_unit).to eq("minutes")
37
+ end
38
+
39
+ it "can parse and retreive the message provided" do
40
+ expect(term.parse_message).to eq("show this message")
41
+ end
42
+
43
+ it "allows the message to be optional" do
44
+ no_message_arg = "10 seconds"
45
+ term_alt = Termodoro.new(no_message_arg)
46
+ expect(term_alt.command).to be_an_instance_of(String)
47
+ end
48
+
49
+ describe "Flexibility on wording of unit of time" do
50
+ it "will accept partial matches of 'seconds' (i.e. s sec secs second seconds)" do
51
+ weird_seconds = "10 s"
52
+ term_alt = Termodoro.new(weird_seconds)
53
+ expect(term_alt.calculate_time).to eq(10)
54
+ end
55
+
56
+ it "will accept partial matches of 'minutes' (i.e. m min mins minute minutes)" do
57
+ weird_minutes = "10 min"
58
+ term_alt = Termodoro.new(weird_minutes)
59
+ expect(term_alt.calculate_time).to eq(600)
60
+ end
61
+
62
+ it "will accept partial matches of 'hours' (i.e. h hr hrs hour hours)" do
63
+ weird_hours = "1 hr"
64
+ term_alt = Termodoro.new(weird_hours)
65
+ expect(term_alt.calculate_time).to eq(3600)
66
+ end
67
+
68
+ it "allows user to smush time unit directly onto decimal without a space (i.e. 10secs, 5minute, etc.)" do
69
+ spaceless_seconds = "10secs"
70
+ term_alt = Termodoro.new(spaceless_seconds)
71
+ expect(term_alt.calculate_time).to eq(10)
72
+ end
73
+
74
+ end
8
75
  end
9
76
 
10
- it "allows the message to be optional" do
11
- arg = "10 seconds"
12
- term = Termodoro.new(arg)
13
- term.command.should be_an_instance_of(String)
77
+ describe "Internal logic" do
78
+ it "can calculate the time given a unit of time" do
79
+ minute_message = "5 minutes"
80
+ term_alt = Termodoro.new(minute_message)
81
+ expect(term_alt.calculate_time).to eq(300)
82
+ end
83
+
84
+ it "can santize the message" do
85
+ pending "This feature needs to be built. Sort of important."
86
+ end
87
+
88
+ end
89
+
90
+ describe "Command line behavior and other shell support" do
91
+ it "Coming soon..." do
92
+ pending "This needs to be built and explored"
93
+ end
14
94
  end
95
+
15
96
  end
97
+
98
+
data/termodoro.gemspec CHANGED
@@ -1,7 +1,8 @@
1
+
1
2
  Gem::Specification.new do |s|
2
3
  s.name = 'termodoro'
3
- s.version = '0.2.6'
4
- s.date = '2013-10-24'
4
+ s.version = '0.3.0'
5
+ s.date = '2013-10-30'
5
6
  s.summary = "A lightweight CL reminder app"
6
7
  s.description = "Use this little utility to set simple reminders from the command line. See the github page below for more information"
7
8
  s.authors = ["Vinney Cavallo"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: termodoro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinney Cavallo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-24 00:00:00.000000000 Z
11
+ date: 2013-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: terminal-notifier