photish 0.3.4 → 0.3.5
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 +4 -4
- data/README.md +24 -11
- data/lib/photish/cache/manifest_db_file.rb +6 -1
- data/lib/photish/cli/interface.rb +2 -1
- data/lib/photish/command/generate.rb +10 -0
- data/lib/photish/config/default_config.rb +1 -0
- data/lib/photish/render/image_conversion.rb +6 -6
- data/lib/photish/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31149e215cc2087c36f281ad5a1984ad2ce5f45b
|
4
|
+
data.tar.gz: 64ee1e2e49df780d17533a63bf3d17e8346fa7ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f9e9849870e9dcaaf562a5e5b13e6d931bddea503f00e2351958c8bbe763cbe7191c1322a0173a87cc2a02fbacb3fbf1ca6ddfe7cfc20d9e1be72f60625fe47
|
7
|
+
data.tar.gz: e937262b5fa4c831585831ff2161412bb6f50a10ca729b83513159f2bbaf28148e95a3fd58f9b21a0009b4be1782b888b55cbff71bbfc1e772df1c70bf964e6e
|
data/README.md
CHANGED
@@ -64,6 +64,8 @@ and running:
|
|
64
64
|
- [Execution Order](#execution-order)
|
65
65
|
- [Workers and Threads](#workers-and-threads)
|
66
66
|
- [Caching](#caching)
|
67
|
+
- [Automatic Rengeneration](#automatic-regeneration)
|
68
|
+
- [Forced Regeneration](#forced-regeneration)
|
67
69
|
- [Host](#host)
|
68
70
|
- [Rake Task](#rake-task)
|
69
71
|
- [Plugins](#plugins)
|
@@ -294,6 +296,7 @@ url:
|
|
294
296
|
base: 'subdirectory'
|
295
297
|
workers: 4
|
296
298
|
threads: 2
|
299
|
+
force: false
|
297
300
|
```
|
298
301
|
|
299
302
|
The meanings and purpose of each field is defined below:
|
@@ -318,6 +321,7 @@ Field | Purpose
|
|
318
321
|
`url/base` | if your website will be hosted in a sub folder and will not be accessible at the root of the host, you can specify the sub folder(s) here, this will also mean your website will be hosted in a sub folder when ran using `photish host`
|
319
322
|
`workers` | the number of workers to create, for computers with multiple processors, photish is configured by default to spawn a worker for each process, a worker is responsible for image generation and html generation, load balancing is done randomly via a simple round robin allocation
|
320
323
|
`threads` | the number of threads each worker should create to handle image magick transcoding
|
324
|
+
`force` | this should always be false, if true, all content will be regenerated and nothing cached
|
321
325
|
|
322
326
|
#### Customizing Templates
|
323
327
|
|
@@ -473,11 +477,11 @@ The Generate command does the following:
|
|
473
477
|
|
474
478
|
#### Workers and Threads
|
475
479
|
|
476
|
-
In order to achieve maximum utilization of all processors on a
|
480
|
+
In order to achieve maximum utilization of all processors on a computer during
|
477
481
|
generation, Photish has the ability to create multiple workers and threads.
|
478
482
|
|
479
483
|
A worker is a spawned sub process created by the Generate command. The worker
|
480
|
-
sub process is responsible for generating the HTML and Images for a
|
484
|
+
sub process is responsible for generating the HTML and Images for a subset of
|
481
485
|
the collection.
|
482
486
|
|
483
487
|
Within each worker, threads are created when calling out to the Image Magick
|
@@ -486,11 +490,11 @@ utilization so rather then block the whole worker, it can be more performant to
|
|
486
490
|
spawn multiple Image Magick processes at once.
|
487
491
|
|
488
492
|
For collections with a large number of images and HTML pages, multiple workers
|
489
|
-
and threads can be used to rapidly speed up generation. However if the
|
490
|
-
collection
|
491
|
-
|
492
|
-
|
493
|
-
a single ruby process.
|
493
|
+
and threads can be used to rapidly speed up generation. However, if the
|
494
|
+
collection has a small number of photos and pages, workers and threads will
|
495
|
+
increase the generation time as loading a new ruby process and creating
|
496
|
+
multiple threads may have a higher setup time then just generating everything
|
497
|
+
in a single ruby process.
|
494
498
|
|
495
499
|
The number of workers and threads is configurable in the [config
|
496
500
|
file](#config-file-options) with the `workers` and `threads` options. By
|
@@ -510,16 +514,25 @@ a local version of Photish with the Host command.
|
|
510
514
|
|
511
515
|
The cache file is stored in the `output_dir` and is named `.changes.yml`.
|
512
516
|
|
513
|
-
|
514
|
-
flag:
|
515
|
-
|
516
|
-
$ photish generate --force
|
517
|
+
##### Automatic Regeneration
|
517
518
|
|
518
519
|
Images are regenerated when they are modified, renamed or moved.
|
519
520
|
|
520
521
|
Changing the `qualities` option in the config file will also trigger a full
|
521
522
|
regeneration of all images.
|
522
523
|
|
524
|
+
##### Forced Regeneration
|
525
|
+
|
526
|
+
To do a full regeneration, run the Generate command with the `--force`
|
527
|
+
flag:
|
528
|
+
|
529
|
+
$ photish generate --force
|
530
|
+
|
531
|
+
The host command also supports the `--force` flag, to do a full regeneration
|
532
|
+
on every change:
|
533
|
+
|
534
|
+
$ photish host --force
|
535
|
+
|
523
536
|
### Host
|
524
537
|
|
525
538
|
To test and view your changes locally, the host command can be used to run a
|
@@ -10,6 +10,10 @@ module Photish
|
|
10
10
|
File.open(db_file(output_dir), 'w') { |f| f.write(changes.to_yaml) }
|
11
11
|
end
|
12
12
|
|
13
|
+
def clear(output_dir)
|
14
|
+
FileUtils.rm_rf(db_file(output_dir))
|
15
|
+
end
|
16
|
+
|
13
17
|
def db_file(output_dir)
|
14
18
|
FileUtils.mkdir_p(output_dir)
|
15
19
|
File.join(output_dir, '.changes.yml')
|
@@ -22,7 +26,8 @@ module Photish
|
|
22
26
|
|
23
27
|
module_function :concat_db_files,
|
24
28
|
:db_file,
|
25
|
-
:worker_db_file
|
29
|
+
:worker_db_file,
|
30
|
+
:clear
|
26
31
|
end
|
27
32
|
end
|
28
33
|
end
|
@@ -4,7 +4,7 @@ module Photish
|
|
4
4
|
package_name "Photish"
|
5
5
|
|
6
6
|
desc "generate", "Generates the gallery static site"
|
7
|
-
option :
|
7
|
+
option :force, type: :boolean
|
8
8
|
def generate
|
9
9
|
Photish::Command::Generate.new(options).execute
|
10
10
|
end
|
@@ -16,6 +16,7 @@ module Photish
|
|
16
16
|
end
|
17
17
|
|
18
18
|
desc "host", "Serves the HTML on a HTTP server"
|
19
|
+
option :force, type: :boolean
|
19
20
|
def host
|
20
21
|
Photish::Command::Host.new(options).execute
|
21
22
|
end
|
@@ -4,6 +4,7 @@ module Photish
|
|
4
4
|
def run
|
5
5
|
log.info "Starting generation with #{workers} workers"
|
6
6
|
|
7
|
+
clear_cache if force_regeneration?
|
7
8
|
spawn_all_workers
|
8
9
|
load_all_plugins
|
9
10
|
wait_for_workers_to_complete
|
@@ -22,8 +23,17 @@ module Photish
|
|
22
23
|
:qualities,
|
23
24
|
:photish_executable,
|
24
25
|
:workers,
|
26
|
+
:force,
|
25
27
|
to: :config
|
26
28
|
|
29
|
+
def force_regeneration?
|
30
|
+
force == true
|
31
|
+
end
|
32
|
+
|
33
|
+
def clear_cache
|
34
|
+
Cache::ManifestDbFile.clear(output_dir)
|
35
|
+
end
|
36
|
+
|
27
37
|
def load_all_plugins
|
28
38
|
Plugin::Repository.reload(log, site_dir)
|
29
39
|
end
|
@@ -12,7 +12,7 @@ module Photish
|
|
12
12
|
def render(images)
|
13
13
|
log.info "Rendering #{images.count} images across #{threads} threads"
|
14
14
|
|
15
|
-
|
15
|
+
cache.preload
|
16
16
|
threads = spawn_thread_instances(to_queue(images))
|
17
17
|
threads.map(&:join)
|
18
18
|
flush_to_disk
|
@@ -30,7 +30,7 @@ module Photish
|
|
30
30
|
:changed?,
|
31
31
|
:flush_to_disk,
|
32
32
|
:preload,
|
33
|
-
to: :
|
33
|
+
to: :cache
|
34
34
|
|
35
35
|
def spawn_thread_instances(image_queue)
|
36
36
|
(0...threads).map do
|
@@ -74,10 +74,10 @@ module Photish
|
|
74
74
|
FileUtils.mkdir_p(File.join(output_dir, image.base_url_parts))
|
75
75
|
end
|
76
76
|
|
77
|
-
def
|
78
|
-
@
|
79
|
-
|
80
|
-
|
77
|
+
def cache
|
78
|
+
@cache ||= Cache::Manifest.new(output_dir,
|
79
|
+
worker_index,
|
80
|
+
version_hash)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
data/lib/photish/version.rb
CHANGED