kanban_txt 0.1.3 → 0.2.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: 20a8fd2ba272bd53dd6023aa3ca3c3d16d75df15
4
- data.tar.gz: 59c5e2db8dfa5373e0e831d8b1d99291ff3cb10a
3
+ metadata.gz: 6430f0e7d113e72c0b67c32da4124400211a920e
4
+ data.tar.gz: 6ec4736040454f87f769885ec2265e14f3d35f40
5
5
  SHA512:
6
- metadata.gz: 25e812270ba1d4a1a9126f0b72fe92515c2e879a57f3e226c2d97243a8909a08390999523945f5c13ff88627f51092bd999f25533fed4f47f1b98580473b60c1
7
- data.tar.gz: 3f5d2c8e40ffa38dbcd434c28c64e3477c2bba5bc878e5e039de0a6eb97bca658c308f7ebf70103b303ac1ab655ae98fe421a0d062fb3333ff4b7be7b1d8227f
6
+ metadata.gz: d8e048c9d6f88eb83ce2a0688eaf7a548568aebb86802324ac1e3ce956219c00666af30cc22e90f6f8f59c937465d7ae0e13a5e27a92ac384da4213ac698fced
7
+ data.tar.gz: 362774ac3e9f1e38f5b266ec5ae6b74c441f53c481a58164dc5556b9d7220df83a302b0e66962bdbf6af0437d29e70e22e9b449f3af38725970397376c055f49
@@ -1,3 +1 @@
1
- i��O/m�گ��ؘ76��U ���Rq�`�]�N���O�-�*ښIS�.�����e���Ķ��byUֳ
2
- d������3�k̓l|+�ς� MP������f�[��%f���_�F��!�Y�%�EB�V!�n�:"{����F�,+�F�5Z䁃�C��ޫ��L��惢��{���B�K[�J�����e�>!X1�.���?_���P@�C���xH�Ԕ�)�)p�=����#k��Z1$I f:
3
- ��QH:
1
+ `����*U  �ޛ�tblwCw��n���l��D��M���L��r3H�`��P h�]�s> ���,�'�p��oi�ܟ�&�,(�Z-F��.N��߼��S"��i����}�өnn�a�G���Z ��w�x��@I���bٛ�g������O���=��>���4�{B�^⿚h}
data.tar.gz.sig CHANGED
Binary file
@@ -11,28 +11,32 @@ class KanbanTxt
11
11
  attr_reader :to_s
12
12
  attr_accessor :title
13
13
 
14
- def initialize(filename='kanban.txt', title: nil,
14
+ def initialize(s='kanban.txt', title: nil,
15
15
  headings: ['Backlog', 'Todo', 'In progress', 'Done'], path: '.')
16
16
 
17
- @filename, @path, @title, @headings = filename, path, title, headings
17
+ @path, @title, @headings = path, title, headings
18
18
 
19
- fpath = File.join(path, filename)
20
-
21
- if File.exists?(fpath) then
22
-
23
- @rx = import_to_rx(File.read(fpath))
24
- housekeeping(@rx)
25
-
19
+ if s.lines.length > 1 then
20
+ read s
26
21
  else
27
22
 
28
- if title.nil? then
29
- raise 'KanbanTxt: title: must be provided e.g. ' + \
30
- 'KanbanTxt.new title: "project1"'
31
- end
32
-
33
- @keys = @headings.map{|x| x.downcase.gsub(/[\s\-_]/,'').to_sym}
23
+ fpath = File.join(path, @filename=s)
34
24
 
35
- @rx = new_rx
25
+ if File.exists?(fpath) then
26
+
27
+ read File.read(fpath)
28
+
29
+ else
30
+
31
+ if title.nil? then
32
+ raise 'KanbanTxt: title: must be provided e.g. ' + \
33
+ 'KanbanTxt.new title: "project1"'
34
+ end
35
+
36
+ @keys = @headings.map{|x| x.downcase.gsub(/[\s\-_]/,'').to_sym}
37
+
38
+ @rx = new_rx
39
+ end
36
40
  end
37
41
 
38
42
  end
@@ -73,7 +77,7 @@ class KanbanTxt
73
77
  #
74
78
  def housekeeping(rx)
75
79
 
76
- columns = rx.to_h.values
80
+ columns = rx.values
77
81
 
78
82
  for i in (0..columns.length - 1)
79
83
 
@@ -86,6 +90,8 @@ class KanbanTxt
86
90
  groupid = task[/\w+\d+(?:\.\d+)?(?:\.\d+)?/]
87
91
  group = a.grep /#{groupid}/
88
92
  first = a.index group.first
93
+
94
+ # is it the 1st column (recurring) and a recurring task?
89
95
  a.slice!(first, group.length)
90
96
 
91
97
  if i + 1 < columns.length then
@@ -99,7 +105,7 @@ class KanbanTxt
99
105
 
100
106
  end
101
107
 
102
- rx.to_h.keys.each.with_index do |column, i|
108
+ rx.keys.each.with_index do |column, i|
103
109
  @rx[column] = columns[i]
104
110
  end
105
111
 
@@ -115,11 +121,16 @@ class KanbanTxt
115
121
  new_rx(@keys.zip(rows[0..-1].map { |x| x.lines[2..-1].join.strip }))
116
122
 
117
123
  end
124
+
125
+ def read(s)
126
+ @rx = import_to_rx(s)
127
+ housekeeping(@rx)
128
+ end
118
129
 
119
130
  def rx_to_s(rx)
120
131
 
121
132
  len = @headings.length
122
- values = @rx.to_h.values
133
+ values = rx.values
123
134
 
124
135
  a = @headings.zip(values).map do |title, value|
125
136
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanban_txt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -34,25 +34,25 @@ cert_chain:
34
34
  date: 2015-12-22 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
- name: dynarex
37
+ name: recordx
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.6'
42
+ version: '0.3'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.6.1
45
+ version: 0.3.1
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '1.6'
52
+ version: '0.3'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 1.6.1
55
+ version: 0.3.1
56
56
  description:
57
57
  email: james@r0bertson.co.uk
58
58
  executables: []
metadata.gz.sig CHANGED
Binary file