Class: WikiTester23
- Inherits:
-
MyMediaWiki
- Object
- MyMediaPages
- MyMediaWikiBase
- MyMediaWiki
- WikiTester23
- Defined in:
- lib/mymedia-wiki.rb
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(config: '', cur_dir: '', debug: false) ⇒ WikiTester23
constructor
it is assumed this class will be executed from a test directory containing the following auxillary files: - wiki.xsl - index-template.html.
- #prep ⇒ Object
-
#write(filename: '', content: '') ⇒ Object
create the input file.
Methods inherited from MyMediaWiki
Methods inherited from MyMediaWikiBase
Constructor Details
#initialize(config: '', cur_dir: '', debug: false) ⇒ WikiTester23
it is assumed this class will be executed from a test directory containing the following auxillary files:
- wiki.xsl
- index-template.html
181 182 183 184 185 186 187 188 |
# File 'lib/mymedia-wiki.rb', line 181 def initialize(config: '', cur_dir: '', debug: false) @cur_dir = cur_dir super(config: config, debug: debug) @parent_dir = '/tmp/media' @dir = 'wiki' end |
Instance Method Details
#cleanup ⇒ Object
190 191 192 193 194 195 196 |
# File 'lib/mymedia-wiki.rb', line 190 def cleanup() # remove the previous test files # FileX.rm_r '/tmp/www/*', force: true puts 'Previous /tmp/www files now removed!' end |
#prep ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/mymedia-wiki.rb', line 198 def prep() #return # create the template files and directories # xsl_src = File.join(@cur_dir, 'wiki.xsl') www_dest = '/tmp/www/xsl/wiki.xsl' r_dest = '/tmp/www/r/xsl/wiki.xsl' index_dest = '/tmp/www/wiki/index-template.html' FileX.mkdir_p File.dirname(www_dest) FileX.cp xsl_src, www_dest FileX.mkdir_p File.dirname(r_dest) FileX.cp xsl_src, r_dest FileX.mkdir_p File.dirname(index_dest) FileX.cp File.join(@cur_dir, 'index-template.html'), '/tmp/www/wiki/index-template.html' filepath = File.join(@parent_dir, @dir) FileUtils.mkdir_p filepath end |
#write(filename: '', content: '') ⇒ Object
create the input file
223 224 225 226 227 228 |
# File 'lib/mymedia-wiki.rb', line 223 def write(filename: '', content: '') File.write File.join(@parent_dir, @dir, filename), content puts 'debug: filename: ' + filename.inspect end |