photish 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/TODO.md +0 -2
- data/lib/photish/gallery/collection.rb +7 -0
- data/lib/photish/gallery/traits/urlable.rb +4 -0
- data/lib/photish/render/change_manifest.rb +4 -16
- data/lib/photish/render/image_conversion.rb +2 -2
- data/lib/photish/render/site.rb +9 -0
- data/lib/photish/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10d4377b58ca8abfc533f024d63b08ac42ad2843
|
4
|
+
data.tar.gz: bbc4d59536dfcfe2bc92880963a32a9f77988b3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1a165687012458bda29b180ea140faca11d1978d7eb9f8353c1863c95cd9aa7d761959e4c1a46c6a637e2c62e98adf860a33c6ce2ae98e0fe33f716cb180d75
|
7
|
+
data.tar.gz: b83864d828fac5f6878df88cd99061c585ba286f1b5fb809af1fc7a3ceb8486bcbd81da73c787a83090d470f1b7c2304235a1e4213892f15897b5ea22549a1d3
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ and running:
|
|
32
32
|
[Nokogiri](http://www.nokogiri.org/tutorials/installing_nokogiri.html) are
|
33
33
|
installed (see [Dependencies](#dependencies))
|
34
34
|
1. Install Photish `gem install photish`
|
35
|
-
1. Create a base project with `photish init`
|
35
|
+
1. Create a base project with `photish init --example`
|
36
36
|
1. Generate the HTML using `photish generate`
|
37
37
|
1. Run a local HTTP server to view the site with `photish host`
|
38
38
|
1. View your photo site at [http://localhost:9876](http://localhost:9876/)
|
@@ -206,6 +206,10 @@ Once you have photish installed. Get started with the following commands:
|
|
206
206
|
A skeleton site can be created by running the below command inside the
|
207
207
|
`my_new_photo_site` folder:
|
208
208
|
|
209
|
+
$ photish init --example
|
210
|
+
|
211
|
+
A barebones site can be created with:
|
212
|
+
|
209
213
|
$ photish init
|
210
214
|
|
211
215
|
#### Basic Photish Structure
|
@@ -567,10 +571,10 @@ To develop:
|
|
567
571
|
|
568
572
|
To release:
|
569
573
|
|
574
|
+
$ vim lib/photish/version.rb # update version
|
570
575
|
$ git add -p # add in changed files
|
571
576
|
$ git commit -m 'Final commit' # finish up changes
|
572
577
|
$ rake # ensure all tests pass
|
573
|
-
$ vim lib/photish/version.rb # update version
|
574
578
|
$ rake release # release to rubygems
|
575
579
|
|
576
580
|
## Contributing
|
data/TODO.md
CHANGED
@@ -6,9 +6,7 @@ module Photish
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def record(key, file_path = nil)
|
9
|
-
|
10
|
-
db[key] = md5_of_file(file_path || key)
|
11
|
-
end
|
9
|
+
db[key] = md5_of_file(file_path || key)
|
12
10
|
end
|
13
11
|
|
14
12
|
def changed?(key, file_path = nil)
|
@@ -16,7 +14,7 @@ module Photish
|
|
16
14
|
end
|
17
15
|
|
18
16
|
def flush_to_disk
|
19
|
-
File.open(db_file, 'w') { |f| f.write((
|
17
|
+
File.open(db_file, 'w') { |f| f.write((db || {}).to_yaml) }
|
20
18
|
end
|
21
19
|
|
22
20
|
private
|
@@ -28,23 +26,13 @@ module Photish
|
|
28
26
|
end
|
29
27
|
|
30
28
|
def old_md5_of_file(file_path)
|
31
|
-
|
29
|
+
db[file_path]
|
32
30
|
end
|
33
31
|
|
34
|
-
def
|
35
|
-
db = read_from_file
|
36
|
-
yield(db)
|
37
|
-
write_to_file(db)
|
38
|
-
end
|
39
|
-
|
40
|
-
def read_from_file
|
32
|
+
def db
|
41
33
|
@db ||= File.exist?(db_file) ? YAML.load_file(db_file) : {}
|
42
34
|
end
|
43
35
|
|
44
|
-
def write_to_file(db)
|
45
|
-
@db = db
|
46
|
-
end
|
47
|
-
|
48
36
|
def db_file
|
49
37
|
File.join(output_dir, '.changes.yml')
|
50
38
|
end
|
@@ -16,7 +16,7 @@ module Photish
|
|
16
16
|
Thread.new do
|
17
17
|
begin
|
18
18
|
while image = image_queue.pop(true)
|
19
|
-
convert(image) if changed?(
|
19
|
+
convert(image) if changed?(image.url_path, image.path)
|
20
20
|
end
|
21
21
|
rescue ThreadError => e
|
22
22
|
log.info "Expected exception, queue is empty #{e.class} \"#{e.message}\" #{e.backtrace.join("\n")}"
|
@@ -47,7 +47,7 @@ module Photish
|
|
47
47
|
def convert(image)
|
48
48
|
create_parent_directories(image)
|
49
49
|
convert_with_imagemagick(image)
|
50
|
-
record(
|
50
|
+
record(image.url_path, image.path)
|
51
51
|
end
|
52
52
|
|
53
53
|
def convert_with_imagemagick(image)
|
data/lib/photish/render/site.rb
CHANGED
@@ -9,6 +9,7 @@ module Photish
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def all_for(collection)
|
12
|
+
delete_unknown_files(collection.all_url_paths)
|
12
13
|
move_non_ignored_site_contents
|
13
14
|
|
14
15
|
collection_template.render(collection)
|
@@ -25,6 +26,14 @@ module Photish
|
|
25
26
|
:output_dir,
|
26
27
|
:max_workers
|
27
28
|
|
29
|
+
def delete_unknown_files(expected_url_paths)
|
30
|
+
files_to_delete = Dir["#{output_dir}/**/*"].select do |f|
|
31
|
+
relative_file_path = f.gsub(/#{output_dir}\/?/, '')
|
32
|
+
File.file?(f) && expected_url_paths.exclude?(relative_file_path)
|
33
|
+
end
|
34
|
+
FileUtils.rm_rf(files_to_delete)
|
35
|
+
end
|
36
|
+
|
28
37
|
def move_non_ignored_site_contents
|
29
38
|
FileUtils.mkdir_p(output_dir)
|
30
39
|
FileUtils.cp_r(non_ignored_site_contents, output_dir)
|
data/lib/photish/version.rb
CHANGED