Class: AppCommand::GenerateUIFavIcon

Inherits:
Convoy::ActionCommand::Base
  • Object
show all
Defined in:
lib/routes/generate/generate_img_favicon.rb

Constant Summary collapse

ACCEPTED_IMG_FORMATS =
%w(jpg jpeg png)

Instance Method Summary collapse

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/routes/generate/generate_img_favicon.rb', line 9

def execute

    begin

        @opts = command_options
        @args = arguments

        opts_validate
        opts_routing

    rescue => e

        Blufin::Terminal::print_exception(e)

    end

end

#opts_routingObject

Generates a favicon.ico file (using ImageMagick)

Returns:

  • void

Raises:

  • (RuntimeError)


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/routes/generate/generate_img_favicon.rb', line 35

def opts_routing

    # TODO - FAVICON GENERATOR - https://medium.com/@morsetree/creating-a-favicon-command-line-8f6bf224e360

    img = 'path-to-img.jpg|png'
    cmd = <<TEMPLATE
convert #{img} -background white \
\( -clone 0 -resize 16x16 -extent 16x16 \) \
\( -clone 0 -resize 32x32 -extent 32x32 \) \
\( -clone 0 -resize 48x48 -extent 48x48 \) \
\( -clone 0 -resize 64x64 -extent 64x64 \) \
-delete 0 -alpha off -colors 256 favicon.ico
TEMPLATE

    puts cmd
    raise RuntimeError, 'Not yet implemented!'

end

#opts_validateObject



27
28
29
30
31
# File 'lib/routes/generate/generate_img_favicon.rb', line 27

def opts_validate

    # TODO - Validate

end