Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add raster url
  • Loading branch information
HazAT committed Jul 30, 2019
1 parent 10465cb commit 0d5c9ad
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Daniel Griesser <daniel.griesser.86@gmail.com>
Copyright (c) 2019 Daniel Griesser <daniel.griesser.86@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion badge.gemspec
Expand Up @@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
spec.add_dependency 'curb', '~> 0.9'
spec.add_dependency 'fastlane', '>= 2.0'
spec.add_dependency 'fastimage', '>= 1.6' # fetch the image sizes
spec.add_dependency 'mini_magick', '>= 4.5' # to add badge image on app icon
spec.add_dependency 'mini_magick', '~> 4.9.5' # to add badge image on app icon

end
6 changes: 5 additions & 1 deletion lib/badge/base.rb
@@ -1,6 +1,6 @@
module Badge

VERSION = "0.10.0"
VERSION = "0.11.0"
DESCRIPTION = "Add a badge overlay to your app icon"

def self.root
Expand Down Expand Up @@ -31,6 +31,10 @@ def self.shield_base_url
'https://raster.shields.io'
end

def self.shield_svg_base_url
'https://img.shields.io'
end

def self.shield_path
'/badge/'
end
Expand Down
15 changes: 10 additions & 5 deletions lib/badge/runner.rb
Expand Up @@ -109,10 +109,15 @@ def add_shield(icon, result, shield, alpha_channel, shield_gravity, shield_no_re

if @@rsvg_enabled
new_path = "#{shield.path}.png"
if shield_no_resize
`rsvg-convert #{shield.path} -z #{shield_scale} -o #{new_path}`
else
`rsvg-convert #{shield.path} -w #{(icon.width * shield_scale).to_i} -a -o #{new_path}`
begin
if shield_no_resize
`rsvg-convert #{shield.path} -z #{shield_scale} -o #{new_path}`
else
`rsvg-convert #{shield.path} -w #{(icon.width * shield_scale).to_i} -a -o #{new_path}`
end
rescue Exception => error
UI.error "Other error occured. Use --verbose for more info".red
UI.verbose error if FastlaneCore::Globals.verbose?
end
new_shield = MiniMagick::Image.open(new_path)
else
Expand All @@ -128,7 +133,7 @@ def add_shield(icon, result, shield, alpha_channel, shield_gravity, shield_no_re
end

def load_shield(shield_string, shield_parameters)
url = Badge.shield_base_url + Badge.shield_path + shield_string + (@@rsvg_enabled ? ".svg" : ".png")
url = (@@rsvg_enabled ? Badge.shield_svg_base_url : Badge.shield_base_url) + Badge.shield_path + shield_string + (@@rsvg_enabled ? ".svg" : ".png")
if shield_parameters
url = url + "?" + shield_parameters
end
Expand Down

0 comments on commit 0d5c9ad

Please sign in to comment.