photish 0.3.10 → 0.3.11

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a602e2fa444afd9abffa153c6bc9dd7b7bf7dc75
4
- data.tar.gz: 618a774823ec2eda75b667161c1c4d673189e64f
3
+ metadata.gz: dd549e0b900be9de4fb137293813237d8e320aa4
4
+ data.tar.gz: 96dbedfaf551bbb1d3e70c8a6f6a383707578ac3
5
5
  SHA512:
6
- metadata.gz: db17ce6d45a74db3af8ab7d070f142e1078b8fca9d285d1e855857e64d81ac7dfdac2788df7a9d5252944c751bd371c04220776fbffd96b4a6d7119849631f27
7
- data.tar.gz: 837e4ecac164613042b9ba202708b97ead4a0ed19522ea1c3185cf7bd79423a196d601eebf33bfd471272c08a6fd62f9e84541f0528af8566d392f73a82066b7
6
+ metadata.gz: 0cee42768c288ffbd5a31011b0fdff42fd4ddf18b1127492b43a0da0275ee8a44cf17dc5c688aa2f43718854d6a592f7ac3aa42706a389dedab8cab6f2dd4366
7
+ data.tar.gz: aaf9bef8e114106b96e2c9e77960364deee7b8a4f83ffdfe75ab8dc9c573d50b4d8de0c4a25d7632d48a95603051fb4ecf4e4cd121d89abee7519a695f1144c7
data/.simplecov CHANGED
@@ -3,15 +3,19 @@ require 'codeclimate-test-reporter'
3
3
  SimpleCov.start(CodeClimate::TestReporter.configuration.profile) do
4
4
  filters.clear
5
5
 
6
+ root(File.expand_path(File.dirname(__FILE__)))
7
+
6
8
  add_filter do |src|
