mymedia-pages 0.4.0 → 0.5.0

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
  SHA256:
3
- metadata.gz: b0c08643b6ed8f8d1d995683aaa991064cd2257a3f1dec07025f26d0536e281d
4
- data.tar.gz: 1e75399e2f80fef5212540d456e7ac905cd91a14de65ed77d6d401d0bc83db2c
3
+ metadata.gz: d4fda1001262e23054bd48053370ba0577692694e721cf0eccb8b81ca0f118ac
4
+ data.tar.gz: e53e008532a3885c05856a59857690b068643b60ea2dece53fc87aa4321cf850
5
5
  SHA512:
6
- metadata.gz: 23195bd7994a9f2cdb40c2eab3373c89e8e20708e4f5ff055fa0def6ff7c93f178ba426aa1374a07cc5ca217e04d0905e9416d0e523611fae2c87ee989a9045a
7
- data.tar.gz: 5acb6b674ce42dd2857d4316918c979ab5fab6ce419aee51b0ce15b321cd0c8a9320cb8719104577a4a1f072d5cfb9c9c8cc238e5da8ff068c0adcd2feb1eb5e
6
+ metadata.gz: c03f7c0dacd88b16b08b2b7ae235529c13f3f1a22de2fec257e68bf9262a7fa14610c968861bb760d9edb8f233cac9a2e25986adfc9a114ae2ea39df42e7c872
7
+ data.tar.gz: a0b539bdfd82ac378893397d3f4c5abb1106c6449c131d28a0c097f6998b6b35c6f53b6d43c37b5a3a0272e14d4fb4f8a6d4c4a6fcaea1b2ab3bf9b65bdef8f6
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mymedia-pages.rb CHANGED
@@ -9,17 +9,18 @@ require 'kramdown'
9
9
 
10
10
 
11
11
  module PageReader
12
+ include RXFHelperModule
12
13
 
13
14
  # read the source file
14
15
  #
15
16
  def read(filename)
16
- File.read File.join(@media_src, escape(filename))
17
+ FileX.read File.join(@media_src, escape(filename))
17
18
  end
18
19
 
19
20
  # view the published file
20
21
  #
21
22
  def view(filename)
22
- File.read File.join(@home, @public_type, filename)
23
+ FileX.read File.join(@home, @public_type, filename)
23
24
  end
24
25
 
25
26
  end
@@ -28,6 +29,7 @@ class MyMediaPagesError < Exception
28
29
  end
29
30
 
30
31
  class MyMediaPages < MyMedia::Base
32
+ include RXFHelperModule
31
33
  include MyMedia::IndexReader
32
34
  include PageReader
33
35
 
@@ -65,13 +67,13 @@ class MyMediaPages < MyMedia::Base
65
67
  x_destination = raw_destination.sub(/\.html$/,ext)
66
68
 
67
69
 
68
- FileUtils.cp src_path, x_destination
70
+ FileX.cp src_path, x_destination
69
71
 
