#505, Allow custom Flapjack branding.

This is to deal with #505, Allow custom Flapjack branding.

The change allows for an image_logo_path setting in the config that points to a custom logo file. 

I'm not 100% sure if this PR should be considered. I'm unhappy with it for two reasons:

1. The logo is copied in from the path into a /public/img/custom folder (created when the Sintra app starts up). This feels like a hack. If I'd started this again I would have used sendfile from the image's default location, though this might have caused performance / security issues. 

2. I had to comment out a test that works in isolation (defaulting to the standard logo if nothing configured). The test will sometimes fail, possibly if the primary spec for the logo executes first and the @config variable gets set. I can't bend my head around this - the start method should load the config, and it's being called independently in each of the tests. There's some weird interdependence between specs in the web_spec.rb file, but I can't for the life of me figure it out - at least not in the time available.

Any feedback appreciated. 

Yep, that's fine. The question about unless was more a general style issue.
The setting of @logo_image_url multiple times was messy. Your style is
cleaner and less prone to potential error.


On Tue, Jun 24, 2014 at 12:09 PM, Ali Graham <notifications@github.com>
wrote:

> In lib/flapjack/gateways/web.rb:
>
> > @@ -76,6 +76,23 @@ def start
> >              @base_url = dummy_url
> >            end
> >
> > +          logo_image_path = @config['logo_image_path']
> > +          if logo_image_path
> > +            if !File.file?(logo_image_path)
>
> For a single clause, yes,, but as this has branches for either case unless
> ... else ... is not very nice. As @logo_image_url is set by multiple
> branches here I'd possibly make that value the result of all of them, e.g.
>
> default_logo_image_url = "#{@base_url}img/flapjack-2013-notext-transparent-300-300.png"
> @logo_image_url = if logo_image_path
>   if File.file?(logo_image_path)
>     # snip...
>     "#{@base_url}img/custom/#{logo_image_filename}"
>   else
>     default_logo_image_url
>   endelse
>   default_logo_image_urlend
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/flapjack/flapjack/pull/544/files#r14110550>.
>