photish 0.1.4 → 0.1.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.
@@ -1,4 +1,14 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2.2
4
- before_install: gem install bundler -v 1.10.6
4
+ sudo: false
5
+ before_install:
6
+ - gem install bundler -v 1.10.6
7
+ script: rake
8
+ addons:
9
+ code_climate:
10
+ repo_token: ae398c193255da8c5e030cb6251f053c76757635e5215e65efa32f52d003a519
11
+ apt:
12
+ packages:
13
+ - libmagic-dev
14
+ - libimage-exiftool-perl
data/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ [![Gem Version](https://badge.fury.io/rb/photish.svg)](https://badge.fury.io/rb/photish)
2
+ [![Build Status](https://travis-ci.org/henrylawson/photish.svg)](https://travis-ci.org/henrylawson/photish)
3
+ [![Dependency Status](https://gemnasium.com/henrylawson/photish.svg)](https://gemnasium.com/henrylawson/photish)
4
+ [![Code Climate](https://codeclimate.com/github/henrylawson/photish/badges/gpa.svg)](https://codeclimate.com/github/henrylawson/photish)
5
+ [![Test Coverage](https://codeclimate.com/github/henrylawson/photish/badges/coverage.svg)](https://codeclimate.com/github/henrylawson/photish/coverage)
6
+ [![Issue Count](https://codeclimate.com/github/henrylawson/photish/badges/issue_count.svg)](https://codeclimate.com/github/henrylawson/photish/issues)
1
7
  # Photish
2
8
 
3
9
  Photish is a simple, convention based (but configurable) static photo site
@@ -15,10 +21,27 @@ information, Photish creates a complete static website that can be hosted on an
15
21
  [NGINX](http://nginx.org/), [Apache HTTP Server](https://httpd.apache.org/), or
16
22
  even on [Github Pages](https://pages.github.com/).
17
23
 
18
- ## Table of Contents
24
+ ## Getting Started
25
+
26
+ It is strongly recommended to read through the [Installation](#installation)
27
+ and [Usage](#usage) sections before seriously using Photish, however to get up
28
+ and running:
29
+
30
+ 1. Ensure [ImageMagick](http://www.imagemagick.org/script/index.php),
31
+ [Exiftool](http://www.sno.phy.queensu.ca/~phil/exiftool/) and
32
+ [Nokogiri](http://www.nokogiri.org/tutorials/installing_nokogiri.html) are
33
+ installed (see [Dependencies](#dependencies))
34
+ 1. Install Photish `gem install photish`
35
+ 1. Create a base project with `photish init`
36
+ 1. Generate the HTML using `photish generate`
37
+ 1. Run a local HTTP server to view the site with `photish host`
38
+ 1. View your photo site at [http://localhost:9876](http://localhost:9876/)
39
+
40
+ # Documentation
19
41
 
20
42
  - [Overview](#overview)
21
43
  - [Installation](#installation)
44
+ - [Dependencies](#dependencies)
22
45
  - [Usage](#usage)
23
46
  - [Initialize](#initialize)
24
47
  - [Basic Photish Structure](#basic-photish-structure)
@@ -64,6 +87,8 @@ Photish turns this:
64
87
  │   ├── layout.slim
65
88
  │   └── photo.slim
66
89
  ├── custom.html
90
+ ├── images
91
+ │   └── crumbs.gif
67
92
  └── styles
68
93
  └── basic.css
69
94
 
@@ -111,6 +136,8 @@ Into this:
111
136
  │   │   │   └── big-ear-dog-original.jpg
112
137
  │   │   └── index.html
113
138
  │   └── index.html
139
+ ├── images
140
+ │   └── crumbs.gif
114
141
  └── styles
115
142
  └── basic.css
116
143
 
@@ -144,6 +171,27 @@ photo site so you can track the version of Photish you are building with:
144
171
  $ echo 'gem "photish"' >> Gemfile
145
172
  $ bundle install
146
173
 
174
+ ### Dependencies
175
+
176
+ Photish has dependencies on certain utilities:
177
+
178
+ - [ImageMagick](http://www.imagemagick.org/script/index.php) for Image
179
+ conversion
180
+ - [Exiftool](http://www.sno.phy.queensu.ca/~phil/exiftool/) for image metadata
181
+ retrieval
182
+ - [Nokogiri](http://www.nokogiri.org/tutorials/installing_nokogiri.html) for
183
+ XML writing and parsing
184
+
185
+ **On MacOSX, using [Brew](http://brew.sh/)**
186
+
187
+ $ brew install imagemagick
188
+ $ brew install exiftool
189
+
190
+ **On Ubuntu or Debian**
191
+
192
+ $ sudo apt-get install imagemagick
193
+ $ sudo apt-get install libimage-exiftool-perl
194
+
147
195
  ## Usage
148
196
 
149
197
  Once you have photish installed. Get started with the following commands:
@@ -176,8 +224,10 @@ By default Photish uses [Slim](http://slim-lang.com/) as the template language.
176
224
  The templates can be in any format supported by
177
225
  [Tilt](https://github.com/rtomayko/tilt). To use a different template language:
178
226
 
179
- 1. Create a `layout`, `collection`, `album` and `photo` file with
180
- the file extension of the template engine you prefer
227
+ 1. Create a `layout`, `collection`, `album` and `photo` file in the
228
+ `site/_templates` folder, with the file extension of the template engine you
229
+ prefer, supported extensions are documented by
230
+ [Tilt](https://github.com/rtomayko/tilt)
181
231
  1. Update `config.yml` to reference your newly created template files
182
232
  1. Re write the basic template code in your chosen language
183
233
 
@@ -186,10 +236,11 @@ the file extension of the template engine you prefer
186
236
  Any content not starting with an `_` (underscore) in the `site` folder will be
187
237
  copied to the `output` folder.
188
238
 
189
- In the example in the Overview section. There are 2 static asset files. These
190
- are:
239
+ In the example in the Overview section. There are a few static asset files.
240
+ These are:
191
241
 
192
242
  1. `site/styles/basic.css`
243
+ 1. `site/images/crumbs.gif`
193
244
  1. `site/custom.html`
194
245
 
195
246
  Both of these files were copied by Photish to the output folder, respecting
@@ -276,6 +327,7 @@ Attribute or Method | Description
276
327
  ------------------- | -----------
277
328
  url | the URL of this page
278
329
  metadata | an object with methods for the attributes in the `photos.yml` file
330
+ albums | an array of child [Albums](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/album.rb) within this folder
279
331
  all_albums | an array of all child [Albums](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/album.rb)
280
332
  all_photos | an array of all child [Photos](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/photo.rb)
281
333
  all_images | an array of all child [Images](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/image.rb)
@@ -296,6 +348,7 @@ Attribute or Method | Description
296
348
  name | the name of the folder, i.e. `photos/My album/` will become `My album`
297
349
  url | the URL of this page
298
350
  metadata | an object with methods for the attributes in the `{album_name}.yml` file stored at the same level as the album
351
+ albums | an array of child [Albums](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/album.rb) within this folder
299
352
  all_albums | an array of all child [Albums](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/album.rb)
300
353
  all_photos | an array of all child [Photos](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/photo.rb)
301
354
  all_images | an array of all child [Images](https://github.com/henrylawson/photish/blob/master/lib/photish/gallery/image.rb)
data/Rakefile CHANGED
@@ -9,4 +9,4 @@ Cucumber::Rake::Task.new(:features) do |t|
9
9
  t.cucumber_opts = "features --format pretty"
10
10
  end
11
11
 
12
- task :default => [:features, :spec]
12
+ task :default => [:spec, :features]
data/TODO.md CHANGED
@@ -1,11 +1,21 @@
1
1
  # Photish Todo
2
2
 
3
- ## Must Have
3
+ ## In Progress
4
4
 
5
- 1. A sitemap helper
6
- 1. A breadcrumb helper
5
+ 1. A .gitignore file for the `init` project
6
+ 1. Change logging to colorize on command options
7
+ 1. Pipe WEBrick logging to log module
7
8
 
8
- ## Might Have
9
+ ## Backlog
9
10
 
10
- 1. `deploy` to deploy to github pages
11
- 1. Relative/absolute with/without hostname URLs (for different host envs) with view helper
11
+ 1. Custom user created helpers in templates
12
+ 1. RDoc documentation for classes
13
+ 1. A Rakefile task for each of the commands
14
+ 1. A `deploy` command as a gem to deploy to github pages, netlify, amazon s3
15
+ 1. Monitor for file changes and regenerate for `host` command
16
+ 1. URL customization, relative, absolute with or without hostname URLs (for
17
+ different host envs)
18
+ 1. Proper asset pipeline for CSS
19
+ 1. Customer template rendering outside of `_templates` folder
20
+ 1. A sitemap helper for use in custome templates for example `sitemap.xml`
21
+ 1. Share on RubyWebToolkit, StaticGen, etc
@@ -8,6 +8,8 @@ html
8
8
  a href="/"
9
9
  h1 PHOTISH
10
10
  div.content
11
+ div.site-breadcrumbs
12
+ == breadcrumbs
11
13
  == yield
12
14
  div.footer
13
15
  | Site assets:
@@ -1,45 +1,68 @@
1
1
  body {
2
- padding:0px;
3
- margin:0px;
4
2
  font-family:sans-serif, arial, helvetica;
5
3
  font-size:12pt;
4
+ margin:0;
5
+ padding:0;
6
6
  }
7
-
8
- div.header {
9
- padding:10px 50px 10px 50px;
10
- border-bottom:30px solid #e9e9e9;
11
- }
12
- div.header h1 {
7
+ h1 {
13
8
  font-size:200%;
14
9
  }
15
- div.album {
16
- }
17
- div.album div.album-title {
10
+ .header {
11
+ border-bottom:30px solid #e9e9e9;
18
12
  padding:10px 50px 10px 50px;
19
- border-top:1px solid #f1f1f1;
13
+ }
14
+ .album .album-title {
20
15
  border-bottom:1px solid #f1f1f1;
16
+ border-top:1px solid #f1f1f1;
17
+ padding:10px 50px 10px 50px;
21
18
  }
22
- div.album div.album-photos a {
23
- padding:0;
24
- margin:0;
19
+ .album .album-photos a {
25
20
  line-height:0;
21
+ margin:0;
22
+ padding:0;
26
23
  }
27
- div.album div.album-photos div.album-photo, div.album-blurb {
24
+ .album .album-photos .album-photo, .album-blurb {
28
25
  padding:10px 50px 10px 50px;
29
26
  }
30
- div.album div.album-photos a img {
31
- padding:0;
32
- margin:0;
27
+ .site-breadcrumbs {
28
+ font-size:90%;
29
+ }
30
+ .album .album-photos a img {
33
31
  display:block;
32
+ margin:0;
33
+ padding:0;
34
34
  }
35
35
  a {
36
- text-decoration:none;
37
36
  color:#F16272;
37
+ text-decoration:none;
38
38
  }
39
- div.sub-albums a {
39
+ .sub-albums a {
40
40
  font-size:90%;
41
41
  }
42
- div.footer {
42
+ .footer {
43
43
  border-top:30px solid #e9e9e9;
44
44
  padding:10px 50px 10px 50px;
45
45
  }
46
+ ul.breadcrumbs, ul.breadcrumbs li {
47
+ list-style-type:none;
48
+ margin:0;
49
+ padding:0;
50
+ }
51
+ ul.breadcrumbs {
52
+ border:1px solid #dedede;
53
+ height:2.3em;
54
+ }
55
+ ul.breadcrumbs li {
56
+ color:#777;
57
+ float:left;
58
+ line-height:2.3em;
59
+ padding-left:.75em;
60
+ }
61
+ ul.breadcrumbs li a {
62
+ background:url(/images/crumbs.gif) no-repeat right center;
63
+ display:block;
64
+ padding:0 15px 0 0;
65
+ }
66
+ ul.breadcrumbs li a:link, ul.breadcrumbs li a:visited {
67
+ text-decoration:none;
68
+ }
@@ -1,5 +1,5 @@
1
- module Photish
2
- module Config
1
+ module Photish
2
+ module Config
3
3
  class Location
4
4
  FILE_NAME = 'config.yml'
5
5
 
@@ -17,7 +17,7 @@
17
17
  attr_reader :site_dir
18
18
 
19
19
  def ensure_expected_path_exists
20
- return if File.exists?(expected_path)
20
+ return if File.exist?(expected_path)
21
21
  raise "Config file does not exist at #{expected_path}"
22
22
  end
23
23
 
@@ -2,6 +2,7 @@ require 'photish/gallery/photo'
2
2
  require 'photish/gallery/traits/urlable'
3
3
  require 'photish/gallery/traits/albumable'
4
4
  require 'photish/gallery/traits/metadatable'
5
+ require 'photish/gallery/traits/breadcrumbable'
5
6
  require 'active_support'
6
7
  require 'active_support/core_ext'
7
8
  require 'filemagic'
@@ -13,6 +14,7 @@ module Photish
13
14
  include ::Photish::Gallery::Traits::Urlable
14
15
  include ::Photish::Gallery::Traits::Albumable
15
16
  include ::Photish::Gallery::Traits::Metadatable
17
+ include ::Photish::Gallery::Traits::Breadcrumbable
16
18
 
17
19
  delegate :qualities, to: :parent, allow_nil: true
18
20
 
@@ -1,6 +1,7 @@
1
1
  require 'photish/gallery/album'
2
2
  require 'photish/gallery/traits/albumable'
3
3
  require 'photish/gallery/traits/metadatable'
4
+ require 'photish/gallery/traits/breadcrumbable'
4
5
 
5
6
  module Photish
6
7
  module Gallery
@@ -9,6 +10,7 @@ module Photish
9
10
  include ::Photish::Gallery::Traits::Urlable
10
11
  include ::Photish::Gallery::Traits::Albumable
11
12
  include ::Photish::Gallery::Traits::Metadatable
13
+ include ::Photish::Gallery::Traits::Breadcrumbable
12
14
 
13
15
  attr_reader :qualities
14
16
 
@@ -17,6 +19,10 @@ module Photish
17
19
  @qualities = qualities
18
20
  end
19
21
 
22
+ def name
23
+ 'Home'
24
+ end
25
+
20
26
  def base_url_parts
21
27
  []
22
28
  end
@@ -32,6 +38,10 @@ module Photish
32
38
  def url_end
33
39
  'index.html'
34
40
  end
41
+
42
+ def parent
43
+ nil
44
+ end
35
45
  end
36
46
  end
37
47
  end
@@ -1,5 +1,6 @@
1
1
  require 'photish/gallery/traits/urlable'
2
2
  require 'photish/gallery/traits/metadatable'
3
+ require 'photish/gallery/traits/breadcrumbable'
3
4
  require 'photish/gallery/image'
4
5
  require 'active_support'
5
6
  require 'active_support/core_ext'
@@ -11,6 +12,7 @@ module Photish
11
12
 
12
13
  include ::Photish::Gallery::Traits::Urlable
13
14
  include ::Photish::Gallery::Traits::Metadatable
15
+ include ::Photish::Gallery::Traits::Breadcrumbable
14
16
 
15
17
  delegate :qualities, to: :parent, allow_nil: true
16
18
 
@@ -0,0 +1,39 @@
1
+ require 'nokogiri'
2
+
3
+ module Photish
4
+ module Gallery
5
+ module Traits
6
+ module Breadcrumbable
7
+ def breadcrumbs
8
+ doc = Nokogiri::HTML::DocumentFragment.parse("")
9
+ builder = Nokogiri::HTML::Builder.with(doc) do |doc|
10
+ doc.ul(class: 'breadcrumbs') {
11
+ parents_and_me.each_with_index do |level, index|
12
+ doc.li(class: crumb_class(index)) {
13
+ doc.a(level.name, href: level.url)
14
+ }
15
+ end
16
+ }
17
+ end
18
+ doc.to_html
19
+ end
20
+
21
+ def parents_and_me
22
+ [parent.try(:parents_and_me), self].flatten.compact
23
+ end
24
+
25
+ private
26
+
27
+ def crumb_class(index)
28
+ crumb_class = []
29
+ crumb_class << 'breadcrumb'
30
+ crumb_class << "crumb-#{index}"
31
+ crumb_class << 'crumb-first' if index == 0
32
+ crumb_class << 'crumb-last' if index == (parents_and_me.count - 1)
33
+ crumb_class << 'crumb-only' if parents_and_me.count == 1
34
+ crumb_class.join(' ')
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -6,7 +6,7 @@ module Photish
6
6
  module Traits
7
7
  module Metadatable
8
8
  def metadata
9
- return unless File.exists?(metadata_file)
9
+ return unless File.exist?(metadata_file)
10
10
  RecursiveOpenStruct.new(YAML.load_file(metadata_file))
11
11
  end
12
12
 
@@ -1,3 +1,3 @@
1
1
  module Photish
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.required_ruby_version = '>= 1.8.6'
23
+ spec.required_ruby_version = '>= 1.9.3'
24
24
 
25
25
  spec.add_dependency "thor", "~> 0.1"
26
26
  spec.add_dependency "activesupport", "~> 4.2"
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "mini_exiftool", "~> 2.5"
33
33
  spec.add_dependency "recursive-open-struct", "~> 0.6"
34
34
  spec.add_dependency "colorize", "~> 0.7"
35
+ spec.add_dependency "nokogiri", "~> 1.6"
35
36
 
36
37
  spec.add_development_dependency "bundler", "~> 1.10"
37
38
  spec.add_development_dependency "rake", "~> 10.0"
@@ -40,4 +41,6 @@ Gem::Specification.new do |spec|
40
41
  spec.add_development_dependency "aruba"
41
42
  spec.add_development_dependency "pry"
42
43
  spec.add_development_dependency "retriable"
44
+ spec.add_development_dependency "codeclimate-test-reporter"
45
+ spec.add_development_dependency "rspec-html-matchers"
43
46
  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.1.4
4
+ version: 0.1.5
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-24 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.7'
153
+ - !ruby/object:Gem::Dependency
154
+ name: nokogiri
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.6'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.6'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: bundler
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +262,34 @@ dependencies:
248
262
  - - ">="
249
263
  - !ruby/object:Gem::Version
250
264
  version: '0'
265
+ - !ruby/object:Gem::Dependency
266
+ name: codeclimate-test-reporter
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: '0'
279
+ - !ruby/object:Gem::Dependency
280
+ name: rspec-html-matchers
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - ">="
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - ">="
291
+ - !ruby/object:Gem::Version
292
+ version: '0'
251
293
  description: |-
252
294
  Photish is a simple, convention based (but
253
295
  configurable) static photo site generator.
@@ -258,8 +300,11 @@ executables:
258
300
  extensions: []
259
301
  extra_rdoc_files: []
260
302
  files:
303
+ - ".codeclimate.yml"
304
+ - ".csslintrc"
261
305
  - ".gitignore"
262
306
  - ".rspec"
307
+ - ".rubocop.yml"
263
308
  - ".travis.yml"
264
309
  - CODE_OF_CONDUCT.md
265
310
  - Gemfile
@@ -286,6 +331,7 @@ files:
286
331
  - lib/photish/assets/site/_templates/layout.slim
287
332
  - lib/photish/assets/site/_templates/photo.slim
288
333
  - lib/photish/assets/site/custom.html
334
+ - lib/photish/assets/site/images/crumbs.gif
289
335
  - lib/photish/assets/site/styles/basic.css
290
336
  - lib/photish/cli.rb
291
337
  - lib/photish/command/generation.rb
@@ -301,6 +347,7 @@ files:
301
347
  - lib/photish/gallery/image.rb
302
348
  - lib/photish/gallery/photo.rb
303
349
  - lib/photish/gallery/traits/albumable.rb
350
+ - lib/photish/gallery/traits/breadcrumbable.rb
304
351
  - lib/photish/gallery/traits/metadatable.rb
305
352
  - lib/photish/gallery/traits/urlable.rb
306
353
  - lib/photish/log/logger.rb
@@ -321,7 +368,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
321
368
  requirements:
322
369
  - - ">="
323
370
  - !ruby/object:Gem::Version
324
- version: 1.8.6
371
+ version: 1.9.3
325
372
  required_rubygems_version: !ruby/object:Gem::Requirement
326
373
  requirements:
327
374
  - - ">="