tempo-cli 0.2.6 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +64 -39
  3. data/README.md +16 -7
  4. data/Rakefile +3 -3
  5. data/bin/tempo +28 -0
  6. data/features/step_definitions/tempo_steps.rb +14 -14
  7. data/features/support/env.rb +1 -1
  8. data/lib/file_record/directory.rb +104 -1
  9. data/lib/file_record/file_utility.rb +50 -8
  10. data/lib/file_record/record.rb +11 -10
  11. data/lib/tempo/controllers/end_controller.rb +1 -1
  12. data/lib/tempo/controllers/projects_controller.rb +1 -1
  13. data/lib/tempo/controllers/records_controller.rb +56 -4
  14. data/lib/tempo/controllers/report_controller.rb +1 -1
  15. data/lib/tempo/controllers/start_controller.rb +2 -2
  16. data/lib/tempo/exceptions.rb +11 -0
  17. data/lib/tempo/models/log.rb +20 -3
  18. data/lib/tempo/models/time_record.rb +7 -1
  19. data/lib/tempo/version.rb +1 -1
  20. data/lib/tempo/views/base.rb +3 -3
  21. data/lib/tempo/views/formatters/interactive.rb +44 -0
  22. data/lib/tempo/views/formatters/screen.rb +9 -10
  23. data/lib/tempo/views/interactive.rb +32 -0
  24. data/lib/tempo/views/reporter.rb +15 -0
  25. data/lib/tempo/views/view_records/base.rb +24 -0
  26. data/lib/tempo/views/view_records/time_record.rb +1 -1
  27. data/tempo-cli.gemspec +6 -8
  28. data/test/lib/file_record/directory_test.rb +17 -14
  29. data/test/lib/file_record/record_test.rb +11 -8
  30. data/test/lib/tempo/models/base_test.rb +3 -3
  31. data/test/lib/tempo/models/composite_test.rb +2 -2
  32. data/test/lib/tempo/models/log_test.rb +17 -7
  33. data/test/lib/tempo/models/project_test.rb +1 -1
  34. data/test/lib/tempo/models/time_record_test.rb +4 -4
  35. data/test/lib/tempo/views/formatters/console_test.rb +32 -0
  36. data/test/lib/tempo/views/reporter_test.rb +7 -1
  37. data/test/support/factories.rb +9 -17
  38. metadata +25 -31
@@ -6,11 +6,11 @@ describe Tempo do
6
6
  before do
7
7
  # See Rakefile for directory prep and cleanup
8
8
  @dir = File.join( Dir.home,"tempo" )
9
- Dir.mkdir(@dir, 0700) unless File.exists?(@dir)
9
+ Dir.mkdir(@dir, 0700) unless File.exist?(@dir)
10
10
  end
11
11
 
12
12
  after do
13
- FileUtils.rm_r(@dir) if File.exists?(@dir)
13
+ FileUtils.rm_r(@dir) if File.exist?(@dir)
14
14
  end
15
15
 
16
16
  describe "Model::TimeRecord" do
@@ -275,8 +275,8 @@ describe Tempo do
275
275
  it "saves to file a collection of projects" do
276
276
  time_record_factory
277
277
  Tempo::Model::TimeRecord.save_to_file
278
- test_file_1 = File.join(ENV['HOME'],'tempo/tempo_time_records/20140101.yaml')
279
- test_file_2 = File.join(ENV['HOME'],'tempo/tempo_time_records/20140102.yaml')
278
+ test_file_1 = File.join(ENV['HOME'],'tempo/tempo_time_records/2014/20140101.yaml')
279
+ test_file_2 = File.join(ENV['HOME'],'tempo/tempo_time_records/2014/20140102.yaml')
280
280
  contents = eval_file_as_array( test_file_1 )
281
281
 
282
282
  # testing with regex because time zone will be different on different computers,
