Piggy 0.4.2.4 → 0.4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/CHANGES.txt +15 -0
  2. data/INSTALL.txt +9 -4
  3. data/README.txt +8 -6
  4. data/bin/directory_diff +1 -1
  5. data/bin/ftp_browser +1 -1
  6. data/bin/piggy +1 -1
  7. data/lib/directory_diff.rb +8 -6
  8. data/lib/ftp_browser.rb +8 -6
  9. data/lib/icons/connect.ico +0 -0
  10. data/lib/icons/hide_details.ico +0 -0
  11. data/lib/icons/show_details.ico +0 -0
  12. data/lib/piggy-core/alive_check.rb +4 -4
  13. data/lib/piggy-core/debug.rb +4 -4
  14. data/lib/piggy-core/environment.rb +24 -26
  15. data/lib/piggy-core/exifr_adapter.rb +11 -11
  16. data/lib/piggy-core/file_info.rb +61 -61
  17. data/lib/piggy-core/ftp_adapter.rb +24 -24
  18. data/lib/piggy-core/htmlgen.rb +41 -45
  19. data/lib/piggy-core/nconvert_thumbsgen.rb +22 -22
  20. data/lib/piggy-core/options.rb +25 -19
  21. data/lib/piggy-core/options_persistence.rb +8 -8
  22. data/lib/piggy-core/progress.rb +7 -7
  23. data/lib/piggy-core/rmagick_thumbnail_page_generator.rb +14 -14
  24. data/lib/piggy-core/thumbnail_generator.rb +26 -26
  25. data/lib/piggy-core/thumbnail_page_generator.rb +234 -230
  26. data/lib/piggy-core/upload_info.rb +22 -22
  27. data/lib/piggy-core/version.rb +7 -7
  28. data/lib/piggy-core/winshell.rb +136 -80
  29. data/lib/piggy-gui/dir_chooser.rb +14 -14
  30. data/lib/piggy-gui/directory_diff_widget.rb +177 -160
  31. data/lib/piggy-gui/filtered_file_list.rb +87 -87
  32. data/lib/piggy-gui/fox_thumbsgen.rb +4 -4
  33. data/lib/piggy-gui/ftp_browser_widget.rb +211 -155
  34. data/lib/piggy-gui/fullscreen.rb +4 -4
  35. data/lib/piggy-gui/html_generation_dialog.rb +42 -115
  36. data/lib/piggy-gui/html_options_widget.rb +97 -0
  37. data/lib/piggy-gui/image_processor.rb +58 -58
  38. data/lib/piggy-gui/modal_dialog.rb +11 -5
  39. data/lib/piggy-gui/multiimagecanvas.rb +59 -59
  40. data/lib/piggy-gui/options_dialog.rb +170 -48
  41. data/lib/piggy-gui/piggy_image_browser.rb +382 -340
  42. data/lib/piggy-gui/pipe_log.rb +17 -17
  43. data/lib/piggy-gui/progress_with_dialog.rb +8 -8
  44. data/lib/piggy-gui/require-fox.rb +23 -8
  45. data/lib/piggy.rb +7 -5
  46. data/lib/templates/styles/basic/style.css +16 -14
  47. data/lib/templates/styles/black/style.css +28 -29
  48. data/lib/templates/styles/roundedbox/style.css +28 -31
  49. data/lib/templates/styles/shadow/style.css +26 -26
  50. data/lib/templates/styles/shadow_D9F5F3/style.css +1 -1
  51. data/lib/templates/styles/shadow_black/lo.jpg +0 -0
  52. data/lib/templates/styles/shadow_black/lu.jpg +0 -0
  53. data/lib/templates/styles/shadow_black/ro.jpg +0 -0
  54. data/lib/templates/styles/shadow_black/ru.jpg +0 -0
  55. data/lib/templates/styles/shadow_black/style.css +78 -0
  56. data/lib/templates/styles/shadow_bowers/style.css +48 -51
  57. data/lib/templates/styles/sylvester/sh.png +0 -0
  58. data/lib/templates/styles/sylvester/style.css +74 -0
  59. data/lib/templates/styles/sylvester/wunderkerze.jpg +0 -0
  60. data/test/file_info_test.rb +29 -29
  61. metadata +52 -38
