wlog 1.1.1 → 1.1.5
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/README.md +33 -48
- data/Rakefile +1 -0
- data/lib/wlog/commands/archive_finished_issues.rb +2 -2
- data/lib/wlog/commands/archive_issues.rb +1 -1
- data/lib/wlog/commands/bootstrap_templates.rb +37 -0
- data/lib/wlog/commands/concat_description.rb +7 -11
- data/lib/wlog/commands/delete_issue.rb +6 -5
- data/lib/wlog/commands/innit_db.rb +62 -6
- data/lib/wlog/commands/make_csv.rb +2 -6
- data/lib/wlog/commands/new_entry.rb +10 -7
- data/lib/wlog/commands/replace_pattern.rb +7 -5
- data/lib/wlog/domain/attachment.rb +50 -75
- data/lib/wlog/domain/invoice.rb +8 -2
- data/lib/wlog/domain/issue.rb +32 -132
- data/lib/wlog/domain/key_value.rb +10 -35
- data/lib/wlog/domain/log_entry.rb +18 -95
- data/lib/wlog/domain/static_configurations.rb +6 -0
- data/lib/wlog/domain/sys_config.rb +2 -5
- data/lib/wlog/migrations/make_standard_tables.rb +59 -0
- data/lib/wlog/ui/cli_interface.rb +55 -44
- data/lib/wlog/ui/commands/create_issue.rb +4 -8
- data/lib/wlog/ui/edit_handler.rb +74 -0
- data/lib/wlog/ui/invoice_ui.rb +133 -0
- data/lib/wlog/ui/issue_ui.rb +21 -77
- data/lib/wlog/ui/template_ui.rb +66 -0
- data/lib/wlog/version.rb +1 -1
- data/spec/domain/attachment_spec.rb +58 -59
- data/spec/domain/commands/concat_desc_spec.rb +10 -13
- data/spec/domain/commands/new_entry_spec.rb +10 -13
- data/spec/domain/commands/replace_pattern_spec.rb +11 -12
- data/spec/domain/issue_spec.rb +35 -38
- data/spec/domain/key_value_spec.rb +5 -8
- data/spec/domain/log_entry_spec.rb +20 -31
- data/spec/domain/sys_config_spec.rb +4 -7
- data/spec/make_db.rb +30 -4
- data/spec/tech/wlog_string_spec.rb +14 -14
- data/wlog.gemspec +2 -1
- metadata +26 -13
- data/lib/wlog/db_registry.rb +0 -38
- data/lib/wlog/domain/sql_modules/attachment_sql.rb +0 -21
- data/lib/wlog/domain/sql_modules/issue_sql.rb +0 -37
- data/lib/wlog/domain/sql_modules/key_value_sql.rb +0 -20
- data/lib/wlog/domain/sql_modules/log_entry_sql.rb +0 -35
- data/lib/wlog/ui/commands/attach_to_issue.rb +0 -0
@@ -10,37 +10,37 @@ describe WlogString do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should write in red' do
|
13
|
-
@str.red('').
|
14
|
-
@str.red('').
|
13
|
+
expect(@str.red('')).to match(/^\x1b\[#{Red}/)
|
14
|
+
expect(@str.red('')).to match(/\x1b\[0m$/)
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should write in green' do
|
18
|
-
@str.green('').
|
19
|
-
@str.green('').
|
18
|
+
expect(@str.green('')).to match(/^\x1b\[#{Green}/)
|
19
|
+
expect(@str.green('')).to match(/\x1b\[0m$/)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should write in blue' do
|
23
|
-
@str.blue('').
|
24
|
-
@str.blue('').
|
23
|
+
expect(@str.blue('')).to match(/^\x1b\[#{Blue}/)
|
24
|
+
expect(@str.blue('')).to match(/\x1b\[0m$/)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should write in yellow' do
|
28
|
-
@str.yellow('').
|
29
|
-
@str.yellow('').
|
28
|
+
expect(@str.yellow('')).to match(/^\x1b\[#{Yellow}/)
|
29
|
+
expect(@str.yellow('')).to match(/\x1b\[0m$/)
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should write in white' do
|
33
|
-
@str.white('').
|
34
|
-
@str.white('').
|
33
|
+
expect(@str.white('')).to match(/^\x1b\[#{White}/)
|
34
|
+
expect(@str.white('')).to match(/\x1b\[0m$/)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should write in cyan' do
|
38
|
-
@str.cyan('').
|
39
|
-
@str.cyan('').
|
38
|
+
expect(@str.cyan('')).to match(/^\x1b\[#{Cyan}/)
|
39
|
+
expect(@str.cyan('')).to match(/\x1b\[0m$/)
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should write in magenta' do
|
43
|
-
@str.magenta('').
|
44
|
-
@str.magenta('').
|
43
|
+
expect(@str.magenta('')).to match(/^\x1b\[#{Magenta}/)
|
44
|
+
expect(@str.magenta('')).to match(/\x1b\[0m$/)
|
45
45
|
end
|
46
46
|
end
|
data/wlog.gemspec
CHANGED
@@ -27,5 +27,6 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rspec"
|
28
28
|
spec.add_development_dependency "yard"
|
29
29
|
spec.add_runtime_dependency "sqlite3", ">= 1.3.7"
|
30
|
-
spec.add_runtime_dependency "
|
30
|
+
spec.add_runtime_dependency "rake", ">= 10.3.2"
|
31
|
+
spec.add_runtime_dependency 'activerecord', ">= 4.1.6"
|
31
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.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- psyomn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,19 +81,33 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.3.7
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 10.3.2
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 10.3.2
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activerecord
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - '>='
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
103
|
+
version: 4.1.6
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
110
|
+
version: 4.1.6
|
97
111
|
description: Track tasks and time on the command line.
|
98
112
|
email:
|
99
113
|
- lethaljellybean@gmail.com
|
@@ -112,6 +126,7 @@ files:
|
|
112
126
|
- lib/wlog.rb
|
113
127
|
- lib/wlog/commands/archive_finished_issues.rb
|
114
128
|
- lib/wlog/commands/archive_issues.rb
|
129
|
+
- lib/wlog/commands/bootstrap_templates.rb
|
115
130
|
- lib/wlog/commands/commandable.rb
|
116
131
|
- lib/wlog/commands/concat_description.rb
|
117
132
|
- lib/wlog/commands/delete_issue.rb
|
@@ -120,7 +135,6 @@ files:
|
|
120
135
|
- lib/wlog/commands/new_entry.rb
|
121
136
|
- lib/wlog/commands/replace_pattern.rb
|
122
137
|
- lib/wlog/commands/taint_setup.rb
|
123
|
-
- lib/wlog/db_registry.rb
|
124
138
|
- lib/wlog/domain.rb
|
125
139
|
- lib/wlog/domain/attachment.rb
|
126
140
|
- lib/wlog/domain/helpers.rb
|
@@ -129,15 +143,12 @@ files:
|
|
129
143
|
- lib/wlog/domain/key_value.rb
|
130
144
|
- lib/wlog/domain/log_entry.rb
|
131
145
|
- lib/wlog/domain/session.rb
|
132
|
-
- lib/wlog/domain/sql_modules/attachment_sql.rb
|
133
|
-
- lib/wlog/domain/sql_modules/issue_sql.rb
|
134
|
-
- lib/wlog/domain/sql_modules/key_value_sql.rb
|
135
|
-
- lib/wlog/domain/sql_modules/log_entry_sql.rb
|
136
146
|
- lib/wlog/domain/sql_modules/polymorphic_attachments_sql.rb
|
137
147
|
- lib/wlog/domain/static_configurations.rb
|
138
148
|
- lib/wlog/domain/sys_config.rb
|
139
149
|
- lib/wlog/domain/template_engine.rb
|
140
150
|
- lib/wlog/domain/timelog_helper.rb
|
151
|
+
- lib/wlog/migrations/make_standard_tables.rb
|
141
152
|
- lib/wlog/sql/mono/1.sql
|
142
153
|
- lib/wlog/sql/seq/.gitkeep
|
143
154
|
- lib/wlog/sql/seq/2.sql
|
@@ -147,13 +158,15 @@ files:
|
|
147
158
|
- lib/wlog/tech/wlog_string.rb
|
148
159
|
- lib/wlog/ui/bootstrap.rb
|
149
160
|
- lib/wlog/ui/cli_interface.rb
|
150
|
-
- lib/wlog/ui/commands/attach_to_issue.rb
|
151
161
|
- lib/wlog/ui/commands/attach_to_log_entry.rb
|
152
162
|
- lib/wlog/ui/commands/create_issue.rb
|
153
163
|
- lib/wlog/ui/commands/ui_command.rb
|
154
164
|
- lib/wlog/ui/configuration_ui.rb
|
165
|
+
- lib/wlog/ui/edit_handler.rb
|
166
|
+
- lib/wlog/ui/invoice_ui.rb
|
155
167
|
- lib/wlog/ui/issue_ui.rb
|
156
168
|
- lib/wlog/ui/setup_wizard.rb
|
169
|
+
- lib/wlog/ui/template_ui.rb
|
157
170
|
- lib/wlog/version.rb
|
158
171
|
- spec/domain/attachment_spec.rb
|
159
172
|
- spec/domain/commands/concat_desc_spec.rb
|
@@ -189,10 +202,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
202
|
version: '0'
|
190
203
|
requirements: []
|
191
204
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.0.
|
205
|
+
rubygems_version: 2.0.14
|
193
206
|
signing_key:
|
194
207
|
specification_version: 4
|
195
|
-
summary: 'A light ruby script to help track tasks and time commit:
|
208
|
+
summary: 'A light ruby script to help track tasks and time commit: e10bdee'
|
196
209
|
test_files:
|
197
210
|
- spec/domain/attachment_spec.rb
|
198
211
|
- spec/domain/commands/concat_desc_spec.rb
|
data/lib/wlog/db_registry.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'sqlite3'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
require 'wlog/domain/static_configurations.rb'
|
5
|
-
|
6
|
-
module Wlog
|
7
|
-
# The db registry, using sqlite3
|
8
|
-
# @author Simon Symeonidis
|
9
|
-
class DbRegistry
|
10
|
-
include StaticConfigurations
|
11
|
-
|
12
|
-
def initialize(dbname)
|
13
|
-
@handle = SQLite3::Database.new(dbname || "#{DataDirectory}#{ARGV[0] || DefaultDb}")
|
14
|
-
end
|
15
|
-
|
16
|
-
# execute a sql with varargs parameters
|
17
|
-
# @param *sql, first the sql string, then the parameters if the statement is
|
18
|
-
# to be prepared.
|
19
|
-
# @example Simple Usage
|
20
|
-
# DbRegistry.execute("SELECT * FROM table WHERE id = ?", 1)
|
21
|
-
def execute(*sql)
|
22
|
-
@handle.execute(*sql)
|
23
|
-
end
|
24
|
-
|
25
|
-
# Get the last row, given a table name. The table needs to have an id
|
26
|
-
def last_row_from(tablename)
|
27
|
-
query = "SELECT * FROM #{tablename} WHERE id =(SELECT MAX(id) FROM"\
|
28
|
-
" #{tablename});"
|
29
|
-
@handle.execute(query)
|
30
|
-
end
|
31
|
-
|
32
|
-
# the database handle
|
33
|
-
attr_accessor :handle
|
34
|
-
|
35
|
-
private
|
36
|
-
end
|
37
|
-
end # module Wlog
|
38
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Wlog
|
2
|
-
# The sql for attachments
|
3
|
-
# @author Simon Symeonidis
|
4
|
-
module AttachmentSql
|
5
|
-
# The table name
|
6
|
-
TableName = "attachments"
|
7
|
-
|
8
|
-
# Insert the file data into the database (NOTE wondering if small/big endian
|
9
|
-
# will be affecting this...)
|
10
|
-
InsertSql = "INSERT INTO #{TableName} (filename, given_name, data) "\
|
11
|
-
"values (?, ?, ?); "
|
12
|
-
|
13
|
-
# Delete by id
|
14
|
-
DeleteSql = "DELETE FROM #{TableName} WHERE discriminator = ? AND "\
|
15
|
-
"discriminator_id = ?;"
|
16
|
-
|
17
|
-
# Select an attachment given an id
|
18
|
-
SelectSql = "SELECT * FROM #{TableName} WHERE id = ? "
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Wlog
|
2
|
-
# Issue SQL
|
3
|
-
# @author Simon Symeonidis
|
4
|
-
module IssueSql
|
5
|
-
# The table name of the log entries table
|
6
|
-
TableName = "issues"
|
7
|
-
|
8
|
-
# Standard insert
|
9
|
-
InsertSql = \
|
10
|
-
"INSERT INTO #{TableName} "\
|
11
|
-
"(description, reported_date, due_date, status, timelog,"\
|
12
|
-
"long_description) "\
|
13
|
-
"values (?,?,?,?,0,?);"
|
14
|
-
# Standard delete
|
15
|
-
DeleteSql = "DELETE FROM #{TableName} WHERE id = ? ;"
|
16
|
-
|
17
|
-
# Standard update
|
18
|
-
UpdateSql = "UPDATE #{TableName} SET "\
|
19
|
-
"description = ? , reported_date = ? , due_date = ? , status = ?, "\
|
20
|
-
"timelog = ? "\
|
21
|
-
"WHERE id = ?;"
|
22
|
-
|
23
|
-
# Select by id
|
24
|
-
SelectSql = "SELECT * FROM #{TableName} WHERE id = ? ;"
|
25
|
-
|
26
|
-
# Select all the issues (which are not archived)
|
27
|
-
SelectAllSql = "SELECT * FROM #{TableName} WHERE status <> 3; "
|
28
|
-
|
29
|
-
# Select issues that are finished
|
30
|
-
SelectFinishedSql = "SELECT * FROM #{TableName} WHERE status = 2"
|
31
|
-
|
32
|
-
# Select issues given a time range
|
33
|
-
SelectTimeRange = "SELECT * FROM #{TableName}"\
|
34
|
-
" WHERE reported_date >= ? AND reported_date <= ?"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Wlog
|
2
|
-
# Encapsulate the sql in only one part.
|
3
|
-
# @author Simon Symeonidis
|
4
|
-
module KeyValueSql
|
5
|
-
# The table name of the log entries table
|
6
|
-
TableName = "key_values"
|
7
|
-
|
8
|
-
# Standard insert
|
9
|
-
InsertSql = \
|
10
|
-
"INSERT INTO #{TableName} (key,value) values (?,?);"
|
11
|
-
# Standard delete
|
12
|
-
DeleteSql = "DELETE FROM #{TableName} WHERE key = ? ;"
|
13
|
-
|
14
|
-
# Standard update
|
15
|
-
UpdateSql = "UPDATE #{TableName} SET value = ? WHERE key = ?;"
|
16
|
-
|
17
|
-
# Select by key
|
18
|
-
Select = "SELECT * FROM #{TableName} WHERE key = ? ;"
|
19
|
-
end
|
20
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Wlog
|
2
|
-
# Encapsulate the sql in only one part.
|
3
|
-
# @author Simon Symeonidis
|
4
|
-
module LogEntrySql
|
5
|
-
# The table name of the log entries table
|
6
|
-
TableName = "log_entries"
|
7
|
-
|
8
|
-
# Standard insert
|
9
|
-
InsertSql = \
|
10
|
-
"INSERT INTO #{TableName} (description,date,issue_id) values (?,?,?);"
|
11
|
-
# Standard delete
|
12
|
-
DeleteSql = "DELETE FROM #{TableName} WHERE id = ? ;"
|
13
|
-
|
14
|
-
# Standard select all
|
15
|
-
SelectAll = "SELECT * FROM #{TableName} ORDER BY date ASC;"
|
16
|
-
|
17
|
-
# Standard update
|
18
|
-
UpdateSql = "UPDATE #{TableName} SET description = ? WHERE id = ?;"
|
19
|
-
|
20
|
-
# select all with a limit
|
21
|
-
SelectAllLimit = \
|
22
|
-
"SELECT * FROM #{TableName} WHERE date >="\
|
23
|
-
" #{Time.now.to_i - 604800 - 24 * 60 * 60} ORDER BY date ASC"
|
24
|
-
|
25
|
-
# Select by id
|
26
|
-
Select = "SELECT * FROM #{TableName} WHERE id = ? ;"
|
27
|
-
|
28
|
-
# Select by id
|
29
|
-
SelectAllByIssue = "SELECT * FROM #{TableName} WHERE issue_id = ? ;"
|
30
|
-
|
31
|
-
# Select by a regex like /.../i
|
32
|
-
SelectDescriptionLike = \
|
33
|
-
"SELECT * FROM #{TableName} WHERE description LIKE ?;"
|
34
|
-
end
|
35
|
-
end
|
File without changes
|