Class: Abqari::CLI::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/abqari/cli/theme.rb

Overview

abqari theme eject <name> — copy an engine theme's stylesheet into the current site so it can be edited there.

Why this exists: for a gem-installed site the engine's themes live inside the gem directory — read-only in practice, and invisible to anyone who doesn't know about bundle show abqari. The asset pipeline already gives site-local themes/<name>/ precedence over the engine's copy, so "make a theme yours" is just a copy into the right place. This command does that copy.

abqari theme eject minimal              # shadow it in place:
                                      # themes/minimal/css/app.css
abqari theme eject minimal --as mytheme # fork it under a new name
                                      # and point config at it
abqari theme eject custom               # the annotated starter

--as writes the copy under the new name and updates theme: in config/site.yml (when the line is unambiguous). Ejecting under the SAME name needs no config change — the site-local copy shadows the engine's automatically.

Bootstrap is the one theme that can't be renamed: the engine keys its special-casing (skip _common.css, emit the vendored dist's link/script tags) on the literal name 'bootstrap'.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTheme

Returns a new instance of Theme.



37
38
39
# File 'lib/abqari/cli/theme.rb', line 37

def initialize
  @options = { as: nil, force: false }
end

Class Method Details

.run(argv) ⇒ Object



33
34
35
# File 'lib/abqari/cli/theme.rb', line 33

def self.run(argv)
  new.run(argv)
end

Instance Method Details

#run(argv) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/abqari/cli/theme.rb', line 41

def run(argv)
  parser = build_parser
  rest = parser.parse(argv)

  subcommand, name = rest
  unless subcommand == 'eject' && name
    warn parser.help
    return false
  end

  eject(name)
end