@@ -11,7 +11,7 @@ require 'piggy-core/options'
11
11
  #
12
12
  # Generation without frames:
13
13
  #
14
- # outputPath
14
+ # output_path
15
15
  # |
16
16
  # +----subDir
17
17
  # |
@@ -30,7 +30,7 @@ require 'piggy-core/options'
30
30
  #
31
31
  # Generation with frames:
32
32
  #
33
- # outputPath
33
+ # output_path
34
34
  # |
35
35
  # +----subDir
36
36
  # | |
@@ -68,26 +68,28 @@ class ThumbnailPageGenerator < HtmlGenerator
68
68
  @indexName = 'index' + HtmlExt
69
69
  end
70
70
 
71
- def setOutputDirectory(outputDir)
71
+ def set_output_directory(outputDir)
72
72
  @subDir = outputDir
73
- @imageOutputPath = File.join(outputPath, outputDir)
73
+ @imageOutputPath = File.join(output_path, outputDir)
74
74
  end
75
75
 
76
76
  # Overwrite this, if you convert arbitrary image types into
77
77
  # output formats suitable for web pages, e. g. jpg or png
78
- def conversionTypeFor(type)
78
+ def conversion_type_for(type)
79
79
  type
80
80
  end
81
81
 
82
- def imageName(info)
83
- escapeHtml("#{info.nameWithoutExtension}.#{conversionTypeFor(info.extension)}")
82
+ def image_name(info, pre = '')
83
+ offset = @options.stylesSample? ? "../basic/#{pre}" : pre
84
+ name = "#{info.name_without_extension}.#{conversion_type_for(info.extension)}"
85
+ offset + escape_html(name)
84
86
  end
85
87
 
86
- def setFiles(fileInfos)
88
+ def set_files(fileInfos)
87
89
  @inputFilenames = fileInfos
88
90
  end
89
91
 
90
- def setTitle(title)
92
+ def set_title(title)
91
93
  @title = title
92
94
  end
93
95
 
@@ -99,147 +101,148 @@ class ThumbnailPageGenerator < HtmlGenerator
99
101
  return "..#{sep}"
100
102
  end
101
103
 
102
- def outputPath
104
+ def output_path
103
105
  return @options.localDestinationPath
104
106
  end
105
107
 
106
- def mainIndexPath
107
- return @options.generateFramePage ? outputPath : imageOutputPath
108
+ def main_index_path
109
+ return @options.generateFramePage ? output_path : imageOutputPath
108
110
  end
109
111
 
110
- def mainIndexWithPath
111
- return mainIndexPath + sep + indexName
112
+ def main_index_with_path
113
+ return main_index_path + sep + indexName
112
114
  end
113
115
 
114
- def getBacklinkString
116
+ def get_backlink_string
115
117
  @options.generateFramePage? ? back + subDir + HtmlExt : indexName
116
118
  end
117
119
 
118
- def subStylesheetUrl
120
+ def sub_stylesheet_url
119
121
  if @options.generateFramePage?
120
- back + mainStylesheetUrl
122
+ back + main_stylesheet_url
121
123
  else
122
- mainStylesheetUrl
124
+ main_stylesheet_url
123
125
  end
124
126
  end
125
127
 
126
- def mainStylesheetUrl
128
+ def main_stylesheet_url
127
129
  'style/style.css'
128
130
  end
129
131
 
130
132
  # Add important meta tags
131
- def commonHead
133
+ def common_head
132
134
  norobots()
133
135
  # the next tag will tell Piggy that this file may be
134
136
  # overwritten by Piggy
