miyano 0.3.3 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b912321841ef36bb834164300fa381ffa943c93f773e766ed49482c4f0ea1d19
4
- data.tar.gz: 1b3e414cb745265ab329f7b77614183030520a173132849d391c449827a3ccbf
3
+ metadata.gz: 3fc3f55facf0a7bc6b82570acb54e79c45272211fd7a6e5c7f22890d58cae2dc
4
+ data.tar.gz: b0ac39866dc9deedb09d5bb056cc080cfe17f9f4fa95737b541c8f14ecee15a1
5
5
  SHA512:
6
- metadata.gz: 83f8b7e6c2239a0b2d446e902a257caade068610bbfb7ed41a2fd37264570099a4d96c6c711351c5c8b7a6fa93a2351ddcd5872189995076fac780914dfbf77f
7
- data.tar.gz: 26e423c77047d9935c7e0bd1b5b198b488dfda80c34f799645c930d2d60bb6fde80706eb0695c291f91ed6f9615733d5149183ecf066185ddde4c7eb2a62a941
6
+ metadata.gz: 3678505af37a97f470ce8eee04f4d2dabee320e3c9f017b571924d78e8b1075dccdb39b84c1b72b35933f13997733237dc845fb01c8e8e2e6f289888438cdb78
7
+ data.tar.gz: f2d4474c1e52b1d09526bf6e26de1c0c416d093f5bdc92c2107038372b31fea64cab7f84137c6d24b47b0fc0222bab325f293f5deb8a3d1dcee3acaf79b42b06
@@ -18,8 +18,8 @@ module Miyano
18
18
  #zipdir = zipdir.force_encoding "UTF-8"
19
19
  zipdir = getZipDir bearnote.entries[0].name
20
20
  assets = bearnote.glob("#{zipdir}/assets/*")
21
+ dir = "_site/#{name}/assets"
21
22
  assets.each do |asset|
22
- dir = "_site/#{name}/assets"
23
23
  FileUtils.mkdir_p dir
24
24
  path = File.join dir, File.basename(asset.name)
25
25
  asset.extract path unless File.exist? path
@@ -33,6 +33,7 @@ module Miyano
33
33
  File.open("_site/#{name}/index.html", "w") do |html|
34
34
  html.write render_bear(f, text)
35
35
  end
36
+ auto_orient_imgs(dir) if Dir.exist? dir
36
37
  end
37
38
  end
38
39
 
@@ -57,5 +58,24 @@ module Miyano
57
58
  end
58
59
  return str
59
60
  end
61
+
62
+ def auto_orient_imgs(dir)
63
+ return unless check_imagemagick
64
+ imgs = Dir["#{dir}/*.{jpg,jpeg,JPG,JPEG}"]
65
+ imgs.each do |img|
66
+ `convert -auto-orient #{img.inspect} #{img.inspect}`
67
+ end
68
+ end
69
+
70
+ def check_imagemagick
71
+ system "convert -version >/dev/null"
72
+ system "brew install imagemagick graphicsmagick" unless $?.success?
73
+ unless $?.success?
74
+ system "/usr/bin/ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'"
75
+ system "brew install imagemagick graphicsmagick" if $?.success?
76
+ end
77
+ system "convert -version >/dev/null"
78
+ end
79
+
60
80
  end
61
81
  end
@@ -1,3 +1,3 @@
1
1
  module Miyano
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miyano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - wuusn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-25 00:00:00.000000000 Z
11
+ date: 2018-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler