kanban_txt 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9360c54f29f7eaa21b1b0f1c8459eab0511c2c0c
4
+ data.tar.gz: 6e2c9fca8f36aa362e7902f4a4604d0afb09cc26
5
+ SHA512:
6
+ metadata.gz: e97ffb2185e292f4f6aae90e084a77d2aed9775eeb055b90d3d2ce9cb29449eccce933f53e23f0d4c17bb9e8ba6cff86de2ee7fb0241d5938a0b92606385a46d
7
+ data.tar.gz: 73cbfcdf850c08c2ac62e21eaaf34ef59c27f89384bb7b80ac93954d359191342c3ec9bbdec05feb9ba59167f49bed739b127c7b08c434ff4d977fd65a8824ea
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ ^���k��� �����Tt��z�\��L��A��+�
2
+ ٓa�{<�&�8�n�Ԯ��"s0�J�&����o�>�ԍ���*��d6s���������P�Q!�����q�Z:#0����d|Z{�e�}���K3j4��׾ *}��s
data/lib/kanban_txt.rb ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: kanban_txt.rb
4
+
5
+ require 'recordx'
6
+ require 'fileutils'
7
+
8
+
9
+ class KanbanTxt
10
+
11
+ attr_reader :to_s
12
+
13
+ def initialize(filename='kanban.txt', title: nil,
14
+ headings: ['Backlog', 'Todo', 'In progress', 'Done'], path: '.')
15
+
16
+ if title.nil? then
17
+ raise 'KanbanTxt: title: must be provided e.g. ' + \
18
+ 'KanbanTxt.new title: "project1"'
19
+ end
20
+
21
+ @filename, @path, @title, @headings = filename, path, title, headings
22
+ @keys = @headings.map{|x| x.downcase.gsub(/[\s\-_]/,'').to_sym}
23
+
24
+ fpath = File.join(path, filename)
25
+
26
+ if File.exists?(fpath) then
27
+
28
+ @rx = import_to_rx(File.read(fpath))
29
+
30
+ else
31
+ @rx = new_rx
32
+ end
33
+
34
+ end
35
+
36
+ def rx()
37
+ @rx
38
+ end
39
+
40
+ def save(filename=@filename)
41
+
42
+ File.write File.join(@path, filename), rx_to_s(@rx)
43
+
44
+ end
45
+
46
+ def to_s()
47
+ rx_to_s @rx
48
+ end
49
+
50
+ private
51
+
52
+ def archive()
53
+
54
+ # archive the daily planner
55
+ # e.g. kanban/gtk2html/2015/k121215.xml
56
+
57
+ archive_path = File.join(@path, @title, @d.year.to_s)
58
+ FileUtils.mkdir_p archive_path
59
+ filename = @d.strftime("k%d%m%Y.xml")
60
+
61
+ File.write File.join(archive_path, filename), rx.to_xml
62
+
63
+ end
64
+
65
+ def import_to_rx(s)
66
+
67
+ raw_rows = s.split(/.*(?=^[\w, ]+\n\-+)/)
68
+
69
+ raw_rows.shift
70
+ rows = raw_rows.map do |x|
71
+ a = x.lines
72
+ a.shift 2
73
+ a.join.strip
74
+ end
75
+
76
+ new_rx(@keys.zip(rows))
77
+
78
+ end
79
+
80
+ def rx_to_s(rx)
81
+
82
+ len = @headings.length
83
+ values = @rx.to_h.values[1..-1]
84
+ a = @headings.zip(values)
85
+
86
+ a2 = a.map do |title, value|
87
+ row = []
88
+ row << title + "\n" << '-' * title.length + ("\n\n" + value).rstrip + "\n"
89
+ row.join
90
+ end
91
+
92
+ "%s\n%s\n\n%s\n" % [@rx.title, '=' * rx.title.length, a2.join("\n")]
93
+
94
+ end
95
+
96
+ def new_rx(h=@keys.zip([''] * @headings.length))
97
+
98
+ title = @title + ' Kanban'
99
+ RecordX.new({title: title }.merge(Hash[h]))
100
+
101
+ end
102
+
103
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kanban_txt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADB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29
+ r88D27zOl01qBlTZx8EBg7Y15lIFe6A3DVFc9BVmiqJy1Z2+rHMh8+668RPSLd98
30
+ cNXlZKgRR8T6brZjO0EkcV8z5qr1RNv6l7gWAHs7t2k5hDrJrF08CYywCDUAEMqu
31
+ ZGMasogHFPcxiu8iC/NpWGYcSslPTXWu/XlGGG+6/93zA4r0ZM2VgT6NpvgVsP5E
32
+ RHbksmtUR7KDmw==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-12-12 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: recordx
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.2'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.2.4
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.2'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.2.4
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/kanban_txt.rb
63
+ homepage: https://github.com/jrobertson/kanban_txt
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.4.8
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Creates a kanban.txt template file
87
+ test_files: []
metadata.gz.sig ADDED
Binary file