yamg 0.5.3 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +2 -2
- data/README.md +4 -1
- data/Rakefile +0 -10
- data/lib/yamg.rb +1 -1
- data/lib/yamg/cli.rb +3 -3
- data/lib/yamg/icon.rb +6 -8
- data/lib/yamg/screenshot.rb +1 -1
- data/lib/yamg/version.rb +1 -1
- data/spec/yamg/icon_spec.rb +9 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8a4301b4c159c904ddaf0be5071ddf331a38d62
|
4
|
+
data.tar.gz: e830d33b8c1e1919c352ba50a1186ac627d7e65d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4e653fd67d279270853ae6214618a233b16924bb58779fec253e60f4681a38d445e548ac09fc78a88fad91233f260f6d2ff6cdfbcf883220bb2317e4ebdb798
|
7
|
+
data.tar.gz: bdc391742aad46a0952f559be5e32d047c0b55647de6ede61ccbcc998716de07ee2e4bde8ec8b0103380d396b397cf608195cd0c6e9232766b720cdadc94239a
|
data/Guardfile
CHANGED
@@ -14,8 +14,8 @@ end
|
|
14
14
|
|
15
15
|
guard :rspec, cmd: 'bundle exec rspec' do
|
16
16
|
watch(%r{^spec/.+_spec\.rb$})
|
17
|
-
watch(%r{^lib/(.+)\.rb$})
|
17
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
18
18
|
watch(%r{^generators/(.+)\.rb$/}) { |_m| 'spec/schemaless/worker_spec' }
|
19
19
|
|
20
|
-
watch('spec/spec_helper.rb')
|
20
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
21
21
|
end
|
data/README.md
CHANGED
@@ -211,6 +211,9 @@ compile:
|
|
211
211
|
|
212
212
|
Meta tags in HTML:
|
213
213
|
|
214
|
+
https://github.com/joshbuchea/HEAD
|
215
|
+
|
216
|
+
|
214
217
|
```html
|
215
218
|
<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png">
|
216
219
|
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">
|
@@ -258,7 +261,7 @@ Meta tags in HAML:
|
|
258
261
|
RSVG - Impossible without
|
259
262
|
https://github.com/svg/svgo
|
260
263
|
|
261
|
-
Real Favicon Generator - Perfect, but I wanted
|
264
|
+
Real Favicon Generator - Perfect, but I wanted it automated (behold YAMG).
|
262
265
|
http://realfavicongenerator.net
|
263
266
|
https://github.com/audreyr/favicon-cheat-sheet
|
264
267
|
https://epicfavicongenerator.com/
|
data/Rakefile
CHANGED
data/lib/yamg.rb
CHANGED
@@ -14,7 +14,7 @@ module YAMG
|
|
14
14
|
autoload :Splash, 'yamg/splash'
|
15
15
|
autoload :Screenshot, 'yamg/screenshot'
|
16
16
|
|
17
|
-
CONFIG_FILE = './.yamg.yml'
|
17
|
+
CONFIG_FILE = './.yamg.yml'.freeze
|
18
18
|
# Load template works
|
19
19
|
TEMPLATES = YAML.load_file(
|
20
20
|
File.join(File.dirname(__FILE__), 'yamg', 'templates.yaml')
|
data/lib/yamg/cli.rb
CHANGED
@@ -23,7 +23,7 @@ module YAMG
|
|
23
23
|
when Hash then { 'path' => './export/' }.merge(opts)
|
24
24
|
when String then { 'path' => opts }
|
25
25
|
when TrueClass then { 'path' => './export/' }
|
26
|
-
else
|
26
|
+
else raise
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -35,7 +35,7 @@ module YAMG
|
|
35
35
|
|
36
36
|
def compile_screenshots(ss, size, setup)
|
37
37
|
return unless YAMG.config['screenshot'].respond_to?(:[])
|
38
|
-
|
38
|
+
raise 'No url provided' unless (url = YAMG.config['screenshot']['url'])
|
39
39
|
Screenshot.new(ss, 'size' => size, 'url' => url).work(setup['path'])
|
40
40
|
puts Rainbow("[o]SS #{ss}").black
|
41
41
|
end
|
@@ -65,7 +65,7 @@ module YAMG
|
|
65
65
|
|
66
66
|
def compile_docs(opts)
|
67
67
|
out = opts['path']
|
68
|
-
%w(
|
68
|
+
%w(manifest.json browserconfig.xml).each do |doc|
|
69
69
|
next if File.exist?(out)
|
70
70
|
puts Rainbow("{DOCS} #{out}/#{doc} created. Please review.").red
|
71
71
|
src = File.expand_path("assets/#{doc}", File.dirname(__FILE__))
|
data/lib/yamg/icon.rb
CHANGED
@@ -17,9 +17,9 @@ module YAMG
|
|
17
17
|
# ICO: 16/32/48
|
18
18
|
#
|
19
19
|
def initialize(src, size, bg = nil, rounded = false, radius = 9)
|
20
|
-
|
20
|
+
raise 'No source' if src.nil? || src.empty?
|
21
21
|
@src = src
|
22
|
-
@size
|
22
|
+
@size = size
|
23
23
|
@rounded = rounded
|
24
24
|
@icons = YAMG.load_images(src)
|
25
25
|
YAMG.puts_and_exit("No sources in '#{src}'") if icons.empty?
|
@@ -28,7 +28,7 @@ module YAMG
|
|
28
28
|
# @dpi = 90
|
29
29
|
@bg = bg
|
30
30
|
end
|
31
|
-
|
31
|
+
alias rounded? rounded
|
32
32
|
|
33
33
|
def find_closest_gte_icon
|
34
34
|
proc = ->(x) { x.tr('^0-9', '').to_i }
|
@@ -51,13 +51,12 @@ module YAMG
|
|
51
51
|
# Maybe this can be smaller, terminal equivalent:
|
52
52
|
# convert
|
53
53
|
# -size 512x512 xc:none
|
54
|
-
# -draw "roundrectangle 0,0,512,512,55,55" mask.png
|
55
|
-
# convert icon.png
|
54
|
+
# -draw "roundrectangle 0,0,512,512,55,55" mask.png convert icon.png
|
56
55
|
# -matte mask.png
|
57
56
|
# -compose DstIn
|
58
57
|
# -composite picture_with_rounded_corners.png
|
59
58
|
# https://gist.github.com/artemave/c20e7450af866f5e7735
|
60
|
-
def round
|
59
|
+
def round
|
61
60
|
mask = MiniMagick::Image.open(img.path)
|
62
61
|
mask.format 'png'
|
63
62
|
|
@@ -98,7 +97,7 @@ module YAMG
|
|
98
97
|
|
99
98
|
# Just copy the svg, never resize
|
100
99
|
def svg!
|
101
|
-
|
100
|
+
raise unless @icons.find { |i| File.extname(i) == 'svg' }
|
102
101
|
end
|
103
102
|
|
104
103
|
# ICO!
|
@@ -123,7 +122,6 @@ module YAMG
|
|
123
122
|
YAMG.run_rsvg(@choosen, temp, args)
|
124
123
|
@img = MiniMagick::Image.open(temp)
|
125
124
|
@img.format File.extname(out) if out
|
126
|
-
|
127
125
|
else
|
128
126
|
@img = MiniMagick::Image.open(@choosen)
|
129
127
|
@img.format File.extname(out) if out
|
data/lib/yamg/screenshot.rb
CHANGED
@@ -8,7 +8,7 @@ module YAMG
|
|
8
8
|
# Uses PhantomJS
|
9
9
|
def initialize(*ss)
|
10
10
|
@name, opts = ss
|
11
|
-
|
11
|
+
raise 'No screen size provided' unless opts && opts['size']
|
12
12
|
uri = URI.parse(opts['url'])
|
13
13
|
@url = "http://#{uri}"
|
14
14
|
@size = opts['size']
|
data/lib/yamg/version.rb
CHANGED
data/spec/yamg/icon_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe YAMG::Icon do
|
4
|
-
|
5
4
|
ICONS_PATH = Dir.pwd + '/spec/icons/'
|
6
5
|
OUT_PATH = Dir.pwd + '/spec/out/'
|
7
6
|
|
@@ -14,7 +13,7 @@ describe YAMG::Icon do
|
|
14
13
|
out = OUT_PATH + 'i16.png'
|
15
14
|
YAMG::Icon.new(ICONS_PATH, 16).image(out)
|
16
15
|
expect(File.exist?(out)).to be_truthy
|
17
|
-
expect(File.size(out)).to
|
16
|
+
expect(File.size(out)).to be_within(30).of(500) # transparency channel
|
18
17
|
img = ::MiniMagick::Image.open out
|
19
18
|
expect(img.width).to eq(16)
|
20
19
|
expect(img.height).to eq(16)
|
@@ -29,7 +28,7 @@ describe YAMG::Icon do
|
|
29
28
|
expect(img.type).to eq('PNG')
|
30
29
|
expect(img.width).to eq(256)
|
31
30
|
expect(img.height).to eq(256)
|
32
|
-
expect(File.size(out)).to
|
31
|
+
expect(File.size(out)).to be_within(200).of(5100) # transparency channel
|
33
32
|
# expect(File.size(out)).to eq(4952) # set format?
|
34
33
|
end
|
35
34
|
|
@@ -37,7 +36,7 @@ describe YAMG::Icon do
|
|
37
36
|
out = OUT_PATH + 'i256bg.png'
|
38
37
|
YAMG::Icon.new(ICONS_PATH, 256, 'black').image(out)
|
39
38
|
expect(File.exist?(out)).to be_truthy
|
40
|
-
expect(File.size(out)).to
|
39
|
+
expect(File.size(out)).to be_within(200).of(5000) # transparency channel
|
41
40
|
img = ::MiniMagick::Image.open out
|
42
41
|
expect(img.width).to eq(256)
|
43
42
|
expect(img.height).to eq(256)
|
@@ -47,7 +46,7 @@ describe YAMG::Icon do
|
|
47
46
|
out = OUT_PATH + 'i256r.png'
|
48
47
|
YAMG::Icon.new(ICONS_PATH, 256, nil, :round).image(out)
|
49
48
|
expect(File.exist?(out)).to be_truthy
|
50
|
-
expect(File.size(out)).to
|
49
|
+
expect(File.size(out)).to be_within(300).of(5089) # transparency channel
|
51
50
|
img = ::MiniMagick::Image.open out
|
52
51
|
expect(img.width).to eq(256)
|
53
52
|
expect(img.height).to eq(256)
|
@@ -57,7 +56,7 @@ describe YAMG::Icon do
|
|
57
56
|
out = OUT_PATH + 'i256bgr.png'
|
58
57
|
YAMG::Icon.new(ICONS_PATH, 256, '#FF0000', :round).image(out)
|
59
58
|
expect(File.exist?(out)).to be_truthy
|
60
|
-
expect(File.size(out)).to
|
59
|
+
expect(File.size(out)).to be_within(300).of(5800) # transparency channel
|
61
60
|
img = ::MiniMagick::Image.open out
|
62
61
|
expect(img.width).to eq(256)
|
63
62
|
expect(img.height).to eq(256)
|
@@ -77,28 +76,28 @@ describe YAMG::Icon do
|
|
77
76
|
|
78
77
|
it 'should have a nice find icon 16' do
|
79
78
|
expect(YAMG).to receive(:load_images).with('foo')
|
80
|
-
|
79
|
+
.and_return(['16.png', '32.png', '64.png'])
|
81
80
|
icon = YAMG::Icon.new('foo', 16)
|
82
81
|
expect(icon.find_closest_gte_icon).to eq('16.png')
|
83
82
|
end
|
84
83
|
|
85
84
|
it 'should have a nice find icon 48' do
|
86
85
|
expect(YAMG).to receive(:load_images).with('foo')
|
87
|
-
|
86
|
+
.and_return(['16.png', '32.png', '64.png'])
|
88
87
|
icon = YAMG::Icon.new('foo', 48)
|
89
88
|
expect(icon.find_closest_gte_icon).to eq('64.png')
|
90
89
|
end
|
91
90
|
|
92
91
|
it 'should have a nice find icon 256' do
|
93
92
|
expect(YAMG).to receive(:load_images).with('foo')
|
94
|
-
|
93
|
+
.and_return(['16.png', '32.png', '64.png'])
|
95
94
|
icon = YAMG::Icon.new('foo', 256)
|
96
95
|
expect(icon.find_closest_gte_icon).to eq('64.png')
|
97
96
|
end
|
98
97
|
|
99
98
|
it 'should have a nice find icon mixed names' do
|
100
99
|
expect(YAMG).to receive(:load_images).with('foo')
|
101
|
-
|
100
|
+
.and_return(['xx16.png', '32oo.png', 'x64o.png'])
|
102
101
|
icon = YAMG::Icon.new('foo', 64)
|
103
102
|
expect(icon.find_closest_gte_icon).to eq('x64o.png')
|
104
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yamg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.6.6
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Yet another media generator
|