daily_notices 0.3.1 → 0.3.2

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: bccd964903ac3707b5d50a1954889c7314604011
4
- data.tar.gz: 97be3e1aa6b9d26ee7f0caac31a366e719552638
3
+ metadata.gz: 2d0956e4f9e411ea2bdf4331054c2400a291f976
4
+ data.tar.gz: 899c4017cbdd20fb2c862336f3544ca090962749
5
5
  SHA512:
6
- metadata.gz: 16e1da1acb6a7d8138f555b04b11564b2f7a6018c9af5836ed35efce0a8c0fec1ed493417fb934000e0d2b37161e3f93cfb1b3e833877eae66c2b3b49673d554
7
- data.tar.gz: 22a80c9e7cf448b9e756012b5ef60a0ac85e62a8b200184a96249d5399f23abb84747339c4f6076fd5a9f1d6180302b9fc79f497ee21afb9af29b74930f395f4
6
+ metadata.gz: 58d380acca57875fed773a723e668139b62f5b752f738f5a36a7b91ba6db00d4f82769bbf03b92c1579cf7ba4f4d199616dbf9d275204baf0ebf80e526baf4c2
7
+ data.tar.gz: caeb891075d3d18c98334f622fb05d57a9e6777541ad9abbb7c2ee9bf98c7e752269ae861395f6f3492d0dc6ac518efec981d972c8389da11e4f2b1c7b8db749
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/daily_notices.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # file: daily_notices.rb
4
4
 
5
5
 
6
+ require 'dx_sliml'
6
7
  require 'rss_creator'
7
8
  require 'fileutils'
8
9
 
@@ -21,6 +22,19 @@ class DailyNotices
21
22
  @schema ||= 'items/item(description, time)'
22
23
  @default_key ||= 'uid'
23
24
 
25
+ if dx_xslt.nil? then
26
+
27
+ subdir = File.basename filepath
28
+ dir = url_base[/http:\/\/[^\/]+\/(.*)/,1]
29
+
30
+ dxxsltfilename = "dx#{Time.now.to_i.to_s}.xsl"
31
+ dxxsltfilepath = '/' + [dir, subdir, dxxsltfilename].join('/')
32
+ File.write File.join(filepath, dxxsltfilename), \
33
+ DxSliml.new(dx: @schema).to_xslt
34
+
35
+ @dx_xslt = dxxsltfilepath
36
+ end
37
+
24
38
  @day = Time.now.day
25
39
  new_day()
26
40
 
@@ -65,7 +79,7 @@ class DailyNotices
65
79
  @dx.to_html(domain: @url_base)
66
80
  else
67
81
 
68
- target_path = File.join(@filepath, @archive_path, '#' + id, 'index.html')
82
+ target_path = File.join(@filepath, @archive_path, id, 'index.html')
69
83
  FileUtils.mkdir_p File.dirname(target_path)
70
84
  rx = @dx.find(id)
71
85
 
@@ -82,8 +96,8 @@ class DailyNotices
82
96
 
83
97
  # Add it to the RSS document
84
98
  title ||= description.split(/\n/,2).first[0..140]
85
- link = [File.join(@url_base, File.basename(@filepath), \
86
- @archive_path, id)].join('/')
99
+ link = create_link(id)
100
+
87
101
  @rss.add( {title: title, link: link, description: description}, id: id)
88
102
  @rss.save @rssfile
89
103
 
@@ -124,10 +138,15 @@ class DailyNotices
124
138
 
125
139
  yield(xmlpath, id) if block_given?
126
140
 
127
- end
141
+ end
128
142
 
129
143
  private
130
144
 
145
+ def create_link(id)
146
+ [File.join(@url_base, File.basename(@filepath), \
147
+ @archive_path, '#' + id)].join('/')
148
+ end
149
+
131
150
  # configures the target page (using a Dynarex document) for a new day
132
151
  #
133
152
  def new_day()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daily_notices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  6KZopP6uiDZcPfIWtD5QSbhxe2cyGqlu4Xnb4imiAb9DWj8g5YP45vWTp1a71ytC
32
32
  TGdJpNvN31W5+w==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-11-01 00:00:00.000000000 Z
34
+ date: 2015-11-02 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rss_creator
@@ -53,6 +53,26 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.2.7
56
+ - !ruby/object:Gem::Dependency
57
+ name: dx_sliml
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.1'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.1.6
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.1'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.6
56
76
  description:
57
77
  email: james@r0bertson.co.uk
58
78
  executables: []
metadata.gz.sig CHANGED
Binary file