wlog 1.0.5 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +24 -2
- data/bin/wlog +0 -1
- data/lib/wlog/domain/helpers.rb +1 -0
- data/lib/wlog/domain/invoice.rb +9 -0
- data/lib/wlog/domain/issue.rb +28 -10
- data/lib/wlog/domain/sql_modules/issue_sql.rb +3 -2
- data/lib/wlog/domain/sys_config.rb +12 -3
- data/lib/wlog/sql/seq/3.sql +3 -0
- data/lib/wlog/ui/cli_interface.rb +80 -32
- data/lib/wlog/ui/commands/create_issue.rb +2 -0
- data/lib/wlog/ui/configuration_ui.rb +63 -0
- data/lib/wlog/ui/issue_ui.rb +79 -14
- data/lib/wlog/version.rb +1 -1
- data/spec/domain/issue_spec.rb +8 -1
- data/wlog.gemspec +1 -0
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 881927105d2ad4db3a54716d36003cd94e2ce6fc
|
4
|
+
data.tar.gz: 9b5f72a05d2924b8bfb3c0c669502abfc3bb0f98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c12ef90cef5b096c659415f4cb250a0953e3b345a94886fcf9a20db0b790a03ad745906bc796d61650005613e5e96592f187076a4b7c2a4136e8caf72601b6e
|
7
|
+
data.tar.gz: 37da1bc3b3da242d01ddc7caaa506b8b782d0a950d4e086f397056c259327eb8bc29dc65f63b856889ee444540a78e9b71ff246106eb6726b56ad57c1265db38
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# wlog [](https://codeclimate.com/github/psyomn/wlog)
|
1
|
+
# wlog [](https://codeclimate.com/github/psyomn/wlog) [](https://travis-ci.org/psyomn/wlog)
|
2
2
|
|
3
3
|
wlog (worklog) is a small utility to track tasks in command line. I use this
|
4
4
|
for things I work on and need to submit a list of stuff done on a particular
|
@@ -132,6 +132,7 @@ If you forgot what you are doing, you can do
|
|
132
132
|
- Time : 3h
|
133
133
|
|
134
134
|
- Whatever description you wrote for issue 1
|
135
|
+
- And here there exists an even larger description of the issue
|
135
136
|
|
136
137
|
You can also attach files to issues
|
137
138
|
|
@@ -156,7 +157,9 @@ And then you can output them to a location:
|
|
156
157
|
Which attachment to output? : 1
|
157
158
|
Output where (abs dir) : /tmp/
|
158
159
|
|
159
|
-
|
160
|
+
## Inside issues
|
161
|
+
|
162
|
+
You can run these commands in this 'sub-shell' of the issues:
|
160
163
|
are `show`, `search`, `replace`, `delete`, and `concat`.
|
161
164
|
|
162
165
|
`show` lists the latest work log entries.
|
@@ -169,6 +172,25 @@ are `show`, `search`, `replace`, `delete`, and `concat`.
|
|
169
172
|
|
170
173
|
`concat` appends a string to the specified log entry.
|
171
174
|
|
175
|
+
All of these will modify the entries of those issues.
|
176
|
+
|
177
|
+
## Logging Time
|
178
|
+
|
179
|
+
It's possible to log time now with the following commands:
|
180
|
+
|
181
|
+
lt 10m
|
182
|
+
|
183
|
+
To log 10 minutes
|
184
|
+
|
185
|
+
lt 1h20m
|
186
|
+
|
187
|
+
To log 1 hour 20 minutes
|
188
|
+
|
189
|
+
lt 1d 1s
|
190
|
+
|
191
|
+
To log one day, one second. (A day is 8 hours). The total time is stored on the
|
192
|
+
issue.
|
193
|
+
|
172
194
|
## Contributing
|
173
195
|
|
174
196
|
1. Fork it
|
data/bin/wlog
CHANGED
data/lib/wlog/domain/helpers.rb
CHANGED
@@ -10,6 +10,7 @@ class Helpers
|
|
10
10
|
# @param string is the string that we want processed.
|
11
11
|
# @param numchars is the amount of characters max per line.
|
12
12
|
def self.break_string(string,numchars)
|
13
|
+
return unless string
|
13
14
|
desc , cl = "", 0
|
14
15
|
string.split.each do |word|
|
15
16
|
wlength = word.length
|
data/lib/wlog/domain/issue.rb
CHANGED
@@ -2,6 +2,8 @@ require 'wlog/db_registry'
|
|
2
2
|
require 'wlog/domain/sql_modules/issue_sql'
|
3
3
|
require 'wlog/domain/log_entry'
|
4
4
|
require 'wlog/domain/timelog_helper'
|
5
|
+
require 'wlog/domain/sys_config'
|
6
|
+
require 'wlog/domain/helpers'
|
5
7
|
|
6
8
|
module Wlog
|
7
9
|
# This aggregates log entries. The total time spent on this issue is
|
@@ -15,6 +17,13 @@ class Issue
|
|
15
17
|
@log_entries = Array.new
|
16
18
|
@status = @seconds = 0
|
17
19
|
@db = db_handle
|
20
|
+
@strmaker = SysConfig.string_decorator
|
21
|
+
end
|
22
|
+
|
23
|
+
# Calculate the total time that someone has wasted on all the
|
24
|
+
# issues in the current database
|
25
|
+
def self.total_time
|
26
|
+
# issues = Issue.find_all
|
18
27
|
end
|
19
28
|
|
20
29
|
def self.find(db, id)
|
@@ -50,7 +59,7 @@ class Issue
|
|
50
59
|
def insert
|
51
60
|
unless @id
|
52
61
|
@db.execute(InsertSql, @description,
|
53
|
-
@reported_date.to_i, @due_date.to_i, @status)
|
62
|
+
@reported_date.to_i, @due_date.to_i, @status, @long_description)
|
54
63
|
@id = @db.last_row_from(TableName).first[0]
|
55
64
|
end
|
56
65
|
end
|
@@ -69,8 +78,10 @@ class Issue
|
|
69
78
|
end
|
70
79
|
|
71
80
|
def quick_assign!(row)
|
72
|
-
@id, @description, @reported_date, @due_date, @status, @seconds
|
73
|
-
|
81
|
+
@id, @description, @reported_date, @due_date, @status, @seconds,
|
82
|
+
@long_description =\
|
83
|
+
row[0], row[1], Time.at(row[2]), Time.at(row[3]), row[4],
|
84
|
+
row[5] || 0, row[6]
|
74
85
|
nil end
|
75
86
|
|
76
87
|
# Log the seconds into the issue
|
@@ -80,14 +91,17 @@ class Issue
|
|
80
91
|
end
|
81
92
|
|
82
93
|
def to_s
|
83
|
-
"
|
84
|
-
"
|
85
|
-
"
|
86
|
-
"
|
87
|
-
"
|
88
|
-
"
|
94
|
+
"#{@strmaker.yellow('Issue')} ##{@id}#{$/}"\
|
95
|
+
" #{@strmaker.blue('Reported')} : #{@reported_date.asctime}#{$/}"\
|
96
|
+
" #{@strmaker.blue('Due')} : #{@due_date.asctime}#{$/}"\
|
97
|
+
" #{@strmaker.blue('Entries')} : #{@log_entries.count}#{$/}"\
|
98
|
+
" #{@strmaker.blue('Status')} : #{Statuses[@status]}#{$/}"\
|
99
|
+
" #{@strmaker.blue('Time')} : #{TimelogHelper.time_to_s(@seconds)}#{$/}"\
|
89
100
|
"#{$/}"\
|
90
|
-
|
101
|
+
"#{@strmaker.yellow('Summary')} #{$/}"\
|
102
|
+
" #{@description}#{$/ + $/}"\
|
103
|
+
"#{@strmaker.yellow('Description')} #{$/}"\
|
104
|
+
" #{Helpers.break_string(@long_description, 80)}#{$/ + $/}"
|
91
105
|
end
|
92
106
|
|
93
107
|
# Mark issue as started
|
@@ -108,6 +122,10 @@ class Issue
|
|
108
122
|
# [String] Description of the issue at hand
|
109
123
|
attr_accessor :description
|
110
124
|
|
125
|
+
# A longer description that can provide more details as opposed to a simple
|
126
|
+
# title as suggested by @description.
|
127
|
+
attr_accessor :long_description
|
128
|
+
|
111
129
|
# [Time] The due date of the issue
|
112
130
|
attr_accessor :due_date
|
113
131
|
|
@@ -8,8 +8,9 @@ module IssueSql
|
|
8
8
|
# Standard insert
|
9
9
|
InsertSql = \
|
10
10
|
"INSERT INTO #{TableName} "\
|
11
|
-
"(description, reported_date, due_date, status, timelog
|
12
|
-
"
|
11
|
+
"(description, reported_date, due_date, status, timelog,"\
|
12
|
+
"long_description) "\
|
13
|
+
"values (?,?,?,?,0,?);"
|
13
14
|
# Standard delete
|
14
15
|
DeleteSql = "DELETE FROM #{TableName} WHERE id = ? ;"
|
15
16
|
|
@@ -23,14 +23,17 @@ class SysConfig
|
|
23
23
|
@key_value.put!('last_focus', "#{issue}")
|
24
24
|
end
|
25
25
|
|
26
|
+
# Are the settings set to ansi?
|
26
27
|
def self.ansi?
|
27
28
|
self.read_attributes['ansi'] == 'yes'
|
28
29
|
end
|
29
30
|
|
31
|
+
# Oh no! The settings are not ansi!
|
30
32
|
def self.not_ansi!
|
31
33
|
self.store_config('ansi', 'no')
|
32
34
|
end
|
33
35
|
|
36
|
+
# SET THE SETTINGS TO ANSI!
|
34
37
|
def self.ansi!
|
35
38
|
self.store_config('ansi', 'yes')
|
36
39
|
end
|
@@ -58,8 +61,6 @@ class SysConfig
|
|
58
61
|
|
59
62
|
attr_accessor :db
|
60
63
|
|
61
|
-
private
|
62
|
-
|
63
64
|
# terms is a hash -> {:a => :b, :c => :d}
|
64
65
|
# write each key value to a file like this:
|
65
66
|
# a:b
|
@@ -71,6 +72,8 @@ private
|
|
71
72
|
fh = File.open(ConfigFile, 'w')
|
72
73
|
fh.write(str)
|
73
74
|
fh.close
|
75
|
+
rescue Errno::ENOENT
|
76
|
+
$stderr.puts "#{self.class.name}: Problem opening file #{ConfigFile}"
|
74
77
|
end
|
75
78
|
|
76
79
|
# Load a hash from a text file.
|
@@ -84,8 +87,14 @@ private
|
|
84
87
|
terms.each do |term_tuple| # [term, value]
|
85
88
|
values[term_tuple[0]] = term_tuple[1]
|
86
89
|
end
|
87
|
-
|
90
|
+
values
|
91
|
+
rescue Errno::ENOENT
|
92
|
+
$stderr.puts "#{self.class.name}: Problem opening file #{ConfigFile}"
|
93
|
+
# Minimum guarantee: disable ansi colors
|
94
|
+
{'ansi' => 'no'}
|
95
|
+
end
|
88
96
|
|
97
|
+
# Key value domain object / helper
|
89
98
|
attr :key_value
|
90
99
|
|
91
100
|
end
|
@@ -5,7 +5,9 @@ require 'wlog/domain/static_configurations'
|
|
5
5
|
require 'wlog/domain/sys_config'
|
6
6
|
require 'wlog/domain/attachment'
|
7
7
|
require 'wlog/domain/helpers'
|
8
|
+
|
8
9
|
require 'wlog/ui/commands/create_issue'
|
10
|
+
require 'wlog/ui/configuration_ui'
|
9
11
|
|
10
12
|
require 'wlog/commands/archive_issues'
|
11
13
|
require 'wlog/commands/archive_finished_issues'
|
@@ -35,18 +37,19 @@ class CliInterface
|
|
35
37
|
cmd.chomp!
|
36
38
|
|
37
39
|
case cmd
|
38
|
-
when
|
39
|
-
when
|
40
|
-
when
|
41
|
-
when
|
42
|
-
when
|
43
|
-
when
|
44
|
-
when
|
45
|
-
when
|
46
|
-
when
|
47
|
-
when
|
48
|
-
when
|
49
|
-
when
|
40
|
+
when /^archive/ then archive cmd
|
41
|
+
when /^showattach/ then show_attach
|
42
|
+
when /^outattach/ then output_attach
|
43
|
+
when /^generateinvoice/ then generate_invoice
|
44
|
+
when /^attach/ then attach
|
45
|
+
when /^focus/ then focus(cmd)
|
46
|
+
when /^new/ then new_issue
|
47
|
+
when /^(ls|show)/ then show_issues
|
48
|
+
when /^outcsv/ then outcsv
|
49
|
+
when /^delete/ then delete_issue(cmd)
|
50
|
+
when /^help/ then print_help
|
51
|
+
when /^search/ then search
|
52
|
+
when /^config/ then config
|
50
53
|
end
|
51
54
|
end
|
52
55
|
end
|
@@ -65,10 +68,26 @@ private
|
|
65
68
|
def new_issue; CreateIssue.new(@db).execute end
|
66
69
|
|
67
70
|
# Procedure to delete an issue
|
68
|
-
def delete_issue
|
69
|
-
issue_id =
|
71
|
+
def delete_issue(cmd)
|
72
|
+
issue_id = cmd.split[1]
|
73
|
+
|
74
|
+
if !issue_id
|
75
|
+
puts 'usage:'
|
76
|
+
puts ' delete <id>'
|
77
|
+
else
|
78
|
+
issue_id = issue_id.to_i
|
79
|
+
end
|
80
|
+
|
70
81
|
dcmd = DeleteIssue.new(@db, issue_id)
|
71
|
-
|
82
|
+
if dcmd
|
83
|
+
choice = Readline.readline("Delete issue #{issue_id}? [y/n]").strip
|
84
|
+
if choice == "y"
|
85
|
+
dcmd.execute
|
86
|
+
else
|
87
|
+
puts "Did nothing"
|
88
|
+
return
|
89
|
+
end
|
90
|
+
end
|
72
91
|
puts "No such issue" unless dcmd.deleted?
|
73
92
|
end
|
74
93
|
|
@@ -129,14 +148,23 @@ private
|
|
129
148
|
att.filename = loc.split('/').last
|
130
149
|
att.given_name = name_alias
|
131
150
|
att.insert
|
132
|
-
puts
|
151
|
+
puts 'Attached file.'
|
133
152
|
else
|
134
|
-
puts
|
153
|
+
puts 'You need to provide a proper path.'
|
135
154
|
end
|
136
155
|
end
|
137
156
|
|
138
|
-
|
139
|
-
|
157
|
+
# Focus on an issue to log work etc
|
158
|
+
def focus(cmd)
|
159
|
+
issue_id = cmd.split[1]
|
160
|
+
if !issue_id
|
161
|
+
puts 'usage: '
|
162
|
+
puts ' focus <id>'
|
163
|
+
return
|
164
|
+
else
|
165
|
+
issue_id = issue_id.to_i
|
166
|
+
end
|
167
|
+
|
140
168
|
issue = Issue.find(@db, issue_id)
|
141
169
|
if issue
|
142
170
|
IssueUi.new(@db, issue).run
|
@@ -155,12 +183,22 @@ private
|
|
155
183
|
# FIXME (update the command stuff)
|
156
184
|
# Print the help of the cli app
|
157
185
|
def print_help
|
158
|
-
[
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
186
|
+
['new', 'Create a new log entry',
|
187
|
+
'outcsv', 'Export everything to CSV',
|
188
|
+
'help', 'print this dialog',
|
189
|
+
'end', 'Exit the progam',
|
190
|
+
'delete', 'Remove the issue with a given id',
|
191
|
+
'archive', 'Archive a file into a specific issue',
|
192
|
+
'showattach', 'Show what files have been attached to an issue',
|
193
|
+
'outattach', 'Extract a file from the database',
|
194
|
+
'generateinvoice', 'todo',
|
195
|
+
'focus', 'Focus on a particular ',
|
196
|
+
'show', 'List all the issues',
|
197
|
+
'help', 'Show this information',
|
198
|
+
'search', 'Search for a specific text',
|
199
|
+
'config', 'Set differeing configuration parameters'
|
200
|
+
].each_with_index do |el,ix|
|
201
|
+
print ' ' if 1 == ix % 2
|
164
202
|
puts el
|
165
203
|
end
|
166
204
|
end
|
@@ -170,19 +208,26 @@ private
|
|
170
208
|
print_list(entries_arr)
|
171
209
|
end
|
172
210
|
|
173
|
-
# TODO might need refactoring
|
174
211
|
def print_list(entries_arr)
|
175
212
|
issue_collections = entries_arr.reverse.group_by{|iss| iss.status_s}
|
176
213
|
issue_collections.each_key do |stat|
|
177
|
-
|
178
|
-
puts @strmaker.magenta(" #{issue_collections[stat].count}")
|
179
|
-
issue_collections[stat].each do |iss|
|
180
|
-
print @strmaker.red(" [#{iss.id}] ")
|
181
|
-
puts "#{iss.description}"
|
182
|
-
end
|
214
|
+
print_date_collection(stat, issue_collections)
|
183
215
|
end
|
184
216
|
end
|
185
217
|
|
218
|
+
def print_date_collection(stat, issues)
|
219
|
+
print @strmaker.green("#{stat}")
|
220
|
+
puts @strmaker.magenta(" #{issues[stat].count}")
|
221
|
+
issues[stat].each do |iss|
|
222
|
+
print_issue(iss)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
def print_issue(issue)
|
227
|
+
print @strmaker.red(" [#{issue.id}] ")
|
228
|
+
puts "#{issue.description}"
|
229
|
+
end
|
230
|
+
|
186
231
|
def make_csv
|
187
232
|
cmd = MakeCsv.new(@db)
|
188
233
|
cmd.execute
|
@@ -207,6 +252,9 @@ private
|
|
207
252
|
print_list(issues)
|
208
253
|
end
|
209
254
|
|
255
|
+
# Run the configuration Ui
|
256
|
+
def config; ConfigurationUi.new.run end
|
257
|
+
|
210
258
|
end
|
211
259
|
end # module Wlog
|
212
260
|
|
@@ -14,7 +14,9 @@ class CreateIssue < UiCommand
|
|
14
14
|
def execute
|
15
15
|
@ret = Issue.new(@db)
|
16
16
|
desc = Readline.readline("Small issue description :") || "None."
|
17
|
+
ldesc = Readline.readline("Long issue description :") || "None."
|
17
18
|
@ret.description = desc.chomp
|
19
|
+
@ret.long_description = ldesc
|
18
20
|
@ret.insert
|
19
21
|
end
|
20
22
|
attr_accessor :ret
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'readline'
|
2
|
+
require 'wlog/domain/sys_config'
|
3
|
+
|
4
|
+
module Wlog
|
5
|
+
# Ui to manage configuration settings
|
6
|
+
# @author Simon Symeonidis
|
7
|
+
class ConfigurationUi
|
8
|
+
|
9
|
+
# Default init
|
10
|
+
def initialize
|
11
|
+
@strmaker = SysConfig.string_decorator
|
12
|
+
end
|
13
|
+
|
14
|
+
# launch the ui
|
15
|
+
def run
|
16
|
+
cmd = "default"
|
17
|
+
label = @strmaker.yellow('config')
|
18
|
+
until cmd == "end" do
|
19
|
+
cmd = Readline.readline("[#{label}] ") || "end"
|
20
|
+
cmd.chomp!
|
21
|
+
|
22
|
+
case cmd
|
23
|
+
when /^show/ then show_configurations
|
24
|
+
when /^set/ then set(cmd)
|
25
|
+
when /^help/ then help
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# This should show the configurations
|
33
|
+
def show_configurations
|
34
|
+
SysConfig.read_attributes.each do |name, value|
|
35
|
+
puts "%s %s" % [@strmaker.green(name), value]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Simply, to show the possible actions on this particular Ui
|
40
|
+
def help
|
41
|
+
Commands.each_pair do |k,v|
|
42
|
+
puts k
|
43
|
+
puts " #{v}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Set a value to something else
|
48
|
+
def set(cmd)
|
49
|
+
arr = cmd.split
|
50
|
+
if arr.size != 3
|
51
|
+
puts "Wrong number of arguments"
|
52
|
+
return
|
53
|
+
end
|
54
|
+
cmd, key, value = arr
|
55
|
+
SysConfig.store_config(key, value)
|
56
|
+
end
|
57
|
+
|
58
|
+
Commands = {
|
59
|
+
'show' => 'shows the current configurations',
|
60
|
+
'set <key> <value>' => 'set the configuration pair'}
|
61
|
+
end
|
62
|
+
end # module wlog
|
63
|
+
|
data/lib/wlog/ui/issue_ui.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'date'
|
1
2
|
require 'readline'
|
2
3
|
|
3
4
|
require 'wlog/commands/replace_pattern'
|
@@ -26,18 +27,19 @@ class IssueUi
|
|
26
27
|
cmd.chomp!
|
27
28
|
|
28
29
|
case cmd
|
29
|
-
when /^new/
|
30
|
-
when /^show/
|
31
|
-
when /^desc/
|
32
|
-
when /^delete/
|
33
|
-
when /^
|
34
|
-
when /^concat/
|
35
|
-
when /^replace/
|
36
|
-
when /^search/
|
37
|
-
when /^lt/
|
38
|
-
when /^forget/
|
39
|
-
when /^finish/
|
40
|
-
when /^help/
|
30
|
+
when /^new/ then new_entry
|
31
|
+
when /^(ls|show)/ then show_entries
|
32
|
+
when /^desc/ then describe_issue
|
33
|
+
when /^delete/ then delete_entry
|
34
|
+
when /^edit/ then edit_what(cmd.split.drop 1)
|
35
|
+
when /^concat/ then concat_description
|
36
|
+
when /^replace/ then replace_pattern
|
37
|
+
when /^search/ then search_term(cmd.split.drop 1)
|
38
|
+
when /^lt/ then time(cmd.split.drop 1) # lt for log time
|
39
|
+
when /^forget/ then cmd = "end"
|
40
|
+
when /^finish/ then finish.nil? ? nil : cmd = "end"
|
41
|
+
when /^help/ then print_help
|
42
|
+
when /^end/ then next
|
41
43
|
else puts "Type 'help' for help"
|
42
44
|
end
|
43
45
|
end
|
@@ -109,11 +111,74 @@ private
|
|
109
111
|
ReplacePattern.new(@db, id, old_pattern, new_pattern).execute
|
110
112
|
end
|
111
113
|
|
112
|
-
def search_term
|
113
|
-
term
|
114
|
+
def search_term(term)
|
115
|
+
term ||= ''
|
116
|
+
term.chomp!
|
114
117
|
print_entries(LogEntry.search_descriptions(@db, term))
|
115
118
|
end
|
116
119
|
|
120
|
+
# Command comes in as edit <...>. This definition will check what comes
|
121
|
+
# next and invoke the proper method to execute.
|
122
|
+
def edit_what(terms_a)
|
123
|
+
case terms_a[0]
|
124
|
+
when /^title/
|
125
|
+
title = (terms_a.drop 1).join ' '
|
126
|
+
@issue.description = title
|
127
|
+
@issue.update
|
128
|
+
|
129
|
+
when /^desc/
|
130
|
+
long = (terms_a.drop 1).join ' '
|
131
|
+
@issue.long_description = long
|
132
|
+
@issue.update
|
133
|
+
|
134
|
+
when /^due/
|
135
|
+
date_time = terms_a.drop 1
|
136
|
+
edit_time(date_time.join(' '))
|
137
|
+
|
138
|
+
when /^reported/
|
139
|
+
date_time = terms_a.drop 1
|
140
|
+
edit_reported_time(date_time.join(' '))
|
141
|
+
|
142
|
+
else
|
143
|
+
$stdout.puts "Usage: "
|
144
|
+
$stdout.puts " edit title - to edit the title"
|
145
|
+
$stdout.puts " edit desc - to edit the long description"
|
146
|
+
$stdout.puts " edit due - to edit the due date"
|
147
|
+
$stdout.puts " edit time - to edit the time"
|
148
|
+
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# @param time is the date-time in string format (eg Oct 28)
|
153
|
+
def edit_time(time)
|
154
|
+
date_time = time_handle(time)
|
155
|
+
@issue.due_date = date_time.to_time
|
156
|
+
@issue.update
|
157
|
+
puts @strmaker.green('Updated due date')
|
158
|
+
rescue ArgumentError
|
159
|
+
$stderr.puts @strmaker.red \
|
160
|
+
"Invalid date/time format. Try format like 'Oct 28'"
|
161
|
+
end
|
162
|
+
|
163
|
+
def edit_reported_time(time_str)
|
164
|
+
date_time = time_handle(time_str)
|
165
|
+
@issue.reported_date = date_time.to_time
|
166
|
+
@issue.update
|
167
|
+
puts @strmaker.green('Updated reported date')
|
168
|
+
rescue ArgumentError
|
169
|
+
$stderr.puts @strmaker.red \
|
170
|
+
"Invalid date/time format. Try format like 'Oct 28'"
|
171
|
+
end
|
172
|
+
|
173
|
+
# TODO fix me
|
174
|
+
# @param time_str The time that we want to kind of sanitize
|
175
|
+
# @return a Time object which is set to 9am on that day if no time
|
176
|
+
# is provided
|
177
|
+
def time_handle(time_str)
|
178
|
+
date_time = DateTime.parse(time)
|
179
|
+
date_time = DateTime.parse(time + ' 9:00') if date_time.hour == 0
|
180
|
+
end
|
181
|
+
|
117
182
|
# TODO might need refactoring
|
118
183
|
def show_entries
|
119
184
|
entries_arr = LogEntry.find_all_by_issue_id(@db, @issue.id)
|
data/lib/wlog/version.rb
CHANGED
data/spec/domain/issue_spec.rb
CHANGED
@@ -72,14 +72,21 @@ describe Issue do
|
|
72
72
|
issue2.description = "find me 2"
|
73
73
|
issue3.description = "find me 3"
|
74
74
|
|
75
|
+
issue1.long_description = "long desc 1"
|
76
|
+
issue2.long_description = "long desc 2"
|
77
|
+
issue3.long_description = "long desc 3"
|
78
|
+
|
75
79
|
issue1.insert
|
76
80
|
issue2.insert
|
77
81
|
issue3.insert
|
78
82
|
|
79
83
|
arr = Issue.find_all(@db)
|
80
|
-
descs
|
84
|
+
descs = arr.collect{|issue| issue.description}
|
85
|
+
ldescs = arr.collect{|issue| issue.long_description}
|
81
86
|
existing = descs & ["find me 1", "find me 2", "find me 3"]
|
87
|
+
lexisting = ldescs & ["long desc 1", "long desc 2", "long desc 3"]
|
82
88
|
expect(existing.size).to eq(3)
|
89
|
+
expect(lexisting.size).to eq(3)
|
83
90
|
end
|
84
91
|
|
85
92
|
it "should not insert an existing value twice" do
|
data/wlog.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
26
|
spec.add_development_dependency "rake"
|
27
27
|
spec.add_development_dependency "rspec"
|
28
|
+
spec.add_development_dependency "yard"
|
28
29
|
spec.add_runtime_dependency "sqlite3", ">= 1.3.7"
|
29
30
|
spec.add_runtime_dependency "turntables", ">= 1.0.3"
|
30
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- psyomn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: sqlite3
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,6 +104,7 @@ extra_rdoc_files: []
|
|
90
104
|
files:
|
91
105
|
- .gitignore
|
92
106
|
- .rspec
|
107
|
+
- .travis.yml
|
93
108
|
- Gemfile
|
94
109
|
- README.md
|
95
110
|
- Rakefile
|
@@ -109,6 +124,7 @@ files:
|
|
109
124
|
- lib/wlog/domain.rb
|
110
125
|
- lib/wlog/domain/attachment.rb
|
111
126
|
- lib/wlog/domain/helpers.rb
|
127
|
+
- lib/wlog/domain/invoice.rb
|
112
128
|
- lib/wlog/domain/issue.rb
|
113
129
|
- lib/wlog/domain/key_value.rb
|
114
130
|
- lib/wlog/domain/log_entry.rb
|
@@ -125,6 +141,7 @@ files:
|
|
125
141
|
- lib/wlog/sql/mono/1.sql
|
126
142
|
- lib/wlog/sql/seq/.gitkeep
|
127
143
|
- lib/wlog/sql/seq/2.sql
|
144
|
+
- lib/wlog/sql/seq/3.sql
|
128
145
|
- lib/wlog/tech/ansi_colors.rb
|
129
146
|
- lib/wlog/tech/uncolored_string.rb
|
130
147
|
- lib/wlog/tech/wlog_string.rb
|
@@ -134,6 +151,7 @@ files:
|
|
134
151
|
- lib/wlog/ui/commands/attach_to_log_entry.rb
|
135
152
|
- lib/wlog/ui/commands/create_issue.rb
|
136
153
|
- lib/wlog/ui/commands/ui_command.rb
|
154
|
+
- lib/wlog/ui/configuration_ui.rb
|
137
155
|
- lib/wlog/ui/issue_ui.rb
|
138
156
|
- lib/wlog/ui/setup_wizard.rb
|
139
157
|
- lib/wlog/version.rb
|
@@ -174,7 +192,7 @@ rubyforge_project:
|
|
174
192
|
rubygems_version: 2.0.3
|
175
193
|
signing_key:
|
176
194
|
specification_version: 4
|
177
|
-
summary: 'A light ruby script to help track tasks and time commit:
|
195
|
+
summary: 'A light ruby script to help track tasks and time commit: f1fbaee'
|
178
196
|
test_files:
|
179
197
|
- spec/domain/attachment_spec.rb
|
180
198
|
- spec/domain/commands/concat_desc_spec.rb
|