HazAT / badge

Add a badge to your app icon
MIT License
966 stars 87 forks source link

Fix Error validating image from shields.io. #86

Closed voxmaster closed 5 years ago

oronbz commented 5 years ago

@voxmaster due to the answer from shields.io https://github.com/HazAT/badge/pull/87#issuecomment-511237755 can this be merged please? also when you do can you release new version for this and the plugin? 🙏

voxmaster commented 5 years ago

@oronbz I have no power here 😄 we must pray on @HazAT that he will fix this issue :)

For my pipelines on fastlane I use this step to fix error:

  before_all do
    puts 'android: before_all'
    # Fix add_badge step
    sh("filefix=/var/lib/gems/2.3.0/gems/badge-0.10.0/lib/badge/base.rb; if [ -f $filefix ]; then sed -i -e s#https://img.shields.io#https://raster.shields.io#g $filefix || true; else echo fixfile_FileNotFound; fi")

or you can to the same on bash if you use another pipeline, etc...

oronbz commented 5 years ago

Thanks for that @voxmaster unfortunately, this is impossible for me since gems folder could vary from developer to developer and with CI. But I've forked the plugin and the source code with the included fix so you and anyone else who willing to get a working version can just add my forks to your Pluginfile:

gem 'fastlane-plugin-badge', :git => 'https://github.com/oronbz/fastlane-plugin-badge.git', :branch => 'master'
gem 'badge', :git => 'https://github.com/oronbz/badge.git', :branch => 'master'
ergunkocak commented 5 years ago

Improved @voxmaster s answer to support multiple machines:

# Fix add_badge step
sh("filefix=$(gem which badge); oldSource=\"badge.rb\"; newSource=\"badge/base.rb\"; ${filefix/$oldSource/$newSource}; if [ -f $filefix ]; then sed -i -e s#https://img.shields.io#https://raster.shields.io#g $filefix || true; else echo fixfile_FileNotFound; fi")

Changed the the file to replace URL because in my machine it was not there ;)

ergunkocak commented 5 years ago

I had permission issues on CI machine so using @oronbz solution without the "fastlane-plugin-badge" row, worked for me.