7
9
  !(src.filename =~ /^#{SimpleCov.root}/) unless src.filename =~ /photish/
8
10
  end
9
-
11
+ add_filter '/gems/photish'
10
12
  add_filter '/bin/'
11
13
  add_filter '/coverage/'
12
14
  add_filter '/exe/'
13
15
  add_filter '/log/'
14
16
  add_filter '/pkg/'
17
+ add_filter 'vendor'
18
+ add_filter 'tmp'
15
19
 
16
20
  add_group 'Library', 'lib'
17
21
  add_group 'Specs', 'spec'
data/README.md CHANGED
@@ -318,6 +318,7 @@ workers: 4
318
318
  threads: 2
319
319
  force: false
320
320
  plugins: ['ssh_deploy', 'other_plugin']
321
+ image_extensions: ['jpg', 'gif']
321
322
  ```
322
323
 
323
324
  The meanings and purpose of each field is defined below:
@@ -345,6 +346,7 @@ Field | Purpose
345
346
  `threads` | the number of threads each worker should create to handle image magick transcoding
346
347
  `force` | this should always be false, if true, all content will be regenerated and nothing cached
347
348
  `plugins` | an array of plugin names that have been included in your Gemfile and that Photish should require into it's runtime
349
+ `image_extensions` | by default, Photish obtains a list of supported image format extensions from ImageMagick, however if you choose too, you can explicitly list the extensions that Photish should use to find images
348
350
 
349
351
  #### Customizing Templates
350
352
 
@@ -685,7 +687,10 @@ Photish supports extension through the creation of plugins.
685
687
 
686
688
  To create a template helper plugin you must:
687
689
 
688
- 1. Create a **Ruby module** in the `Photish::Plugin` module namespace
690
+ 1. Create a **Ruby Module** in the `Photish::Plugin` module namespace, if
691
+ you are packaging the plugin as a Gem, you can implement your module one
692
+ level deeper in the namespace to allow for the Gem namespace, e.g.
693
+ `Photish::Plugin::MyGemPlugin::MyTemplateHelper`
689
694
  1. Make the plugin available for [loading](#plugin-loading)
690
695
  1. Implement the `self.is_for?(type)` method
691
696
  1. Implement your custom helper method(s)
@@ -737,7 +742,10 @@ Some "core" Template Helper plugins available in Photish by default are:
737
742
 
738
743
  To create a deployment engine plugin you must:
739
744
 
740
- 1. Create a **Ruby class** in the `Photish::Plugin` module namespace
745
+ 1. Create a **Ruby Class** in the `Photish::Plugin` module namespace, if
746
+ you are packaging the plugin as a Gem, you can implement your module one
747
+ level deeper in the namespace to allow for the Gem namespace, e.g.
748
+ `Photish::Plugin::MyGemPlugin::MyDeployEngine`
741
749
  1. Make the plugin available for [loading](#plugin-loading)
742
750
  1. Implement a `self.is_for?(type)` method and respond true when it receives
743
751
  the `Photish::Plugin::Type::Deploy` type
@@ -775,18 +783,70 @@ module Photish::Plugin::MyCustomDeploy
775
783
  end
776
784
  ```
777
785
 
786
+ Some reference implementations of deploy plugins are:
787
+
788
+ 1. [Photish SSH Deploy](https://github.com/henrylawson/photish-plugin-sshdeploy)
789
+ 1. [Tmp Dir Deploy](https://github.com/henrylawson/photish/blob/master/lib/photish/assets/example/site/_plugins/tmpdir_deploy.rb)
790
+
778
791
  ### Plugin Loading
779
792
 
780
- Photish supports the following methods of Plugin loading:
793
+ Photish supports the following methods of Plugin loading.
794
+
795
+ #### Site Folder Loading
796
+
797
+ By default, Photish will automatically load all files in the `site/_plugins`
798
+ directory. This is the most simple way and is recommended if you just want to
799
+ write a simple helper specific to your site.
800
+
801
+ The example site created when running `photish generate --example` uses this
802
+ method to load plugins.
803
+
804
+ #### Explicit Gem Loading
805
+
806
+ This is recommended method if you want to utilize a plugin created by someone
807
+ else in the community - rather than simply copy pasting their code to your
808
+ `site/_plugins` directory. It is done by including a Gem in your Photish site's
809
+ `Gemfile` and listing the require path of the Gem in the `plugins` [Config File
810
+ Option](#config-file-options).
811
+
812
+ An example of Explicit Gem Loading is provided by the [Photish
813
+ Montage](https://github.com/henrylawson/photish-montage) demo that explicitly
814
+ loads the
815
+ [Photish::Plugin::Sshdeploy](https://github.com/henrylawson/photish-plugin-sshdeploy)
816
+ Gem.
817
+
818
+ To load a Gem as a plugin, first of all add the Gem to your Gemfile:
819
+
820
+ **Gemfile**
821
+
822
+ ```Gemfile
823
+ gem 'photish-plugin-sshdeploy'
824
+ ```
825
+
826
+ And in your Photish config, ensure it is listed in your `plugins` [Config File
827
+ Option](#config-file-options).
828
+
829
+ **config.yml**
830
+
831
+ ```YAML
832
+ plugins: ['photish/plugin/sshdeploy']
833
+ ```
834
+
835
+ Then run `bundle install`.
836
+
837
+ To confirm that it is installed correctly, when you run the `photish generate`
838
+ command, you should see the plugin load:
839
+
840
+ **log/photish.log or STDOUT**
841
+
842
+ ```
843
+ ...
844
+ ... Photish::Plugin::Repository: Found plugin Photish::Plugin::Sshdeploy::Deploy
845
+ ...
846
+ ```
781
847
 
782
- 1. Automatic loading of files in the `site/_plugins` directory. This is the
783
- most simple way and is recommended if you just want a simple helper specific
784
- to your site.
785
- 1. Including a Gem in your Photish site's `Gemfile` and listing the name of the
786
- Gem in the `plugins` [Config File Option](#config-file-options). This is
787
- recommended if you want to utilize a plugin created by someone else in the
788
- community - rather than simple copy pasting their code to your
789
- `site/_plugins` directory.
848
+ Note the 'photish-plugin-sshdeploy' Gem has other install steps documented in
849
+ it's [README](https://github.com/henrylawson/photish-plugin-sshdeploy).
790
850
 
791
851
  ## Development
792
852
 
data/TODO.md CHANGED
@@ -2,13 +2,8 @@
2
2
 
3
3
  ## In Progress
4
4
 
5
- 1. Extract the SSH deploy to gem
6
-
7
5
  ## Backlog
8
6
 
9
- 1. Dry up the SimpleCov config that is everywhere
10
- 1. Mime-types gem required 2.0 and above, lost 1.9.x, does this matter?
11
- 1. Need to have parameters to change on deploy
12
7
  1. Worker can die when large folders moved mid generation
13
8
  1. Changing convert items does not trigger regeneration but changing name does
14
9
  1. Templates with exif data, super slow
@@ -21,4 +16,3 @@
21
16
  1. Provide generic way to override config from arguments to allow for host name
22
17
  override on deploy etc.
23
18
  1. Video transcoding and template rendering
24
- 1. JRuby support, perhaps?
data/exe/photish CHANGED
@@ -3,9 +3,6 @@
3
3
  if ENV['COVERAGE']
4
4
  require 'simplecov'
5
5
  SimpleCov.command_name "photish-binary-#{Process.pid}"
6
- SimpleCov.add_filter 'vendor'
7
- SimpleCov.add_filter 'tmp'
8
- SimpleCov.root(File.join(File.expand_path(File.dirname(__FILE__)), '..'))
9
6
  end
10
7
 
11
8
  if ENV['PROFILE']
@@ -25,6 +25,7 @@ module Photish
25
25
  :workers,
26
26
  :force,
27
27
  :threads,
28
+ :image_extensions,
28
29
  to: :config
29
30
 
30
31
  delegate :concat_db_files,
@@ -69,7 +70,8 @@ module Photish
69
70
  def collection
70
71
  @collection ||= Gallery::Collection.new(photo_dir,
71
72
  qualities_mapped,
72
- url)
73
+ url,
74
+ image_extensions)
73
75
  end
74
76
 
75
77
  def qualities_mapped
@@ -18,6 +18,7 @@ module Photish
18
18
  :qualities,
19
19
  :url,
20
20
  :worker_index,
21
+ :image_extensions,
21
22
  to: :config
22
23
 
23
24
  def load_all_plugins
@@ -33,7 +34,8 @@ module Photish
33
34
  def collection
34
35
  @collection ||= Gallery::Collection.new(photo_dir,
35
36
  qualities_mapped,
36
- url)
37
+ url,
38
+ image_extensions)
37
39
  end
38
40
 
39
41
  def qualities_mapped
@@ -16,12 +16,17 @@ module Photish
16
16
  templates: templates,
17
17
  logging: logging,
18
18
  url: url,
19
- plugins: []
19
+ plugins: [],
20
+ image_extensions: image_extensions
20
21
  }
21
22
  end
22
23
 
23
24
  private
24
25
 
26
+ def image_extensions
27
+ ImageExtension::IMAGE_MAGICK
28
+ end
29
+
25
30
  def url
26
31
  {
27
32
  host: '',
@@ -0,0 +1,8 @@
1
+ module Photish
2
+ module Config
3
+ module ImageExtension
4
+ # Taken from 'convert -list format'
5
+ IMAGE_MAGICK = ['aai', 'art', 'avs', 'bgr', 'bgra', 'bgro', 'bmp', 'bmp2', 'bmp3', 'brf', 'cal', 'cals', 'canvas', 'caption', 'cin', 'cip', 'clip', 'cmyk', 'cmyka', 'cur', 'cut', 'data', 'dcm', 'dcx', 'dds', 'dfont', 'dpx', 'dxt1', 'dxt5', 'eps2', 'eps3', 'fax', 'fits', 'fractal', 'fts', 'g3', 'gif', 'gif87', 'gradient', 'gray', 'group4', 'h', 'hald', 'hdr', 'histogram', 'hrz', 'htm', 'html', 'icb', 'ico', 'icon', 'inline', 'ipl', 'isobrl', 'isobrl6', 'jng', 'jnx', 'jpe', 'jpeg', 'jpg', 'jps', 'label', 'mac', 'magick', 'map', 'mask', 'matte', 'miff', 'mng', 'mono', 'mpc', 'msl', 'mtv', 'mvg', 'null', 'otb', 'otf', 'pal', 'palm', 'pam', 'pango', 'pattern', 'pbm', 'pcd', 'pcds', 'pct', 'pcx', 'pdb', 'pes', 'pfa', 'pfb', 'pfm', 'pgm', 'picon', 'pict', 'pix', 'pjpeg', 'plasma', 'png', 'png00', 'png24', 'png32', 'png48', 'png64', 'png8', 'pnm', 'ppm', 'preview', 'ps2', 'ps3', 'psb', 'psd', 'ptif', 'pwp', 'radial-gradient', 'ras', 'rgb', 'rgba', 'rgbo', 'rgf', 'rla', 'rle', 'scr', 'sct', 'sfw', 'sgi', 'shtml', 'six', 'sixel', 'sparse-color', 'stegano', 'sun', 'text', 'tga', 'thumbnail', 'tiff', 'tiff64', 'tile', 'tim', 'ttc', 'ttf', 'txt', 'ubrl', 'ubrl6', 'uil', 'uyvy', 'vda', 'vicar', 'vid', 'viff', 'vips', 'vst', 'wbmp', 'wpg', 'xbm', 'xc', 'xcf', 'xpm', 'xv', 'ycbcr', 'ycbcra', 'yuv']
6
+ end
7
+ end
8
+ end
@@ -7,6 +7,7 @@ module Photish
7
7
  include Photish::Plugin::Pluginable
8
8
 
9
9
  delegate :qualities,
10
+ :image_extensions,
10
11
  :url_info,
11
12
  to: :parent, allow_nil: true
12
13
 
@@ -42,10 +43,7 @@ module Photish
42
43
 
43
44
  def image_format?(file)
44
45
  extension = File.extname(file).split('.').last.try(:downcase)
45
- return if extension.nil?
46
- MIME::Types.type_for(extension).any? do
47
- |mime| mime.to_s.match(formats)
48
- end
46
+ image_extensions.include?(extension)
49
47
  end
50
48
 
51
49
  def album_class
@@ -55,12 +53,6 @@ module Photish
55
53
  def url_end
56
54
  'index.html'
57
55
  end
58
-
59
- def formats
60
- Regexp.union([
61
- /image/i
62
- ])
63
- end
64
56
  end
65
57
  end
66
58
  end
@@ -7,13 +7,15 @@ module Photish
7
7
  include Photish::Plugin::Pluginable
8
8
 
9
9
  attr_reader :qualities,
10
- :url_info
10
+ :url_info,
11
+ :image_extensions
11
12
 
12
- def initialize(path, qualities, url_info)
13
+ def initialize(path, qualities, url_info, image_extensions)
13
14
  super
14
15
  @path = path
15
16
  @qualities = qualities
16
17
  @url_info = url_info
18
+ @image_extensions = Set.new(image_extensions)
17
19
  end
18
20
 
19
21
  def name
@@ -1,3 +1,3 @@
1
1
  module Photish
2
- VERSION = "0.3.10"
2
+ VERSION = "0.3.11"
3
3
  end
data/lib/photish.rb CHANGED
@@ -12,11 +12,11 @@ require 'thor'
12
12
  require 'recursive_open_struct'
13
13
  require 'cgi'
14
14
  require 'facter'
15
- require 'mime-types'
16
15
  require 'thread'
17
16
  require 'thwait'
18
17
  require 'slim'
19
18
  require 'colorize'
19
+ require 'open3'
20
20
 
21
21
  # Photish
22
22
  require 'photish/log/loggable'
@@ -34,6 +34,7 @@ require 'photish/command/host'
34
34
  require 'photish/command/init'
35
35
  require 'photish/command/deploy'
36
36
  require 'photish/cli/interface'
37
+ require 'photish/config/image_extension'
37
38
  require 'photish/config/default_config'
38
39
  require 'photish/config/file_config'
39
40
  require 'photish/config/file_config_location'
data/photish.gemspec CHANGED
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "recursive-open-struct", "~> 1.0"
32
32
  spec.add_dependency "listen", "~> 3.0"
33
33
  spec.add_dependency "facter", "~> 2.4"
34
- spec.add_dependency "mime-types", "~> 3.0"
35
34
  spec.add_dependency "colorize", "~> 0.7.7"
36
35
 
37
36
  spec.add_development_dependency "anemone", "~> 0.7"
@@ -44,4 +43,5 @@ Gem::Specification.new do |spec|
44
43
  spec.add_development_dependency "codeclimate-test-reporter"
45
44
  spec.add_development_dependency "rspec-html-matchers"
46
45
  spec.add_development_dependency "metric_fu"
46
+ spec.add_development_dependency "photish-plugin-sshdeploy"
47
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Lawson
@@ -136,20 +136,6 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '2.4'
139
- - !ruby/object:Gem::Dependency
140
- name: mime-types
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '3.0'
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '3.0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: colorize
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -304,6 +290,20 @@ dependencies:
304
290
  - - ">="
305
291
  - !ruby/object:Gem::Version
306
292
  version: '0'
293
+ - !ruby/object:Gem::Dependency
294
+ name: photish-plugin-sshdeploy
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - ">="
298
+ - !ruby/object:Gem::Version
299
+ version: '0'
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - ">="
305
+ - !ruby/object:Gem::Version
306
+ version: '0'
307
307
  description: |-
308
308
  Photish is a simple, convention based (but
309
309
  configurable) static photo site generator.
@@ -369,6 +369,7 @@ files:
369
369
  - lib/photish/config/default_config.rb
370
370
  - lib/photish/config/file_config.rb
371
371
  - lib/photish/config/file_config_location.rb
372
+ - lib/photish/config/image_extension.rb
372
373
  - lib/photish/core_plugin/breadcrumb.rb
373
374
  - lib/photish/core_plugin/build_url.rb
374
375
  - lib/photish/gallery/album.rb