photish 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +346 -5
- data/TODO.md +5 -5
- data/lib/photish/assets/config.yml +12 -0
- data/lib/photish/assets/photos/Big Dogs/Tired Dogs.jpg +0 -0
- data/lib/photish/assets/photos/Big Dogs/Winking Dog.jpg +0 -0
- data/lib/photish/assets/photos/Small Dogs/Fluffy Dogs/Exhausted Dogs.jpg +0 -0
- data/lib/photish/assets/photos/Small Dogs/Fluffy Dogs/Exhausted Dogs.yml +2 -0
- data/lib/photish/assets/photos/Small Dogs/Fluffy Dogs/Many Dogs.jpg +0 -0
- data/lib/photish/assets/photos/Small Dogs/Fluffy Dogs/Many Dogs.yml +2 -0
- data/lib/photish/assets/photos/Small Dogs/Sleepy Dog.jpg +0 -0
- data/lib/photish/assets/photos/Small Dogs/Sleepy Dog.yml +2 -0
- data/lib/photish/assets/photos/Small Dogs/Squishy Dogs/Big Ear Dog.jpg +0 -0
- data/lib/photish/assets/site/_templates/album.slim +31 -0
- data/lib/photish/assets/site/_templates/collection.slim +19 -0
- data/lib/photish/assets/site/_templates/layout.slim +16 -0
- data/lib/photish/assets/site/_templates/photo.slim +10 -0
- data/lib/photish/assets/site/custom.html +8 -0
- data/lib/photish/assets/site/styles/basic.css +3 -0
- data/lib/photish/cli.rb +7 -19
- data/lib/photish/init.rb +36 -0
- data/lib/photish/version.rb +1 -1
- data/photish.gemspec +15 -10
- metadata +61 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b24062db6ffb294975d675025cf9948d2396584
|
4
|
+
data.tar.gz: d3694dd3929c89a3c236519d0787874c3763846f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bee41d8d3348cb8a944979d430fe61a0f8ab901408ac7d5c982ca5f636fdbc9eeb9df14b2099beb1ccd639acac9453e92b19f95e8c3982cc29a98a2aa5979166
|
7
|
+
data.tar.gz: 9a9921a7d9a0373c3c0089533b1d4c73c09b29cba11392e1e9ff38984102d8ccc165960adc2e87d060041c337eef2674f563e98250a4d3814accc8db1070a3c4
|
data/README.md
CHANGED
@@ -1,26 +1,367 @@
|
|
1
1
|
# Photish
|
2
2
|
|
3
|
+
Photish is a simple, convention based (but configurable) static photo site
|
4
|
+
generator. Photish allows you to group your photo collections by folder.
|
5
|
+
Metadata can be written alongside the photo in a [YAML](http://yaml.org/) file
|
6
|
+
with the same name as the photo.
|
7
|
+
|
8
|
+
Photish will crawl through your directory of photos and metadata, and render
|
9
|
+
the information in your website templates. Photish supports all template
|
10
|
+
engines implemented by [Tilt](https://github.com/rtomayko/tilt) (currently over
|
11
|
+
30 formats). It will also read your configuration and automatically convert
|
12
|
+
your images to your configured size, dimensions, colourscheme, etc using
|
13
|
+
[ImageMagick](http://www.imagemagick.org/script/index.php). Using this
|
14
|
+
information, Photish creates a complete static website that can be hosted on an
|
15
|
+
[NGINX](http://nginx.org/), [Apache HTTP Server](https://httpd.apache.org/), or
|
16
|
+
even on [Github Pages](https://pages.github.com/).
|
17
|
+
|
18
|
+
## Overview
|
19
|
+
|
20
|
+
Photish turns this:
|
21
|
+
|
22
|
+
./my_new_photo_site
|
23
|
+
├── config.yml
|
24
|
+
├── photos
|
25
|
+
│ ├── Big Dogs
|
26
|
+
│ │ ├── Tired Dogs.jpg
|
27
|
+
│ │ └── Winking Dog.jpg
|
28
|
+
│ └── Small Dogs
|
29
|
+
│ ├── Fluffy Dogs
|
30
|
+
│ │ ├── Exhausted Dogs.jpg
|
31
|
+
│ │ ├── Exhausted Dogs.yml
|
32
|
+
│ │ ├── Many Dogs.jpg
|
33
|
+
│ │ └── Many Dogs.yml
|
34
|
+
│ ├── Sleepy Dog.jpg
|
35
|
+
│ ├── Sleepy Dog.yml
|
36
|
+
│ └── Squishy Dogs
|
37
|
+
│ └── Big Ear Dog.jpg
|
38
|
+
└── site
|
39
|
+
├── _templates
|
40
|
+
│ ├── album.slim
|
41
|
+
│ ├── collection.slim
|
42
|
+
│ ├── layout.slim
|
43
|
+
│ └── photo.slim
|
44
|
+
├── custom.html
|
45
|
+
└── styles
|
46
|
+
└── basic.css
|
47
|
+
|
48
|
+
Into this:
|
49
|
+
|
50
|
+
./my_new_photo_site
|
51
|
+
└── output
|
52
|
+
├── big-dogs
|
53
|
+
│ ├── index.html
|
54
|
+
│ ├── tired-dogs
|
55
|
+
│ │ ├── images
|
56
|
+
│ │ │ ├── tired-dogs-low.jpg
|
57
|
+
│ │ │ └── tired-dogs-original.jpg
|
58
|
+
│ │ └── index.html
|
59
|
+
│ └── winking-dog
|
60
|
+
│ ├── images
|
61
|
+
│ │ ├── winking-dog-low.jpg
|
62
|
+
│ │ └── winking-dog-original.jpg
|
63
|
+
│ └── index.html
|
64
|
+
├── custom.html
|
65
|
+
├── index.html
|
66
|
+
├── small-dogs
|
67
|
+
│ ├── fluffy-dogs
|
68
|
+
│ │ ├── exhausted-dogs
|
69
|
+
│ │ │ ├── images
|
70
|
+
│ │ │ │ ├── exhausted-dogs-low.jpg
|
71
|
+
│ │ │ │ └── exhausted-dogs-original.jpg
|
72
|
+
│ │ │ └── index.html
|
73
|
+
│ │ ├── index.html
|
74
|
+
│ │ └── many-dogs
|
75
|
+
│ │ ├── images
|
76
|
+
│ │ │ ├── many-dogs-low.jpg
|
77
|
+
│ │ │ └── many-dogs-original.jpg
|
78
|
+
│ │ └── index.html
|
79
|
+
│ ├── index.html
|
80
|
+
│ ├── sleepy-dog
|
81
|
+
│ │ ├── images
|
82
|
+
│ │ │ ├── sleepy-dog-low.jpg
|
83
|
+
│ │ │ └── sleepy-dog-original.jpg
|
84
|
+
│ │ └── index.html
|
85
|
+
│ └── squishy-dogs
|
86
|
+
│ ├── big-ear-dog
|
87
|
+
│ │ ├── images
|
88
|
+
│ │ │ ├── big-ear-dog-low.jpg
|
89
|
+
│ │ │ └── big-ear-dog-original.jpg
|
90
|
+
│ │ └── index.html
|
91
|
+
│ └── index.html
|
92
|
+
└── styles
|
93
|
+
└── basic.css
|
94
|
+
|
95
|
+
A breakdown of the before and after is as follows:
|
96
|
+
|
97
|
+
1. For the **Collection** of photos in "Photos" an _index.html_ was created
|
98
|
+
1. For each **Album** (that is a folder in the "Photos" collection), an
|
99
|
+
_index.html_ was created in a slugified sub folder
|
100
|
+
1. For each **Photo** (an image file in the album), another _index.html_ was
|
101
|
+
created in a slugified sub folder named after the original photo
|
102
|
+
1. For each of these Photos, a version of the **Image** was made in both "low"
|
103
|
+
and "original" quality in a sub folder called _images_
|
104
|
+
|
105
|
+
The number of Images and the quality of each is completely configurable. Using
|
106
|
+
the templating language of your choice you can easily generate a Photo
|
107
|
+
collection driven website with all of your photos available in various
|
108
|
+
qualities and formats.
|
109
|
+
|
3
110
|
## Installation
|
4
111
|
|
5
112
|
Install the gem locally by running:
|
6
113
|
|
7
114
|
$ gem install photish
|
8
115
|
|
116
|
+
Alternatively, use [Bundler](http://bundler.io/). Create a folder for your
|
117
|
+
photo site so you can track the version of Photish you are building with:
|
118
|
+
|
119
|
+
$ mkdir my_new_photo_site
|
120
|
+
$ cd my_new_photo_site
|
121
|
+
$ bundle init
|
122
|
+
$ echo 'gem "photish"' >> Gemfile
|
123
|
+
$ bundle install
|
124
|
+
|
9
125
|
## Usage
|
10
126
|
|
11
|
-
|
127
|
+
Once you have photish installed. Get started with the following commands:
|
128
|
+
|
129
|
+
### Initialize
|
130
|
+
|
131
|
+
A skeleton site can be created by running the below command inside the
|
132
|
+
`my_new_photo_site` folder:
|
133
|
+
|
134
|
+
$ photish init
|
135
|
+
|
136
|
+
#### Basic Photish Structure
|
137
|
+
|
138
|
+
Inside your `my_new_photo_site` folder, you will have a:
|
139
|
+
|
140
|
+
File or Folder | Purpose
|
141
|
+
--------------------------------- | -------
|
142
|
+
`photos` | folder, for your photo collection and metadata
|
143
|
+
`site` | folder for your templates, assets and static pages
|
144
|
+
`site/_templates` | folder for your templates
|
145
|
+
`site/_templates/layout.slim` | file for the basic layout for all pages
|
146
|
+
`site/_templates/collection.slim` | template file for your collection page
|
147
|
+
`site/_templates/album.slim` | template file for your album page(s)
|
148
|
+
`site/_templates/photo.slim` | template file for your photo page(s)
|
149
|
+
`config.yml` | file to store all configuration in YAML format
|
150
|
+
|
151
|
+
#### Template Engines
|
152
|
+
|
153
|
+
By default Photish uses [Slim](http://slim-lang.com/) as the template language.
|
154
|
+
The templates can be in any format supported by
|
155
|
+
[Tilt](https://github.com/rtomayko/tilt). To use a different template language:
|
156
|
+
|
157
|
+
1. Create a `layout`, `collection`, `album` and `photo` file with
|
158
|
+
the file extension of the template engine you prefer
|
159
|
+
1. Update `config.yml` to reference your newly created template files
|
160
|
+
1. Re write the basic template code in your chosen language
|
161
|
+
|
162
|
+
#### Site Assets, CSS, Images, JavaScript
|
163
|
+
|
164
|
+
Any content not starting with an `_` (underscore) in the `site` folder will be
|
165
|
+
copied to the `output` folder.
|
166
|
+
|
167
|
+
In the example in the Overview section. There are 2 static asset files. These
|
168
|
+
are:
|
169
|
+
|
170
|
+
1. `site/styles/basic.css`
|
171
|
+
1. `site/custom.html`
|
172
|
+
|
173
|
+
Both of these files were copied by Photish to the output folder, respecting
|
174
|
+
their folder/file hierarchy:
|
175
|
+
|
176
|
+
1. `output/styles/basic.css`
|
177
|
+
1. `site/custom.html`
|
178
|
+
|
179
|
+
As documented in the Generate section, assets are copied before the site
|
180
|
+
content is generated. If an asset has a conflicting name and path with a
|
181
|
+
generated file, the generated file will clobber the asset.
|
182
|
+
|
183
|
+
#### Config File Options
|
184
|
+
|
185
|
+
Below is a basic `config.yml` file:
|
186
|
+
|
187
|
+
```yaml
|
188
|
+
port: 9876
|
189
|
+
qualities:
|
190
|
+
- name: Original
|
191
|
+
params: []
|
192
|
+
- name: Low
|
193
|
+
params: ['-resize', '200x200']
|
194
|
+
templates:
|
195
|
+
layout: layout.slim
|
196
|
+
collection: collection.slim
|
197
|
+
album: album.slim
|
198
|
+
photo: photo.slim
|
199
|
+
```
|
200
|
+
|
201
|
+
The meanings and purpose of each field is defined below:
|
202
|
+
|
203
|
+
Field | Purpose
|
204
|
+
---------------------- | -------
|
205
|
+
`port` | the port number that the `photish host` command will bind to
|
206
|
+
`qualities` | an array of `name` and `params` fields for **Images**
|
207
|
+
`qualities[]/name` | the name of the **Image** quality
|
208
|
+
`qualities[]/params` | the parameters to be provided to the ImageMagick `convert` utility for the **Image** file quality
|
209
|
+
`templates` | a listing of the various template files
|
210
|
+
`templates/layout` | the layout template file in the `site/_templates` folder
|
211
|
+
`templates/collection` | the collection template file in the `site/_templates` folder
|
212
|
+
`templates/album` | the album template file in the `site/_templates` folder
|
213
|
+
`templates/photo` | the photo template file in the `site/_templates` folder
|
214
|
+
|
215
|
+
#### Customizing Templates
|
216
|
+
|
217
|
+
Below is the documentation for the various data available inside
|
218
|
+
each of the templates.
|
219
|
+
|
220
|
+
**Note:** `{type}` is a place holder depending on your chosen template engine
|
221
|
+
the file extension will change. By default the template engine is
|
222
|
+
[Slim](http://slim-lang.com/), so templates will end with the _slim_ extension.
|
223
|
+
|
224
|
+
##### Layout Template
|
225
|
+
|
226
|
+
`site/_templates/layout.{type}`
|
227
|
+
|
228
|
+
The layout template is the base layout for all the other templates. The
|
229
|
+
`collection`, `album` and `photo` templates will be rendered inside this
|
230
|
+
layout. The layout template **must** include the `yield` statement to bind the
|
231
|
+
sub template inside it. Below is an example [Slim](http://slim-lang.com/)
|
232
|
+
template, the other templates will be bound where the `yield` statement is:
|
233
|
+
|
234
|
+
```slim
|
235
|
+
doctype html
|
236
|
+
html
|
237
|
+
head
|
238
|
+
title Master Layout
|
239
|
+
body
|
240
|
+
== yield
|
241
|
+
```
|
242
|
+
|
243
|
+
##### Collection Template
|
244
|
+
|
245
|
+
`site/_templates/collection.{type}`
|
246
|
+
|
247
|
+
The collection template becomes the `index.html` for the root of the website.
|
248
|
+
|
249
|
+
This template is passed the
|
250
|
+
[Collection](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/collection.rb)
|
251
|
+
model when rendered.
|
252
|
+
|
253
|
+
Attribute or Method | Description
|
254
|
+
------------------- | -----------
|
255
|
+
url | the URL of this page
|
256
|
+
metadata | an object with methods for the attributes in the `photos.yml` file
|
257
|
+
all_albums | an array of all child [Albums](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/album.rb)
|
258
|
+
all_photos | an array of all child [Photos](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/photo.rb)
|
259
|
+
all_images | an array of all child [Images](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/image.rb)
|
260
|
+
|
261
|
+
##### Album Template
|
262
|
+
|
263
|
+
`site/_templates/album.{type}`
|
264
|
+
|
265
|
+
For each folder in the `photos` directory, a slugified album folder is created
|
266
|
+
with an `index.html` in it.
|
267
|
+
|
268
|
+
This template is passed the
|
269
|
+
[Album](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/album.rb)
|
270
|
+
model when rendered.
|
271
|
+
|
272
|
+
Attribute or Method | Description
|
273
|
+
------------------- | -----------
|
274
|
+
name | the name of the folder, i.e. `photos/My album/` will become `My album`
|
275
|
+
url | the URL of this page
|
276
|
+
metadata | an object with methods for the attributes in the `{album_name}.yml` file stored at the same level as the album
|
277
|
+
all_albums | an array of all child [Albums](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/album.rb)
|
278
|
+
all_photos | an array of all child [Photos](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/photo.rb)
|
279
|
+
all_images | an array of all child [Images](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/image.rb)
|
280
|
+
|
281
|
+
##### Photo Template
|
282
|
+
|
283
|
+
`site/_templates/photo.{type}`
|
284
|
+
|
285
|
+
For each image in an Albums directory, a slugified photo folder is created
|
286
|
+
with an `index.html` in it.
|
287
|
+
|
288
|
+
This template is passed the
|
289
|
+
[Photo](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/photo.rb)
|
290
|
+
model when rendered.
|
291
|
+
|
292
|
+
Attribute or Method | Description
|
293
|
+
------------------- | -----------
|
294
|
+
name | the name of the photo, i.e. `photos/My album/My dog.jpg` will become `My dog`
|
295
|
+
url | the URL of this page
|
296
|
+
metadata | an object with methods for the attributes in the `{photo_name}.yml` file stored at the same level as the photo
|
297
|
+
exif | an object with methods for the exif data of the original photo file
|
298
|
+
images | an array of all the [Images](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/image.rb) for this photo, an Image will be a version of the photo in the quality configured in `config.yml`
|
299
|
+
|
300
|
+
### Generate
|
301
|
+
|
302
|
+
The static HTML can be generated by running the below command inside the
|
303
|
+
`my_new_photo_site` folder:
|
304
|
+
|
305
|
+
$ photish generate
|
306
|
+
|
307
|
+
All generated content will be written to the `output` folder by default.
|
308
|
+
|
309
|
+
#### Execution Order
|
310
|
+
|
311
|
+
The Generate command does the following:
|
312
|
+
|
313
|
+
1. Crawls the `photos` directory for photos and metadata
|
314
|
+
1. Creates a site structure of Collection, Album(s), Photo(s) and Image(s)
|
315
|
+
1. Copies all files in the `site` folder **not** beginning with an `_`
|
316
|
+
(underscore) to the `output` folder as these are viewed as "static" assets.
|
317
|
+
That is, folders like `_templates` are ignored
|
318
|
+
1. Renders the HTML _index_ file(s) for the Collection, Album(s), Photo(s) and
|
319
|
+
Image(s) to the `output` folder
|
320
|
+
1. Converts all Photo(s) to the configured quality versions, writing various
|
321
|
+
images to the `output` folder
|
322
|
+
|
323
|
+
### Host
|
324
|
+
|
325
|
+
To test and view your changes locally, the host command can be used to run a
|
326
|
+
local
|
327
|
+
[WEBrick](http://ruby-doc.org/stdlib-1.9.3/libdoc/webrick/rdoc/WEBrick.html)
|
328
|
+
server to serve the HTML files:
|
329
|
+
|
330
|
+
$ photish host
|
331
|
+
|
332
|
+
The local version of your website will be visible at [http://localhost:9876/](http://localhost:9876/)
|
12
333
|
|
13
334
|
## Development
|
14
335
|
|
15
|
-
|
336
|
+
If you would like to contribute to Photish by creating a new feature or fixing
|
337
|
+
bugs, you are more then welcome!
|
338
|
+
|
339
|
+
To develop:
|
340
|
+
|
341
|
+
$ git clone git@github.com:henrylawson/photish.git
|
342
|
+
$ cd photish
|
343
|
+
$ ./bin/setup # installs dependencies
|
344
|
+
$ rake # runs the tests
|
345
|
+
$ vim # open up the project and begin contributing
|
346
|
+
$ ./bin/console # for an interactive prompt
|
347
|
+
|
348
|
+
To release:
|
16
349
|
|
17
|
-
|
350
|
+
$ git add -p # add in changed files
|
351
|
+
$ git commit -m 'Final commit' # finish up changes
|
352
|
+
$ rake # ensure all tests pass
|
353
|
+
$ vim lib/photish/version.rb # update version
|
354
|
+
$ rake release # release to rubygems
|
18
355
|
|
19
356
|
## Contributing
|
20
357
|
|
21
|
-
Bug reports and pull requests are welcome on GitHub at
|
358
|
+
Bug reports and pull requests are welcome on GitHub at
|
359
|
+
https://github.com/henrylawson/photish. This project is intended to be a safe,
|
360
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
361
|
+
the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
22
362
|
|
23
363
|
## License
|
24
364
|
|
25
|
-
The gem is available as open source under the terms of the [MIT
|
365
|
+
The gem is available as open source under the terms of the [MIT
|
366
|
+
License](http://opensource.org/licenses/MIT).
|
26
367
|
|
data/TODO.md
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
## Must Have
|
4
4
|
|
5
|
+
1. `init` command to get started
|
5
6
|
|
6
7
|
## Might Have
|
7
8
|
|
8
|
-
1. `init` command to get started
|
9
9
|
1. `deploy` to deploy to github pages
|
10
|
-
1.
|
11
|
-
1. Actual website, using photish
|
10
|
+
1. Exception and error handling to have clearer errors
|
12
11
|
1. Startup bash script should install image magick, libmagic, exiftool
|
12
|
+
1. README table of contents
|
13
13
|
|
14
14
|
## Potential Features
|
15
15
|
|
16
|
-
1. A sitemap
|
17
|
-
1. A breadcrumb
|
16
|
+
1. A sitemap helper
|
17
|
+
1. A breadcrumb helper
|
18
18
|
1. Relative/absolute with/without hostname URLs (for different host envs) with view helper
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
h1 Album "#{name}"
|
2
|
+
h2 Sub Albums
|
3
|
+
ul
|
4
|
+
- albums.each do |album|
|
5
|
+
li
|
6
|
+
a href=album.url
|
7
|
+
| #{album.name}
|
8
|
+
- if albums.empty?
|
9
|
+
li
|
10
|
+
| Empty
|
11
|
+
h2 Photos
|
12
|
+
ul
|
13
|
+
- photos.each do |photo|
|
14
|
+
li
|
15
|
+
a href=photo.url
|
16
|
+
| #{photo.name}
|
17
|
+
- if photos.empty?
|
18
|
+
li
|
19
|
+
| Empty
|
20
|
+
h2 Photos
|
21
|
+
ul
|
22
|
+
- all_photos.each do |photo|
|
23
|
+
li
|
24
|
+
a href=photo.url
|
25
|
+
| #{photo.name}
|
26
|
+
h2 Images
|
27
|
+
ul
|
28
|
+
- all_images.each do |image|
|
29
|
+
li
|
30
|
+
a href=image.url
|
31
|
+
| #{image.name}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
h1 Collection "My Photo Site"
|
2
|
+
h2 Albums
|
3
|
+
ul
|
4
|
+
- albums.each do |album|
|
5
|
+
li
|
6
|
+
a href=album.url
|
7
|
+
| #{album.name}
|
8
|
+
h2 Photos
|
9
|
+
ul
|
10
|
+
- all_photos.each do |photo|
|
11
|
+
li
|
12
|
+
a href=photo.url
|
13
|
+
| #{photo.name}
|
14
|
+
h2 Images
|
15
|
+
ul
|
16
|
+
- all_images.each do |image|
|
17
|
+
li
|
18
|
+
a href=image.url
|
19
|
+
| #{image.name}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title Master Template
|
5
|
+
link href="/styles/basic.css" media="screen" rel="stylesheet" type="text/css"
|
6
|
+
body
|
7
|
+
== yield
|
8
|
+
|
9
|
+
h2 Asset Links
|
10
|
+
ul
|
11
|
+
li
|
12
|
+
a href="/custom.html"
|
13
|
+
| My Custom Page
|
14
|
+
li
|
15
|
+
a href="/styles/basic.css"
|
16
|
+
| CSS Download
|
data/lib/photish/cli.rb
CHANGED
@@ -1,38 +1,26 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'photish/generation'
|
3
3
|
require 'photish/host'
|
4
|
+
require 'photish/init'
|
4
5
|
|
5
6
|
module Photish
|
6
7
|
class CLI < Thor
|
7
8
|
package_name "Photish"
|
8
9
|
|
9
10
|
desc "generate", "Generates the gallery static site"
|
10
|
-
method_option :photo_dir,
|
11
|
-
aliases: "-p",
|
12
|
-
desc: "The directory where the photos live"
|
13
|
-
method_option :site_dir,
|
14
|
-
aliases: "-s",
|
15
|
-
desc: "The location of the site config and template files"
|
16
|
-
method_option :output_dir,
|
17
|
-
aliases: "-o",
|
18
|
-
desc: "The output directory where the generated site should go"
|
19
11
|
def generate
|
20
12
|
Photish::Generation.new(options).execute
|
21
13
|
end
|
22
14
|
|
23
|
-
desc "host", "
|
24
|
-
method_option :photo_dir,
|
25
|
-
aliases: "-p",
|
26
|
-
desc: "The directory where the photos live"
|
27
|
-
method_option :site_dir,
|
28
|
-
aliases: "-s",
|
29
|
-
desc: "The location of the site config and template files"
|
30
|
-
method_option :output_dir,
|
31
|
-
aliases: "-o",
|
32
|
-
desc: "The output directory where the generated site should go"
|
15
|
+
desc "host", "Serves the HTML on a HTTP server at http://localhost:9876/"
|
33
16
|
def host
|
34
17
|
Photish::Host.new(options).execute
|
35
18
|
end
|
19
|
+
|
20
|
+
desc "init", "Creates a basic Photish site sctructure"
|
21
|
+
def init
|
22
|
+
Photish::Init.new(options).execute
|
23
|
+
end
|
36
24
|
end
|
37
25
|
end
|
38
26
|
|
data/lib/photish/init.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Photish
|
2
|
+
class Init
|
3
|
+
include Photish::Log
|
4
|
+
|
5
|
+
def initialize(runtime_config)
|
6
|
+
@runtime_config = runtime_config
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
FileUtils.cp_r(config_file, Dir.pwd)
|
11
|
+
FileUtils.cp_r(photos_dir, Dir.pwd)
|
12
|
+
FileUtils.cp_r(site_dir, Dir.pwd)
|
13
|
+
log "Photish site initiated successfully"
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_reader :runtime_config
|
19
|
+
|
20
|
+
def config_file
|
21
|
+
asset_path('config.yml')
|
22
|
+
end
|
23
|
+
|
24
|
+
def photos_dir
|
25
|
+
asset_path('photos')
|
26
|
+
end
|
27
|
+
|
28
|
+
def site_dir
|
29
|
+
asset_path('site')
|
30
|
+
end
|
31
|
+
|
32
|
+
def asset_path(*path)
|
33
|
+
File.join(File.dirname(__FILE__), 'assets', path)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/photish/version.rb
CHANGED
data/photish.gemspec
CHANGED
@@ -10,7 +10,10 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["henry.lawson@foinq.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{A static photo site generator}
|
13
|
-
spec.description = %q{
|
13
|
+
spec.description = %q{Photish is a simple, convention based (but
|
14
|
+
configurable) static photo site generator. Photish allows you to group your
|
15
|
+
photo collections by folder. Metadata can be written alongside the photo in
|
16
|
+
a [YAML](http://yaml.org/) file with the same name as the photo.}
|
14
17
|
spec.homepage = "https://github.com/henrylawson/photish"
|
15
18
|
spec.license = "MIT"
|
16
19
|
|
@@ -19,15 +22,17 @@ Gem::Specification.new do |spec|
|
|
19
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
23
|
spec.require_paths = ["lib"]
|
21
24
|
|
22
|
-
spec.
|
23
|
-
|
24
|
-
spec.add_dependency "
|
25
|
-
spec.add_dependency "
|
26
|
-
spec.add_dependency "
|
27
|
-
spec.add_dependency "
|
28
|
-
spec.add_dependency "
|
29
|
-
spec.add_dependency "
|
30
|
-
spec.add_dependency "
|
25
|
+
spec.required_ruby_version = '>= 1.8.6'
|
26
|
+
|
27
|
+
spec.add_dependency "thor", "~> 0.1"
|
28
|
+
spec.add_dependency "activesupport", "~> 4.2"
|
29
|
+
spec.add_dependency "slim", "~> 3.0"
|
30
|
+
spec.add_dependency "tilt", "~> 2.0"
|
31
|
+
spec.add_dependency "mini_magick", "~> 4.3"
|
32
|
+
spec.add_dependency "ruby-filemagic", "~> 0.7"
|
33
|
+
spec.add_dependency "anemone", "~> 0.7"
|
34
|
+
spec.add_dependency "mini_exiftool", "~> 2.5"
|
35
|
+
spec.add_dependency "recursive-open-struct", "~> 0.6"
|
31
36
|
|
32
37
|
spec.add_development_dependency "bundler", "~> 1.10"
|
33
38
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,141 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: photish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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: 2015-11-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '0.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: slim
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '3.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: tilt
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '2.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mini_magick
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '4.3'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '4.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: ruby-filemagic
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '0.7'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '0.7'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: anemone
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '0.7'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '0.7'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mini_exiftool
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '2.5'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '2.5'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: recursive-open-struct
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
131
|
+
version: '0.6'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
138
|
+
version: '0.6'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: bundler
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,8 +234,11 @@ dependencies:
|
|
234
234
|
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
|
-
description:
|
238
|
-
|
237
|
+
description: |-
|
238
|
+
Photish is a simple, convention based (but
|
239
|
+
configurable) static photo site generator. Photish allows you to group your
|
240
|
+
photo collections by folder. Metadata can be written alongside the photo in
|
241
|
+
a [YAML](http://yaml.org/) file with the same name as the photo.
|
239
242
|
email:
|
240
243
|
- henry.lawson@foinq.com
|
241
244
|
executables:
|
@@ -256,6 +259,22 @@ files:
|
|
256
259
|
- bin/setup
|
257
260
|
- exe/photish
|
258
261
|
- lib/photish.rb
|
262
|
+
- lib/photish/assets/config.yml
|
263
|
+
- lib/photish/assets/photos/Big Dogs/Tired Dogs.jpg
|
264
|
+
- lib/photish/assets/photos/Big Dogs/Winking Dog.jpg
|
265
|
+
- lib/photish/assets/photos/Small Dogs/Fluffy Dogs/Exhausted Dogs.jpg
|
266
|
+
- lib/photish/assets/photos/Small Dogs/Fluffy Dogs/Exhausted Dogs.yml
|
267
|
+
- lib/photish/assets/photos/Small Dogs/Fluffy Dogs/Many Dogs.jpg
|
268
|
+
- lib/photish/assets/photos/Small Dogs/Fluffy Dogs/Many Dogs.yml
|
269
|
+
- lib/photish/assets/photos/Small Dogs/Sleepy Dog.jpg
|
270
|
+
- lib/photish/assets/photos/Small Dogs/Sleepy Dog.yml
|
271
|
+
- lib/photish/assets/photos/Small Dogs/Squishy Dogs/Big Ear Dog.jpg
|
272
|
+
- lib/photish/assets/site/_templates/album.slim
|
273
|
+
- lib/photish/assets/site/_templates/collection.slim
|
274
|
+
- lib/photish/assets/site/_templates/layout.slim
|
275
|
+
- lib/photish/assets/site/_templates/photo.slim
|
276
|
+
- lib/photish/assets/site/custom.html
|
277
|
+
- lib/photish/assets/site/styles/basic.css
|
259
278
|
- lib/photish/cli.rb
|
260
279
|
- lib/photish/config/app_settings.rb
|
261
280
|
- lib/photish/config/default_config.rb
|
@@ -271,6 +290,7 @@ files:
|
|
271
290
|
- lib/photish/gallery/traits/urlable.rb
|
272
291
|
- lib/photish/generation.rb
|
273
292
|
- lib/photish/host.rb
|
293
|
+
- lib/photish/init.rb
|
274
294
|
- lib/photish/log.rb
|
275
295
|
- lib/photish/render/image_conversion.rb
|
276
296
|
- lib/photish/render/page.rb
|
@@ -289,7 +309,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
289
309
|
requirements:
|
290
310
|
- - ">="
|
291
311
|
- !ruby/object:Gem::Version
|
292
|
-
version:
|
312
|
+
version: 1.8.6
|
293
313
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
294
314
|
requirements:
|
295
315
|
- - ">="
|