photish 0.7.0 → 0.7.1
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 +8 -8
- data/README.md +15 -0
- data/TODO.md +0 -1
- data/lib/photish/assets/example/site/sitemap.xml.slim +5 -0
- data/lib/photish/gallery/traits/albumable.rb +7 -0
- data/lib/photish/render/asset_page.rb +13 -6
- data/lib/photish/render/site.rb +2 -1
- data/lib/photish/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjcxN2U3NzM1YzQ3YzgxNmFjN2FkNTk5YjU2MjYxZmUyMjJkMjM3Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODM0OTAwYjZjNzE1NjViNDVjMGNmMjFjYWI3MjU4NzA1NWVjMjJhMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzgxNWY3MGQ0NWMyMzJiNjc4Nzk0Y2JiYzQ3NWZlNGRhNDFkMTJkN2MyYjQ3
|
10
|
+
Y2U2Yzc5MTJiNTY5YjMxZjBjZDI3OGQwZDcwYWE4ZDM1M2UyM2E5NzIxZjg3
|
11
|
+
MjY0YmYwMjIyOTMzOWFlMmJhNzMyODE2ZWVmODAwYmFiNTBmODk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzMyM2Q2NGIwYWQ5OGNhNWQxOWRhMGE5MzcyMmUzMGMxOTdhYzhhMmQxNTBh
|
14
|
+
NGJlZDRkYTA2MjgzYTRlZmE1MTg4MzQ3Zjc2NWRkNGE5MDNjZDBlMGRmNGQx
|
15
|
+
M2I4ZWQ2ZDYyMDcxYjNlOTdjYjE1Y2QyNGRmYjk5Nzg0MzMzNTU=
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[](https://badge.fury.io/rb/photish)
|
2
2
|
[](https://travis-ci.org/henrylawson/photish)
|
3
|
+
[](https://snap-ci.com/henrylawson/photish/branch/master)
|
3
4
|
[](https://gemnasium.com/henrylawson/photish)
|
4
5
|
[](https://codeclimate.com/github/henrylawson/photish)
|
5
6
|
[](https://codeclimate.com/github/henrylawson/photish/coverage)
|
@@ -237,6 +238,14 @@ Target OS dependencies:
|
|
237
238
|
$ sudo apt-get install imagemagick # or sudo apt-get install graphicsmagick
|
238
239
|
$ sudo apt-get install libimage-exiftool-perl
|
239
240
|
|
241
|
+
**On CentOS, RedHat, etc.**
|
242
|
+
|
243
|
+
$ sudo apt-get install ruby2.2
|
244
|
+
$ sudo yum install ruby-rdoc ruby-devel rubygems
|
245
|
+
$
|
246
|
+
$ sudo yum install ImageMagick
|
247
|
+
$ sudo yum install perl-Image-ExifTool
|
248
|
+
|
240
249
|
### Ruby Versions
|
241
250
|
|
242
251
|
Photish supports multiple ruby versions:
|
@@ -643,6 +652,12 @@ and the basename is used for the final filename. This allows you to specify
|
|
643
652
|
custom extensions before the `page_extension` such as TXT or XML. In the
|
644
653
|
example above, HTML is specified.
|
645
654
|
|
655
|
+
[An
|
656
|
+
example](https://github.com/henrylawson/photish/blob/master/lib/photish/assets/example/site/sitemap.xml.slim)
|
657
|
+
usage of an Asset Page is in the [include example
|
658
|
+
site](https://github.com/henrylawson/photish#initialize), it uses an Asset Page
|
659
|
+
to create a [sitemap.xml](https://www.xml-sitemaps.com/)
|
660
|
+
|
646
661
|
### Generate
|
647
662
|
|
648
663
|
The static HTML can be generated by running the below command inside the
|
data/TODO.md
CHANGED
@@ -0,0 +1,5 @@
|
|
1
|
+
urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
|
2
|
+
- (all_entities).map(&:url).each do |url|
|
3
|
+
url
|
4
|
+
loc #{url}
|
5
|
+
lastmod #{Time.now.iso8601}
|
@@ -10,6 +10,13 @@ module Photish
|
|
10
10
|
.map { |file| album_class.new(self, file) }
|
11
11
|
end
|
12
12
|
|
13
|
+
def all_entities
|
14
|
+
all_albums +
|
15
|
+
all_photos +
|
16
|
+
all_pages +
|
17
|
+
all_images
|
18
|
+
end
|
19
|
+
|
13
20
|
def all_albums
|
14
21
|
@all_albums ||= albums.map { |album| [album] + album.all_albums }
|
15
22
|
.flatten
|
@@ -3,10 +3,11 @@ module Photish
|
|
3
3
|
class AssetPage
|
4
4
|
include Log::Loggable
|
5
5
|
|
6
|
-
def initialize(collection, output_dir, site_dir)
|
6
|
+
def initialize(collection, output_dir, site_dir, url)
|
7
7
|
@collection = collection
|
8
8
|
@output_dir = output_dir
|
9
9
|
@site_dir = site_dir
|
10
|
+
@url = url
|
10
11
|
end
|
11
12
|
|
12
13
|
def render(page_paths)
|
@@ -17,12 +18,13 @@ module Photish
|
|
17
18
|
|
18
19
|
attr_reader :collection,
|
19
20
|
:output_dir,
|
20
|
-
:site_dir
|
21
|
+
:site_dir,
|
22
|
+
:url
|
21
23
|
|
22
24
|
def render_all(page_paths)
|
23
25
|
Array(page_paths).each do |page_path|
|
24
26
|
rendered_model = render_page(page_path)
|
25
|
-
output_model_file =
|
27
|
+
output_model_file = output_model_file(page_path)
|
26
28
|
output_model_dir = File.dirname(output_model_file)
|
27
29
|
|
28
30
|
log.debug "Rendering #{page_path} to #{output_model_file}"
|
@@ -32,12 +34,17 @@ module Photish
|
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
37
|
+
def output_model_file(page_path)
|
38
|
+
relative = relative_to_output_dir(page_path)
|
39
|
+
dirname = File.dirname(relative)
|
40
|
+
filename = relative.sub(dirname, '')
|
41
|
+
File.join([dirname, url.base, filename].compact)
|
42
|
+
end
|
43
|
+
|
35
44
|
def relative_to_output_dir(page_path)
|
36
45
|
relative_path = page_path.gsub(site_dir, '')
|
37
46
|
basename = File.basename(relative_path, File.extname(relative_path))
|
38
|
-
|
39
|
-
puts a
|
40
|
-
a
|
47
|
+
File.join(output_dir, File.dirname(relative_path), basename)
|
41
48
|
end
|
42
49
|
|
43
50
|
def render_page(page_path)
|
data/lib/photish/render/site.rb
CHANGED
data/lib/photish/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: photish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Lawson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -400,6 +400,7 @@ files:
|
|
400
400
|
- lib/photish/assets/example/site/custom.html
|
401
401
|
- lib/photish/assets/example/site/images/crumbs.gif
|
402
402
|
- lib/photish/assets/example/site/map/site_albums.html.slim
|
403
|
+
- lib/photish/assets/example/site/sitemap.xml.slim
|
403
404
|
- lib/photish/assets/example/site/styles/basic.css
|
404
405
|
- lib/photish/assets/gitignore
|
405
406
|
- lib/photish/cache/db_file.rb
|