wlog 1.1.5 → 1.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2050581ce02c72f62ceee213cb8b10a7abaeafa
4
- data.tar.gz: edb367143269344a076ac8470e55ff07c65dbb96
3
+ metadata.gz: 927ff5dc0487a5b1a77551c62e722b5465da5ca3
4
+ data.tar.gz: e3d49fb7ed7233b91709ca04df26d06618ea814e
5
5
  SHA512:
6
- metadata.gz: 3145857f03f3a6049bdc06ac393d44643973728e2da54f9a678acd9a04701f154ae6312f7b13e6605df169dca19762131b45abec00ff399abf9cf2f650f6f68d
7
- data.tar.gz: c7f451d8b41d134adb47767229336848b93cd1922196298ce078c93949fdb14bbfb9d417d01f0aa466867d4b544b471cd931905f8f877cc2a5538c2061f745a8
6
+ metadata.gz: 6a880d8230ddce74c868ba4c6ea5dec4016a00792604e177b1d19c9b6408bf5d9ac3c0035e7969afd26dfeeea45858469441065e30db5e30bbb3df6dbe4bf86a
7
+ data.tar.gz: 1e677504858659be29cf7ce0f861c18ca62b4e179d458df62df129da97714577b5db969da0d881f1b7110d13223bcf76708f153e50cc18453e99c2e34e9c618c
data/README.md CHANGED
@@ -64,15 +64,16 @@ databases, you can do the following:
64
64
 
65
65
  That will print the absolute path to that directory.
66
66
 
67
- At the moment there are two main uis in this application. One of the UI is to
68
- demonstrate the issues that are currently to be worked on. Then you choose an
69
- issue, and log your work on that particular issue only.
70
-
71
- So when you start the application this is what you see:
67
+ # Main Interface
72
68
 
73
69
  [wlog]
74
70
 
75
- Enter the command `show` to list the issues
71
+ Enter the command `new` to create a new issue:
72
+
73
+ [wlog] new
74
+
75
+ Follow the on screen queries in order to create the issue.
76
+ Enter the command `show` or `ls` to list the issues:
76
77
 
77
78
  [wlog] ls
78
79
  started work 2
@@ -81,7 +82,7 @@ Enter the command `show` to list the issues
81
82
  new 1
82
83
  [3] Need to check out templating system
83
84
 
84
- Now we want to focus on a particular issue. We type in `focus`
85
+ Now we want to focus on a particular issue. We type in `focus`:
85
86
 
86
87
  [wlog] focus 1
