monthly_planner 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a3fc602f1c0fd7b4811c6e734e9346d95e58fb05
4
+ data.tar.gz: bb270b8bbb7f0746b0c80607fa17e06051de4abf
5
+ SHA512:
6
+ metadata.gz: ad7a4fc71e41dffd962eb68e5f47e8456ec29858609d6ff8c1cbd6aaebd74fe85132cfbf37b5787f65f8657de7a98908fc0fa399bb9afa410ebf7f1724a12358
7
+ data.tar.gz: 00c663bb323a814597b902e4622323f282a676a9833e0337918ca7af2a9f01e7caab7c0d19ca41b16f6f110a6ec77f830f17b7992166cbc4034b168b3a4426d0
Binary file
Binary file
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: monthly_planner.rb
4
+
5
+ require 'date'
6
+ require 'dynarex'
7
+ require 'fileutils'
8
+
9
+
10
+
11
+ class MonthlyPlanner
12
+
13
+ attr_reader :to_s
14
+
15
+ def initialize(filename='monthly-planner.txt', path: '.')
16
+
17
+ @filename, @path = filename, path
18
+
19
+ fpath = File.join(path, filename)
20
+ @dx = new_dx
21
+ end
22
+
23
+ def dx()
24
+ @dx
25
+ end
26
+
27
+ def save(filename=@filename)
28
+
29
+ s = File.basename(filename) + "\n" + dx_to_s(@dx).lines[1..-1].join
30
+ File.write File.join(@path, filename), s
31
+ @dx.save File.join(@path, filename.sub(/\.txt$/,'.xml'))
32
+
33
+ end
34
+
35
+ def to_s()
36
+ dx_to_s @dx
37
+ end
38
+
39
+ private
40
+
41
+ def dx_to_s(dx)
42
+
43
+
44
+ rows = ['']
45
+ title = File.basename(@filename)
46
+ title + "\n" + "=" * title.length + "\n\n%s\n\n" % [rows.join("\n\n")]
47
+
48
+ end
49
+
50
+ def new_dx()
51
+
52
+ dx = Dynarex.new 'month[title]/day(date, desc, uid)'
53
+
54
+ d = DateTime.now.to_date
55
+ title = %i(itself next_month)\
56
+ .map {|x| d.method(x).call.strftime("%b")}.join(' - ')
57
+ dx.title = "Monthly Planner (%s)" % title
58
+
59
+ return dx
60
+ end
61
+
62
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: monthly_planner
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
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE2MDcyMjA5NTEyMloXDTE3MDcyMjA5NTEyMlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAL5gU54derKoIjlkW3PRF3Opa0w/FxjZ+S0AQ4+4OAj5VSneEG6vTC+LzR/P
19
+ +ao9VF5OiCjgw07klCedBqvz5AVKhIhj6hzcyYR7ync9NM6zyxeCSbKX8ZkyJs+o
20
+ Xz1UKmZ4CrjUQDZG9cWWDmXdG1Ir5EB0fn/fXwOW6no5uN8dvoL2mZ77b6zCrLKn
21
+ GCNAYt7qgmVyu0IpiwFrmLqCgB2HrXbQmzuSxZL7dxUGuZEm9OtQcRYEtjaKnhoZ
22
+ BTU+ZqTmHoyXQ5MH6n+BYpW8KVK/rCKyWNjV/A5Nsk9/XLMGXMc5RXcSroSyBmTl
23
+ cI/M70Ycv9D8AedDzoIA9dysdrMCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQU2Hp0hdrXHG4+9ieQXL5vQQuMCIkwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAir6PG3j1
27
+ 7nXC9DRoyDlmW00q5rSw5CjocQ9qWOQbpxcG0Z4+lDyazmzOQyJjtxYl0y9iazCS
28
+ MH0QnVjPu8mNeWfUBWTLLqyzxnMYHigJM2GClDOpO/iLL3JcBs3DCSS/mVYklK52
29
+ NPt27DWbi/Syt/p1B9MO2kDF1nrE+0HAqH2kJ5h0kDRTZxRcQPt8ajwYh5TNj49D
30
+ hg7lOXARJ25ZRpqqDltZTCD2v/e9eHd8RUXAjFpW0+L5uOJdojnN1CDHxSgNs87e
31
+ La10JAgwh3I97hV0e0ftxKgM9wPTv/1NX1ejKg4fj4f68cTSVJZTNJFFM2ljPCK1
32
+ 94ClrbJHIurLOQ==
33
+ -----END CERTIFICATE-----
34
+ date: 2016-07-22 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: dynarex
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.7'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.7.9
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.7'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.7.9
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/monthly_planner.rb
63
+ homepage: https://github.com/jrobertson/monthly_planner
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.5.1
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Stores upcoming dates for the month primarily in a plain text file
87
+ test_files: []
Binary file