├── .github ├── images │ ├── favicon_factory.svg │ ├── hot_docs.svg │ ├── rictionary.svg │ └── typescript-tips.svg └── workflows │ └── main.yml ├── .gitignore ├── .rubocop.yml ├── CHANGELOG.md ├── Dockerfile ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README.md ├── Rakefile ├── bin ├── console ├── favicon_factory ├── rake └── setup ├── exe └── favicon_factory ├── favicon_factory.gemspec ├── lib ├── favicon_factory.rb └── favicon_factory │ ├── base_adapter.rb │ ├── cli.rb │ ├── command.rb │ ├── image_magick_adapter.rb │ ├── version.rb │ └── vips_adapter.rb ├── samples ├── github.com │ ├── image_magick │ │ ├── apple-touch-icon.png │ │ ├── favicon.ico │ │ ├── favicon.svg │ │ ├── icon-192.png │ │ ├── icon-512.png │ │ ├── icon-mask.png │ │ └── manifest.webmanifest │ └── vips │ │ ├── apple-touch-icon.png │ │ ├── favicon.ico │ │ ├── favicon.svg │ │ ├── icon-192.png │ │ ├── icon-512.png │ │ ├── icon-mask.png │ │ └── manifest.webmanifest └── rictionary │ ├── image_magick │ ├── apple-touch-icon.png │ ├── favicon.ico │ ├── favicon.svg │ ├── icon-192.png │ ├── icon-512.png │ ├── icon-mask.png │ └── manifest.webmanifest │ └── vips │ ├── apple-touch-icon.png │ ├── favicon.ico │ ├── favicon.svg │ ├── icon-192.png │ ├── icon-512.png │ ├── icon-mask.png │ └── manifest.webmanifest └── test ├── test_e2e.rb ├── test_favicon_factory.rb └── test_helper.rb /.github/images/favicon_factory.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.github/images/hot_docs.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.github/images/rictionary.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /.github/images/typescript-tips.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | pull_request: 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | strategy: 14 | matrix: 15 | ruby: 16 | - 3.3 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Set up Ruby 20 | uses: ruby/setup-ruby@v1 21 | with: 22 | ruby-version: ${{ matrix.ruby }} 23 | bundler-cache: true 24 | - run: bin/rake test:unit 25 | - run: bin/rake test:e2e 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /_yardoc/ 4 | /coverage/ 5 | /doc/ 6 | /pkg/ 7 | /spec/reports/ 8 | /tmp/ 9 | 10 | .DS_Store 11 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - rubocop-minitest 3 | - rubocop-performance 4 | - rubocop-rake 5 | - rubocop-thread_safety 6 | 7 | AllCops: 8 | TargetRubyVersion: 2.6 9 | NewCops: enable 10 | 11 | Style/StringLiterals: 12 | Enabled: true 13 | EnforcedStyle: double_quotes 14 | 15 | Style/StringLiteralsInInterpolation: 16 | Enabled: true 17 | EnforcedStyle: double_quotes 18 | 19 | Layout/LineLength: 20 | Max: 120 21 | 22 | ThreadSafety/NewThread: 23 | Enabled: false 24 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [Unreleased] - Date 2 | 3 | ## [0.3.0] 4 | 5 | - Add support for icon-mask.png #3 6 | - Update dependencies 7 | 8 | ## [0.2.0] 9 | 10 | - Add support for Vips #1 11 | 12 | ## [0.1.0] 13 | 14 | - Initial release 15 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:3.3-bullseye 2 | 3 | ARG IMAGE_MAGICK_VERSION=7.1.1-33 4 | ARG UNPATH_VERSION=0.1.0 5 | 6 | # throw errors if Gemfile has been modified since Gemfile.lock 7 | RUN bundle config --global frozen 1 8 | 9 | RUN apt remove --purge -y "*imagemagick*" && \ 10 | apt autoremove --purge -y 11 | RUN apt-get update && apt-get install -y \ 12 | checkinstall && \ 13 | rm -rf /var/lib/apt/lists/* 14 | RUN t=$(mktemp) && \ 15 | wget 'https://dist.1-2.dev/imei.sh' -qO "$t" && \ 16 | bash "$t" --checkinstall --imagemagick-version=$IMAGE_MAGICK_VERSION && \ 17 | rm "$t" 18 | 19 | RUN apt-get update && apt-get install -y \ 20 | libvips \ 21 | libvips-tools && \ 22 | rm -rf /var/lib/apt/lists/* 23 | 24 | RUN curl --location https://github.com/3v0k4/unpath/releases/download/v$UNPATH_VERSION/unpath-linux-amd64 --output unpath && \ 25 | chmod +x unpath && \ 26 | mv unpath /usr/local/sbin 27 | 28 | WORKDIR /usr/src/app 29 | 30 | COPY lib/favicon_factory/version.rb ./lib/favicon_factory/version.rb 31 | COPY favicon_factory.gemspec Gemfile Gemfile.lock . 32 | RUN bundle install 33 | 34 | COPY . . 35 | 36 | CMD ["bin/console"] 37 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | # Specify your gem's dependencies in favicon_factory.gemspec 6 | gemspec 7 | 8 | gem "minitest", "~> 5.16" 9 | gem "rake", "~> 13.0" 10 | gem "rubocop", "~> 1.21" 11 | gem "rubocop-minitest", require: false 12 | gem "rubocop-performance", require: false 13 | gem "rubocop-rake", require: false 14 | gem "rubocop-thread_safety", require: false 15 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | favicon_factory (0.3.0) 5 | mini_magick (~> 5.2) 6 | ruby-vips (~> 2.2) 7 | tty-option (~> 0.3.0) 8 | tty-which (~> 0.5.0) 9 | 10 | GEM 11 | remote: https://rubygems.org/ 12 | specs: 13 | ast (2.4.3) 14 | benchmark (0.4.1) 15 | ffi (1.17.2-x86_64-darwin) 16 | ffi (1.17.2-x86_64-linux-gnu) 17 | json (2.12.2) 18 | language_server-protocol (3.17.0.5) 19 | lint_roller (1.1.0) 20 | logger (1.7.0) 21 | mini_magick (5.2.0) 22 | benchmark 23 | logger 24 | minitest (5.25.5) 25 | parallel (1.27.0) 26 | parser (3.3.8.0) 27 | ast (~> 2.4.1) 28 | racc 29 | prism (1.4.0) 30 | racc (1.8.1) 31 | rainbow (3.1.1) 32 | rake (13.3.0) 33 | regexp_parser (2.10.0) 34 | rubocop (1.76.2) 35 | json (~> 2.3) 36 | language_server-protocol (~> 3.17.0.2) 37 | lint_roller (~> 1.1.0) 38 | parallel (~> 1.10) 39 | parser (>= 3.3.0.2) 40 | rainbow (>= 2.2.2, < 4.0) 41 | regexp_parser (>= 2.9.3, < 3.0) 42 | rubocop-ast (>= 1.45.1, < 2.0) 43 | ruby-progressbar (~> 1.7) 44 | unicode-display_width (>= 2.4.0, < 4.0) 45 | rubocop-ast (1.45.1) 46 | parser (>= 3.3.7.2) 47 | prism (~> 1.4) 48 | rubocop-minitest (0.38.1) 49 | lint_roller (~> 1.1) 50 | rubocop (>= 1.75.0, < 2.0) 51 | rubocop-ast (>= 1.38.0, < 2.0) 52 | rubocop-performance (1.25.0) 53 | lint_roller (~> 1.1) 54 | rubocop (>= 1.75.0, < 2.0) 55 | rubocop-ast (>= 1.38.0, < 2.0) 56 | rubocop-rake (0.7.1) 57 | lint_roller (~> 1.1) 58 | rubocop (>= 1.72.1) 59 | rubocop-thread_safety (0.7.2) 60 | lint_roller (~> 1.1) 61 | rubocop (~> 1.72, >= 1.72.1) 62 | ruby-progressbar (1.13.0) 63 | ruby-vips (2.2.4) 64 | ffi (~> 1.12) 65 | logger 66 | tty-option (0.3.0) 67 | tty-which (0.5.0) 68 | unicode-display_width (3.1.4) 69 | unicode-emoji (~> 4.0, >= 4.0.4) 70 | unicode-emoji (4.0.4) 71 | 72 | PLATFORMS 73 | x86_64-darwin-21 74 | x86_64-linux 75 | 76 | DEPENDENCIES 77 | favicon_factory! 78 | minitest (~> 5.16) 79 | rake (~> 13.0) 80 | rubocop (~> 1.21) 81 | rubocop-minitest 82 | rubocop-performance 83 | rubocop-rake 84 | rubocop-thread_safety 85 | 86 | BUNDLED WITH 87 | 2.5.23 88 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2024 3v0k4 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FaviconFactory 2 | 3 |
4 | 5 |
6 | 7 | Tired of managing dozens of favicons to support all the browsers, resolutions, and formats? 8 | 9 | `favicon_factory` generates from an SVG the minimal set of icons needed by modern browsers. 10 | 11 | The source SVG is ideal for [modern browsers](https://caniuse.com/link-icon-svg). And it may contain a `