activity-logger 0.1.15 → 0.2.1
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/activity-logger.rb +62 -4
- metadata +48 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ced3849f6d18699f5ddd6d27c2065b93ce46a68e
|
4
|
+
data.tar.gz: f84118d7be663e9f5f0526c0d8c89bc681445e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fa024b202510fa2906714517830653e2208202c779bd8cbe6c91b95f6ad0c1069f35ceb85d07d4d0c82c5651f66d36b3d56d8443dd66ace1b28ecea4137bb57
|
7
|
+
data.tar.gz: 38fe15d52f0f0b23caa243888bbaa9857533e027e4b42470627c967ffdea45165e57f02bb3d247e369aff391f0e61bf12ef59ecece62ca2d7b1a5b16d0954a53
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/activity-logger.rb
CHANGED
@@ -3,14 +3,27 @@
|
|
3
3
|
# file: activity-logger.rb
|
4
4
|
|
5
5
|
require 'dynarex-daily'
|
6
|
+
require 'simple-config'
|
6
7
|
|
7
8
|
class ActivityLogger
|
8
9
|
|
9
10
|
attr_writer :xml_instruction
|
10
11
|
|
11
|
-
def initialize(
|
12
|
+
def initialize(dir=nil, options={}, config: nil)
|
13
|
+
|
12
14
|
@options = options
|
13
|
-
|
15
|
+
@publish_html = false
|
16
|
+
|
17
|
+
|
18
|
+
if config then
|
19
|
+
|
20
|
+
h = SimpleConfig.new(config).to_h
|
21
|
+
dir, @urlbase, @edit_url, @css_url, @xsl_path = \
|
22
|
+
%i(dir urlbase edit_url css_url, xsl_path).map{|x| h[x]}
|
23
|
+
@publish_html = true
|
24
|
+
end
|
25
|
+
|
26
|
+
Dir.chdir(dir) if dir
|
14
27
|
end
|
15
28
|
|
16
29
|
def create(desc='', time=Time.now)
|
@@ -21,7 +34,12 @@ class ActivityLogger
|
|
21
34
|
|
22
35
|
ddaily.create(time: time.to_s, desc: desc)
|
23
36
|
ddaily.save
|
24
|
-
|
37
|
+
|
38
|
+
if @publish_html then
|
39
|
+
File.write 'index.txt', ddaily.to_s
|
40
|
+
save_html()
|
41
|
+
end
|
42
|
+
|
25
43
|
end
|
26
44
|
|
27
45
|
# Returns true if the time from the last entry exceeds 45 minutes.
|
@@ -34,5 +52,45 @@ class ActivityLogger
|
|
34
52
|
true
|
35
53
|
end
|
36
54
|
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def add(summary, name, s)
|
59
|
+
summary.add Rexle::Element.new(name).add_text s
|
60
|
+
end
|
61
|
+
|
62
|
+
def render_html(doc)
|
63
|
+
|
64
|
+
#lib = File.exists?('notices.xsl') ? '.' : File.dirname(__FILE__)
|
65
|
+
#xslt_buffer = File.read(File.join(lib,'notices.xsl'))
|
66
|
+
xslt_buffer = File.read @xsl_path
|
67
|
+
|
68
|
+
xslt = Nokogiri::XSLT(xslt_buffer)
|
69
|
+
out = xslt.transform(Nokogiri::XML(doc.xml))
|
70
|
+
File.write 'index.html', out
|
71
|
+
end
|
72
|
+
|
73
|
+
def save_html()
|
74
|
+
|
75
|
+
newfile = 'formatted.xml'
|
76
|
+
FileUtils.cp 'dynarexdaily.xml', newfile
|
77
|
+
doc = Rexle.new File.read(newfile)
|
78
|
+
|
79
|
+
summary = doc.root.element('summary')
|
80
|
+
|
81
|
+
add summary, 'edit_url', "%s/index.txt" % [@edit_url]
|
82
|
+
add summary, 'date', Date.today.strftime("%d-%b-%Y").upcase
|
83
|
+
add summary, 'css_url', @css_url
|
84
|
+
add summary, 'published', Time.now.strftime("%d-%m-%Y %H:%M")
|
85
|
+
|
86
|
+
doc.root.xpath('records/entry') do |entry|
|
87
|
+
|
88
|
+
e = entry.element('time')
|
89
|
+
e.text = Time.parse(e.text).strftime("%-l:%M%P")
|
90
|
+
end
|
91
|
+
|
92
|
+
File.write newfile, doc.xml(pretty: true)
|
93
|
+
render_html doc
|
94
|
+
end
|
37
95
|
|
38
|
-
end
|
96
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activity-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,41 +12,67 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE1MDMxODIwMzAwNFoXDTE2MDMxNzIwMzAwNFowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
ggEBAL/R2P2PD66LU56Jgo3VrK7mgAFCMxVWcY3lhDwQx4N8gMs5ta5sQTIB6g9b
|
19
|
+
iCqPXLqolRY+JMcUSjA7D99pEz47RywOlxh+0Mj4HJxIoZ8wQFFac6vvv2wPQzyw
|
20
|
+
VGdquD+onPDl+3KfrwpePmqDbv0viC1GRcZlYdfJ4I5oM1VnP11Y6crbmfU7vKuV
|
21
|
+
2mtUEEiChkNt3EUUQszuSgvJwnd+NnOv0489VWUZAvcEohy0jDqo4YAsBmnGAB5p
|
22
|
+
Hbm4G8viJ/HdLZ+HZPL3y1pI8g+5yZbD14wSnsafrU8hU8RfO5gITmdqFw/uINHt
|
23
|
+
XZL4oiWoBJRfil4NNqh/gguUkw8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUG2tX86Wh9NnfxWlgdtoYd7BYojkwJgYDVR0RBB8w
|
25
25
|
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAYd7ZV2SS
|
27
|
+
NHCYa+HMVZk0GJyucFWWYUdeP+JbapT5J6ywgHMDB9vso8vzVN5Ry+JVlJvH02Am
|
28
|
+
IjNZWfSWil09pVEp0rbj3lARB3fh+g8cPUnq/t8jWZJdveOmrbjraUT9362mokZz
|
29
|
+
vozMWUmStb3uYDcdnkps74GJ4P3b/sT1m76lZXtO+5ylNzOz69MF2oNZOnVcoPpE
|
30
|
+
CB4Tdhr9SQlxcvM1GVs2sqgkbrXIzCzWFVCyDKWtoZEwgjJh7/4ZGEJETIRZk+Sa
|
31
|
+
rOfBKWCXu0KP485R2A3y2ObqyYihhDjXF9hQVVvQ+nXiOv/HBLL1nFLCKE7iBKWk
|
32
|
+
zy/1qi4eXuuy7Q==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex-daily
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.13
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
40
53
|
- - ">="
|
41
54
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
55
|
+
version: 0.1.13
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: simple-config
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.3'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.3.0
|
43
66
|
type: :runtime
|
44
67
|
prerelease: false
|
45
68
|
version_requirements: !ruby/object:Gem::Requirement
|
46
69
|
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.3'
|
47
73
|
- - ">="
|
48
74
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
75
|
+
version: 0.3.0
|
50
76
|
description:
|
51
77
|
email: james@r0bertson.co.uk
|
52
78
|
executables: []
|
@@ -66,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
92
|
requirements:
|
67
93
|
- - ">="
|
68
94
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
95
|
+
version: 2.1.2
|
70
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
97
|
requirements:
|
72
98
|
- - ">="
|
@@ -74,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
100
|
version: '0'
|
75
101
|
requirements: []
|
76
102
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.4.6
|
78
104
|
signing_key:
|
79
105
|
specification_version: 4
|
80
|
-
summary:
|
106
|
+
summary: Uses the Dynarex-daily gem to log notices for the day
|
81
107
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|