photish 0.2.1 → 0.3.0
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 +4 -4
- data/README.md +16 -0
- data/TODO.md +2 -0
- data/exe/photish +1 -1
- data/lib/photish/assets/site/_plugins/tmpdir_deploy.rb +30 -0
- data/lib/photish/cli/interface.rb +6 -5
- data/lib/photish/command/base.rb +36 -0
- data/lib/photish/command/deploy.rb +44 -0
- data/lib/photish/command/generate.rb +15 -48
- data/lib/photish/command/host.rb +8 -36
- data/lib/photish/command/init.rb +4 -21
- data/lib/photish/config/app_settings.rb +21 -11
- data/lib/photish/config/default_config.rb +4 -0
- data/lib/photish/config/file_config.rb +0 -2
- data/lib/photish/config/{location.rb → file_config_location.rb} +1 -1
- data/lib/photish/gallery/album.rb +3 -11
- data/lib/photish/gallery/collection.rb +5 -9
- data/lib/photish/gallery/image.rb +3 -4
- data/lib/photish/gallery/photo.rb +3 -10
- data/lib/photish/gallery/traits/breadcrumbable.rb +0 -2
- data/lib/photish/gallery/traits/metadatable.rb +0 -3
- data/lib/photish/gallery/traits/urlable.rb +9 -3
- data/lib/photish/log/logger.rb +4 -6
- data/lib/photish/plugin/pluginable.rb +0 -3
- data/lib/photish/plugin/repository.rb +11 -1
- data/lib/photish/plugin/type.rb +4 -3
- data/lib/photish/rake/task.rb +0 -3
- data/lib/photish/render/image_conversion.rb +0 -2
- data/lib/photish/render/page.rb +0 -2
- data/lib/photish/render/site.rb +0 -3
- data/lib/photish/version.rb +1 -1
- data/lib/photish.rb +47 -1
- metadata +6 -4
- data/lib/photish/config/settings.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d2196afefb3930e090519fd81435fbba5c8347c
|
4
|
+
data.tar.gz: 5b2213f00cf0521772295fb2e21f84e764cfdbb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3db008201ee711a28556bbd0c5b7d65f1e6dca3a6a0c775518c88e61881fd885f55ad11cfee2ab4b208144f4346dd92e6759bfd0f90f8146dc0c1ab4d079d5e0
|
7
|
+
data.tar.gz: 732b2b201fabfc21593277d1c633bc8a54d4d464d658085871a626e12b5fe02f627f3de53082fd86374723a8620736ca2b32e18d551d8d0d2874d8a766bb1d22
|
data/README.md
CHANGED
@@ -216,6 +216,7 @@ File or Folder | Purpose
|
|
216
216
|
--------------------------------- | -------
|
217
217
|
`photos` | folder, for your photo collection and metadata
|
218
218
|
`site` | folder for your templates, assets and static pages
|
219
|
+
`site/_plugins` | folder for plugins to be loaded from
|
219
220
|
`site/_templates` | folder for your templates
|
220
221
|
`site/_templates/layout.slim` | file for the basic layout for all pages
|
221
222
|
`site/_templates/collection.slim` | template file for your collection page
|
@@ -278,6 +279,9 @@ logging:
|
|
278
279
|
colorize: true
|
279
280
|
level: 'info'
|
280
281
|
output: ['stdout', 'file']
|
282
|
+
url:
|
283
|
+
host: http://mydomain.com
|
284
|
+
base: 'subdirectory'
|
281
285
|
```
|
282
286
|
|
283
287
|
The meanings and purpose of each field is defined below:
|
@@ -297,6 +301,9 @@ Field | Purpose
|
|
297
301
|
`logging/colorize` | when outputting to `STDOUT`, `true` to use color, `false` for none
|
298
302
|
`logging/level` | the default logging level, it is advised to keep this at `info`
|
299
303
|
`logging/output` | the appenders for the logger, `stdout` goes to `STDOUT`, `file` goes to `log/photish.log`
|
304
|
+
`url` | a listing of the various url options
|
305
|
+
`url/host` | default is to leave this configuration blank, however if you would like URLs generated with a specific host prefix, you can define it here
|
306
|
+
`url/base` | default is to leave this configuration blank, if your website will be hosted in a sub folder and will not be accessible at the root of the host, you can specify the sub folder(s) here, this will also mean your website will be hosted in a sub folder when ran using `photish host`
|
300
307
|
|
301
308
|
#### Customizing Templates
|
302
309
|
|
@@ -521,6 +528,15 @@ If the above code is saved to `site/_plugins/shout.rb` Photish will detect the
|
|
521
528
|
plugin ruby file at runtime and it will load and make the method available in
|
522
529
|
the template.
|
523
530
|
|
531
|
+
A Template Helper Plugin `self.is_for?(type)` method could potentially receive
|
532
|
+
any of the below types, simply return true for the types the Template Helper
|
533
|
+
Plugin supports:
|
534
|
+
|
535
|
+
1. `Photish::Plugin::Type::Collection`
|
536
|
+
1. `Photish::Plugin::Type::Album`
|
537
|
+
1. `Photish::Plugin::Type::Photo`
|
538
|
+
1. `Photish::Plugin::Type::Image`
|
539
|
+
|
524
540
|
A usage example is below
|
525
541
|
|
526
542
|
**site/_templates/photo.slim**
|
data/TODO.md
CHANGED
data/exe/photish
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
class Photish::Plugin::TmpdirDeploy
|
2
|
+
|
3
|
+
def initialize(config, log)
|
4
|
+
@config = config
|
5
|
+
@log = log
|
6
|
+
end
|
7
|
+
|
8
|
+
def deploy
|
9
|
+
tmpdir = Dir.mktmpdir
|
10
|
+
FileUtils.cp_r(config.output_dir, tmpdir)
|
11
|
+
|
12
|
+
log.info "Static site deployed to directory: #{tmpdir}"
|
13
|
+
log.info "Deployment to tmpdir successful"
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_reader :config,
|
19
|
+
:log
|
20
|
+
|
21
|
+
def self.is_for?(type)
|
22
|
+
[
|
23
|
+
Photish::Plugin::Type::Deploy
|
24
|
+
].include?(type)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.engine_name
|
28
|
+
'tmpdir'
|
29
|
+
end
|
30
|
+
end
|
@@ -1,8 +1,3 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'photish/command/generate'
|
3
|
-
require 'photish/command/host'
|
4
|
-
require 'photish/command/init'
|
5
|
-
|
6
1
|
module Photish
|
7
2
|
module CLI
|
8
3
|
class Interface < Thor
|
@@ -22,6 +17,12 @@ module Photish
|
|
22
17
|
def init
|
23
18
|
Photish::Command::Init.new(options).execute
|
24
19
|
end
|
20
|
+
|
21
|
+
desc "deploy", "Deploys the static site, using the specified engine"
|
22
|
+
method_option :engine, required: true
|
23
|
+
def deploy
|
24
|
+
Photish::Command::Deploy.new(options).execute
|
25
|
+
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Photish
|
2
|
+
module Command
|
3
|
+
class Base
|
4
|
+
def initialize(runtime_config)
|
5
|
+
@runtime_config = runtime_config
|
6
|
+
@log = Logging.logger[self]
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
setup_logging
|
11
|
+
begin
|
12
|
+
run
|
13
|
+
rescue => e
|
14
|
+
log.fatal "An exception occured #{e.class} \"#{e.message}\" #{e.backtrace.join("\n")}"
|
15
|
+
false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
attr_reader :runtime_config,
|
22
|
+
:log
|
23
|
+
|
24
|
+
def config
|
25
|
+
@config ||= Photish::Config::AppSettings.new(runtime_config)
|
26
|
+
.config
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def setup_logging
|
32
|
+
Photish::Log::Logger.instance.setup_logging(config)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Photish
|
2
|
+
module Command
|
3
|
+
class Deploy < Base
|
4
|
+
def run
|
5
|
+
load_all_plugins
|
6
|
+
log.info "Requested engine: #{engine}"
|
7
|
+
|
8
|
+
return no_engine_found unless engine
|
9
|
+
|
10
|
+
log.info "Deploying with engine #{engine_class}"
|
11
|
+
engine_class.new(config, log).deploy
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
delegate :engine,
|
17
|
+
:site_dir,
|
18
|
+
to: :config
|
19
|
+
|
20
|
+
|
21
|
+
def no_engine_found
|
22
|
+
log.info "No engine found..."
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_all_plugins
|
26
|
+
Photish::Plugin::Repository.reload(log, site_dir)
|
27
|
+
end
|
28
|
+
|
29
|
+
def engine_class
|
30
|
+
@engine ||= deploy_plugins.find do |p|
|
31
|
+
p.engine_name == engine
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def deploy_plugins
|
36
|
+
Photish::Plugin::Repository.plugins_for(deploy_plugin_type)
|
37
|
+
end
|
38
|
+
|
39
|
+
def deploy_plugin_type
|
40
|
+
Photish::Plugin::Type::Deploy
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,19 +1,7 @@
|
|
1
|
-
require 'photish/log/logger'
|
2
|
-
require 'photish/config/app_settings'
|
3
|
-
require 'photish/gallery/collection'
|
4
|
-
require 'photish/render/site'
|
5
|
-
|
6
1
|
module Photish
|
7
2
|
module Command
|
8
|
-
class Generate
|
9
|
-
def
|
10
|
-
@runtime_config = runtime_config
|
11
|
-
@log = Logging.logger[self]
|
12
|
-
end
|
13
|
-
|
14
|
-
def execute
|
15
|
-
Photish::Log::Logger.instance.setup_logging(config)
|
16
|
-
|
3
|
+
class Generate < Base
|
4
|
+
def run
|
17
5
|
log_important_config_values
|
18
6
|
load_all_plugins
|
19
7
|
log_album_and_photo_names
|
@@ -23,22 +11,16 @@ module Photish
|
|
23
11
|
|
24
12
|
private
|
25
13
|
|
26
|
-
|
27
|
-
|
14
|
+
delegate :output_dir,
|
15
|
+
:site_dir,
|
16
|
+
:photo_dir,
|
17
|
+
:qualities,
|
18
|
+
:templates,
|
19
|
+
:url,
|
20
|
+
to: :config
|
28
21
|
|
29
22
|
def load_all_plugins
|
30
|
-
|
31
|
-
require file
|
32
|
-
end
|
33
|
-
|
34
|
-
Photish::Plugin::Repository.all_plugins.each do |plugin|
|
35
|
-
log.info "Found plugin #{plugin}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def config
|
40
|
-
@config ||= Photish::Config::AppSettings.new(runtime_config)
|
41
|
-
.config
|
23
|
+
Photish::Plugin::Repository.reload(log, site_dir)
|
42
24
|
end
|
43
25
|
|
44
26
|
def log_important_config_values
|
@@ -61,29 +43,14 @@ module Photish
|
|
61
43
|
.all_for(collection)
|
62
44
|
end
|
63
45
|
|
64
|
-
def photo_dir
|
65
|
-
config.val(:photo_dir)
|
66
|
-
end
|
67
|
-
|
68
|
-
def output_dir
|
69
|
-
config.val(:output_dir)
|
70
|
-
end
|
71
|
-
|
72
|
-
def site_dir
|
73
|
-
config.val(:site_dir)
|
74
|
-
end
|
75
|
-
|
76
46
|
def collection
|
77
|
-
@collection ||= Gallery::Collection.new(photo_dir,
|
78
|
-
|
79
|
-
|
80
|
-
def qualities
|
81
|
-
config.val(:qualities)
|
82
|
-
.map { |quality| OpenStruct.new(quality) }
|
47
|
+
@collection ||= Gallery::Collection.new(photo_dir,
|
48
|
+
qualities_mapped,
|
49
|
+
url)
|
83
50
|
end
|
84
51
|
|
85
|
-
def
|
86
|
-
OpenStruct.new(
|
52
|
+
def qualities_mapped
|
53
|
+
qualities.map { |quality| OpenStruct.new(quality) }
|
87
54
|
end
|
88
55
|
end
|
89
56
|
end
|
data/lib/photish/command/host.rb
CHANGED
@@ -1,17 +1,7 @@
|
|
1
|
-
require 'photish/log/logger'
|
2
|
-
require 'photish/log/access_log'
|
3
|
-
require 'webrick'
|
4
|
-
require 'listen'
|
5
|
-
|
6
1
|
module Photish
|
7
2
|
module Command
|
8
|
-
class Host
|
9
|
-
def
|
10
|
-
@runtime_config = runtime_config
|
11
|
-
@log = Logging.logger[self]
|
12
|
-
end
|
13
|
-
|
14
|
-
def execute
|
3
|
+
class Host < Base
|
4
|
+
def run
|
15
5
|
Photish::Log::Logger.instance.setup_logging(config)
|
16
6
|
|
17
7
|
log.info "Site will be running at http://0.0.0.0:#{port}/"
|
@@ -23,8 +13,11 @@ module Photish
|
|
23
13
|
|
24
14
|
private
|
25
15
|
|
26
|
-
|
27
|
-
|
16
|
+
delegate :port,
|
17
|
+
:output_dir,
|
18
|
+
:site_dir,
|
19
|
+
:photo_dir,
|
20
|
+
to: :config
|
28
21
|
|
29
22
|
def start_http_server_with_listener
|
30
23
|
trap 'INT' do server.shutdown end
|
@@ -34,11 +27,6 @@ module Photish
|
|
34
27
|
log.info "Photish host has shutdown"
|
35
28
|
end
|
36
29
|
|
37
|
-
def config
|
38
|
-
@config ||= Photish::Config::AppSettings.new(runtime_config)
|
39
|
-
.config
|
40
|
-
end
|
41
|
-
|
42
30
|
def server
|
43
31
|
@server ||= WEBrick::HTTPServer.new(Port: port,
|
44
32
|
DocumentRoot: output_dir,
|
@@ -58,7 +46,7 @@ module Photish
|
|
58
46
|
|
59
47
|
def paths_to_monitor
|
60
48
|
[site_dir,
|
61
|
-
|
49
|
+
photo_dir]
|
62
50
|
end
|
63
51
|
|
64
52
|
def access_log
|
@@ -73,22 +61,6 @@ module Photish
|
|
73
61
|
Photish::Command::Generate.new(runtime_config)
|
74
62
|
.execute
|
75
63
|
end
|
76
|
-
|
77
|
-
def port
|
78
|
-
config.val(:port)
|
79
|
-
end
|
80
|
-
|
81
|
-
def output_dir
|
82
|
-
config.val(:output_dir)
|
83
|
-
end
|
84
|
-
|
85
|
-
def site_dir
|
86
|
-
config.val(:site_dir)
|
87
|
-
end
|
88
|
-
|
89
|
-
def photos_dir
|
90
|
-
config.val(:photo_dir)
|
91
|
-
end
|
92
64
|
end
|
93
65
|
end
|
94
66
|
end
|
data/lib/photish/command/init.rb
CHANGED
@@ -1,33 +1,16 @@
|
|
1
|
-
require 'photish/log/logger'
|
2
|
-
|
3
1
|
module Photish
|
4
2
|
module Command
|
5
|
-
class Init
|
6
|
-
def
|
7
|
-
@runtime_config = runtime_config
|
8
|
-
@log = Logging.logger[self]
|
9
|
-
end
|
10
|
-
|
11
|
-
def execute
|
12
|
-
Photish::Log::Logger.instance.setup_logging(config)
|
13
|
-
|
3
|
+
class Init < Base
|
4
|
+
def run
|
14
5
|
FileUtils.cp_r(config_file, Dir.pwd)
|
15
6
|
FileUtils.cp_r(gitignore_file, File.join(Dir.pwd, '.gitignore'))
|
16
|
-
FileUtils.cp_r(
|
7
|
+
FileUtils.cp_r(photo_dir, Dir.pwd)
|
17
8
|
FileUtils.cp_r(site_dir, Dir.pwd)
|
18
9
|
log.info "Photish site initiated successfully"
|
19
10
|
end
|
20
11
|
|
21
12
|
private
|
22
13
|
|
23
|
-
attr_reader :runtime_config,
|
24
|
-
:log
|
25
|
-
|
26
|
-
def config
|
27
|
-
@config ||= Photish::Config::AppSettings.new(runtime_config)
|
28
|
-
.config
|
29
|
-
end
|
30
|
-
|
31
14
|
def config_file
|
32
15
|
asset_path('config.yml')
|
33
16
|
end
|
@@ -36,7 +19,7 @@ module Photish
|
|
36
19
|
asset_path('gitignore')
|
37
20
|
end
|
38
21
|
|
39
|
-
def
|
22
|
+
def photo_dir
|
40
23
|
asset_path('photos')
|
41
24
|
end
|
42
25
|
|
@@ -1,31 +1,41 @@
|
|
1
|
-
require 'photish/config/settings'
|
2
|
-
require 'photish/config/location'
|
3
|
-
|
4
1
|
module Photish
|
5
2
|
module Config
|
6
3
|
class AppSettings
|
7
4
|
def initialize(runtime_config)
|
8
|
-
@runtime_config = runtime_config
|
5
|
+
@runtime_config = symbolize(runtime_config)
|
9
6
|
end
|
10
7
|
|
11
8
|
def config
|
12
|
-
@config ||=
|
13
|
-
.new(default_config)
|
14
|
-
.override(file_config)
|
15
|
-
.override(runtime_config)
|
9
|
+
@config ||= RecursiveOpenStruct.new(prioritized_config)
|
16
10
|
end
|
17
11
|
|
18
12
|
private
|
19
13
|
|
20
14
|
attr_reader :runtime_config
|
21
15
|
|
16
|
+
def prioritized_config
|
17
|
+
{}.merge(default_config)
|
18
|
+
.merge(file_config)
|
19
|
+
.merge(runtime_config)
|
20
|
+
end
|
21
|
+
|
22
22
|
def file_config
|
23
|
-
|
24
|
-
|
23
|
+
symbolize(FileConfig.new(file_config_location)
|
24
|
+
.hash)
|
25
25
|
end
|
26
26
|
|
27
27
|
def default_config
|
28
|
-
|
28
|
+
symbolize(DefaultConfig.new.hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
def file_config_location
|
32
|
+
FileConfigLocation.new(runtime_config[:site_dir])
|
33
|
+
.path
|
34
|
+
end
|
35
|
+
|
36
|
+
def symbolize(hash)
|
37
|
+
(hash || {})
|
38
|
+
.deep_symbolize_keys
|
29
39
|
end
|
30
40
|
end
|
31
41
|
end
|
@@ -1,13 +1,3 @@
|
|
1
|
-
require 'photish/gallery/photo'
|
2
|
-
require 'photish/gallery/traits/urlable'
|
3
|
-
require 'photish/gallery/traits/albumable'
|
4
|
-
require 'photish/gallery/traits/metadatable'
|
5
|
-
require 'photish/gallery/traits/breadcrumbable'
|
6
|
-
require 'photish/plugin/pluginable'
|
7
|
-
require 'active_support'
|
8
|
-
require 'active_support/core_ext'
|
9
|
-
require 'filemagic'
|
10
|
-
|
11
1
|
module Photish
|
12
2
|
module Gallery
|
13
3
|
class Album
|
@@ -17,7 +7,9 @@ module Photish
|
|
17
7
|
include Photish::Gallery::Traits::Breadcrumbable
|
18
8
|
include Photish::Plugin::Pluginable
|
19
9
|
|
20
|
-
delegate :qualities,
|
10
|
+
delegate :qualities,
|
11
|
+
:url_info,
|
12
|
+
to: :parent, allow_nil: true
|
21
13
|
|
22
14
|
def initialize(parent, path)
|
23
15
|
super
|
@@ -1,9 +1,3 @@
|
|
1
|
-
require 'photish/gallery/album'
|
2
|
-
require 'photish/gallery/traits/albumable'
|
3
|
-
require 'photish/gallery/traits/metadatable'
|
4
|
-
require 'photish/gallery/traits/breadcrumbable'
|
5
|
-
require 'photish/plugin/pluginable'
|
6
|
-
|
7
1
|
module Photish
|
8
2
|
module Gallery
|
9
3
|
class Collection
|
@@ -13,12 +7,14 @@ module Photish
|
|
13
7
|
include Photish::Gallery::Traits::Breadcrumbable
|
14
8
|
include Photish::Plugin::Pluginable
|
15
9
|
|
16
|
-
attr_reader :qualities
|
10
|
+
attr_reader :qualities,
|
11
|
+
:url_info
|
17
12
|
|
18
|
-
def initialize(path, qualities)
|
13
|
+
def initialize(path, qualities, url_info)
|
19
14
|
super
|
20
15
|
@path = path
|
21
16
|
@qualities = qualities
|
17
|
+
@url_info = url_info
|
22
18
|
end
|
23
19
|
|
24
20
|
def name
|
@@ -26,7 +22,7 @@ module Photish
|
|
26
22
|
end
|
27
23
|
|
28
24
|
def base_url_parts
|
29
|
-
[]
|
25
|
+
[url_info.base].flatten.compact
|
30
26
|
end
|
31
27
|
|
32
28
|
def plugin_type
|
@@ -1,7 +1,3 @@
|
|
1
|
-
require 'active_support'
|
2
|
-
require 'active_support/core_ext'
|
3
|
-
require 'photish/plugin/pluginable'
|
4
|
-
|
5
1
|
module Photish
|
6
2
|
module Gallery
|
7
3
|
class Image
|
@@ -12,6 +8,9 @@ module Photish
|
|
12
8
|
:params,
|
13
9
|
to: :quality, prefix: true, allow_nil: true
|
14
10
|
|
11
|
+
delegate :url_info,
|
12
|
+
to: :parent, allow_nil: true
|
13
|
+
|
15
14
|
attr_reader :path
|
16
15
|
|
17
16
|
def initialize(parent, path, quality)
|
@@ -1,12 +1,3 @@
|
|
1
|
-
require 'photish/gallery/traits/urlable'
|
2
|
-
require 'photish/gallery/traits/metadatable'
|
3
|
-
require 'photish/gallery/traits/breadcrumbable'
|
4
|
-
require 'photish/gallery/image'
|
5
|
-
require 'photish/plugin/pluginable'
|
6
|
-
require 'active_support'
|
7
|
-
require 'active_support/core_ext'
|
8
|
-
require 'mini_exiftool'
|
9
|
-
|
10
1
|
module Photish
|
11
2
|
module Gallery
|
12
3
|
class Photo
|
@@ -15,7 +6,9 @@ module Photish
|
|
15
6
|
include Photish::Gallery::Traits::Breadcrumbable
|
16
7
|
include Photish::Plugin::Pluginable
|
17
8
|
|
18
|
-
delegate :qualities,
|
9
|
+
delegate :qualities,
|
10
|
+
:url_info,
|
11
|
+
to: :parent, allow_nil: true
|
19
12
|
|
20
13
|
def initialize(parent, path)
|
21
14
|
super
|
@@ -1,11 +1,9 @@
|
|
1
|
-
require 'cgi'
|
2
|
-
|
3
1
|
module Photish
|
4
2
|
module Gallery
|
5
3
|
module Traits
|
6
4
|
module Urlable
|
7
5
|
def url
|
8
|
-
|
6
|
+
[host, url_parts].flatten.join('/')
|
9
7
|
end
|
10
8
|
|
11
9
|
def url_parts
|
@@ -18,6 +16,14 @@ module Photish
|
|
18
16
|
|
19
17
|
private
|
20
18
|
|
19
|
+
def host
|
20
|
+
normalized_host || ''
|
21
|
+
end
|
22
|
+
|
23
|
+
def normalized_host
|
24
|
+
url_info.host.try(:chomp, '/')
|
25
|
+
end
|
26
|
+
|
21
27
|
def slugify(word)
|
22
28
|
CGI.escape(word.downcase.gsub(' ', '-'))
|
23
29
|
end
|
data/lib/photish/log/logger.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'logging'
|
2
|
-
|
3
1
|
module Photish
|
4
2
|
module Log
|
5
3
|
class Logger
|
@@ -24,19 +22,19 @@ module Photish
|
|
24
22
|
private
|
25
23
|
|
26
24
|
def logging_level(config)
|
27
|
-
config.
|
25
|
+
config.logging.level.to_sym
|
28
26
|
end
|
29
27
|
|
30
28
|
def colorize?(config)
|
31
|
-
config.
|
29
|
+
config.logging.colorize
|
32
30
|
end
|
33
31
|
|
34
32
|
def output_to_stdout?(config)
|
35
|
-
config.
|
33
|
+
config.logging.output.include?('stdout')
|
36
34
|
end
|
37
35
|
|
38
36
|
def output_to_file?(config)
|
39
|
-
config.
|
37
|
+
config.logging.output.include?('file')
|
40
38
|
end
|
41
39
|
|
42
40
|
def setup_color_scheme
|
@@ -1,8 +1,18 @@
|
|
1
|
-
|
2
1
|
module Photish
|
3
2
|
module Plugin
|
4
3
|
module Repository
|
5
4
|
class << self
|
5
|
+
def reload(log, site_dir)
|
6
|
+
log.info "Loading plugins..."
|
7
|
+
Dir[File.join(site_dir, '_plugins', '*.rb')].each do |file|
|
8
|
+
load file
|
9
|
+
end
|
10
|
+
|
11
|
+
all_plugins.each do |plugin|
|
12
|
+
log.info "Found plugin #{plugin}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
def plugins_for(type)
|
7
17
|
all_plugins.reject { |m| !m.is_for?(type) }
|
8
18
|
end
|
data/lib/photish/plugin/type.rb
CHANGED
data/lib/photish/rake/task.rb
CHANGED
data/lib/photish/render/page.rb
CHANGED
data/lib/photish/render/site.rb
CHANGED
data/lib/photish/version.rb
CHANGED
data/lib/photish.rb
CHANGED
@@ -1,4 +1,50 @@
|
|
1
|
-
|
1
|
+
# 3rd Party
|
2
|
+
require 'mini_magick'
|
3
|
+
require 'logging'
|
4
|
+
require 'tilt'
|
5
|
+
require 'rake'
|
6
|
+
require 'active_support'
|
7
|
+
require 'active_support/core_ext'
|
8
|
+
require 'mini_exiftool'
|
9
|
+
require 'webrick'
|
10
|
+
require 'listen'
|
11
|
+
require 'yaml'
|
12
|
+
require 'thor'
|
13
|
+
require 'filemagic'
|
14
|
+
require 'recursive_open_struct'
|
15
|
+
require 'cgi'
|
16
|
+
|
17
|
+
# Photish
|
18
|
+
require 'photish/plugin/type'
|
19
|
+
require 'photish/plugin/pluginable'
|
20
|
+
require 'photish/plugin/repository'
|
21
|
+
require 'photish/command/base'
|
22
|
+
require 'photish/command/generate'
|
23
|
+
require 'photish/command/host'
|
24
|
+
require 'photish/command/init'
|
25
|
+
require 'photish/command/deploy'
|
26
|
+
require 'photish/cli/interface'
|
27
|
+
require 'photish/log/logger'
|
28
|
+
require 'photish/log/logger'
|
29
|
+
require 'photish/log/access_log'
|
30
|
+
require 'photish/log/logger'
|
31
|
+
require 'photish/config/default_config'
|
32
|
+
require 'photish/config/file_config'
|
33
|
+
require 'photish/config/file_config_location'
|
34
|
+
require 'photish/config/app_settings'
|
35
|
+
require 'photish/gallery/traits/urlable'
|
36
|
+
require 'photish/gallery/traits/albumable'
|
37
|
+
require 'photish/gallery/traits/metadatable'
|
38
|
+
require 'photish/gallery/traits/breadcrumbable'
|
39
|
+
require 'photish/gallery/photo'
|
40
|
+
require 'photish/gallery/album'
|
41
|
+
require 'photish/gallery/image'
|
42
|
+
require 'photish/gallery/collection'
|
43
|
+
require 'photish/render/page'
|
44
|
+
require 'photish/render/site'
|
45
|
+
require 'photish/render/image_conversion'
|
46
|
+
require 'photish/rake/task'
|
47
|
+
require 'photish/version'
|
2
48
|
|
3
49
|
module Photish
|
4
50
|
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.
|
4
|
+
version: 0.3.0
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -328,6 +328,7 @@ files:
|
|
328
328
|
- lib/photish/assets/photos/Small Dogs/Sleepy Dog.yml
|
329
329
|
- lib/photish/assets/photos/Small Dogs/Squishy Dogs/Big Ear Dog.jpg
|
330
330
|
- lib/photish/assets/site/_plugins/footer_links.rb
|
331
|
+
- lib/photish/assets/site/_plugins/tmpdir_deploy.rb
|
331
332
|
- lib/photish/assets/site/_plugins/yell_loud.rb
|
332
333
|
- lib/photish/assets/site/_templates/album.slim
|
333
334
|
- lib/photish/assets/site/_templates/collection.slim
|
@@ -337,14 +338,15 @@ files:
|
|
337
338
|
- lib/photish/assets/site/images/crumbs.gif
|
338
339
|
- lib/photish/assets/site/styles/basic.css
|
339
340
|
- lib/photish/cli/interface.rb
|
341
|
+
- lib/photish/command/base.rb
|
342
|
+
- lib/photish/command/deploy.rb
|
340
343
|
- lib/photish/command/generate.rb
|
341
344
|
- lib/photish/command/host.rb
|
342
345
|
- lib/photish/command/init.rb
|
343
346
|
- lib/photish/config/app_settings.rb
|
344
347
|
- lib/photish/config/default_config.rb
|
345
348
|
- lib/photish/config/file_config.rb
|
346
|
-
- lib/photish/config/
|
347
|
-
- lib/photish/config/settings.rb
|
349
|
+
- lib/photish/config/file_config_location.rb
|
348
350
|
- lib/photish/gallery/album.rb
|
349
351
|
- lib/photish/gallery/collection.rb
|
350
352
|
- lib/photish/gallery/image.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'active_support'
|
3
|
-
require 'active_support/core_ext'
|
4
|
-
require 'photish/config/default_config'
|
5
|
-
require 'photish/config/file_config'
|
6
|
-
|
7
|
-
module Photish
|
8
|
-
module Config
|
9
|
-
class Settings
|
10
|
-
def initialize(config = nil)
|
11
|
-
@config = compact_symbolize(config)
|
12
|
-
end
|
13
|
-
|
14
|
-
def val(key)
|
15
|
-
config[key.to_sym]
|
16
|
-
end
|
17
|
-
|
18
|
-
def override(hash)
|
19
|
-
cleaned_hash = compact_symbolize(hash)
|
20
|
-
self.class.new(config.merge(cleaned_hash))
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
attr_reader :config
|
26
|
-
|
27
|
-
def compact_symbolize(hash)
|
28
|
-
(hash || {})
|
29
|
-
.compact
|
30
|
-
.deep_symbolize_keys
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|