ralber 0.0.2 → 0.0.3
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/bin/ralber.rb +12 -1
- data/lib/ralber/album.rb +1 -0
- data/lib/ralber/commands/list_templates_command.rb +21 -0
- data/lib/ralber/commands/publish_command.rb +1 -1
- data/lib/ralber/image.rb +45 -2
- data/lib/ralber/template.rb +23 -5
- data/lib/ralber/version.rb +3 -0
- data/templates/default/detail.html.erb +29 -5
- data/templates/default/index.html.erb +9 -5
- data/templates/fancybox-dark/detail.html.erb +29 -5
- data/templates/fancybox-dark/index.html.erb +10 -6
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8816b7cf2778b206cc83d233dd0286cd767774b2
|
4
|
+
data.tar.gz: e48b4f003ac51ca79b6824e160a4d5cd31eae595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c681c3717e3e47723c11ee22b12e555978335357b5968eca908bebebbb59ca7e5d9725378e2e845df065b8455f78a30ebb03ce2d23a1cb2aca7eef0790a0a7b5
|
7
|
+
data.tar.gz: cb4f24f126be61ea8c0c6e1b0df34444c7d7fdfc89963966973c9249bb2871113eea88923458bf2c4565502fa2aa0b10adc662462f154b19def169f1e1a458f9
|
data/bin/ralber.rb
CHANGED
@@ -9,8 +9,11 @@ require 'commander/import'
|
|
9
9
|
require 'ralber/commands/create_command'
|
10
10
|
require 'ralber/commands/publish_command'
|
11
11
|
require 'ralber/commands/update_command'
|
12
|
+
require 'ralber/commands/list_templates_command'
|
13
|
+
require 'ralber/version'
|
12
14
|
|
13
|
-
|
15
|
+
|
16
|
+
program :version, Ralber::VERSION
|
14
17
|
program :description, 'A static web album generator'
|
15
18
|
|
16
19
|
command :create do |c|
|
@@ -44,3 +47,11 @@ command :update do |c|
|
|
44
47
|
c.when_called Ralber::Commands::Update
|
45
48
|
end
|
46
49
|
|
50
|
+
command :'list templates' do |c|
|
51
|
+
c.syntax = 'ralber list templates'
|
52
|
+
c.summary = 'List bundled templates'
|
53
|
+
c.description = 'ralber comes with some pre-bundled templates. list templates list these.'
|
54
|
+
c.example 'List available templates', 'ralber list templates'
|
55
|
+
c.when_called Ralber::Commands::ListTemplates
|
56
|
+
end
|
57
|
+
|
data/lib/ralber/album.rb
CHANGED
@@ -193,6 +193,7 @@ module Ralber
|
|
193
193
|
@images.each_with_index do | img, index |
|
194
194
|
# all images in the @images array are still OK and present, we just re-append them:
|
195
195
|
new_images << img
|
196
|
+
img.update
|
196
197
|
|
197
198
|
# remove entry from the found image files, as those are OK:
|
198
199
|
img_files.delete_if {|img_file| File.basename(img_file) == File.basename(img.path)}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
require 'pathname'
|
3
|
+
require 'ralber/template'
|
4
|
+
|
5
|
+
module Ralber
|
6
|
+
module Commands
|
7
|
+
class ListTemplates
|
8
|
+
def initialize(args, options)
|
9
|
+
self.print_list
|
10
|
+
end
|
11
|
+
|
12
|
+
def print_list
|
13
|
+
print "Availabe bundled templates:\n\n"
|
14
|
+
Ralber::Template.bundled_templates.each {|entry|
|
15
|
+
print "Name: #{entry[:name]}\n"
|
16
|
+
print "Path: #{entry[:path]}\n\n"
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -25,7 +25,7 @@ module Ralber
|
|
25
25
|
tpl = "default" unless tpl
|
26
26
|
tplObj = nil
|
27
27
|
begin
|
28
|
-
tplObj = Ralber::Template.
|
28
|
+
tplObj = Ralber::Template.find(tpl)
|
29
29
|
@album.template = tpl
|
30
30
|
rescue
|
31
31
|
puts "Could not find template. Either give the name or path to a template via --template parameter, or put a 'template' config in album.json."
|
data/lib/ralber/image.rb
CHANGED
@@ -3,6 +3,7 @@ require 'bundler/setup'
|
|
3
3
|
require 'digest'
|
4
4
|
require 'json'
|
5
5
|
require 'rmagick'
|
6
|
+
require 'exifr'
|
6
7
|
|
7
8
|
module Ralber
|
8
9
|
|
@@ -11,12 +12,13 @@ module Ralber
|
|
11
12
|
# functions like thumbs etc.
|
12
13
|
class Image
|
13
14
|
attr :path
|
14
|
-
|
15
|
+
attr_reader :exif
|
15
16
|
|
16
17
|
def initialize(path)
|
17
18
|
raise StandardError, "File does not exits" if not File.exists?(path)
|
18
19
|
@path = File.expand_path(path)
|
19
20
|
@image_info = self.get_image_info
|
21
|
+
@exif = self.exif_data
|
20
22
|
end
|
21
23
|
|
22
24
|
def title
|
@@ -56,8 +58,10 @@ module Ralber
|
|
56
58
|
|
57
59
|
def write_imageinfo
|
58
60
|
FileUtils.mkdir_p(File.dirname json_path)
|
61
|
+
data = @image_info.clone
|
62
|
+
data[:exif] = @exif
|
59
63
|
open(self.json_path,'w') do |f|
|
60
|
-
f.write(JSON.pretty_generate(
|
64
|
+
f.write(JSON.pretty_generate(data))
|
61
65
|
end
|
62
66
|
end
|
63
67
|
|
@@ -98,6 +102,7 @@ module Ralber
|
|
98
102
|
end
|
99
103
|
else
|
100
104
|
self.create
|
105
|
+
info = @image_info
|
101
106
|
end
|
102
107
|
return info
|
103
108
|
end
|
@@ -123,6 +128,40 @@ module Ralber
|
|
123
128
|
}
|
124
129
|
end
|
125
130
|
|
131
|
+
def exif_data
|
132
|
+
data = {
|
133
|
+
:exif => false,
|
134
|
+
:width => nil,
|
135
|
+
:height => nil,
|
136
|
+
:date_time => nil,
|
137
|
+
:date_time_original => nil,
|
138
|
+
:gps_longitude => 0.0,
|
139
|
+
:gps_latitude => 0.0,
|
140
|
+
:gps_altitude => 0.0,
|
141
|
+
:exposure_time => nil,
|
142
|
+
:focal_length => nil,
|
143
|
+
:f_number => nil
|
144
|
+
}
|
145
|
+
if self.type == :jpeg
|
146
|
+
begin
|
147
|
+
exifr = EXIFR::JPEG.new(@path)
|
148
|
+
data[:exif] = exifr.exif?
|
149
|
+
data[:width] = exifr.width
|
150
|
+
data[:height] = exifr.height
|
151
|
+
data[:date_time] = exifr.date_time
|
152
|
+
data[:date_time_original] = exifr.date_time_original
|
153
|
+
data[:gps_longitude] = exifr.gps.longitude || 0.0
|
154
|
+
data[:gps_latitude] = exifr.gps.latitude || 0.0
|
155
|
+
data[:gps_altitude] = exifr.gps.altitude || 0.0
|
156
|
+
data[:exposure_time] = exifr.exposure_time
|
157
|
+
data[:focal_length] = exifr.focal_length
|
158
|
+
data[:f_number] = exifr.f_number
|
159
|
+
rescue
|
160
|
+
end
|
161
|
+
end
|
162
|
+
return data
|
163
|
+
end
|
164
|
+
|
126
165
|
def map_type(imagickType)
|
127
166
|
case imagickType
|
128
167
|
when 'JPEG' then :jpeg
|
@@ -174,5 +213,9 @@ module Ralber
|
|
174
213
|
@image_info['published_md5'] = self.calc_md5
|
175
214
|
self.write_imageinfo
|
176
215
|
end
|
216
|
+
|
217
|
+
def update
|
218
|
+
self.update_md5
|
219
|
+
end
|
177
220
|
end
|
178
221
|
end
|
data/lib/ralber/template.rb
CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
3
3
|
|
4
4
|
require 'json'
|
5
|
+
require 'uri'
|
5
6
|
|
6
7
|
module Ralber
|
7
8
|
|
@@ -10,12 +11,20 @@ module Ralber
|
|
10
11
|
class Template
|
11
12
|
attr_reader :path,:config,:images_config
|
12
13
|
|
14
|
+
def self.find(nameOrPath)
|
15
|
+
nameOrPath = 'default' if not nameOrPath
|
16
|
+
nameOrPath = File.expand_path(File.join(self.template_path,nameOrPath)) if not File.exists?(nameOrPath)
|
17
|
+
self.new(nameOrPath)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.template_path
|
21
|
+
File.expand_path(File.join(File.dirname(Gem.bin_path('ralber','ralber.rb')),'..','templates'))
|
22
|
+
end
|
13
23
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@path = File.expand_path(@path)
|
24
|
+
|
25
|
+
def initialize(path)
|
26
|
+
raise StandardError, "File does not exits" if not File.exists?(path)
|
27
|
+
@path = File.expand_path(path)
|
19
28
|
raise StandardError, "template.json not found" if not File.exists?(self.json_path)
|
20
29
|
@config = self.read_config
|
21
30
|
end
|
@@ -52,5 +61,14 @@ module Ralber
|
|
52
61
|
nil
|
53
62
|
end
|
54
63
|
end
|
64
|
+
|
65
|
+
def self.bundled_templates
|
66
|
+
entries = Dir.entries(self.template_path)
|
67
|
+
entries.delete_if {|entry|
|
68
|
+
true != File.exists?(File.join(self.template_path,entry,'template.json'))
|
69
|
+
}.map{|entry|
|
70
|
+
{ :name => entry, :path => File.join(self.template_path,entry) }
|
71
|
+
}
|
72
|
+
end
|
55
73
|
end
|
56
74
|
end
|
@@ -1,11 +1,15 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<link rel="stylesheet" href="css/pure/pure-min.css"
|
5
|
-
<link rel="stylesheet" href="css/styles.css"
|
6
|
-
<link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css"
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1"
|
8
|
-
<meta charset="utf-8"
|
4
|
+
<link rel="stylesheet" href="css/pure/pure-min.css"/>
|
5
|
+
<link rel="stylesheet" href="css/styles.css"/>
|
6
|
+
<link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css"/>
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
8
|
+
<meta charset="utf-8"/>
|
9
|
+
<meta name="DC.title" content="<%= album.title.to_s.gsub('"',"'") %>" />
|
10
|
+
<meta name="DC.subject" content="<%= album.subtitle.to_s.gsub('"',"'") %>" />
|
11
|
+
<meta name="DC.description" content="<%= album.description.to_s.gsub('"',"'") %>" />
|
12
|
+
<meta name="DC.creator" content="<%= album.author.to_s.gsub('"',"'") %>" />
|
9
13
|
<title><%= image.title %> - <%= album.title %></title>
|
10
14
|
</head>
|
11
15
|
<body class="detailpage">
|
@@ -31,6 +35,26 @@
|
|
31
35
|
</a>
|
32
36
|
</div>
|
33
37
|
<div class="subtitle"><%= image.description %></div>
|
38
|
+
<% if image.exif[:exif] %>
|
39
|
+
<table align="center">
|
40
|
+
<tr>
|
41
|
+
<td align="left">Capture Date:</td>
|
42
|
+
<td align="left"><%= image.exif[:date_time_original].strftime('%d.%m.%Y %H:%S') if image.exif[:date_time_original] %></td>
|
43
|
+
</tr>
|
44
|
+
<tr>
|
45
|
+
<td align="left">GPS Location:</td>
|
46
|
+
<td align="left"><a href="https://www.google.com/maps/place/<%= "#{image.exif[:gps_latitude]}N,#{image.exif[:gps_longitude]}E" %>" target="_blank"><%= "#{image.exif[:gps_latitude].round(6)} / #{image.exif[:gps_longitude].round(6)}" %></a></td>
|
47
|
+
</tr>
|
48
|
+
<tr>
|
49
|
+
<td align="left">Exposure Time:</td>
|
50
|
+
<td align="left"><%= image.exif[:exposure_time].to_s %></td>
|
51
|
+
</tr>
|
52
|
+
<tr>
|
53
|
+
<td align="left">Aperture:</td>
|
54
|
+
<td align="left"><%= image.exif[:f_number].to_f.round(3) %></td>
|
55
|
+
</tr>
|
56
|
+
</table>
|
57
|
+
<% end %>
|
34
58
|
</div>
|
35
59
|
</div>
|
36
60
|
|
@@ -1,11 +1,15 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<link rel="stylesheet" href="css/pure/pure-min.css"
|
5
|
-
<link rel="stylesheet" href="css/styles.css"
|
6
|
-
<link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css"
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1"
|
8
|
-
<meta charset="utf-8"
|
4
|
+
<link rel="stylesheet" href="css/pure/pure-min.css" />
|
5
|
+
<link rel="stylesheet" href="css/styles.css" />
|
6
|
+
<link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css" />
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
8
|
+
<meta charset="utf-8" />
|
9
|
+
<meta name="DC.title" content="<%= album.title.to_s.gsub('"',"'") %>" />
|
10
|
+
<meta name="DC.subject" content="<%= album.subtitle.to_s.gsub('"',"'") %>" />
|
11
|
+
<meta name="DC.description" content="<%= album.description.to_s.gsub('"',"'") %>" />
|
12
|
+
<meta name="DC.creator" content="<%= album.author.to_s.gsub('"',"'") %>" />
|
9
13
|
<title><%= album.title %></title>
|
10
14
|
</head>
|
11
15
|
<body class="indexpage">
|
@@ -1,11 +1,15 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<link rel="stylesheet" href="css/pure/pure-min.css"
|
5
|
-
<link rel="stylesheet" href="css/styles.css"
|
6
|
-
<link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css"
|
7
|
-
<meta name="viewport" content="width=device-width, initial-scale=1"
|
8
|
-
<meta charset="utf-8"
|
4
|
+
<link rel="stylesheet" href="css/pure/pure-min.css"/>
|
5
|
+
<link rel="stylesheet" href="css/styles.css"/>
|
6
|
+
<link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css"/>
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
8
|
+
<meta charset="utf-8"/>
|
9
|
+
<meta name="DC.title" content="<%= album.title.to_s.gsub('"',"'") %>" />
|
10
|
+
<meta name="DC.subject" content="<%= album.subtitle.to_s.gsub('"',"'") %>" />
|
11
|
+
<meta name="DC.description" content="<%= album.description.to_s.gsub('"',"'") %>" />
|
12
|
+
<meta name="DC.creator" content="<%= album.author.to_s.gsub('"',"'") %>" />
|
9
13
|
<title><%= image.title %> - <%= album.title %></title>
|
10
14
|
</head>
|
11
15
|
<body class="detailpage">
|
@@ -31,6 +35,26 @@
|
|
31
35
|
</a>
|
32
36
|
</div>
|
33
37
|
<div class="subtitle"><%= image.description %></div>
|
38
|
+
<% if image.exif[:exif] %>
|
39
|
+
<table align="center">
|
40
|
+
<tr>
|
41
|
+
<td align="left">Capture Date:</td>
|
42
|
+
<td align="left"><%= image.exif[:date_time_original].strftime('%d.%m.%Y %H:%S') if image.exif[:date_time_original] %></td>
|
43
|
+
</tr>
|
44
|
+
<tr>
|
45
|
+
<td align="left">GPS Location:</td>
|
46
|
+
<td align="left"><a href="https://www.google.com/maps/place/<%= "#{image.exif[:gps_latitude]}N,#{image.exif[:gps_longitude]}E" %>" target="_blank"><%= "#{image.exif[:gps_latitude].round(6)} / #{image.exif[:gps_longitude].round(6)}" %></a></td>
|
47
|
+
</tr>
|
48
|
+
<tr>
|
49
|
+
<td align="left">Exposure Time:</td>
|
50
|
+
<td align="left"><%= image.exif[:exposure_time].to_s %></td>
|
51
|
+
</tr>
|
52
|
+
<tr>
|
53
|
+
<td align="left">Aperture:</td>
|
54
|
+
<td align="left"><%= image.exif[:f_number].to_f.round(3) %></td>
|
55
|
+
</tr>
|
56
|
+
</table>
|
57
|
+
<% end %>
|
34
58
|
</div>
|
35
59
|
</div>
|
36
60
|
|
@@ -1,13 +1,17 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<link rel="stylesheet" href="css/pure/pure-min.css"
|
5
|
-
<link rel="stylesheet" href="css/styles.css"
|
6
|
-
<link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css"
|
4
|
+
<link rel="stylesheet" href="css/pure/pure-min.css"/>
|
5
|
+
<link rel="stylesheet" href="css/styles.css"/>
|
6
|
+
<link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css"/>
|
7
7
|
<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
|
8
8
|
<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
|
9
|
-
<meta name="viewport" content="width=device-width, initial-scale=1"
|
10
|
-
<meta charset="utf-8"
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
10
|
+
<meta charset="utf-8"/>
|
11
|
+
<meta name="DC.title" content="<%= album.title.to_s.gsub('"',"'") %>" />
|
12
|
+
<meta name="DC.subject" content="<%= album.subtitle.to_s.gsub('"',"'") %>" />
|
13
|
+
<meta name="DC.description" content="<%= album.description.to_s.gsub('"',"'") %>" />
|
14
|
+
<meta name="DC.creator" content="<%= album.author.to_s.gsub('"',"'") %>" />
|
11
15
|
<title><%= album.title %></title>
|
12
16
|
</head>
|
13
17
|
<body class="indexpage">
|
@@ -36,7 +40,7 @@
|
|
36
40
|
originfo = image_info(img,'original')
|
37
41
|
%>
|
38
42
|
<div class="index">
|
39
|
-
<a class="fancybox" rel="group" href="<%= detailinfo['rel_path'] %>" title="<%= img.title %><%= (" - " + img.description) if img.description.length > 0
|
43
|
+
<a class="fancybox" rel="group" href="<%= detailinfo['rel_path'] %>" title="<%= img.title %><%= (" - " + img.description) if img.description.length > 0 %><br /><a href="<%= originfo['rel_path'] %>">[download]</a><%= "<br /><a href="https://www.google.com/maps/place/#{img.exif[:gps_latitude]}N,#{img.exif[:gps_longitude]}E" target="_blank">[googe maps]</a>" if img.exif[:gps_longitude] %>">
|
40
44
|
<div>
|
41
45
|
<img class="pure-img" src="<%= info['rel_path'] %>" alt="<%= img.title %>" title="<%= img.description %>"/>
|
42
46
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ralber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Schenkel
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: exifr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.2'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,12 +90,14 @@ files:
|
|
76
90
|
- bin/ralber.rb
|
77
91
|
- lib/ralber/album.rb
|
78
92
|
- lib/ralber/commands/create_command.rb
|
93
|
+
- lib/ralber/commands/list_templates_command.rb
|
79
94
|
- lib/ralber/commands/publish_command.rb
|
80
95
|
- lib/ralber/commands/update_command.rb
|
81
96
|
- lib/ralber/image.rb
|
82
97
|
- lib/ralber/observable.rb
|
83
98
|
- lib/ralber/publisher.rb
|
84
99
|
- lib/ralber/template.rb
|
100
|
+
- lib/ralber/version.rb
|
85
101
|
- templates/default/css/pure/pure-min.css
|
86
102
|
- templates/default/css/styles.css
|
87
103
|
- templates/default/detail.html.erb
|