sisu 7.0.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 +7 -0
- data/bin/sisu +367 -0
- data/bin/sisugem +367 -0
- data/data/sisu/image/arrow_next_red.png +0 -0
- data/data/sisu/image/arrow_prev_red.png +0 -0
- data/data/sisu/image/arrow_up_red.png +0 -0
- data/data/sisu/image/b_bluebell.png +0 -0
- data/data/sisu/image/b_doc.png +0 -0
- data/data/sisu/image/b_epub.png +0 -0
- data/data/sisu/image/b_home.png +0 -0
- data/data/sisu/image/b_info.png +0 -0
- data/data/sisu/image/b_odf.png +0 -0
- data/data/sisu/image/b_pdf.png +0 -0
- data/data/sisu/image/b_search.png +0 -0
- data/data/sisu/image/b_toc.png +0 -0
- data/data/sisu/image/bullet_08.png +0 -0
- data/data/sisu/image/bullet_09.png +0 -0
- data/data/sisu/image/bullet_10.png +0 -0
- data/data/sisu/image/bullet_11.png +0 -0
- data/data/sisu/image/bullet_12.png +0 -0
- data/data/sisu/image/bullet_doc.png +0 -0
- data/data/sisu/image/bullet_red.png +0 -0
- data/data/sisu/image/dot_clear.png +0 -0
- data/data/sisu/image/dot_white.png +0 -0
- data/data/sisu/image/gplv3.png +0 -0
- data/data/sisu/image/gplv3_free_software.png +0 -0
- data/data/sisu/image/next.png +0 -0
- data/data/sisu/image/previous.png +0 -0
- data/data/sisu/image/rb7.ico +0 -0
- data/data/sisu/image/sisu.png +0 -0
- data/data/sisu/image/toctoc.png +0 -0
- data/data/sisu/version.yml +5 -0
- data/lib/sisu.rb +94 -0
- data/lib/sisu/air.rb +80 -0
- data/lib/sisu/ao.rb +590 -0
- data/lib/sisu/ao_character_check.rb +102 -0
- data/lib/sisu/ao_composite.rb +286 -0
- data/lib/sisu/ao_doc_objects.rb +565 -0
- data/lib/sisu/ao_doc_str.rb +2269 -0
- data/lib/sisu/ao_endnotes.rb +136 -0
- data/lib/sisu/ao_expand_insertions.rb +514 -0
- data/lib/sisu/ao_hash_digest.rb +174 -0
- data/lib/sisu/ao_idx.rb +422 -0
- data/lib/sisu/ao_images.rb +187 -0
- data/lib/sisu/ao_metadata.rb +86 -0
- data/lib/sisu/ao_misc_arrange.rb +207 -0
- data/lib/sisu/ao_numbering.rb +720 -0
- data/lib/sisu/ao_persist.rb +194 -0
- data/lib/sisu/ao_references.rb +502 -0
- data/lib/sisu/ao_syntax.rb +640 -0
- data/lib/sisu/cgi.rb +84 -0
- data/lib/sisu/cgi_pgsql.rb +270 -0
- data/lib/sisu/cgi_sql_common.rb +986 -0
- data/lib/sisu/cgi_sqlite.rb +244 -0
- data/lib/sisu/conf.rb +287 -0
- data/lib/sisu/constants.rb +388 -0
- data/lib/sisu/css.rb +3484 -0
- data/lib/sisu/db_columns.rb +1997 -0
- data/lib/sisu/db_create.rb +689 -0
- data/lib/sisu/db_dbi.rb +90 -0
- data/lib/sisu/db_drop.rb +207 -0
- data/lib/sisu/db_import.rb +877 -0
- data/lib/sisu/db_indexes.rb +146 -0
- data/lib/sisu/db_load_tuple.rb +323 -0
- data/lib/sisu/db_remove.rb +182 -0
- data/lib/sisu/db_select.rb +230 -0
- data/lib/sisu/db_sqltxt.rb +173 -0
- data/lib/sisu/db_tests.rb +114 -0
- data/lib/sisu/dbi.rb +166 -0
- data/lib/sisu/dbi_discrete.rb +206 -0
- data/lib/sisu/digests.rb +306 -0
- data/lib/sisu/dp.rb +1606 -0
- data/lib/sisu/dp_identify_markup.rb +161 -0
- data/lib/sisu/dp_make.rb +668 -0
- data/lib/sisu/embedded.rb +149 -0
- data/lib/sisu/errors.rb +84 -0
- data/lib/sisu/generic_parts.rb +131 -0
- data/lib/sisu/git.rb +277 -0
- data/lib/sisu/html.rb +775 -0
- data/lib/sisu/html_concordance.rb +391 -0
- data/lib/sisu/html_format.rb +1348 -0
- data/lib/sisu/html_harvest.rb +109 -0
- data/lib/sisu/html_harvest_author_format.rb +111 -0
- data/lib/sisu/html_harvest_authors.rb +466 -0
- data/lib/sisu/html_harvest_topics.rb +893 -0
- data/lib/sisu/html_lite_shared.rb +324 -0
- data/lib/sisu/html_manifest.rb +1032 -0
- data/lib/sisu/html_minitoc.rb +230 -0
- data/lib/sisu/html_parts.rb +437 -0
- data/lib/sisu/html_persist.rb +237 -0
- data/lib/sisu/html_promo.rb +440 -0
- data/lib/sisu/html_scroll.rb +235 -0
- data/lib/sisu/html_segments.rb +716 -0
- data/lib/sisu/html_shared.rb +62 -0
- data/lib/sisu/html_table.rb +64 -0
- data/lib/sisu/html_tune.rb +301 -0
- data/lib/sisu/hub.rb +277 -0
- data/lib/sisu/hub_actions.rb +1122 -0
- data/lib/sisu/hub_loop_markup_files.rb +170 -0
- data/lib/sisu/hub_options.rb +1695 -0
- data/lib/sisu/i18n.rb +702 -0
- data/lib/sisu/manpage.rb +377 -0
- data/lib/sisu/manpage_format.rb +85 -0
- data/lib/sisu/object_munge.rb +307 -0
- data/lib/sisu/prog_text_translation.rb +1702 -0
- data/lib/sisu/qrcode.rb +754 -0
- data/lib/sisu/relaxng.rb +1153 -0
- data/lib/sisu/remote.rb +246 -0
- data/lib/sisu/rexml.rb +148 -0
- data/lib/sisu/se.rb +158 -0
- data/lib/sisu/se_cleanoutput.rb +145 -0
- data/lib/sisu/se_clear.rb +105 -0
- data/lib/sisu/se_createsite.rb +273 -0
- data/lib/sisu/se_css.rb +221 -0
- data/lib/sisu/se_date.rb +92 -0
- data/lib/sisu/se_db.rb +214 -0
- data/lib/sisu/se_envcall.rb +326 -0
- data/lib/sisu/se_file_op.rb +2758 -0
- data/lib/sisu/se_filemap.rb +247 -0
- data/lib/sisu/se_get_init.rb +238 -0
- data/lib/sisu/se_hub_particulars.rb +234 -0
- data/lib/sisu/se_info_env.rb +2179 -0
- data/lib/sisu/se_info_port.rb +70 -0
- data/lib/sisu/se_info_system.rb +202 -0
- data/lib/sisu/se_load.rb +108 -0
- data/lib/sisu/se_processing.rb +659 -0
- data/lib/sisu/se_programs.rb +394 -0
- data/lib/sisu/se_remotes.rb +553 -0
- data/lib/sisu/se_standardise_lang.rb +176 -0
- data/lib/sisu/se_version.rb +174 -0
- data/lib/sisu/shared_images.rb +137 -0
- data/lib/sisu/shared_markup_alt.rb +336 -0
- data/lib/sisu/shared_metadata.rb +1361 -0
- data/lib/sisu/shared_sem.rb +156 -0
- data/lib/sisu/sisu_thor_lib.rb +407 -0
- data/lib/sisu/sitemaps.rb +224 -0
- data/lib/sisu/src_kdissert_share.rb +102 -0
- data/lib/sisu/src_po4a_share.rb +309 -0
- data/lib/sisu/src_po4a_shelf.rb +1217 -0
- data/lib/sisu/src_po4a_shelf_set.rb +297 -0
- data/lib/sisu/src_po4a_sst_ao_sst.rb +893 -0
- data/lib/sisu/src_po4a_sst_ao_sst_set.rb +284 -0
- data/lib/sisu/src_po4a_sstm.rb +135 -0
- data/lib/sisu/src_shared.rb +347 -0
- data/lib/sisu/src_sisupod_make.rb +171 -0
- data/lib/sisu/src_sisupod_sstm.rb +109 -0
- data/lib/sisu/sst_convert_markup.rb +323 -0
- data/lib/sisu/sst_do_inline_footnotes.rb +440 -0
- data/lib/sisu/sst_from_xml.rb +178 -0
- data/lib/sisu/sst_identify_markup.rb +482 -0
- data/lib/sisu/sst_to_s_xml_sax.rb +471 -0
- data/lib/sisu/termsheet.rb +163 -0
- data/lib/sisu/texinfo.rb +430 -0
- data/lib/sisu/texinfo_format.rb +541 -0
- data/lib/sisu/texpdf.rb +1162 -0
- data/lib/sisu/texpdf_format.rb +1689 -0
- data/lib/sisu/texpdf_parts.rb +235 -0
- data/lib/sisu/txt_asciidoc.rb +354 -0
- data/lib/sisu/txt_asciidoc_decorate.rb +207 -0
- data/lib/sisu/txt_markdown.rb +389 -0
- data/lib/sisu/txt_markdown_decorate.rb +207 -0
- data/lib/sisu/txt_orgmode.rb +376 -0
- data/lib/sisu/txt_orgmode_decorate.rb +186 -0
- data/lib/sisu/txt_output.rb +86 -0
- data/lib/sisu/txt_plain.rb +410 -0
- data/lib/sisu/txt_plain_decorate.rb +189 -0
- data/lib/sisu/txt_read.rb +109 -0
- data/lib/sisu/txt_rst.rb +371 -0
- data/lib/sisu/txt_rst_decorate.rb +186 -0
- data/lib/sisu/txt_shared.rb +241 -0
- data/lib/sisu/txt_textile.rb +367 -0
- data/lib/sisu/txt_textile_decorate.rb +186 -0
- data/lib/sisu/update.rb +141 -0
- data/lib/sisu/urls.rb +696 -0
- data/lib/sisu/utils.rb +232 -0
- data/lib/sisu/utils_composite.rb +115 -0
- data/lib/sisu/utils_response.rb +114 -0
- data/lib/sisu/utils_screen_text_color.rb +472 -0
- data/lib/sisu/utils_spell.rb +99 -0
- data/lib/sisu/webrick.rb +191 -0
- data/lib/sisu/wikispeak.rb +375 -0
- data/lib/sisu/xhtml.rb +472 -0
- data/lib/sisu/xhtml_epub2.rb +890 -0
- data/lib/sisu/xhtml_epub2_concordance.rb +322 -0
- data/lib/sisu/xhtml_epub2_format.rb +2272 -0
- data/lib/sisu/xhtml_epub2_persist.rb +278 -0
- data/lib/sisu/xhtml_epub2_segments.rb +599 -0
- data/lib/sisu/xhtml_epub2_tune.rb +330 -0
- data/lib/sisu/xhtml_parts.rb +183 -0
- data/lib/sisu/xhtml_shared.rb +62 -0
- data/lib/sisu/xhtml_table.rb +97 -0
- data/lib/sisu/xml_docbook5.rb +376 -0
- data/lib/sisu/xml_dom.rb +624 -0
- data/lib/sisu/xml_fictionbook2.rb +389 -0
- data/lib/sisu/xml_format.rb +865 -0
- data/lib/sisu/xml_md_oai_pmh_dc.rb +229 -0
- data/lib/sisu/xml_odf_odt.rb +887 -0
- data/lib/sisu/xml_odf_odt_format.rb +674 -0
- data/lib/sisu/xml_parts.rb +191 -0
- data/lib/sisu/xml_persist.rb +126 -0
- data/lib/sisu/xml_sax.rb +521 -0
- data/lib/sisu/xml_scaffold_structure_collapsed.rb +198 -0
- data/lib/sisu/xml_scaffold_structure_sisu.rb +201 -0
- data/lib/sisu/xml_shared.rb +665 -0
- data/lib/sisu/xml_tables.rb +261 -0
- data/lib/sisu/zap.rb +90 -0
- metadata +251 -0
data/lib/sisu/remote.rb
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** remote operations, get source from or copy output to remote server
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/remote.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_Remote
|
|
58
|
+
require_relative 'se' # se.rb
|
|
59
|
+
include SiSU_Env
|
|
60
|
+
class Put
|
|
61
|
+
def initialize(opt)
|
|
62
|
+
@opt=opt
|
|
63
|
+
@dir=SiSU_Env::InfoEnv.new(@opt.fns)
|
|
64
|
+
@put=(@opt.fns =~/\.ssm\.sst$/) \
|
|
65
|
+
? opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
|
|
66
|
+
: opt.fns
|
|
67
|
+
@remote=SiSU_Env::InfoRemote.new(opt)
|
|
68
|
+
end
|
|
69
|
+
def rsync
|
|
70
|
+
SiSU_Screen::Ansi.new(
|
|
71
|
+
@opt.act[:color_state][:set],
|
|
72
|
+
'Remote placement ->',
|
|
73
|
+
@put
|
|
74
|
+
).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
75
|
+
@remote.rsync.document
|
|
76
|
+
end
|
|
77
|
+
def rsync_base
|
|
78
|
+
SiSU_Screen::Ansi.new(
|
|
79
|
+
@opt.act[:color_state][:set],
|
|
80
|
+
'Remote placement ->',
|
|
81
|
+
'rsync'
|
|
82
|
+
).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
83
|
+
@remote.rsync.site_base
|
|
84
|
+
end
|
|
85
|
+
def rsync_base_sync
|
|
86
|
+
SiSU_Screen::Ansi.new(
|
|
87
|
+
@opt.act[:color_state][:set],
|
|
88
|
+
'Remote placement ->',
|
|
89
|
+
'rsync and sync'
|
|
90
|
+
).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
91
|
+
@remote.rsync.site_base_sync
|
|
92
|
+
end
|
|
93
|
+
def rsync_sitemaps
|
|
94
|
+
SiSU_Screen::Ansi.new(
|
|
95
|
+
@opt.act[:color_state][:set],
|
|
96
|
+
'Remote placement sitemaps ->',
|
|
97
|
+
'rsync'
|
|
98
|
+
).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
99
|
+
@remote.rsync_sitemaps
|
|
100
|
+
end
|
|
101
|
+
def rsync_harvest
|
|
102
|
+
SiSU_Screen::Ansi.new(
|
|
103
|
+
@opt.act[:color_state][:set],
|
|
104
|
+
'Remote placement metadata harvest ->',
|
|
105
|
+
'rsync_harvest'
|
|
106
|
+
).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
107
|
+
@remote.rsync.site_harvest
|
|
108
|
+
end
|
|
109
|
+
def scp
|
|
110
|
+
SiSU_Screen::Ansi.new(
|
|
111
|
+
@opt.act[:color_state][:set],
|
|
112
|
+
'Remote placement ->',
|
|
113
|
+
@put
|
|
114
|
+
).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
115
|
+
@remote.scp.document
|
|
116
|
+
end
|
|
117
|
+
def scp_base
|
|
118
|
+
SiSU_Screen::Ansi.new(
|
|
119
|
+
@opt.act[:color_state][:set],
|
|
120
|
+
'Remote placement of base site ->',
|
|
121
|
+
'excluding images'
|
|
122
|
+
).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
123
|
+
@remote.scp.site_base
|
|
124
|
+
end
|
|
125
|
+
def scp_base_all
|
|
126
|
+
SiSU_Screen::Ansi.new(
|
|
127
|
+
@opt.act[:color_state][:set],
|
|
128
|
+
'Remote placement ->',
|
|
129
|
+
'complete'
|
|
130
|
+
).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on
|
|
131
|
+
@remote.scp.site_base_all
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
class Get
|
|
135
|
+
def initialize(opt,get_s)
|
|
136
|
+
@opt,@get_s=opt,get_s
|
|
137
|
+
@msg,@msgs='',nil
|
|
138
|
+
@tell=lambda {
|
|
139
|
+
SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],
|
|
140
|
+
@msg,
|
|
141
|
+
"#{@msgs.inspect if @msgs}")
|
|
142
|
+
}
|
|
143
|
+
end
|
|
144
|
+
def fns
|
|
145
|
+
begin
|
|
146
|
+
require 'open-uri'
|
|
147
|
+
require 'pp'
|
|
148
|
+
rescue LoadError
|
|
149
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
150
|
+
error('open-uri or pp NOT FOUND (LoadError)')
|
|
151
|
+
end
|
|
152
|
+
require_relative 'ao_composite' # ao_composite.rb
|
|
153
|
+
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
|
|
154
|
+
threads=[]
|
|
155
|
+
for requested_page in @get_s
|
|
156
|
+
re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO
|
|
157
|
+
threads << Thread.new(requested_page) do |url|
|
|
158
|
+
open(url) do |f|
|
|
159
|
+
raise "#{url} not found" unless f
|
|
160
|
+
base_uri,fnb=re_fnb.match(url)[1..2] if re_fnb
|
|
161
|
+
imagedir=base_uri + '/_sisu/image' #check on
|
|
162
|
+
downloaded_file=File.new("#{fnb}.-sst",'w+')
|
|
163
|
+
image_download_url=SiSU_Assemble::RemoteImage.new.image(imagedir)
|
|
164
|
+
images=[]
|
|
165
|
+
f.collect.each do |r| # work area
|
|
166
|
+
unless r =~/^%+\s/
|
|
167
|
+
if r !~/^%+\s/ \
|
|
168
|
+
and r =~@rgx_image
|
|
169
|
+
images << r.scan(@rgx_image).uniq
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
downloaded_file << r
|
|
173
|
+
end
|
|
174
|
+
if images \
|
|
175
|
+
and images.length > 1
|
|
176
|
+
images=images.flatten.uniq
|
|
177
|
+
images.delete_if {|x| x =~/https?:\/\// }
|
|
178
|
+
images=images.sort
|
|
179
|
+
@msg,@msgs='downloading images:', [ images.join(',') ]
|
|
180
|
+
@tell.call.warn unless @opt.act[:quiet][:set]==:on
|
|
181
|
+
image_info=image_download_url + images
|
|
182
|
+
SiSU_Assemble::RemoteImage.new.download_images(image_info)
|
|
183
|
+
#SiSU_Assemble::RemoteImage.new.download_images(image_download_url,images)
|
|
184
|
+
@msg,@msgs='downloading done',nil
|
|
185
|
+
@tell.call.warn unless @opt.act[:quiet][:set]==:on
|
|
186
|
+
end
|
|
187
|
+
downloaded_file.close
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
threads.each {|thr| thr.join} if threads #and threads.length > 0
|
|
192
|
+
end
|
|
193
|
+
def sisupod
|
|
194
|
+
get_p=@get_s
|
|
195
|
+
if get_p.length > 0 #% remote sisupod
|
|
196
|
+
begin
|
|
197
|
+
require 'net/http'
|
|
198
|
+
rescue LoadError
|
|
199
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
200
|
+
error('net/http NOT FOUND (LoadError)')
|
|
201
|
+
end
|
|
202
|
+
for requested_pod in get_p
|
|
203
|
+
pod_info=RemoteDownload.new(requested_pod)
|
|
204
|
+
Net::HTTP.start(pod_info.pod.site) do |http|
|
|
205
|
+
resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}")
|
|
206
|
+
open(pod_info.pod.name,'wb') do |file|
|
|
207
|
+
file.write(resp.body)
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
class RemoteDownload
|
|
215
|
+
def initialize(requested_file)
|
|
216
|
+
@requested_file=requested_file
|
|
217
|
+
end
|
|
218
|
+
def pod
|
|
219
|
+
re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod\.(?:txz|zip)|\S+?(?:\.ss[mt]\.(?:txz|zip))?|[^\/]+?\.ssp)$/
|
|
220
|
+
re_p=/(sisupod\.(?:txz|zip)|\S+?\.ss[mt]\.(?:txz|zip)?|[^\/]+?\.ssp)$/
|
|
221
|
+
if @requested_file =~ re_p_div
|
|
222
|
+
@site,@pth,@pod= re_p_div.match(@requested_file).captures
|
|
223
|
+
elsif @requested_file =~ re_p
|
|
224
|
+
@pod=re_p.match(@requested_file).captures.join
|
|
225
|
+
end
|
|
226
|
+
def site
|
|
227
|
+
@site
|
|
228
|
+
end
|
|
229
|
+
def path
|
|
230
|
+
@pth
|
|
231
|
+
end
|
|
232
|
+
def dir_stub
|
|
233
|
+
re_p_stub=/.+?([^\/]+)$/
|
|
234
|
+
re_p_stub.match(path).captures.join if path
|
|
235
|
+
end
|
|
236
|
+
def name_source
|
|
237
|
+
@pod
|
|
238
|
+
end
|
|
239
|
+
def name
|
|
240
|
+
name_source
|
|
241
|
+
end
|
|
242
|
+
self
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
__END__
|
data/lib/sisu/rexml.rb
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** rexml testing of xml
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/rexml.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
module SiSU_Rexml
|
|
58
|
+
# load XML file for REXML parsing
|
|
59
|
+
begin
|
|
60
|
+
require 'rexml/document' \
|
|
61
|
+
if FileTest.directory?("#{RbConfig::CONFIG['rubylibdir']}/rexml") #RbConfig::CONFIG['sitedir']
|
|
62
|
+
rescue LoadError
|
|
63
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
64
|
+
error('rexml/document NOT FOUND (LoadError)')
|
|
65
|
+
end
|
|
66
|
+
require_relative 'dp' # dp.rb
|
|
67
|
+
include SiSU_Param
|
|
68
|
+
require_relative 'se' # se.rb
|
|
69
|
+
include SiSU_Env
|
|
70
|
+
class Rexml
|
|
71
|
+
begin
|
|
72
|
+
require 'rexml/document' \
|
|
73
|
+
if FileTest.directory?("#{RbConfig::CONFIG['rubylibdir']}/rexml") #RbConfig::CONFIG['sitedir']
|
|
74
|
+
rescue LoadError
|
|
75
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
76
|
+
error('rexml/document NOT FOUND (LoadError)')
|
|
77
|
+
end
|
|
78
|
+
def initialize(md,fno)
|
|
79
|
+
@md,@fno=md,fno
|
|
80
|
+
@env=SiSU_Env::InfoEnv.new(@md.fns)
|
|
81
|
+
@prog=SiSU_Env::InfoProgram.new #(md.fns) #if md
|
|
82
|
+
if File.file?(@fno)
|
|
83
|
+
@fnap=@fno #index.xml causes problems with index.html in server config
|
|
84
|
+
end
|
|
85
|
+
@e_head='/document/head'
|
|
86
|
+
@e_title='/document/head/title'
|
|
87
|
+
@e_object='/document/body/object'
|
|
88
|
+
@e_ocn='/document/body/object/ocn'
|
|
89
|
+
@e_text='/document/body/object/text'
|
|
90
|
+
@e_endnote='/document/body/object/endnote'
|
|
91
|
+
end
|
|
92
|
+
def xml
|
|
93
|
+
begin
|
|
94
|
+
if FileTest.file?(@fnap)
|
|
95
|
+
if @prog.rexml !=false \
|
|
96
|
+
and FileTest.directory?('/usr/lib/ruby/1.8/rexml/') #note values can be other than true
|
|
97
|
+
xmlfile=IO.readlines(@fnap,'').join
|
|
98
|
+
begin
|
|
99
|
+
@xmldoc=REXML::Document.new xmlfile
|
|
100
|
+
SiSU_Screen::Ansi.new(
|
|
101
|
+
@md.opt.act[:color_state][:set],
|
|
102
|
+
'invert',
|
|
103
|
+
'REXML',
|
|
104
|
+
"XML document #{@fnap} loaded"
|
|
105
|
+
).colorize unless @md.opt.act[:quiet][:set]==:on
|
|
106
|
+
if (@opt.act[:verbose][:set]==:on \
|
|
107
|
+
|| @opt.act[:verbose_plus][:set]==:on)
|
|
108
|
+
@xmldoc.elements.each(@e_head) do |e|
|
|
109
|
+
SiSU_Screen::Ansi.new(
|
|
110
|
+
@md.opt.act[:color_state][:set],
|
|
111
|
+
'brown',
|
|
112
|
+
e
|
|
113
|
+
).colorize unless @md.opt.act[:quiet][:set]==:on
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
rescue REXML::ParseException
|
|
117
|
+
puts 'broken XML'
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
else
|
|
121
|
+
SiSU_Screen::Ansi.new(
|
|
122
|
+
@md.opt.act[:color_state][:set],
|
|
123
|
+
'fuchsia',
|
|
124
|
+
"File Not Found #{xmlfile}",
|
|
125
|
+
'requested XML processing skipped'
|
|
126
|
+
).colorize unless @md.opt.act[:quiet][:set]==:on
|
|
127
|
+
exit
|
|
128
|
+
end
|
|
129
|
+
rescue
|
|
130
|
+
SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do
|
|
131
|
+
__LINE__.to_s + ':' + __FILE__
|
|
132
|
+
end
|
|
133
|
+
ensure
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
__END__
|
|
139
|
+
misc
|
|
140
|
+
e.each do |element|
|
|
141
|
+
element.each do |child|
|
|
142
|
+
if child.is_a?(REXML::Text)
|
|
143
|
+
puts "Text: #{child.to_s.inspect}"
|
|
144
|
+
else
|
|
145
|
+
puts "SubElement: #{child.name}"
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
data/lib/sisu/se.rb
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
=begin
|
|
3
|
+
|
|
4
|
+
* Name: SiSU
|
|
5
|
+
|
|
6
|
+
** Description: documents, structuring, processing, publishing, search
|
|
7
|
+
*** system environment, resource control and configuration details
|
|
8
|
+
|
|
9
|
+
** Author: Ralph Amissah
|
|
10
|
+
<ralph@amissah.com>
|
|
11
|
+
<ralph.amissah@gmail.com>
|
|
12
|
+
|
|
13
|
+
** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
|
14
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
|
|
15
|
+
All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
** License: GPL 3 or later:
|
|
18
|
+
|
|
19
|
+
SiSU, a framework for document structuring, publishing and search
|
|
20
|
+
|
|
21
|
+
Copyright (C) Ralph Amissah
|
|
22
|
+
|
|
23
|
+
This program is free software: you can redistribute it and/or modify it
|
|
24
|
+
under the terms of the GNU General Public License as published by the Free
|
|
25
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
26
|
+
any later version.
|
|
27
|
+
|
|
28
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
29
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
31
|
+
more details.
|
|
32
|
+
|
|
33
|
+
You should have received a copy of the GNU General Public License along with
|
|
34
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
|
|
36
|
+
If you have Internet connection, the latest version of the GPL should be
|
|
37
|
+
available at these locations:
|
|
38
|
+
<http://www.fsf.org/licensing/licenses/gpl.html>
|
|
39
|
+
<http://www.gnu.org/licenses/gpl.html>
|
|
40
|
+
|
|
41
|
+
<http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
|
|
42
|
+
|
|
43
|
+
** SiSU uses:
|
|
44
|
+
* Standard SiSU markup syntax,
|
|
45
|
+
* Standard SiSU meta-markup syntax, and the
|
|
46
|
+
* Standard SiSU object citation numbering and system
|
|
47
|
+
|
|
48
|
+
** Hompages:
|
|
49
|
+
<http://www.jus.uio.no/sisu>
|
|
50
|
+
<http://www.sisudoc.org>
|
|
51
|
+
|
|
52
|
+
** Git
|
|
53
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
|
|
54
|
+
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/se.rb;hb=HEAD>
|
|
55
|
+
|
|
56
|
+
=end
|
|
57
|
+
@@cX=nil
|
|
58
|
+
module SiSU_Env
|
|
59
|
+
require_relative 'constants' # constants.rb
|
|
60
|
+
require_relative 'utils' # utils.rb
|
|
61
|
+
require_relative 'se_date' # se_date.rb
|
|
62
|
+
require_relative 'se_info_system' # se_info_system.rb
|
|
63
|
+
require_relative 'se_load' # se_load.rb
|
|
64
|
+
require_relative 'se_get_init' # se_get_init.rb
|
|
65
|
+
require_relative 'se_envcall' # se_envcall.rb
|
|
66
|
+
require_relative 'se_programs' # se_programs.rb
|
|
67
|
+
require_relative 'se_standardise_lang' # se_standardise_lang.rb
|
|
68
|
+
require_relative 'se_info_env' # se_info_env.rb
|
|
69
|
+
require_relative 'se_processing' # se_processing.rb
|
|
70
|
+
require_relative 'se_filemap' # se_filemap.rb
|
|
71
|
+
require_relative 'se_file_op' # se_file_op.rb
|
|
72
|
+
require_relative 'se_cleanoutput' # se_cleanoutput.rb
|
|
73
|
+
require_relative 'se_remotes' # se_remotes.rb
|
|
74
|
+
require_relative 'se_version' # se_version.rb
|
|
75
|
+
require_relative 'se_db' # se_db.rb
|
|
76
|
+
require_relative 'se_css' # se_css.rb
|
|
77
|
+
require_relative 'se_clear' # se_clear.rb
|
|
78
|
+
require_relative 'se_createsite' # se_createsite.rb
|
|
79
|
+
require_relative 'se_info_port' # se_info_port.rb
|
|
80
|
+
begin
|
|
81
|
+
require 'singleton'
|
|
82
|
+
require 'fileutils'
|
|
83
|
+
include FileUtils::Verbose
|
|
84
|
+
rescue LoadError
|
|
85
|
+
SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
|
|
86
|
+
error('singleton or fileutils NOT FOUND (LoadError)')
|
|
87
|
+
end
|
|
88
|
+
@@noyaml=false
|
|
89
|
+
class InfoDate < SiSU_Info_Date::InfoDate # se_date.rb
|
|
90
|
+
end
|
|
91
|
+
class InfoSystemGen < SiSU_Info_Sys_Gen::InfoSystemGen # se_info_system.rb
|
|
92
|
+
end
|
|
93
|
+
class InfoSystem < SiSU_Info_Sys::InfoSystem # se_info_system.rb
|
|
94
|
+
end
|
|
95
|
+
class Load < SiSU_Load::Load # se_load.rb
|
|
96
|
+
end
|
|
97
|
+
class GetInit < SiSU_Get_Init::GetInit # se_get_init.rb
|
|
98
|
+
end
|
|
99
|
+
class EnvCall < SiSU_Env_Call::EnvCall # se_envcall.rb
|
|
100
|
+
end
|
|
101
|
+
class SystemCall < SiSU_Sys_Call::SystemCall # se_programs.rb
|
|
102
|
+
end
|
|
103
|
+
class StandardiseLanguage < SiSU_Standardise_Lang::StandardiseLanguage # se_standardise_lang.rb
|
|
104
|
+
end
|
|
105
|
+
class InfoEnv < SiSU_Info_Env::InfoEnv # se_info_env.rb
|
|
106
|
+
end
|
|
107
|
+
class InfoProcessingFlag < SiSU_Info_Processing_Flag::InfoProcessingFlag # se_processing.rb
|
|
108
|
+
end
|
|
109
|
+
class InfoSettings < SiSU_Info_Set::InfoSettings # se_programs.rb
|
|
110
|
+
end
|
|
111
|
+
class FileMap < SiSU_File_Map::FileMap # se_filemap.rb
|
|
112
|
+
end
|
|
113
|
+
class CleanOutput < SiSU_Clean_Output::CleanOutput # se_cleanoutput.rb
|
|
114
|
+
end
|
|
115
|
+
class InfoRemoteHost < SiSU_Info_Remote_Host::InfoRemoteHost # se_remotes.rb
|
|
116
|
+
end
|
|
117
|
+
class InfoRemote < SiSU_Info_Remote::InfoRemote # se_remotes.rb
|
|
118
|
+
end
|
|
119
|
+
class InfoVersion < SiSU_Info_Version::InfoVersion # se_version.rb
|
|
120
|
+
end
|
|
121
|
+
class InfoAbout < SiSU_Info_About::InfoAbout # se_version.rb
|
|
122
|
+
end
|
|
123
|
+
class InfoFile < SiSU_Info_File::InfoFile # se_file_op.rb
|
|
124
|
+
end
|
|
125
|
+
class ProcessingSettings < SiSU_Processing_Settings::ProcessingSettings # se_processing.rb
|
|
126
|
+
end
|
|
127
|
+
class InfoDb < SiSU_Info_Db::InfoDb # se_db.rb
|
|
128
|
+
end
|
|
129
|
+
class DbOp < SiSU_Db_Op::DbOp # se_db.rb
|
|
130
|
+
end
|
|
131
|
+
class FileOp < SiSU_File_Op::FileOp # se_file_op.rb
|
|
132
|
+
end
|
|
133
|
+
class FilenameLanguageCodeInsert < SiSU_Filename_Lang::FilenameLanguageCodeInsert # se_file_op.rb
|
|
134
|
+
end
|
|
135
|
+
class CreateFile < SiSU_Create_File::CreateFile # se_file_op.rb
|
|
136
|
+
end
|
|
137
|
+
class Clear < SiSU_Clear::Clear # se_clear.rb
|
|
138
|
+
end
|
|
139
|
+
class InfoPort < SiSU_Info_Port::InfoPort # se_info_port.rb
|
|
140
|
+
end
|
|
141
|
+
class InfoProgram < SiSU_Info_Program::InfoProgram # se_programs.rb
|
|
142
|
+
end
|
|
143
|
+
class CSS_Default < SiSU_CSS::CSS_Default # se_css.rb
|
|
144
|
+
end
|
|
145
|
+
class CSS_Select < SiSU_CSS::CSS_Select # se_css.rb
|
|
146
|
+
end
|
|
147
|
+
class CSS_Stylesheet < SiSU_CSS::CSS_Stylesheet # se_css.rb
|
|
148
|
+
end
|
|
149
|
+
class CreateSite < SiSU_Create_Site::CreateSite # se_createsite.rb
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
module SiSU_Screen
|
|
153
|
+
require_relative 'utils_screen_text_color' # utils_screen_text_color.rb
|
|
154
|
+
end
|
|
155
|
+
module SiSU_Errors
|
|
156
|
+
require_relative 'errors' # errors.rb
|
|
157
|
+
end
|
|
158
|
+
__END__
|