87
88
  [issue #1]
@@ -94,10 +95,8 @@ And now we can show all the logged work with `ls` or `show`:
94
95
  [5] Some trivial work there too [15:35:32]
95
96
  [issue #1]
96
97
 
97
- To exit the scope of an issue, you can use the `forget` command:
98
-
99
- [issue #1] forget
100
- [wlog]
98
+ And commands you execute apply to the scope of only that issue. You can type in
99
+ `help` for more info.
101
100
 
102
101
  While in the scope of an issue, you can display its full description by invoking
103
102
  the command `desc`.
@@ -117,6 +116,50 @@ the command `desc`.
117
116
  Description
118
117
  But this is an ever longer desc
119
118
 
119
+ ## Logging Time
120
+
121
+ It's possible to log time within issue scope with the following commands:
122
+
123
+ lt 10m
124
+
125
+ To log 10 minutes
126
+
127
+ lt 1h20m
128
+
129
+ To log 1 hour 20 minutes
130
+
131
+ lt 1d 1s
132
+
133
+ To log one day, one second. (A day is 8 hours). The total time is stored on the
134
+ issue.
135
+
136
+ ## Inside issues
137
+
138
+ You can run these commands in this 'sub-shell' of the issues:
139
+ are `search`, `replace`, `delete`, and `concat`.
140
+
141
+ search
142
+ searches the database for a pattern that you specify.
143
+
144
+ replace
145
+ searches and replaces a pattern that you specify.
146
+
147
+ delete
148
+ removes an entry from the database.
149
+
150
+ concat
151
+ appends a string to the specified log entry.
152
+
153
+ ## Escape Scope
154
+
155
+ To exit the scope of an issue, you can use the `forget` command:
156
+
157
+ [issue #1] forget
158
+ [wlog]
159
+
160
+ *NOTE*: Attachments don't currently work in v1.1.5 - they might be back in the
161
+ future.
162
+
120
163
  You can also attach files to issues (you have to be outside the scope of an
121
164
  issue for this - this feature is experimental at the momment so don't rely too
122
165
  much on it):
@@ -142,39 +185,68 @@ And then you can output them to a location:
142
185
  Which attachment to output? : 1
143
186
  Output where (abs dir) : /tmp/
144
187
 
145
- ## Inside issues
146
-
147
- You can run these commands in this 'sub-shell' of the issues:
148
- are `show`, `search`, `replace`, `delete`, and `concat`.
149
-
150
- `show` lists the latest work log entries.
188
+ # Generating Invoices
151
189
 
152
- `search` searches the database for a pattern that you specify.
190
+ You can generate invoices. You need to create an invoice first. To do that,
191
+ enter the command `invoices` in the `wlog` shell:
153
192
 
154
- `replace` searches and replaces a pattern that you specify.
193
+ [wlog] invoices
194
+ [invoices]
155
195
 
156
- `delete` removes an entry from the database.
196
+ You can create a new invoice with the `new` command. Enter the two dates which
197
+ correspond the date range you want to bill. For example, let's enter the whole
198
+ month of September:
157
199
 
158
- `concat` appends a string to the specified log entry.
200
+ [invoice] new
201
+ From (dd-mm-yyyy) 01-09-2014
202
+ To (dd-mm-yyyy) 30-09-2014
203
+ I did many things this month
204
+ It is very very true
205
+ And I can write all of this in multiline
206
+
207
+ And I can break into another paragraph.
208
+
209
+ And another.
210
+
211
+ But you need to press enter a few more times until you
212
+ break you of the input for the invoice.
213
+
214
+
215
+
216
+
217
+
218
+
219
+ [invoice]
159
220
 
160
- All of these will modify the entries of those issues.
221
+ So now you should have your first invoice:
161
222
 
162
- ## Logging Time
223
+ [invoice] show
224
+ [1] 01-09-2014 -> 30-09-2014 I
163
225
 
164
- It's possible to log time now with the following commands:
226
+ And now you can generate your invoice with the following command:
165
227
 
166
- lt 10m
228
+ [invoice] generate 1
167
229
 
168
- To log 10 minutes
230
+ This will write the output in `~/Documents/wlog/`. Will create dirs if not
231
+ exist.
169
232
 
170
- lt 1h20m
233
+ ## Templates
171
234
 
172
- To log 1 hour 20 minutes
235
+ To generate invoices templates are used. Templates are _erb_ templates. They are
236
+ stored in `~/.config/wlog/templates/`. You can write your own as well. If you
237
+ write your own, you need to tell wlog to use them. Do so with the following
238
+ commands:
173
239
 
174
- lt 1d 1s
240
+ [templates] show
241
+ [ 1] /home/psyomn/.config/wlog/templates/default.erb
242
+ * [ 2] /home/psyomn/.config/wlog/templates/mine.erb.html
243
+ [templates] set 1
244
+ [templates] show
245
+ * [ 1] /home/psyomn/.config/wlog/templates/default.erb
246
+ [ 2] /home/psyomn/.config/wlog/templates/mine.erb.html
175
247
 
176
- To log one day, one second. (A day is 8 hours). The total time is stored on the
177
- issue.
248
+ Also, worth to note that you should verify any template you get off the
249
+ internet to use as your own.
178
250
 
179
251
  ## Contributing
180
252
 
@@ -184,8 +256,6 @@ issue.
184
256
  4. Push to the branch (`git push origin my-new-feature`)
185
257
  5. Create new Pull Request
186
258
 
187
- ### For newcommers
188
-
189
- Look at the github issues, for things marked as 'Up for Grabs'. Feel free to
190
- message me to ask anything. I'll be more than happy to answer.
259
+ # Developers
191
260
 
261
+ Check issue tracker - thanks.
@@ -1,12 +1,12 @@
1
1
  require 'active_record'
2
2
  require 'readline'
3
- require 'wlog/ui/commands/ui_command'
3
+ require 'wlog/commands/commandable'
4
4
  require 'wlog/domain/issue'
5
5
 
6
6
  module Wlog
7
7
  # Creational logic for issues
8
8
  # @author Simon Symeonidis
9
- class CreateIssue < UiCommand
9
+ class CreateIssue < Commandable
10
10
  # Execute create issue transaction
11
11
  def execute
12
12
  desc = Readline.readline("Small issue description :") || "None."
@@ -5,7 +5,7 @@ require 'wlog/domain/sys_config'
5
5
  require 'wlog/domain/attachment'
6
6
  require 'wlog/domain/helpers'
7
7
 
8
- require 'wlog/ui/commands/create_issue'
8
+ require 'wlog/commands/create_issue'
9
9
  require 'wlog/ui/configuration_ui'
10
10
 
11
11
  require 'wlog/commands/archive_issues'
@@ -40,7 +40,6 @@ class CliInterface
40
40
  when /^archive/ then archive cmd
41
41
  when /^showattach/ then show_attach
42
42
  when /^outattach/ then output_attach
43
- when /^generateinvoice/ then generate_invoice
44
43
  when /^attach/ then attach
45
44
  when /^focus/ then focus(cmd)
46
45
  when /new/ then new_issue
@@ -76,6 +75,7 @@ private
76
75
  if !issue_id
77
76
  puts 'usage:'
78
77
  puts ' delete <id>'
78
+ return
79
79
  else
80
80
  issue_id = issue_id.to_i
81
81
  end
@@ -202,7 +202,8 @@ private
202
202
  'archive', 'Archive a file into a specific issue',
203
203
  'showattach', 'Show what files have been attached to an issue',
204
204
  'outattach', 'Extract a file from the database',
205
- 'generateinvoice', 'todo',
205
+ 'invoices', 'Go to invoices interface',
206
+ 'templates', 'Go to template interface, and set templates',
206
207
  'focus', 'Focus on a particular ',
207
208
  'show', 'List all the issues',
208
209
  'help', 'Show this information',
@@ -245,17 +246,6 @@ private
245
246
  cmd.ret
246
247
  end
247
248
 
248
- def generate_invoice
249
- require 'time'
250
- puts "Eg: valid input is Oct 2013 15"
251
- from = Readline.readline("From: ")
252
- to = Readline.readline("To : ")
253
-
254
- from_time = Time.parse(from).to_i
255
- to_time = Time.parse(to).to_i
256
- issues = Issue.find_in_time_range(@db, from_time, to_time)
257
- end
258
-
259
249
  # Search for an issue
260
250
  def search
261
251
  term = Readline.readline("search issues for term : ")
@@ -1,31 +1,31 @@
1
+ require 'wlog/domain/sys_config'
1
2
 
2
3
  module Wlog
3
4
  # @author Simon Symeonidis
4
5
  class EditHandler
5
6
 
6
- def initialize(issue); @issue = issue end
7
+ def initialize(issue)
8
+ @issue = issue
9
+ @strmaker = SysConfig.string_decorator
10
+ end
7
11
 
8
12
  # Command comes in as edit <...>. This definition will check what comes
9
13
  # next and invoke the proper method to execute.
10
14
  def edit_what(terms_a)
15
+ param = (terms_a.drop 1).join ' '
16
+
11
17
  case terms_a[0]
12
18
  when /^title/
13
- title = (terms_a.drop 1).join ' '
14
- @issue.description = title
15
- @issue.update
19
+ @issue.update(:description => param)
16
20
 
17
21
  when /^desc/
18
- long = (terms_a.drop 1).join ' '
19
- @issue.long_description = long
20
- @issue.update
22
+ @issue.update(:long_description => param)
21
23
 
22
24
  when /^due/
23
- date_time = terms_a.drop 1
24
- edit_time(date_time.join(' '))
25
+ edit_time(param)
25
26
 
26
27
  when /^reported/
27
- date_time = terms_a.drop 1
28
- edit_reported_time(date_time.join(' '))
28
+ edit_reported_time(param)
29
29
 
30
30
  else
31
31
  $stdout.puts "Usage: "
@@ -33,15 +33,13 @@ class EditHandler
33
33
  $stdout.puts " edit desc - to edit the long description"
34
34
  $stdout.puts " edit due - to edit the due date"
35
35
  $stdout.puts " edit time - to edit the time"
36
-
37
36
  end
38
37
  end
39
38
 
40
39
  # @param time is the date-time in string format (eg Oct 28)
41
40
  def edit_time(time)
42
41
  date_time = time_handle(time)
43
- @issue.due_date = date_time.to_time
44
- @issue.update
42
+ @issue.update(:due_date => date_time)
45
43
  puts @strmaker.green('Updated due date')
46
44
  rescue ArgumentError
47
45
  $stderr.puts @strmaker.red \
@@ -63,8 +61,8 @@ class EditHandler
63
61
  # @return a Time object which is set to 9am on that day if no time
64
62
  # is provided
65
63
  def time_handle(time_str)
66
- date_time = DateTime.parse(time)
67
- date_time = DateTime.parse(time + ' 9:00') if date_time.hour == 0
64
+ date_time = DateTime.parse(time_str)
65
+ date_time = DateTime.parse(time_str + ' 9:00') if date_time.hour == 0
68
66
  end
69
67
 
70
68
  # Pass the issue from the previous ui to this one. This ui modifies
@@ -18,7 +18,7 @@ class InvoiceUi
18
18
  cmd = "default"
19
19
 
20
20
  while cmd != 'end'
21
- cmd = Readline.readline("[#{@strmaker.red('invoice')}] ") || ""
21
+ cmd = Readline.readline("[#{@strmaker.red('invoices')}] ") || ""
22
22
  case cmd
23
23
  when /^new/ then make_invoice
24
24
  when /^(ls|show)/ then ls
@@ -36,10 +36,10 @@ private
36
36
  # TODO maybe separate this in the future for better testing.
37
37
  def generate(rest)
38
38
  num = rest.first || 1
39
- invoice = Invoice.find(num.to_i)
39
+ @invoice = Invoice.find(num.to_i)
40
40
 
41
41
  # NOTE: these need to be instance vars, so we expose them to ERB later on
42
- @les = invoice.log_entries_within_dates
42
+ @les = @invoice.log_entries_within_dates
43
43
  @issues = [Issue.find(*(@les.collect(&:issue_id).uniq))].compact.flatten
44
44
 
45
45
  # Get the template
@@ -52,7 +52,7 @@ private
52
52
 
53
53
  FileUtils.mkdir_p TemplateOutputDir
54
54
  template_ext = tpath.split(File::SEPARATOR).last.split('.').last
55
- filename = TemplateOutputDir + "#{invoice.id}-invoice.#{template_ext}"
55
+ filename = TemplateOutputDir + "#{@invoice.id}-invoice.#{template_ext}"
56
56
 
57
57
  File.write(filename, output)
58
58
 
@@ -75,7 +75,7 @@ private
75
75
  print @strmaker.yellow(invoice.from.strftime("%d-%m-%Y"))
76
76
  print @strmaker.blue(" -> ")
77
77
  print @strmaker.yellow(invoice.to.strftime("%d-%m-%Y"))
78
- puts " #{invoice.description.split.first}"
78
+ puts " #{invoice.description.lines.first.gsub(/(\r|\n)/, "")[0..49]}..."
79
79
  end
80
80
  end
81
81
 
@@ -1,3 +1,3 @@
1
1
  module Wlog
2
- VERSION = "1.1.5"
2
+ VERSION = "1.1.6"
3
3
  end
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "yard"
29
29
  spec.add_runtime_dependency "sqlite3", ">= 1.3.7"
30
30
  spec.add_runtime_dependency "rake", ">= 10.3.2"
31
- spec.add_runtime_dependency 'activerecord', ">= 4.1.6"
31
+ spec.add_runtime_dependency 'activerecord', "4.1.6"
32
32
  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.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - psyomn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-30 00:00:00.000000000 Z
11
+ date: 2014-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,14 +98,14 @@ dependencies:
98
98
  name: activerecord
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - '='
102
102
  - !ruby/object:Gem::Version
103
103
  version: 4.1.6
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - '='
109
109
  - !ruby/object:Gem::Version
110
110
  version: 4.1.6
111
111
  description: Track tasks and time on the command line.
@@ -129,6 +129,7 @@ files:
129
129
  - lib/wlog/commands/bootstrap_templates.rb
130
130
  - lib/wlog/commands/commandable.rb
131
131
  - lib/wlog/commands/concat_description.rb
132
+ - lib/wlog/commands/create_issue.rb
132
133
  - lib/wlog/commands/delete_issue.rb
133
134
  - lib/wlog/commands/innit_db.rb
134
135
  - lib/wlog/commands/make_csv.rb
@@ -158,8 +159,6 @@ files:
158
159
  - lib/wlog/tech/wlog_string.rb
159
160
  - lib/wlog/ui/bootstrap.rb
160
161
  - lib/wlog/ui/cli_interface.rb
161
- - lib/wlog/ui/commands/attach_to_log_entry.rb
162
- - lib/wlog/ui/commands/create_issue.rb
163
162
  - lib/wlog/ui/commands/ui_command.rb
164
163
  - lib/wlog/ui/configuration_ui.rb
165
164
  - lib/wlog/ui/edit_handler.rb
@@ -205,7 +204,7 @@ rubyforge_project:
205
204
  rubygems_version: 2.0.14
206
205
  signing_key:
207
206
  specification_version: 4
208
- summary: 'A light ruby script to help track tasks and time commit: e10bdee'
207
+ summary: 'A light ruby script to help track tasks and time commit: 176c67c'
209
208
  test_files:
210
209
  - spec/domain/attachment_spec.rb
211
210
  - spec/domain/commands/concat_desc_spec.rb
@@ -1,11 +0,0 @@
1
- require 'wlog/ui/commands/ui_command'
2
- require 'wlog/domain/attachment'
3
- module Wlog
4
- # Attaching a file to a log entry procedural logic
5
- # @author Simon Symeonidis
6
- class AttachToLogEntry < UiCommand
7
- def execute
8
- end
9
- end
10
- end
11
-