135
137
  meta({
136
- "name" => "generator",
137
- "content" =>"Piggy"})
138
+ "name" => "generator",
139
+ "content" =>"Piggy"})
138
140
  utf8()
139
141
  end
140
142
 
141
143
  # Check if this file has been written by Piggy
142
- def isPiggyFile?(file)
144
+ def is_piggy_file?(file)
143
145
  ret = false
144
- File.open(file, 'r') { |fp|
145
- while !ret && fp.gets
146
- ret = true if(/<meta.*name="generator"/ && /<meta.*content="Piggy"/)
146
+ File.open(file, 'r') do |fp|
147
+ while !ret && (line = fp.gets)
148
+ ret = /<meta.*name="generator"/.match(line) &&
149
+ /<meta.*content="Piggy"/.match(line)
147
150
  end
148
- }
151
+ end
149
152
  return ret
150
153
  end
151
154
 
152
- def buildHtmlPagesForImages(progress)
153
- progress.setTask("Generate html", @inputFilenames.size)
154
- maxInd = @inputFilenames.size - 1
155
- backlink = getBacklinkString
156
- (0..maxInd).each { | i |
155
+ def build_html_pages_for_images(progress)
156
+ progress.set_task("Generate html", @inputFilenames.size)
157
+ max_ind = @inputFilenames.size - 1
158
+ backlink = get_backlink_string
159
+ (0..max_ind).each { | i |
157
160
  currentInfo = @inputFilenames[i]
158
- predInfo = @inputFilenames[i == 0 ? maxInd : i - 1]
159
- succInfo = @inputFilenames[i == maxInd ? 0 : i + 1]
160
- current = currentInfo.nameWithoutExtension
161
+ predInfo = @inputFilenames[i == 0 ? max_ind : i - 1]
162
+ succInfo = @inputFilenames[i == max_ind ? 0 : i + 1]
163
+ current = currentInfo.name_without_extension
161
164
  comment = currentInfo.comment
162
- pred = predInfo.nameWithoutExtension
163
- succ = succInfo.nameWithoutExtension
164
- progress.setProgress(current, 1)
165
- newTransitional
165
+ pred = predInfo.name_without_extension
166
+ succ = succInfo.name_without_extension
167
+ progress.set_progress(current, 1)
168
+ new_transitional
166
169
  html {
167
170
  head {
168
- title() { escapeHTML(current) }
169
- commonHead
170
- stylesheet subStylesheetUrl
171
+ title() { escape_html(current) }
172
+ common_head
173
+ stylesheet sub_stylesheet_url
171
174
  }
172
175
  body({"class"=>"image_page"}) {
173
- div({'class' => 'content'}){
174
- div({'class' => 'navigation'}){
175
- div {
176
- div {
177
- p {
178
- a({"HREF" => escapeHTML(pred) + HtmlExt}){
179
- addHtml(escapeHTML(i == 0 ? 'last' : 'previous'))
180
- }
181
- a({"HREF" => escapeHTML(backlink) }) {
182
- addHtml(escapeHTML('overview'))
183
- }
184
- a({"HREF" => escapeHTML(succ) + HtmlExt}) {
185
- addHtml(escapeHTML(i == maxInd ? 'first' : 'next'))
186
- }
187
- }
188
- }
189
- }
190
- }
191
- div({'class' => 'image'}){
192
- div {
193
- div {
194
- p {
195
- img(imageName(currentInfo), escapeHTML(current))
196
- }
197
- }
198
- }
199
- }
200
- div({'class' => 'comment'}){
201
- div {
202
- div {
203
- p { addHtml(escapeHTML(comment)) }
204
- }
205
- }
206
- }
207
- }
208
- }
176
+ div({'class' => 'content'}){
177
+ div({'class' => 'navigation'}){
178
+ div {
179
+ div {
180
+ p {
181
+ a({"HREF" => escape_html(pred) + HtmlExt}){
182
+ add_html(escape_html(i == 0 ? 'last' : 'previous'))
183
+ }
184
+ a({"HREF" => escape_html(backlink) }) {
185
+ add_html(escape_html('overview'))
186
+ }
187
+ a({"HREF" => escape_html(succ) + HtmlExt}) {
188
+ add_html(escape_html(i == max_ind ? 'first' : 'next'))
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ div({'class' => 'image'}){
195
+ div {
196
+ div {
197
+ p {
198
+ img(image_name(currentInfo), escape_html(current))
199
+ }
200
+ }
201
+ }
202
+ }
203
+ div({'class' => 'comment'}){
204
+ div {
205
+ div {
206
+ p { add_html(escape_html(comment)) }
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
209
212
  }
210
213
  File.open(File.join(imageOutputPath, current + HtmlExt), 'w') { | fp |
211
- fp.print(getPage)
214
+ fp.print(get_page)
212
215
  }
213
216
  }
214
217
  end
215
218
 
216
- def buildSlideshowList
219
+ def build_slideshow_list
217
220
  File.open(File.join(imageOutputPath, 'images.js'), 'w') { | fp |
218
221
  fp.print("var images = new Array(\n")
219
222
  maxInd = @inputFilenames.size - 1
220
- (0..maxInd).each { | i |
221
- current = slideshowImage(@inputFilenames[i])
223
+ (0..maxInd).each { | i |
224
+ current = slideshow_image(@inputFilenames[i])
222
225
  fp.print("#{current}")
223
226
  fp.print(i == maxInd ? "\n" : ",\n")
224
227
  }
225
228
  fp.print(")\n")
226
229
  }
227
230
  unless @inputFilenames.empty?
228
- updateSlideshowTemplate(slideshowImage(@inputFilenames[1]))
231
+ update_slideshow_template(slideshow_image(@inputFilenames[1]))
229
232
  end
230
233
  end
231
234
 
232
- def slideshowImage(fileInfo)
233
- src = imageName(fileInfo)
234
- txt = escapeHtml(fileInfo.comment)
235
+ def slideshow_image(fileInfo)
236
+ src = image_name(fileInfo)
237
+ txt = escape_html(fileInfo.comment)
235
238
  "new slide(\"#{src}\", \"\", \"#{txt}\")"
236
239
  end
237
240
 
238
- def updateSlideshowTemplate(imageFile)
241
+ def update_slideshow_template(imageFile)
239
242
  reset
240
243
  file = File.join(imageOutputPath, 'slideshow.htm')
241
244
  lines = File.readlines(file)
242
- backlink = "href=\"#{getBacklinkString}\""
245
+ backlink = "href=\"#{get_backlink_string}\""
243
246
  File.open(file, 'w') { |fp|
244
247
  lines.each { |line|
245
248
  line = line.gsub('PLACEHOLDER_FOR_IMAGE_NAME', imageFile)
@@ -249,7 +252,7 @@ class ThumbnailPageGenerator < HtmlGenerator
249
252
  }
250
253
  end
251
254
 
252
- def bytesAsString(bytes)
255
+ def bytes_as_string(bytes)
253
256
  kb = bytes/1024
254
257
  return "#{kb} KB" if kb < 1024
255
258
  mb = kb/1024
@@ -258,58 +261,58 @@ class ThumbnailPageGenerator < HtmlGenerator
258
261
  return "#{gb} GB"
259
262
  end
260
263
 
261
- def buildThumbnailPage(sizeOfZipfile = -1)
262
- numCol = 5
263
- matrix = Array.new(@inputFilenames.size() / numCol)
264
+ def build_thumbnail_page(size_of_zipfile = -1)
265
+ num_col = 5
266
+ matrix = Array.new(@inputFilenames.size() / num_col)
264
267
  row = -1
265
268
  col = 0
266
269
  @inputFilenames.each { |info|
267
- if col % numCol == 0
270
+ if col % num_col == 0
268
271
  col = 0
269
272
  row += 1
270
- matrix[row] = Array.new(numCol)
273
+ matrix[row] = Array.new(num_col)
271
274
  end
272
275
  matrix[row][col] = info
273
276
  col += 1
274
277
  }
275
- newTransitional
278
+ new_transitional
276
279
  html() {
277
280
  head() {
278
281
  title() { @title }
279
- commonHead()
280
- stylesheet subStylesheetUrl
282
+ common_head()
283
+ stylesheet sub_stylesheet_url
281
284
  }
282
285
  body({'class'=>'thumbs'}){
283
- h3({}){ addHtml(escapeHTML(@title)) }
284
- if(sizeOfZipfile > 0)
285
- a({"href" => DownloadName }) { addHtml(DownloadName) }
286
- addHtml("(#{bytesAsString(sizeOfZipfile)})")
287
- end
288
- if(@options.addSlideshow?)
289
- a({"href" => File.join('slideshow.htm'), "target" => "_top"}) {
290
- addHtml(SlideshowName)
291
- }
292
- end
293
- imageTable({'class'=>'table'}) {
294
- matrix.each { |row|
295
- imageRow {
296
- row.each { |info|
297
- if info
298
- imageColumn {
299
- addPreview(info)
300
- }
301
- end
302
- }
303
- }
304
- }
305
- }
286
+ h3({}){ add_html(escape_html(@title)) }
287
+ if(size_of_zipfile > 0)
288
+ a({"href" => DownloadName }) { add_html(DownloadName) }
289
+ add_html("(#{bytes_as_string(size_of_zipfile)})")
290
+ end
291
+ if(@options.addSlideshow?)
292
+ a({"href" => File.join('slideshow.htm'), "target" => "_top"}) {
293
+ add_html(SlideshowName)
294
+ }
295
+ end
296
+ image_table({'class'=>'table'}) {
297
+ matrix.each do |m_row|
298
+ image_row {
299
+ m_row.each do |info|
300
+ if info
301
+ image_column {
302
+ add_preview(info)
303
+ }
304
+ end
305
+ end
306
+ }
307
+ end
308
+ }
306
309
  }
307
310
  }
308
311
  File.open(File.join(imageOutputPath, indexName), 'w') { | fp |
309
- fp.print(getPage) }
312
+ fp.print(get_page) }
310
313
  end
311
314
 
312
- def imageTable(params, &block)
315
+ def image_table(params, &block)
313
316
  if @options.useTable?
314
317
  table(params, &block)
315
318
  else
@@ -317,140 +320,140 @@ class ThumbnailPageGenerator < HtmlGenerator
317
320
  end
318
321
  end
319
322
 
320
- def imageRow(&block)
321
- if @options.useTable?
322
- tr({}, &block)
323
- else
324
- block.call
325
- end
323
+ def image_row(&block)
324
+ if @options.useTable?
325
+ tr({}, &block)
326
+ else
327
+ block.call
328
+ end
326
329
  end
327
330
 
328
- def imageColumn(&block)
329
- if @options.useTable?
330
- td({}, &block)
331
- else
332
- dd({}, &block)
333
- end
331
+ def image_column(&block)
332
+ if @options.useTable?
333
+ td({}, &block)
334
+ else
335
+ dd({}, &block)
336
+ end
334
337
  end
335
338
 
336
- def addPreview(info)
339
+ def add_preview(info)
337
340
  div({'class' => 'preview'}){
338
341
  div({'class' => 'thumb'}){
339
- p {
340
- name = escapeHtml(info.nameWithoutExtension)
341
- a({
342
- "href" => name + HtmlExt,
343
- 'target' => '_top'}
344
- ) {
345
- img('t_'+ imageName(info), name)
346
- }
347
- }
342
+ p {
343
+ name = escape_html(info.name_without_extension)
344
+ a({
345
+ "href" => name + HtmlExt,
346
+ 'target' => '_top'}
347
+ ) {
348
+ img(image_name(info, 't_'), name)
349
+ }
350
+ }
348
351
  }
349
352
  }
350
353
  end
351
354
 
352
- def frameText()
353
- newFrame
355
+ def frame_text()
356
+ new_frame
354
357
  html(){
355
358
  head(){
356
359
  title { 'Bildindex' }
357
- commonHead
358
- stylesheet mainStylesheetUrl
360
+ common_head
361
+ stylesheet main_stylesheet_url
359
362
  }
360
363
  frameset({'rows'=>'14%,65%,21%'}){
361
364
  frame({
362
- 'src'=>"kopf.htm",
363
- 'name'=>"Kopf",
364
- 'scrolling'=>"no",
365
- 'frameborder'=>"0"
366
- })
367
- frameset({'cols'=>"15%,85%"}){
368
- frame({
369
- 'src'=>"navigation.htm",
370
- 'name'=>"Navigation",
371
- 'scrolling'=>"yes",
365
+ 'src'=>"kopf.htm",
366
+ 'name'=>"Kopf",
367
+ 'scrolling'=>"no",
372
368
  'frameborder'=>"0"
373
369
  })
370
+ frameset({'cols'=>"15%,85%"}){
374
371
  frame({
375
- 'src'=>"#{subDir + sep + indexName}",
376
- 'name'=>"Daten",
377
- 'frameborder'=>"0"
378
- })
372
+ 'src'=>"navigation.htm",
373
+ 'name'=>"Navigation",
374
+ 'scrolling'=>"yes",
375
+ 'frameborder'=>"0"
376
+ })
377
+ frame({
378
+ 'src'=>"#{subDir + sep + indexName}",
379
+ 'name'=>"Daten",
380
+ 'frameborder'=>"0"
381
+ })
379
382
  }
380
383
  frame({
381
- 'src'=>"fuss.htm",
382
- 'name'=>"Fuss",
383
- 'scrolling'=>"no",
384
- 'frameborder'=>"0"
385
- })
384
+ 'src'=>"fuss.htm",
385
+ 'name'=>"Fuss",
386
+ 'scrolling'=>"no",
387
+ 'frameborder'=>"0"
388
+ })
386
389
  noframes(){
387
390
  cr
388
- addHtml('Ohne Frames siehe: ')
391
+ add_html('Ohne Frames siehe: ')
389
392
  a({'href'=>"navigation.htm"}){
390
- addHtml('Navigationsleiste')
393
+ add_html('Navigationsleiste')
391
394
  }
392
395
  }
393
396
  }
394
397
  }
395
- return getPage
398
+ return get_page
396
399
  end
397
400
 
398
- def buildFramePage()
399
- content = frameText
400
- writeFile(File.join(outputPath, subDir + HtmlExt), content)
401
- writeFile(File.join(outputPath, indexName), content)
401
+ def build_frame_page()
402
+ content = frame_text
403
+ write_file(File.join(output_path, subDir + HtmlExt), content)
404
+ write_file(File.join(output_path, indexName), content)
402
405
  end
403
406
 
404
- def writeFile(file, content)
405
- return if File.exists?(file) && !isPiggyFile?(file)
407
+ def write_file(file, content)
408
+ return if File.exists?(file) && !is_piggy_file?(file)
406
409
  File.open(file, 'w') { |fp| fp.print(content) }
407
410
  end
408
411
 
409
- def buildZipfile(nameOfZipFile, progress)
412
+ def build_zip_file(nameOfZipFile, progress)
410
413
  require 'zip/zip'
411
- progress.setTask("Creating zipfile", @inputFilenames.size)
414
+ progress.set_task("Creating zipfile", @inputFilenames.size)
412
415
  Zip::ZipFile.open(nameOfZipFile, Zip::ZipFile::CREATE) {
413
416
  |zipfile|
414
417
  zipfile.mkdir(subDir)
415
418
  @inputFilenames.each do
416
419
  |info|
417
- progress.setProgress("Zip #{info.name}", 1)
420
+ progress.set_progress("Zip #{info.name}", 1)
418
421
  entry = File.join(subDir, info.name)
419
- src = info.nameWithPath
422
+ src = info.name_with_path
420
423
  zipfile.add(entry, src)
421
424
  end
422
425
  }
423
426
  end
424
427
 
425
- def copyTemplateFiles()
428
+ def copy_template_files()
426
429
  if @options.generateFramePage
427
- copyTemplates(['navigation.htm', 'kopf.htm', 'fuss.htm'],
428
- outputPath)
429
- copyStyle(outputPath)
430
+ copy_templates(['navigation.htm', 'kopf.htm', 'fuss.htm'],
431
+ output_path)
432
+ copy_style(output_path)
430
433
  else
431
- copyStyle(imageOutputPath)
434
+ copy_style(imageOutputPath)
432
435
  end
433
436
  if @options.addSlideshow?
434
- copyTemplates(['slideshow.htm', 'slideshow.js'], imageOutputPath)
435
- link = "<link href=\"#{subStylesheetUrl}\" rel=\"stylesheet\" type=\"text/css\">"
436
- insertInFile(File.join(imageOutputPath, 'slideshow.htm'),
437
- /<!--STYLE-->/, link)
437
+ copy_templates(['slideshow.htm', 'slideshow.js'], imageOutputPath)
438
+ link = "<link href=\"#{sub_stylesheet_url}\" rel=\"stylesheet\" type=\"text/css\">"
439
+ insert_in_file(File.join(imageOutputPath, 'slideshow.htm'),
440
+ /<!--STYLE-->/, link)
438
441
  end
439
442
  end
440
443
 
441
- def styleSourceDir
444
+ def style_source_dir
442
445
  File.join(PIGGY_PATH, 'templates/styles', @options.style)
443
446
  end
444
447
 
445
- def copyStyle(targetPath)
446
- targetDir = File.join(targetPath, 'style')
447
- File.makedirs(targetDir)
448
- Dir[File.join(styleSourceDir, '*.*')].each { |fName|
449
- File.copy(fName, targetDir) unless File.exists?(File.join(targetDir, fName))
448
+ def copy_style(targetPath)
449
+ target_dir = File.join(targetPath, 'style')
450
+ File.makedirs(target_dir)
451
+ Dir[File.join(style_source_dir, '*.*')].each { |fName|
452
+ File.copy(fName, target_dir) unless File.exists?(File.join(target_dir, fName))
450
453
  }
451
454
  end
452
455
 
453
- def copyTemplates(files, targetPath)
456
+ def copy_templates(files, targetPath)
454
457
  files.each do
455
458
  |fName|
456
459
  unless File.exists?(File.join(targetPath, fName))
@@ -461,7 +464,7 @@ class ThumbnailPageGenerator < HtmlGenerator
461
464
  end
462
465
 
463
466
  # Insert insertion into file after any match of pattern
464
- def insertInFile(file, pattern, insertion)
467
+ def insert_in_file(file, pattern, insertion)
465
468
  lines = File.readlines(file)
466
469
  File.open(file, 'w') { |fp|
467
470
  lines.each { |line|
@@ -471,18 +474,18 @@ class ThumbnailPageGenerator < HtmlGenerator
471
474
  }
472
475
  end
473
476
 
474
- def updateNavigationFrame()
477
+ def update_navigation_frame()
475
478
  reset
476
- navFile = File.join(outputPath, 'navigation.htm')
479
+ nav_file = File.join(output_path, 'navigation.htm')
477
480
  a({
478
- 'href' => escapeHtml(subDir) + '/index.htm',
479
- 'target' => 'Daten'}) {
480
- addHtml(escapeHTML(@title))
481
+ 'href' => escape_html(subDir) + '/index.htm',
482
+ 'target' => 'Daten'}) {
483
+ add_html(escape_html(@title))
481
484
  }
482
485
  br
483
- addHtml("\n")
484
- link = getPage
485
- insertInFile(navFile, /<!--NAV-->/, link)
486
+ add_html("\n")
487
+ link = get_page
488
+ insert_in_file(nav_file, /<!--NAV-->/, link)
486
489
  end
487
490
 
488
491
  def error msg
@@ -493,37 +496,38 @@ class ThumbnailPageGenerator < HtmlGenerator
493
496
  ##
494
497
  # Will create the directory for all the '3 files per image'
495
498
  # unless directory exits
496
- def createSubdir
497
- subDirWithPath = File.join(outputPath, subDir)
498
- Dir.mkdir(subDirWithPath) unless File.directory?(subDirWithPath)
499
+ def create_subdir
500
+ sub_dir_with_path = File.join(output_path, subDir)
501
+ Dir.mkdir(sub_dir_with_path) unless File.directory?(sub_dir_with_path)
499
502
  end
500
503
 
501
504
  ##
502
505
  # Central bublic doit function
503
- def generate(progress, overwrite=false, addZipfile=false)
504
- if File.directory?(File.join(outputPath, subDir)) && !overwrite
505
- return error("#{subDir} allready exists")
506
+ def generate(progress, overwrite=false, add_zipfile=false)
507
+ unless File.directory?(output_path)
508
+ return error("#{output_path} ist no directory}")
506
509
  end
507
- unless File.directory?(outputPath)
508
- return error("#{outputPath} ist no directory}")
510
+ if File.directory?(File.join(output_path, subDir))
511
+ return error("#{subDir} allready exists") unless overwrite
512
+ else
513
+ progress.set_task("Creating directory")
514
+ create_subdir
509
515
  end
510
- progress.setTask("Creating directory")
511
- createSubdir
512
- sizeOfZipfile = -1
513
- if addZipfile
514
- nameOfZipFile = File.join(outputPath, subDir, DownloadName)
515
- buildZipfile(nameOfZipFile, progress)
516
- sizeOfZipfile = File.size(nameOfZipFile) if File.exists?(nameOfZipFile)
516
+ size_of_zipfile = -1
517
+ if add_zipfile
518
+ name_of_zip_file = File.join(output_path, subDir, DownloadName)
519
+ build_zip_file(name_of_zip_file, progress)
520
+ size_of_zipfile = File.size(name_of_zip_file) if File.exists?(name_of_zip_file)
517
521
  end
518
- buildHtmlPagesForImages(progress)
519
- buildThumbnailPage(sizeOfZipfile)
520
- copyTemplateFiles
521
- buildSlideshowList if @options.addSlideshow?
522
+ build_html_pages_for_images(progress)
523
+ build_thumbnail_page(size_of_zipfile)
524
+ copy_template_files
525
+ build_slideshow_list if @options.addSlideshow?
522
526
  if @options.generateFramePage?
523
- buildFramePage
524
- updateNavigationFrame
527
+ build_frame_page
528
+ update_navigation_frame
525
529
  end
526
- imageProcessing(progress)
530
+ image_processing(progress) unless @options.skipImageProcessing
527
531
  return true
528
532
  end
529
533
 
@@ -532,12 +536,12 @@ class ThumbnailPageGenerator < HtmlGenerator
532
536
  ##
533
537
  # Overwrite this hook method to add image processing
534
538
  # to html genmeration
535
- def imageProcessing(&block)
539
+ def image_processing(&block)
536
540
  end
537
541
 
538
542
  ##
539
543
  # Service which migt be useful if no client is set
540
- def runCommand(commandline, workingDir)
541
- inPath(workingDir) { `#{commandline}` }
544
+ def run_command(commandline, workingDir)
545
+ in_path(workingDir) { `#{commandline}` }
542
546
  end
543
547
  end