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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTYwNTBmNGZkNTJlNDIxZDFlYWE2MzlmMGQzODlmYjI3YzE5Zjc3Mg==
4
+ YjcxN2U3NzM1YzQ3YzgxNmFjN2FkNTk5YjU2MjYxZmUyMjJkMjM3Yg==
5
5
  data.tar.gz: !binary |-
6
- M2JhODU3NzAwMTNmMzQ3ZmUxNmUzYWI3ZDBjNjMxNjJlYmRiNWUyOQ==
6
+ ODM0OTAwYjZjNzE1NjViNDVjMGNmMjFjYWI3MjU4NzA1NWVjMjJhMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjFhZWY5ZmNiZmE1MzE4Yjk2NmYzMDNkZTVlNTcxMWYyNTU5ZTY5NzNlMWU0
10
- NjIwNjJjMjM5NGUzM2MxMGNkNDEzNTRmNzFmMThhNTY5ZmU4NzViM2UxZWI2
11
- ZjkxYzFlYWQwMjUxZDljMDUwNGEwMjQwMDI4YmZiZTVjY2IyMDI=
9
+ YzgxNWY3MGQ0NWMyMzJiNjc4Nzk0Y2JiYzQ3NWZlNGRhNDFkMTJkN2MyYjQ3
10
+ Y2U2Yzc5MTJiNTY5YjMxZjBjZDI3OGQwZDcwYWE4ZDM1M2UyM2E5NzIxZjg3
11
+ MjY0YmYwMjIyOTMzOWFlMmJhNzMyODE2ZWVmODAwYmFiNTBmODk=
12
12
  data.tar.gz: !binary |-
13
- MWI1ZjJiMDkwZjQ3MzRlOWRhMTlhZjdlN2M1Yjg0NGFlYmI1N2E4MWU4NjJl
14
- ZmY1NzUyOWUwYWVmNjNlOTg0NGYxN2M0NDBhNmEwZTYxYTk0ZDRjNzJhZGNm
15
- MGVlNWI4N2JmMWVlNjg1MjA0ZjA2ZDI5NTJlNzZkMjk5YmNlYjc=
13
+ NzMyM2Q2NGIwYWQ5OGNhNWQxOWRhMGE5MzcyMmUzMGMxOTdhYzhhMmQxNTBh
14
+ NGJlZDRkYTA2MjgzYTRlZmE1MTg4MzQ3Zjc2NWRkNGE5MDNjZDBlMGRmNGQx
15
+ M2I4ZWQ2ZDYyMDcxYjNlOTdjYjE1Y2QyNGRmYjk5Nzg0MzMzNTU=
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/photish.svg)](https://badge.fury.io/rb/photish)
2
2
  [![Build Status](https://travis-ci.org/henrylawson/photish.svg)](https://travis-ci.org/henrylawson/photish)
3
+ [![Build Status](https://snap-ci.com/henrylawson/photish/branch/master/build_image)](https://snap-ci.com/henrylawson/photish/branch/master)
3
4
  [![Dependency Status](https://gemnasium.com/henrylawson/photish.svg)](https://gemnasium.com/henrylawson/photish)
4
5
  [![Code Climate](https://codeclimate.com/github/henrylawson/photish/badges/gpa.svg)](https://codeclimate.com/github/henrylawson/photish)
5
6
  [![Test Coverage](https://codeclimate.com/github/henrylawson/photish/badges/coverage.svg)](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
@@ -2,7 +2,6 @@
2
2
 
3
3
  ## In Progress
4
4
 
5
- 1. An example Asset Page that is a `sitemap.xml`
6
5
  1. Get url by smart key
7
6
 
8
7
  ## Backlog
@@ -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 = relative_to_output_dir(page_path)
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
- a = File.join(output_dir, File.dirname(relative_path), basename)
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)
@@ -28,7 +28,8 @@ module Photish
28
28
  def render_asset_pages(collection)
29
29
  AssetPage.new(collection,
30
30
  output_dir,
31
- site_dir).render(asset_page_paths)
31
+ site_dir,
32
+ url).render(asset_page_paths)
32
33
  end
33
34
 
34
35
  def asset_page_paths
@@ -1,5 +1,5 @@
1
1
  module Photish
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  AUTHOR_NAME = "Henry Lawson"
4
4
  AUTHOR_EMAIL = "henry.lawson@foinq.com"
5
5
  end
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.0
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-15 00:00:00.000000000 Z
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