70
72
  source = x_destination[/\/r\/#{@public_type}.*/]
71
73
  s = @website + source
72
74
 
73
75
  relative_path = s[/https?:\/\/[^\/]+([^$]+)/,1]
74
- src_content = File.read src_path
76
+ src_content = FileX.read src_path
75
77
  doc = xml(src_content, relative_path, filename)
76
78
 
77
79
  return unless doc
@@ -81,20 +83,20 @@ class MyMediaPages < MyMedia::Base
81
83
 
82
84
  @log.info 'mymedia_pages/copy_publish: after modify_xml' if @log
83
85
 
84
- File.write raw_destination, xsltproc("#{@home}/r/xsl/#{@public_type}.xsl", raw_dest_xml)
86
+ FileX.write raw_destination, xsltproc("#{@home}/r/xsl/#{@public_type}.xsl", raw_dest_xml)
85
87
 
86
- File.write destination, xsltproc("#{@home}/#{@www}/xsl/#{@public_type}.xsl", dest_xml)
88
+ FileX.write destination, xsltproc("#{@home}/#{@www}/xsl/#{@public_type}.xsl", dest_xml)
87
89
 
88
90
  html_filename = basename(@media_src, src_path).sub(/(?:md|txt)$/,'html')
89
91
 
90
92
 
91
93
  xml_filename = html_filename.sub(/html$/,'xml')
92
94
 
93
- FileUtils.mkdir_p File.dirname(File.join(File.dirname(destination), html_filename))
94
- FileUtils.cp destination, File.join(File.dirname(destination), html_filename)
95
+ FileX.mkdir_p File.dirname(File.join(File.dirname(destination), html_filename))
96
+ FileX.cp destination, File.join(File.dirname(destination), html_filename)
95
97
 
96
- FileUtils.mkdir_p File.dirname( File.join(File.dirname(dest_xml), xml_filename))
97
- FileUtils.cp dest_xml, File.join(File.dirname(dest_xml), xml_filename)
98
+ FileX.mkdir_p File.dirname( File.join(File.dirname(dest_xml), xml_filename))
99
+ FileX.cp dest_xml, File.join(File.dirname(dest_xml), xml_filename)
98
100
 
99
101
  tags = doc.root.xpath('summary/tags/tag/text()')
100
102
  raw_msg = "%s %s" % [doc.root.text('summary/title'),
@@ -109,11 +111,11 @@ class MyMediaPages < MyMedia::Base
109
111
  html_filename = basename(@media_src, src_path)
110
112
 
111
113
  if html_filename =~ /\// then
112
- FileUtils.mkdir_p File.dirname(html_filename)
114
+ FileX.mkdir_p File.dirname(html_filename)
113
115
  end
114
116
 
115
- FileUtils.cp src_path, destination
116
- FileUtils.cp src_path, raw_destination
117
+ FileX.cp src_path, destination
118
+ FileX.cp src_path, raw_destination
117
119
 
118
120
  raw_msg = File.read(destination)[/<title>([^<]+)<\/title>/,1]
119
121
  end
@@ -121,8 +123,8 @@ class MyMediaPages < MyMedia::Base
121
123
  if not File.basename(src_path)[/[a-z]\d{6}T\d{4}\.(?:html|md|txt)/] then
122
124
 
123
125
  @log.info 'MyMediaPages::copy_publish before FileUtils' if @log
124
- FileUtils.mkdir_p File.dirname(@home + "/#{@public_type}/" + html_filename)
125
- FileUtils.cp destination, @home + "/#{@public_type}/" + html_filename
126
+ FileX.mkdir_p File.dirname(@home + "/#{@public_type}/" + html_filename)
127
+ FileX.cp destination, @home + "/#{@public_type}/" + html_filename
126
128
 
127
129
  if xml_filename then
128
130
  FileUtils.cp dest_xml, @home + "/#{@public_type}/" + xml_filename
@@ -206,7 +208,7 @@ class MyMediaPages < MyMedia::Base
206
208
  + ["href='#{@website}/#{xslpath}xsl/#{@public_type}.xsl'"]
207
209
 
208
210
  yield(doc) if block_given?
209
- File.write filepath, doc.xml(declaration: true, pretty: false)
211
+ FileX.write filepath, doc.xml(declaration: true, pretty: false)
210
212
  end
211
213
 
212
214
  def xml(raw_buffer, filename, original_file)
@@ -266,6 +268,6 @@ class MyMediaPages < MyMedia::Base
266
268
  def xsltproc(xslpath, xmlpath)
267
269
 
268
270
  Nokogiri::XSLT(File.open(xslpath))\
269
- .transform(Nokogiri::XML(File.open(xmlpath))).to_xhtml(indent: 0)
271
+ .transform(Nokogiri::XML(FileX.read(xmlpath))).to_xhtml(indent: 0)
270
272
  end
271
273
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mymedia-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  jSG8iFV4kJofCyHyfW6zyZy0d22o23Syxam2rIESaal2RPL7gADDTc8XBe/sFeWr
36
36
  A7Ido2/5qg5YDVloSOHTfzZj
37
37
  -----END CERTIFICATE-----
38
- date: 2022-02-03 00:00:00.000000000 Z
38
+ date: 2022-02-04 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: mymedia
@@ -43,20 +43,20 @@ dependencies:
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 0.3.0
46
+ version: 0.4.0
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0.3'
49
+ version: '0.4'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 0.3.0
56
+ version: 0.4.0
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '0.3'
59
+ version: '0.4'
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: martile
62
62
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file