@@ -0,0 +1,32 @@
1
+ require "test_helper"
2
+
3
+ describe Tempo do
4
+ describe "Views" do
5
+ describe "Formatters" do
6
+ describe "Console" do
7
+
8
+ before do
9
+ view_records_factory
10
+ end
11
+
12
+ describe "Message View Records" do
13
+
14
+ it "outputs the message" do
15
+ record = @progress_message
16
+ formatter = Tempo::Views::Formatters::Interactive.new
17
+ out = capture_stdout { formatter.report record }
18
+
19
+ assert_equal "Making progress...\n", out.string
20
+ end
21
+ end
22
+
23
+ describe "Interactive View Records" do
24
+
25
+ it "outputs the interaction with a prompt" do
26
+ # pending
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -22,6 +22,12 @@ describe Tempo do
22
22
  proc { Tempo::Views::Reporter.add_view_record record }.must_raise Tempo::InvalidViewRecordError
23
23
  end
24
24
 
25
+ it "sends the reports immediately to the console formatter" do
26
+ Tempo::Views::Reporter.clear_records
27
+ out = capture_stdout { Tempo::Views::ViewRecords::Message.new "an immediate message to report", category: :immediate }
28
+ assert_equal "an immediate message to report\n", out.string
29
+ end
30
+
25
31
  it "sends the reports to the screen formatter on report" do
26
32
  Tempo::Views::Reporter.clear_records
27
33
  record_1 = Tempo::Views::ViewRecords::Message.new "a message to report"
@@ -37,4 +43,4 @@ describe Tempo do
37
43
  end
38
44
  end
39
45
  end
40
- end
46
+ end
@@ -27,16 +27,6 @@ module Tempo
27
27
  end
28
28
  end
29
29
 
30
- class Log
31
- def self.clear_all()
32
- @ids = {}
33
- @index = []
34
- @days_index = {}
35
- @id_counter = {}
36
- @current = nil
37
- end
38
- end
39
-
40
30
  class MessageLog < Tempo::Model::Log
41
31
  attr_accessor :message
42
32
 
@@ -109,7 +99,7 @@ def log_factory
109
99
 
110
100
  # delete all records so they aren't loaded when new logs are created
111
101
  test_dir = File.join(ENV['HOME'],'tempo','tempo_message_logs')
112
- FileUtils.rm_r test_dir if File.exists?(test_dir)
102
+ FileUtils.rm_r test_dir if File.exist?(test_dir)
113
103
 
114
104
  Tempo::Model::MessageLog.clear_all
115
105
  @log_1 = Tempo::Model::MessageLog.new({ message: "day 1 pet the sheep", start_time: Time.new(2014, 1, 1, 7 ) })
@@ -133,10 +123,10 @@ end
133
123
  # For creating a file to load records from
134
124
  def log_record_factory
135
125
  Tempo::Model::MessageLog.clear_all
136
- test_dir = File.join(ENV['HOME'],'tempo','tempo_message_logs')
126
+ test_dir = File.join(ENV['HOME'],'tempo','tempo_message_logs','2014')
137
127
 
