yamg 0.5.3 → 0.5.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f4f5266569bf86e1b025fc429287269a30ef7d7
4
- data.tar.gz: be00e31834b39c0c8fa77278c14401aa57bba6b7
3
+ metadata.gz: a8a4301b4c159c904ddaf0be5071ddf331a38d62
4
+ data.tar.gz: e830d33b8c1e1919c352ba50a1186ac627d7e65d
5
5
  SHA512:
6
- metadata.gz: 19da1099627f14a27ea4d759c973852e61e9ff96b70f20cd79307b4d87837d7ea84f8ac0794fe7611d6ffae78e1960fac7d9539c310f6a09e4cea39c43799261
7
- data.tar.gz: ec16c0c0a123e692b4910931ecf939fa247d7c69664f0b50f3fa5d28b3619302e48aa734439f863798b451b11f340b2378be7442878e08738f466bb275943e25
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$}) { |m| "spec/#{m[1]}_spec.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') { 'spec' }
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 make it automated.
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
@@ -1,11 +1 @@
1
1
  require 'bundler/gem_tasks'
2
- require 'rake'
3
- require 'rake/testtask'
4
-
5
- Rake::TestTask.new do |t|
6
- t.libs << 'spec'
7
- t.test_files = FileList['spec/**/*_spec.rb']
8
- t.verbose = true
9
- end
10
-
11
- task default: [:test]
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 fail
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
- fail 'No url provided' unless (url = YAMG.config['screenshot']['url'])
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( manifest.json browserconfig.xml ).each do |doc|
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
- fail 'No source' if src.nil? || src.empty?
20
+ raise 'No source' if src.nil? || src.empty?
21
21
  @src = src
22
- @size = 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
- alias_method :rounded?, :rounded
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(r = 14)
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
- fail unless @icons.find { |i| File.extname(i) == 'svg' }
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
@@ -8,7 +8,7 @@ module YAMG
8
8
  # Uses PhantomJS
9
9
  def initialize(*ss)
10
10
  @name, opts = ss
11
- fail 'No screen size provided' unless opts && opts['size']
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
@@ -1,4 +1,4 @@
1
1
  # :nodoc:
2
2
  module YAMG
3
- VERSION = '0.5.3'
3
+ VERSION = '0.5.5'.freeze
4
4
  end
@@ -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 eq(524) # transparency channel
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 eq(5070) # transparency channel
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 eq(5141) # transparency channel
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 eq(5089) # transparency channel
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 eq(5809) # transparency channel
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
- .and_return(['16.png', '32.png', '64.png'])
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
- .and_return(['16.png', '32.png', '64.png'])
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
- .and_return(['16.png', '32.png', '64.png'])
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
- .and_return(['xx16.png', '32oo.png', 'x64o.png'])
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.3
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-01-11 00:00:00.000000000 Z
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.5.1
112
+ rubygems_version: 2.6.6
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Yet another media generator