follmann / favicon_maker

Create favicon files in various sizes from a base image for ruby projects
MIT License
70 stars 7 forks source link

More Verbose Readme #23

Open dillonbailey opened 8 years ago

dillonbailey commented 8 years ago

Hey,

Thanks for creating the gem. I'm still a bit new to the world of Rails and was wondering if it would be possible to get a bit more verbose version of the readme for setup and execution of the gem?

For instance I tried to put the favicon maker block into my development.rb config just to run it as I run my environment with:

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = true

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

  # Asset digests allow you to set far-future HTTP expiration dates on all assets,
  # yet still be able to expire them through the digest params.
  config.assets.digest = true

  config.assets.enable = true

  # Adds additional error checking when serving assets at runtime.
  # Checks for improperly declared sprockets dependencies.
  # Raises helpful error messages.
  config.assets.raise_runtime_errors = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true

  # Add Rack::LiveReload to the bottom of the middleware stack with the default options.
  config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload

  FaviconMaker.generate do

    setup do
      template_dir  "app/assets/images"
      output_dir    "public/assets"
    end

    from "favicon_base_hires.png" do
      icon "apple-touch-icon-152x152-precomposed.png"
      icon "apple-touch-icon-144x144-precomposed.png"
      icon "apple-touch-icon-120x120-precomposed.png"
      icon "apple-touch-icon-114x114-precomposed.png"
      icon "favicon-196x196.png"
      icon "favicon-160x160.png"
      icon "favicon-96x96.png"
      icon "mstile-144x144", format: "png"
    end

    # from "favicon_base.png" do
    #   icon "apple-touch-icon-76x76-precomposed.png"
    #   icon "apple-touch-icon-72x72-precomposed.png"
    #   icon "apple-touch-icon-60x60-precomposed.png"
    #   icon "apple-touch-icon-57x57-precomposed.png"
    #   icon "apple-touch-icon-precomposed.png", size: "57x57"
    #   icon "apple-touch-icon.png", size: "57x57"
    #   icon "favicon-32x32.png"
    #   icon "favicon-16x16.png"
    #   icon "favicon.png", size: "16x16"
    #   icon "favicon.ico", size: "64x64,32x32,24x24,16x16"
    # end

    each_icon do |filepath|
      puts filepath # verbose example
    end
  end

end

And end up with this output after trying to run rails s

/Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/creator.rb:61:in ``': No such file or directory - convert (Errno::ENOENT)
    from /Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/creator.rb:61:in `fetch_image_magick_version'
    from /Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/creator.rb:20:in `initialize'
    from /Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/generator.rb:41:in `new'
    from /Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/generator.rb:41:in `block in start'
    from /Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/generator.rb:38:in `each'
    from /Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/generator.rb:38:in `start'
    from /Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/generator.rb:8:in `generate'
    from /Users/dillonbailey/Sites/honestfox/config/environments/development.rb:47:in `block in <top (required)>'

Thanks in advance!

n-rodriguez commented 8 years ago

/Users/dillonbailey/.rvm/gems/ruby-2.2.2/gems/favicon_maker-1.3.1/lib/favicon_maker/creator.rb:61:in ``': No such file or directory - convert (Errno::ENOENT)

Install ImageMagick on your system :

apt-get install imagemagick