hyde_admin 0.0.7 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.idea/hyde_admin.iml +4 -0
- data/CHANGELOG.md +9 -0
- data/README.md +19 -2
- data/bin/admin_views/admin_layout.html.erb +8 -6
- data/bin/admin_views/configuration.erb +2 -2
- data/bin/admin_views/upload_image_form.erb +17 -13
- data/bin/hyde_admin.ru +24 -0
- data/bin/hyde_admin.yml +7 -4
- data/bin/hyde_admin_config +16 -0
- data/bin/i18n/en.yml +7 -1
- data/bin/i18n/fr.yml +7 -1
- data/hyde_admin.gemspec +2 -1
- data/lib/hyde_admin/version.rb +1 -1
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c2a24943a838bb470b6375c0658626798f0f1beb456f65d792995a4fe7bf0bd
|
4
|
+
data.tar.gz: a367a451d9b2e2aa05aa79cc2812702624472e59a776bf9fdc842260fa1cf099
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 712d1960647c69074f878d94d4bc1db2193f3f170835f7c7ad98d4652df95ad96ef25d9d6dd238d19517ff0a87d5256a2875dafba89b534d69a8d632de576596
|
7
|
+
data.tar.gz: f3773cbc9b770c60ee5c237f1ac657d4ed9cbe25973f8a3cfffbf86938ac6b9ab8573820a3e72710dcf32e96738d3d4c0e7954c7efde347ad122a79a4bff3a6b
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/.idea/hyde_admin.iml
CHANGED
@@ -12,7 +12,11 @@
|
|
12
12
|
<orderEntry type="inheritedJdk" />
|
13
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
14
|
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.9, RVM: ruby-2.7.0) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.4, RVM: ruby-2.7.0) [gem]" level="application" />
|
15
16
|
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.8.10, RVM: ruby-2.7.0) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="image_processing (v1.12.1, RVM: ruby-2.7.0) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_magick (v4.11.0, RVM: ruby-2.7.0) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-vips (v2.0.17, RVM: ruby-2.7.0) [gem]" level="application" />
|
16
20
|
</component>
|
17
21
|
<component name="RModuleSettingsStorage">
|
18
22
|
<LOAD_PATH number="0" />
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# 0.0.9
|
2
|
+
|
3
|
+
Hide deploy button if 'deploy_dest_address' is empty.
|
4
|
+
hyde_admin_config allow you to install the latest default config file.
|
5
|
+
|
6
|
+
# 0.0.8
|
7
|
+
|
8
|
+
Resize image at upload with ImageProcessing (MiniMagick)
|
9
|
+
|
1
10
|
# 0.0.7
|
2
11
|
|
3
12
|
Post edit : bugfix, keep layout & format when we don't show input.
|
data/README.md
CHANGED
@@ -1,8 +1,15 @@
|
|
1
|
+
## Hyde admin
|
2
|
+
|
3
|
+
Hyde_admin is a administration frontend for Jekyll (static site generator in Ruby).
|
4
|
+
|
1
5
|
## Getting Started with Hyde Admin
|
2
6
|
|
3
7
|
Add
|
4
8
|
|
5
|
-
|
9
|
+
```
|
10
|
+
gem 'hyde_admin'
|
11
|
+
gem 'puma'
|
12
|
+
```
|
6
13
|
|
7
14
|
In the Gemfile of your jekyll site.
|
8
15
|
|
@@ -20,4 +27,14 @@ You can visit localhost:9292 !
|
|
20
27
|
hyde_admin.yml is automatically generated in your jekyll directory.
|
21
28
|
(you can change settings with hyde_admin ou directly)
|
22
29
|
|
23
|
-
Hyde_admin allow ssh deployment.
|
30
|
+
Hyde_admin allow ssh deployment.
|
31
|
+
|
32
|
+
## New version of hyde_admin ?
|
33
|
+
|
34
|
+
Just install the lastest config file (your config file will be renamed, and latest config file will be installed), run :
|
35
|
+
|
36
|
+
`hyde_admin_config`
|
37
|
+
|
38
|
+
## Error when bundle install
|
39
|
+
|
40
|
+
Try this [https://stackoverflow.com/questions/30818391/gem-eventmachine-fatal-error-openssl-ssl-h-file-not-found](https://stackoverflow.com/questions/30818391/gem-eventmachine-fatal-error-openssl-ssl-h-file-not-found)
|
@@ -84,12 +84,14 @@
|
|
84
84
|
<%= EscapeUtils.escape_html t.overview.capitalize %>
|
85
85
|
</a>
|
86
86
|
</li>
|
87
|
-
|
88
|
-
<
|
89
|
-
<
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
<% if !@hyde_parameters['deploy_dest_address'].to_s.empty? %>
|
88
|
+
<li class="nav-item">
|
89
|
+
<a class="nav-link active" aria-current="page" href="/deploy" id="btn-deploy">
|
90
|
+
<span data-feather="home" class="fas fa-cloud-upload-alt"></span>
|
91
|
+
<%= EscapeUtils.escape_html t.deploy.capitalize %>
|
92
|
+
</a>
|
93
|
+
</li>
|
94
|
+
<% end %>
|
93
95
|
</ul>
|
94
96
|
<p class="text-center text-muted"><br><br><em>Hyde Admin V.<%= HydeAdmin::VERSION %></em> <a href="https://github.com/rivsc/hyde_admin" class="link-secondary"><i class="fab fa-github"></i></a></p>
|
95
97
|
</div>
|
@@ -3,9 +3,9 @@
|
|
3
3
|
<form action="/configuration" method="post">
|
4
4
|
<% @hyde_parameters.each_pair do |setting, value| %>
|
5
5
|
<div class="mb-3">
|
6
|
-
<label for="i-<%= setting %>" class="form-label"><%= EscapeUtils.escape_html t.send(setting).capitalize %></label>
|
6
|
+
<label for="i-<%= setting %>" class="form-label"><%= (EscapeUtils.escape_html t.send(setting).capitalize rescue setting) %></label>
|
7
7
|
<input type="text" class="form-control" value="<%= value %>" name="<%= setting %>" id="i-<%= setting %>">
|
8
|
-
<div id="i-<%= setting %>-help" class="form-text"><%= EscapeUtils.escape_html t.send("help_#{setting}").capitalize %></div>
|
8
|
+
<div id="i-<%= setting %>-help" class="form-text"><%= (EscapeUtils.escape_html t.send("help_#{setting}").capitalize rescue '') %></div>
|
9
9
|
</div>
|
10
10
|
<% end %>
|
11
11
|
<button type="submit" class="btn btn-primary"><%= EscapeUtils.escape_html t.submit.capitalize %></button>
|
@@ -25,21 +25,25 @@
|
|
25
25
|
</script>
|
26
26
|
</head>
|
27
27
|
<body style="width:800px;" class="p-4">
|
28
|
-
|
28
|
+
<div class="container-fluid">
|
29
|
+
<div class="row">
|
30
|
+
<h1><%= t.upload_image_form.capitalize %></h1>
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
<% if @filenames %>
|
33
|
+
<%= t.pictures_has_been_uploaded.capitalize %> : <%= @filenames.join(', ') %>
|
34
|
+
<% end %>
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
<form enctype="multipart/form-data" method="post" action="/upload_image" class="row g-3">
|
37
|
+
<div class="col-10">
|
38
|
+
<input type="file" name="files[]" multiple class="form-control">
|
39
|
+
</div>
|
40
|
+
<div class="col-2">
|
41
|
+
<button class="btn btn-primary"><%= t.upload.capitalize %></button>
|
42
|
+
</div>
|
43
|
+
</form>
|
42
44
|
|
43
|
-
|
45
|
+
<button class="btn btn-secondary btn-return-to-editor fixed-bottom mb-4 ms-4"><%= t.quit.capitalize %></button>
|
46
|
+
</div>
|
47
|
+
</div>
|
44
48
|
</body>
|
45
49
|
</html>
|
data/bin/hyde_admin.ru
CHANGED
@@ -6,6 +6,7 @@ require 'fileutils'
|
|
6
6
|
require 'i18n'
|
7
7
|
require 'date'
|
8
8
|
require 'escape_utils'
|
9
|
+
require 'image_processing/mini_magick'
|
9
10
|
require_relative '../lib/hyde_admin/version'
|
10
11
|
|
11
12
|
# TODO détecter format nouveau post (pour codemirror)
|
@@ -82,6 +83,26 @@ class Mid < Roda
|
|
82
83
|
str.to_s.scan(/^\[?(.*?)\]?$/).flatten.first.split(',')
|
83
84
|
end
|
84
85
|
|
86
|
+
def self.resize_image(image_path,params)
|
87
|
+
dir = File.dirname(image_path)
|
88
|
+
basename = File.basename(image_path, File.extname(image_path))
|
89
|
+
while File.exist?("#{File.join(dir, "#{basename}_#{params['resize_size']}")}.#{params['resize_format']}")
|
90
|
+
basename += '_'
|
91
|
+
end
|
92
|
+
output_path = "#{File.join(dir, "#{basename}_#{params['resize_size']}")}.#{params['resize_format']}"
|
93
|
+
|
94
|
+
width,height = params['resize_size'].split("x")
|
95
|
+
ip = ImageProcessing::MiniMagick
|
96
|
+
.source(image_path)
|
97
|
+
.convert(params['resize_format'])
|
98
|
+
.resize_to_limit(width.to_i, height.to_i)
|
99
|
+
if params['resize_format'] == 'jpg'
|
100
|
+
ip = ip.saver(quality: 80, interlace: "Line")
|
101
|
+
end
|
102
|
+
|
103
|
+
ip.call(destination: output_path)
|
104
|
+
end
|
105
|
+
|
85
106
|
FORMAT_DATE_FILENAME = '%Y-%m-%d'
|
86
107
|
FORMAT_DATE_INPUT_FILENAME = '%Y-%m-%d %H:%M:%S %z'
|
87
108
|
|
@@ -156,6 +177,9 @@ class Mid < Roda
|
|
156
177
|
File.open(File.join(@hyde_parameters['images_path'], filename), 'wb') do |f|
|
157
178
|
f.write(file[:tempfile].read)
|
158
179
|
end
|
180
|
+
if @hyde_parameters['resize_enable'] == 'true'
|
181
|
+
Mid.resize_image(File.join(@hyde_parameters['images_path'], filename), @hyde_parameters)
|
182
|
+
end
|
159
183
|
end
|
160
184
|
render("upload_image_form")
|
161
185
|
end
|
data/bin/hyde_admin.yml
CHANGED
@@ -6,10 +6,13 @@ deploy_dest_path: "/absolute/remote/path/mysite"
|
|
6
6
|
rsync_fullpath: rsync
|
7
7
|
site_index: index.html
|
8
8
|
hyde_admin_language: en
|
9
|
-
hyde_admin_auth: false
|
9
|
+
hyde_admin_auth: 'false'
|
10
10
|
hyde_admin_user: admin
|
11
11
|
hyde_admin_password: admin
|
12
12
|
default_format: html
|
13
|
-
display_layout: true
|
14
|
-
display_format: true
|
15
|
-
images_path: assets/images/
|
13
|
+
display_layout: 'true'
|
14
|
+
display_format: 'true'
|
15
|
+
images_path: assets/images/
|
16
|
+
resize_format: jpg
|
17
|
+
resize_size: 1500x1000
|
18
|
+
resize_enable: 'true'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
local_config_file = File.join(Dir.pwd, 'hyde_admin.yml')
|
6
|
+
old_filename = "hyde_admin_old_#{Time.now.strftime('%Y_%m_%d')}.yml"
|
7
|
+
|
8
|
+
# Backup actual config file
|
9
|
+
if File.exist?(local_config_file)
|
10
|
+
FileUtils.mv(local_config_file, old_filename)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Copy the default config file
|
14
|
+
FileUtils.copy(File.join(File.expand_path(File.dirname(__FILE__)), 'hyde_admin.yml'), local_config_file)
|
15
|
+
|
16
|
+
puts "#{local_config_file} copied, you can find your old config file here : #{old_filename} !"
|
data/bin/i18n/en.yml
CHANGED
@@ -100,4 +100,10 @@ quit: quit
|
|
100
100
|
header_name: header name
|
101
101
|
header_value: header value
|
102
102
|
images: images
|
103
|
-
load_images: load images
|
103
|
+
load_images: load images
|
104
|
+
resize_format: jpg
|
105
|
+
help_resize_format: jpg or png
|
106
|
+
resize_size: "size to fit, example : 1500x1000"
|
107
|
+
help_resize_size: Downsize to fit to the specified size (resize preserve ratio), example 1500x1000
|
108
|
+
resize_enable: Enable resizing for images
|
109
|
+
help_resize_enable: enable feature resize image at upload
|
data/bin/i18n/fr.yml
CHANGED
@@ -100,4 +100,10 @@ quit: quitter
|
|
100
100
|
header_name: nom d'entête
|
101
101
|
header_value: valeur d'entête
|
102
102
|
images: images
|
103
|
-
load_images: charger images
|
103
|
+
load_images: charger images
|
104
|
+
resize_format: jpg
|
105
|
+
help_resize_format: jpg ou png
|
106
|
+
resize_size: "Recadrer en (example : 1500x1000)"
|
107
|
+
help_resize_size: Réduit les image pour coller à la taille spécifiée (le redimensionnement préserve le ratio), exemple 1500x1000
|
108
|
+
resize_enable: activer redimensionnement
|
109
|
+
help_resize_enable: active la fonctionnalité de redimensionnement d'image à l'upload
|
data/hyde_admin.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
all_files = `git ls-files`.split("\n").reject{ |filepath| filepath.start_with? 'test/' }
|
12
12
|
s.files = all_files
|
13
13
|
|
14
|
-
s.executables = ['hyde_admin']
|
14
|
+
s.executables = ['hyde_admin','hyde_admin_config']
|
15
15
|
s.bindir = "bin"
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
|
@@ -31,4 +31,5 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_runtime_dependency("escape_utils") # escape_javascript / escape_html
|
32
32
|
#s.add_runtime_dependency("i18n", "~> 0.4.0") # I18n.transliterate (already required by jekyll)
|
33
33
|
s.add_runtime_dependency('jekyll') # Because we call jekyll binary
|
34
|
+
s.add_runtime_dependency('image_processing') # JPEG quality
|
34
35
|
end
|
data/lib/hyde_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyde_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Claudel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: roda
|
@@ -80,14 +80,30 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: image_processing
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: A Jekyll admin interface
|
84
98
|
email: claudel.sylvain@gmail.com
|
85
99
|
executables:
|
86
100
|
- hyde_admin
|
101
|
+
- hyde_admin_config
|
87
102
|
extensions: []
|
88
103
|
extra_rdoc_files: []
|
89
104
|
files:
|
90
105
|
- ".gitattributes"
|
106
|
+
- ".gitignore"
|
91
107
|
- ".idea/.gitignore"
|
92
108
|
- ".idea/hyde_admin.iml"
|
93
109
|
- ".idea/misc.xml"
|
@@ -112,6 +128,7 @@ files:
|
|
112
128
|
- bin/hyde_admin
|
113
129
|
- bin/hyde_admin.ru
|
114
130
|
- bin/hyde_admin.yml
|
131
|
+
- bin/hyde_admin_config
|
115
132
|
- bin/hyde_assets/hyde_admin.css
|
116
133
|
- bin/hyde_assets/hyde_admin.js
|
117
134
|
- bin/i18n/en.yml
|
@@ -179,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
196
|
- !ruby/object:Gem::Version
|
180
197
|
version: '0'
|
181
198
|
requirements: []
|
182
|
-
rubygems_version: 3.
|
199
|
+
rubygems_version: 3.3.7
|
183
200
|
signing_key:
|
184
201
|
specification_version: 4
|
185
202
|
summary: Hyde for Jekyll site
|