138
- FileUtils.rm_r test_dir if File.exists?(test_dir)
139
- Dir.mkdir(test_dir, 0700) unless File.exists?(test_dir)
128
+ FileUtils.rm_r test_dir if File.exist?(test_dir)
129
+ FileUtils.mkdir_p(test_dir) unless File.exist?(test_dir)
140
130
  file_lines = ["---", ":start_time: 2014-01-01 07:15:00.000000000 -05:00",
141
131
  ":id: 1", ":message: day 1 pet the sheep",
142
132
  "---", ":start_time: 2014-01-01 07:45:00.000000000 -05:00",
@@ -170,13 +160,15 @@ end
170
160
 
171
161
  def view_records_factory
172
162
  time_record_factory
173
- @message_1 = Tempo::Views::ViewRecords::Message.new "All The Things I Did", class: :title
174
- @message_2 = Tempo::Views::ViewRecords::Message.new "on a busy busy day", class: :title
163
+ @message_1 = Tempo::Views::ViewRecords::Message.new "All The Things I Did"#, class: :title
164
+ @message_2 = Tempo::Views::ViewRecords::Message.new "on a busy busy day"#, class: :title
175
165
  @error = Tempo::Views::ViewRecords::Message.new "raising an error", category: :error
176
166
  @duration = Tempo::Views::ViewRecords::Duration.new 9600 # 2 hours and 40 minutes
177
167
  @project_1 = Tempo::Views::ViewRecords::Project.new @project_1
178
168
  @project_2 = Tempo::Views::ViewRecords::Project.new @project_2
179
169
  @time_record_1 = Tempo::Views::ViewRecords::TimeRecord.new @record_1
180
170
  @time_record_6 = Tempo::Views::ViewRecords::TimeRecord.new @record_6
181
- #@records = [@message, @project, @time_record]
171
+ @progress_message = Tempo::Views::ViewRecords::Message.new "Making progress", category: :progress
172
+ # change to interaction:
173
+ @interaction = Tempo::Views::ViewRecords::Message.new "Making progress", category: :progress
182
174
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tempo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gabel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-11 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -24,90 +24,82 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '10.3'
27
- - !ruby/object:Gem::Dependency
28
- name: rdoc
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '4.1'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '4.1'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: aruba
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '0.5'
33
+ version: '2.2'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '0.5'
40
+ version: '2.2'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: turn
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '0.9'
47
+ version: 0.9.7
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '0.9'
54
+ version: 0.9.7
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: pry
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '0.9'
61
+ version: 0.14.2
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '0.9'
68
+ version: 0.14.2
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: gli
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '2.10'
75
+ version: '2.21'
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 2.21.1
90
79
  type: :runtime
91
80
  prerelease: false
92
81
  version_requirements: !ruby/object:Gem::Requirement
93
82
  requirements:
94
83
  - - "~>"
95
84
  - !ruby/object:Gem::Version
96
- version: '2.10'
85
+ version: '2.21'
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 2.21.1
97
89
  - !ruby/object:Gem::Dependency
98
90
  name: chronic
99
91
  requirement: !ruby/object:Gem::Requirement
100
92
  requirements:
101
93
  - - "~>"
102
94
  - !ruby/object:Gem::Version
103
- version: '0.10'
95
+ version: 0.10.2
104
96
  type: :runtime
105
97
  prerelease: false
106
98
  version_requirements: !ruby/object:Gem::Requirement
107
99
  requirements:
108
100
  - - "~>"
109
101
  - !ruby/object:Gem::Version
110
- version: '0.10'
102
+ version: 0.10.2
111
103
  description: tempo-cli is a command line time tracking application. Record time spent
112
104
  on projects in YAML files, and manage them from the command line.
113
105
  email: hello@jonathangabel.com
@@ -158,7 +150,9 @@ files:
158
150
  - lib/tempo/views/arrange_view.rb
159
151
  - lib/tempo/views/base.rb
160
152
  - lib/tempo/views/formatters/base.rb
153
+ - lib/tempo/views/formatters/interactive.rb
161
154
  - lib/tempo/views/formatters/screen.rb
155
+ - lib/tempo/views/interactive.rb
162
156
  - lib/tempo/views/projects_view.rb
163
157
  - lib/tempo/views/report_view.rb
164
158
  - lib/tempo/views/reporter.rb
@@ -183,6 +177,7 @@ files:
183
177
  - test/lib/tempo/models/time_record_test.rb
184
178
  - test/lib/tempo/views/base_test.rb
185
179
  - test/lib/tempo/views/formatters/base_test.rb
180
+ - test/lib/tempo/views/formatters/console_test.rb
186
181
  - test/lib/tempo/views/formatters/screen_test.rb
187
182
  - test/lib/tempo/views/reporter_test.rb
188
183
  - test/lib/tempo/views/view_records/base_test.rb
@@ -199,7 +194,7 @@ homepage: https://github.com/josankapo/tempo-cli
199
194
  licenses:
200
195
  - MIT
201
196
  metadata: {}
202
- post_install_message:
197
+ post_install_message:
203
198
  rdoc_options: []
204
199
  require_paths:
205
200
  - lib
@@ -215,9 +210,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
210
  - !ruby/object:Gem::Version
216
211
  version: '0'
217
212
  requirements: []
218
- rubyforge_project:
219
- rubygems_version: 2.2.2
220
- signing_key:
213
+ rubygems_version: 3.3.7
214
+ signing_key:
221
215
  specification_version: 4
222
216
  summary: A command line time tracker for recording by day and by project
223
217
  test_files: []