mymedia-pages 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89f8c997b5dd0bde2f3a98b90f40329891888113
4
- data.tar.gz: 6a8956160a8416c3781873e02f747b3a686c9b5c
3
+ metadata.gz: b15f19822509733aa65c31a7fea3a55c1c6983b2
4
+ data.tar.gz: 0fe7c67942ed134abf13e991257aec981d8d7969
5
5
  SHA512:
6
- metadata.gz: 14cd28b7ef656821c45d27e7a01079250a6a1490b8e1d2aff3f8e8b4b36c0df9ceaac3cd37d3c410bf807b72c04eeccb265628b7fbc990fa360111ccafbb2d37
7
- data.tar.gz: 6fa0988c11cc2e2547ae0b4a137e674a56b0fb1a67067f3d3921af997cc39f2d9cd6374d171a52d37f0f18136630cb8bcb2b6f7a3196c159892db2354d3af9a6
6
+ metadata.gz: e8bbacbba3be319ae6c0a6440ba4fc551017a82fe8fab1851c71b4327216cab819ad46db5b9fac2a4cb5c3e0669a6b9f5c6eea94c76df36f7aaee1b912792fb3
7
+ data.tar.gz: 5c7edaf55572f4dc2e6e6174a98c00562ef1c9aac7d744dd41fe4ee0daf69f10652cd919d3e5452eabe252a07c90f719dc6f8af3a4dbde25e005e5f5c76afcda
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mymedia-pages.rb CHANGED
@@ -3,15 +3,17 @@
3
3
  # file: mymedia-pages.rb
4
4
 
5
5
 
6
- require 'mymedia-blogbase'
6
+ require 'mymedia'
7
7
 
8
8
 
9
9
  class MyMediaPages < MyMedia::Base
10
10
 
11
- def initialize(config: nil)
11
+ def initialize(media_type: media_type='pages',
12
+ public_type: @public_type=media_type, ext: '.(html|md|txt)',config: nil)
12
13
 
13
- super(media_type: 'pages', public_type: @public_type='pages', ext: '.(html|md|txt)', config: config)
14
- @media_src = "%s/media/pages" % @home
14
+ super(media_type: media_type, public_type: @public_type=media_type,
15
+ ext: '.(html|md|txt)', config: config)
16
+ @media_src = "%s/media/%s" % [@home, media_type]
15
17
  @target_ext = '.html'
16
18
  @static_html = true
17
19
 
@@ -22,7 +24,7 @@ class MyMediaPages < MyMedia::Base
22
24
  @filename = filename
23
25
  src_path = File.join(@media_src, filename)
24
26
 
25
- if File.basename(src_path)[/[pw]\d{6}T\d{4}\.(?:html)/] then
27
+ if File.basename(src_path)[/[pwn]\d{6}T\d{4}\.(?:html)/] then
26
28
  return file_publish(src_path, raw_msg)
27
29
  end
28
30
 
@@ -62,15 +64,22 @@ class MyMediaPages < MyMedia::Base
62
64
  File.write destination,
63
65
  Nokogiri::XSLT(xsl).transform(Nokogiri::XML(File.read dest_xml))
64
66
 
67
+ html_filename = File.basename(src_path).sub(/(?:md|txt)$/,'html')
68
+ xml_filename = html_filename.sub(/html$/,'xml')
69
+ FileUtils.cp destination, File.dirname(destination) + html_filename
70
+ FileUtils.cp dest_xml, File.dirname(dest_xml) + xml_filename
71
+
72
+
73
+ #target_url = [@website, @public_type, html_filename].join('/')
74
+
65
75
  else
66
76
  FileUtils.cp src_path, destination
67
77
  FileUtils.cp src_path, raw_destination
68
78
  end
69
79
 
70
- if not File.basename(src_path)[/[pw]\d{6}T\d{4}\.(?:html|md|txt)/] then
80
+ if not File.basename(src_path)[/[pwn]\d{6}T\d{4}\.(?:html|md|txt)/] then
71
81
 
72
- html_filename = File.basename(src_path).sub(/(?:md|txt)$/,'html')
73
- xml_filename = html_filename.sub(/html$/,'xml')
82
+
74
83
 
75
84
  FileUtils.cp destination, @home + "/#{@public_type}/" + html_filename
76
85
  FileUtils.cp dest_xml, @home + "/#{@public_type}/" + xml_filename
@@ -83,13 +92,14 @@ class MyMediaPages < MyMedia::Base
83
92
  target_url = [@website, @public_type, x_filename].join('/')
84
93
 
85
94
  publish_dynarex(static_filepath, {title: x_filename, url: target_url })
86
-
87
- tags = doc.root.xpath('summary/tags/tag/text()')
88
-
89
- raw_msg = "%s %s" % [doc.root.text('summary/title'),
90
- tags.map {|x| "#%s" % x }.join]
95
+
91
96
 
92
97
  end
98
+
99
+ tags = doc.root.xpath('summary/tags/tag/text()')
100
+
101
+ raw_msg = "%s %s" % [doc.root.text('summary/title'),
102
+ tags.map {|x| "#%s" % x }.join]
93
103
 
94
104
  [raw_msg, target_url]
95
105
  end
@@ -143,7 +153,8 @@ class MyMediaPages < MyMedia::Base
143
153
 
144
154
  doc = docx.clone
145
155
  raw_msg = microblog_title(doc)
146
- doc.instructions.push %w(xml-stylesheet title='XSL_formatting' type='text/xsl') + ["href='#{@website}/#{xslpath}xsl/#{@public_type}.xsl'"]
156
+ doc.instructions.push %w(xml-stylesheet title='XSL_formatting' type='text/xsl') \
157
+ + ["href='#{@website}/#{xslpath}xsl/#{@public_type}.xsl'"]
147
158
  doc = yield(doc) if block_given?
148
159
  File.write filepath, doc.xml(pretty: true)
149
160
  end
@@ -180,13 +191,14 @@ class MyMediaPages < MyMedia::Base
180
191
  xml.source_file File.basename(filename)
181
192
  xml.original_file original_file
182
193
  xml.published Time.now.strftime("%d-%m-%Y %H:%M")
194
+ xml.filetitle original_file[/.*(?=\.\w+$)/]
183
195
  end
184
196
 
185
197
  xml.body body
186
198
  end
187
199
 
188
200
  rescue
189
- @logger.debug "mymedia-blogbase.rb: html: " + ($!).to_s
201
+ @logger.debug "mymedia-pages.rb: html: " + ($!).to_s
190
202
  end
191
203
 
192
204
  return Rexle.new(a)
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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,10 +31,10 @@ cert_chain:
31
31
  R8qQYTqUH5uyN1gXTamDXNnXrSWNIRgATqBFU0Rk4ia1O2X6/oMnJctbKR+A3n78
32
32
  zZLvJwXE0u524g==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-10-13 00:00:00.000000000 Z
34
+ date: 2014-10-14 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
- name: mymedia-blogbase
37
+ name: mymedia
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '0.1'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.1.0
45
+ version: 0.1.1
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.0
55
+ version: 0.1.1
56
56
  description:
57
57
  email: james@r0bertson.co.uk
58
58
  executables: []
metadata.gz.sig CHANGED
Binary file