activity-logger 0.2.1 → 0.3.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/activity-logger.rb +29 -11
- data/lib/notices.css +173 -0
- data/lib/notices.xsl +58 -0
- metadata +6 -4
- 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: 7c0f042f9d56c7ff8b76d47ee808a96541483c53
|
4
|
+
data.tar.gz: 8ce08b317021b4661e58a96ca4104c0464d195ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09dbc30e20a3f84f27e15e65848e08410e5622babd26455ab42fb7fc38669758c32cd9b661c069947fa42b5522004f73154384b50a29fad0cb1aec0622843210
|
7
|
+
data.tar.gz: 9da7ecc76803e661e3954e61c59bbefbb6b05cedefa91008e7b140b849139a01f82b45ed8297c40126fbd83dccebf2432e3ca4bc0d18e557489d0f01dd628656
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/activity-logger.rb
CHANGED
@@ -19,7 +19,7 @@ class ActivityLogger
|
|
19
19
|
|
20
20
|
h = SimpleConfig.new(config).to_h
|
21
21
|
dir, @urlbase, @edit_url, @css_url, @xsl_path = \
|
22
|
-
%i(dir urlbase edit_url css_url
|
22
|
+
%i(dir urlbase edit_url css_url xsl_path).map{|x| h[x]}
|
23
23
|
@publish_html = true
|
24
24
|
end
|
25
25
|
|
@@ -29,12 +29,11 @@ class ActivityLogger
|
|
29
29
|
def create(desc='', time=Time.now)
|
30
30
|
|
31
31
|
ddaily = DynarexDaily.new(nil, @options)
|
32
|
-
|
32
|
+
|
33
33
|
ddaily.xml_instruction = @xml_instruction
|
34
|
-
|
35
34
|
ddaily.create(time: time.to_s, desc: desc)
|
36
35
|
ddaily.save
|
37
|
-
|
36
|
+
|
38
37
|
if @publish_html then
|
39
38
|
File.write 'index.txt', ddaily.to_s
|
40
39
|
save_html()
|
@@ -61,12 +60,19 @@ class ActivityLogger
|
|
61
60
|
|
62
61
|
def render_html(doc)
|
63
62
|
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
xslt_buffer = if @xsl_path then
|
64
|
+
|
65
|
+
buffer, _ = RXFHelper.read @xsl_path
|
66
|
+
buffer
|
67
|
+
|
68
|
+
else
|
69
|
+
|
70
|
+
lib = File.exists?('notices.xsl') ? '.' : File.dirname(__FILE__)
|
71
|
+
File.read(File.join(lib,'notices.xsl'))
|
72
|
+
end
|
67
73
|
|
68
74
|
xslt = Nokogiri::XSLT(xslt_buffer)
|
69
|
-
out = xslt.transform(Nokogiri::XML(doc.xml))
|
75
|
+
out = xslt.transform(Nokogiri::XML(doc.xml))
|
70
76
|
File.write 'index.html', out
|
71
77
|
end
|
72
78
|
|
@@ -78,8 +84,10 @@ class ActivityLogger
|
|
78
84
|
|
79
85
|
summary = doc.root.element('summary')
|
80
86
|
|
81
|
-
|
82
|
-
add summary, 'date'
|
87
|
+
date = Date.today.strftime("%d-%b-%Y").upcase
|
88
|
+
add summary, 'title', date + ' Notices'
|
89
|
+
add summary, 'edit_url', @edit_url
|
90
|
+
summary.element('date').text = date
|
83
91
|
add summary, 'css_url', @css_url
|
84
92
|
add summary, 'published', Time.now.strftime("%d-%m-%Y %H:%M")
|
85
93
|
|
@@ -87,10 +95,20 @@ class ActivityLogger
|
|
87
95
|
|
88
96
|
e = entry.element('time')
|
89
97
|
e.text = Time.parse(e.text).strftime("%-l:%M%P")
|
98
|
+
desc = entry.element('desc')
|
99
|
+
desc.add Rexle.new("<span>%s</span>" % desc.text.unescape).root
|
100
|
+
desc.text = ''
|
90
101
|
end
|
91
102
|
|
92
103
|
File.write newfile, doc.xml(pretty: true)
|
93
104
|
render_html doc
|
105
|
+
|
106
|
+
# save the related CSS file locally if the file doesn't already exist
|
107
|
+
|
108
|
+
if not File.exists? 'notices.css' then
|
109
|
+
FileUtils.cp File.join(File.dirname(__FILE__), 'notices.css'),\
|
110
|
+
'notices.css'
|
111
|
+
end
|
94
112
|
end
|
95
113
|
|
96
|
-
end
|
114
|
+
end
|
data/lib/notices.css
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
body { background-color: #c48f33;}
|
2
|
+
|
3
|
+
|
4
|
+
header{
|
5
|
+
background-color: rgba(200,200,200,0.1);
|
6
|
+
border-top: 1px solid rgba(100,150,100,0.4);
|
7
|
+
border-bottom: 1px solid rgba(100,150,100,0.4);
|
8
|
+
overflow: hidden
|
9
|
+
margin: 0.3em; padding: 0.3em 0.1em;
|
10
|
+
}
|
11
|
+
|
12
|
+
header>nav:first-child>ul{
|
13
|
+
background-color: transparent;
|
14
|
+
list-style-type: none;
|
15
|
+
margin: 0.2em; padding: 0.3em;
|
16
|
+
}
|
17
|
+
header>nav:first-child>ul>li {
|
18
|
+
background-color: transparent;
|
19
|
+
color: #392;
|
20
|
+
display: inline;
|
21
|
+
font-family: Verdana, Arial;
|
22
|
+
font-size: 1em;
|
23
|
+
}
|
24
|
+
|
25
|
+
header>nav:first-child>ul>li~li:before {
|
26
|
+
background-color: transparent; color: rgba(100,150,100,0.6);
|
27
|
+
content: "> ";
|
28
|
+
}
|
29
|
+
header>nav>ul>li>a {background-color: tansparent; color: #494;}
|
30
|
+
header>nav>ul>li>a:hover {background-color: transparent; color: #272;}
|
31
|
+
header>nav>ul>li>a:focus {background-color: #161; color: #fff;}
|
32
|
+
header>nav>ul>li>a:active {background-color: rgba(200,200,200,0.4); color: #5a5;}
|
33
|
+
|
34
|
+
div {
|
35
|
+
background-color: #AFC332;
|
36
|
+
background-color: transparent;
|
37
|
+
background-color: rgba(255,255,255,0.2);
|
38
|
+
float: left;
|
39
|
+
min-height: 200px;
|
40
|
+
margin: 2em; 0.3em;
|
41
|
+
}
|
42
|
+
|
43
|
+
div ul {
|
44
|
+
|
45
|
+
|
46
|
+
background-color: #ee2;
|
47
|
+
background-color: transparent;
|
48
|
+
color: rgba(100,100,100,0.9);
|
49
|
+
list-style-type: none;
|
50
|
+
margin: 0.2em; padding: 0.5em;
|
51
|
+
}
|
52
|
+
|
53
|
+
div ul li{
|
54
|
+
|
55
|
+
background-color: #443;
|
56
|
+
background-color: rgba(255,255,255,0.2);
|
57
|
+
margin: 0.5em;
|
58
|
+
padding: 1em;
|
59
|
+
overflow: hidden;
|
60
|
+
}
|
61
|
+
|
62
|
+
div ul li time, div ul li span {
|
63
|
+
|
64
|
+
background-color: transparent;
|
65
|
+
}
|
66
|
+
|
67
|
+
div ul li time {
|
68
|
+
|
69
|
+
background-color: transparent;
|
70
|
+
background-color: rgba(255,255,255,0.2);
|
71
|
+
float: right;
|
72
|
+
margin: 0.3em; padding: 0.2em; 0.6em;
|
73
|
+
margin-top: 2em;
|
74
|
+
|
75
|
+
|
76
|
+
}
|
77
|
+
|
78
|
+
div ul li span {
|
79
|
+
|
80
|
+
background-color: transparent;
|
81
|
+
font-size: 1.4em;
|
82
|
+
float: left;
|
83
|
+
margin: 0.3em; padding: 0.6em;
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
aside {
|
89
|
+
|
90
|
+
background-color: transparent;
|
91
|
+
background-color: rgba(255,255,255,0.2);
|
92
|
+
float: left;
|
93
|
+
margin: 3em;
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
aside ul {
|
98
|
+
background-color: transparent;
|
99
|
+
list-style-type: none;
|
100
|
+
margin: 0.4em 0.7em;
|
101
|
+
padding: 0.6em 0.9em;
|
102
|
+
color: #c48f33;
|
103
|
+
}
|
104
|
+
|
105
|
+
aside ul li {
|
106
|
+
background-color: transparent;
|
107
|
+
|
108
|
+
|
109
|
+
font-family: helvetica, arial;
|
110
|
+
font-size: 1.6em;
|
111
|
+
font-weight: 900;
|
112
|
+
|
113
|
+
margin: 0.4em;
|
114
|
+
padding: 0.9em;
|
115
|
+
text-align: center;
|
116
|
+
}
|
117
|
+
|
118
|
+
aside ul li a{
|
119
|
+
background-color: transparent;
|
120
|
+
color: rgba(100,100,100,0.4);
|
121
|
+
text-decoration: none;
|
122
|
+
}
|
123
|
+
|
124
|
+
aside ul li a:hover {
|
125
|
+
background-color: rgba(100, 100, 100, 0.5);
|
126
|
+
color: #eee;
|
127
|
+
text-decoration: none;
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
footer{
|
132
|
+
background-color: rgba(255,255,255,0.2);
|
133
|
+
clear: both;
|
134
|
+
}
|
135
|
+
|
136
|
+
footer>dl#info{
|
137
|
+
background-color: transparent;
|
138
|
+
|
139
|
+
margin: 1.9em 0 0 0; padding: 2em;
|
140
|
+
width: 33em;
|
141
|
+
overflow: hidden;
|
142
|
+
}
|
143
|
+
|
144
|
+
footer>dl#info{
|
145
|
+
background-color: transparent;
|
146
|
+
margin: 4.1em 0 0.1em 0;
|
147
|
+
}
|
148
|
+
footer>dl#info dt{
|
149
|
+
background-color: transparent;
|
150
|
+
float: left;
|
151
|
+
font:15px arial,sans-serif;
|
152
|
+
padding: 0.2em 0;
|
153
|
+
margin: 0.1em 0 0.1em 0;
|
154
|
+
text-align: left;
|
155
|
+
width: 4.8em;
|
156
|
+
}
|
157
|
+
footer>dl#info dd{
|
158
|
+
background-color: transparent;
|
159
|
+
float: left;
|
160
|
+
margin: 0.1em 0; padding: 0.2em 0.2em;
|
161
|
+
width: 27em;
|
162
|
+
}
|
163
|
+
footer>dl#info ul{
|
164
|
+
background-color: transparent;
|
165
|
+
list-style-type: none;
|
166
|
+
margin: 0 0em; padding: 0 0em;
|
167
|
+
}
|
168
|
+
dl#info ul li {
|
169
|
+
background-color: transparent;
|
170
|
+
float: left;
|
171
|
+
padding: 0em 0.5em 0 0;
|
172
|
+
margin: 0em;
|
173
|
+
}
|
data/lib/notices.xsl
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
3
|
+
<xsl:output method="html" encoding="utf-8" indent="yes" />
|
4
|
+
|
5
|
+
<xsl:template match="*">
|
6
|
+
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>
|
7
|
+
<html>
|
8
|
+
<head>
|
9
|
+
<title><xsl:value-of select='summary/title'/></title>
|
10
|
+
<link rel='stylesheet' type='text/css' href='{summary/css_url}' media='screen, projection, tv, print'/>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<header>
|
15
|
+
<nav>
|
16
|
+
<ul>
|
17
|
+
<li>
|
18
|
+
<a href="/">home</a>
|
19
|
+
</li>
|
20
|
+
<li>
|
21
|
+
<a href="/notices">notices</a>
|
22
|
+
</li>
|
23
|
+
</ul>
|
24
|
+
</nav>
|
25
|
+
</header>
|
26
|
+
|
27
|
+
<div>
|
28
|
+
<ul>
|
29
|
+
<xsl:for-each select="records/entry">
|
30
|
+
<li>
|
31
|
+
<xsl:copy-of select='desc/span'/>
|
32
|
+
<time><xsl:value-of select='time'/></time>
|
33
|
+
</li>
|
34
|
+
</xsl:for-each>
|
35
|
+
</ul>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<aside>
|
39
|
+
<ul>
|
40
|
+
<li><xsl:value-of select='summary/date'/></li>
|
41
|
+
<li>
|
42
|
+
<a href="{summary/edit_url}" rel="nofollow">edit</a>
|
43
|
+
</li>
|
44
|
+
</ul>
|
45
|
+
</aside>
|
46
|
+
|
47
|
+
<footer>
|
48
|
+
<dl id="info">
|
49
|
+
<dt>Source:</dt><dd><a href="index.txt">index.txt</a></dd>
|
50
|
+
<dt>XML:</dt><dd><a href="formatted.xml">formatted.xml</a></dd>
|
51
|
+
<dt>Published:</dt><dd><xsl:value-of select="summary/published"/></dd>
|
52
|
+
</dl>
|
53
|
+
</footer>
|
54
|
+
|
55
|
+
</body>
|
56
|
+
</html>
|
57
|
+
</xsl:template>
|
58
|
+
</xsl:stylesheet>
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
rOfBKWCXu0KP485R2A3y2ObqyYihhDjXF9hQVVvQ+nXiOv/HBLL1nFLCKE7iBKWk
|
32
32
|
zy/1qi4eXuuy7Q==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-03-
|
34
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex-daily
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
version: '0.1'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.1.
|
45
|
+
version: 0.1.14
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
version: '0.1'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.1.
|
55
|
+
version: 0.1.14
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: simple-config
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,8 @@ extensions: []
|
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
82
|
- lib/activity-logger.rb
|
83
|
+
- lib/notices.css
|
84
|
+
- lib/notices.xsl
|
83
85
|
homepage: https://github.com/jrobertson/activity-logger
|
84
86
|
licenses:
|
85
87
|
- MIT
|
metadata.gz.sig
CHANGED
Binary file
|