photish 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/photish/command/generate.rb +0 -15
- data/lib/photish/gallery/collection.rb +4 -4
- data/lib/photish/gallery/photo.rb +2 -2
- data/lib/photish/gallery/traits/albumable.rb +7 -7
- data/lib/photish/gallery/traits/breadcrumbable.rb +2 -1
- data/lib/photish/gallery/traits/metadatable.rb +1 -1
- data/lib/photish/gallery/traits/urlable.rb +5 -5
- data/lib/photish/render/change_manifest.rb +16 -7
- data/lib/photish/render/image_conversion.rb +2 -1
- 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: 837da75e8c5426ba38888369dc28eaa433e5162c
|
4
|
+
data.tar.gz: 8678a47a42f4b7e49ec3faae98130ada68e742e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5fb8362d0d569a7f2f7c13edcd86259112cc062714f64a30602d3d00aaf7e6efde8bf0f5753a72a7f92447702b67d823085c363e445defddee223d98341374d
|
7
|
+
data.tar.gz: e5309014399f150ee267288433e363206b6b9356c4f6c7fbe28d9a61f9cbdd00112d0cb01017a890b6e7c946bd8488d12f2f2e37a04f1ca5987cdd1d539f5bad
|
data/README.md
CHANGED
@@ -21,6 +21,13 @@ information, Photish creates a complete static website that can be hosted on an
|
|
21
21
|
[NGINX](http://nginx.org/), [Apache HTTP Server](https://httpd.apache.org/), or
|
22
22
|
even on [Github Pages](https://pages.github.com/).
|
23
23
|
|
24
|
+
Photish has been created with speed and efficiency in mind. Threads are used
|
25
|
+
to parallelize image transcoding to achieve maximum utilization of your CPU
|
26
|
+
during generation. A cache file is then used to ensure that unless the image
|
27
|
+
has changed, it is not needlessly regenerated. This results in a responsive
|
28
|
+
and fast local development environment, making it easy to perfect the design
|
29
|
+
of your photo based website without having to wait for regeneration.
|
30
|
+
|
24
31
|
## Getting Started
|
25
32
|
|
26
33
|
It is strongly recommended to read through the [Installation](#installation)
|
@@ -2,9 +2,7 @@ module Photish
|
|
2
2
|
module Command
|
3
3
|
class Generate < Base
|
4
4
|
def run
|
5
|
-
log_important_config_values
|
6
5
|
load_all_plugins
|
7
|
-
log_album_and_photo_names
|
8
6
|
render_whole_site
|
9
7
|
log.info 'Site generation completed successfully'
|
10
8
|
end
|
@@ -24,19 +22,6 @@ module Photish
|
|
24
22
|
Photish::Plugin::Repository.reload(log, site_dir)
|
25
23
|
end
|
26
24
|
|
27
|
-
def log_important_config_values
|
28
|
-
log.info "Photo directory: #{photo_dir}"
|
29
|
-
log.info "Site directory: #{site_dir}"
|
30
|
-
log.info "Output directory: #{output_dir}"
|
31
|
-
end
|
32
|
-
|
33
|
-
def log_album_and_photo_names
|
34
|
-
collection.albums.each do |album|
|
35
|
-
log.info album.name
|
36
|
-
log.info album.photos.map(&:name)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
25
|
def render_whole_site
|
41
26
|
Photish::Render::Site.new(templates,
|
42
27
|
site_dir,
|
@@ -30,10 +30,10 @@ module Photish
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def all_url_paths
|
33
|
-
[url_path,
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
@all_url_paths ||= [url_path,
|
34
|
+
all_albums.map(&:url_path),
|
35
|
+
all_photos.map(&:url_path),
|
36
|
+
all_images.map(&:url_path)].flatten
|
37
37
|
end
|
38
38
|
|
39
39
|
private
|
@@ -21,11 +21,11 @@ module Photish
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def images
|
24
|
-
qualities.map { |quality| Photish::Gallery::Image.new(self, path, quality) }
|
24
|
+
@images ||= qualities.map { |quality| Photish::Gallery::Image.new(self, path, quality) }
|
25
25
|
end
|
26
26
|
|
27
27
|
def exif
|
28
|
-
MiniExiftool.new(path)
|
28
|
+
@exif ||= MiniExiftool.new(path)
|
29
29
|
end
|
30
30
|
|
31
31
|
def plugin_type
|
@@ -11,19 +11,19 @@ module Photish
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def all_albums
|
14
|
-
albums.map { |album| [album] + album.all_albums }
|
15
|
-
|
14
|
+
@all_albums ||= albums.map { |album| [album] + album.all_albums }
|
15
|
+
.flatten
|
16
16
|
end
|
17
17
|
|
18
18
|
def all_photos
|
19
|
-
all_albums.map(&:photos)
|
20
|
-
|
21
|
-
|
19
|
+
@all_photos ||= all_albums.map(&:photos)
|
20
|
+
.concat(self.try(:photos) || [])
|
21
|
+
.flatten
|
22
22
|
end
|
23
23
|
|
24
24
|
def all_images
|
25
|
-
all_photos.map(&:images)
|
26
|
-
|
25
|
+
@all_images ||= all_photos.map(&:images)
|
26
|
+
.flatten
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -3,25 +3,25 @@ module Photish
|
|
3
3
|
module Traits
|
4
4
|
module Urlable
|
5
5
|
def url
|
6
|
-
[host, url_parts].flatten.join('/')
|
6
|
+
@url ||= [host, url_parts].flatten.join('/')
|
7
7
|
end
|
8
8
|
|
9
9
|
def url_path
|
10
|
-
url_parts.join('/')
|
10
|
+
@url_path ||= url_parts.join('/')
|
11
11
|
end
|
12
12
|
|
13
13
|
def url_parts
|
14
|
-
base_url_parts + [url_end]
|
14
|
+
@url_parts ||= base_url_parts + [url_end]
|
15
15
|
end
|
16
16
|
|
17
17
|
def base_url_parts
|
18
|
-
parent.base_url_parts + [slugify(base_url_name)]
|
18
|
+
@base_url_parts ||= parent.base_url_parts + [slugify(base_url_name)]
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
23
|
def host
|
24
|
-
normalized_host || ''
|
24
|
+
@host ||= normalized_host || ''
|
25
25
|
end
|
26
26
|
|
27
27
|
def normalized_host
|
@@ -3,34 +3,43 @@ module Photish
|
|
3
3
|
class ChangeManifest
|
4
4
|
def initialize(output_dir)
|
5
5
|
@output_dir = output_dir
|
6
|
+
@dirty = false
|
6
7
|
end
|
7
8
|
|
8
9
|
def record(key, file_path = nil)
|
9
|
-
|
10
|
+
@dirty = true
|
11
|
+
db[key] = checksum_of_file(file_path || key)
|
10
12
|
end
|
11
13
|
|
12
14
|
def changed?(key, file_path = nil)
|
13
|
-
|
15
|
+
checksum_of_file(file_path || key) != old_checksum_of_file(key)
|
14
16
|
end
|
15
17
|
|
16
18
|
def flush_to_disk
|
19
|
+
return unless dirty
|
17
20
|
File.open(db_file, 'w') { |f| f.write((db || {}).to_yaml) }
|
18
21
|
end
|
19
22
|
|
23
|
+
def preload
|
24
|
+
db
|
25
|
+
end
|
26
|
+
|
20
27
|
private
|
21
28
|
|
22
|
-
attr_reader :output_dir
|
29
|
+
attr_reader :output_dir,
|
30
|
+
:dirty
|
23
31
|
|
24
|
-
def
|
32
|
+
def checksum_of_file(file_path)
|
25
33
|
Digest::MD5.file(file_path).hexdigest
|
26
34
|
end
|
27
|
-
|
28
|
-
def
|
35
|
+
|
36
|
+
def old_checksum_of_file(file_path)
|
29
37
|
db[file_path]
|
30
38
|
end
|
31
39
|
|
32
40
|
def db
|
33
|
-
@db
|
41
|
+
return @db if @db
|
42
|
+
@db = File.exist?(db_file) ? YAML.load_file(db_file) : {}
|
34
43
|
end
|
35
44
|
|
36
45
|
def db_file
|
@@ -10,8 +10,9 @@ module Photish
|
|
10
10
|
def render(images)
|
11
11
|
image_queue = to_queue(images)
|
12
12
|
|
13
|
-
log.info "Rendering #{images.count} across #{max_workers} threads"
|
13
|
+
log.info "Rendering #{images.count} images across #{max_workers} threads"
|
14
14
|
|
15
|
+
change_manifest.preload
|
15
16
|
workers = (0...max_workers).map do
|
16
17
|
Thread.new do
|
17
18
|
begin
|
data/lib/photish/version.rb
CHANGED