Class: Bunto::Commands::NewTheme
- Inherits:
-
Bunto::Command
- Object
- Bunto::Command
- Bunto::Commands::NewTheme
- Defined in:
- lib/bunto/commands/new_theme.rb
Class Method Summary collapse
- .init_with_program(prog) ⇒ Object
-
.process(args, opts) ⇒ Object
rubocop:disable Metrics/AbcSize.
Methods inherited from Bunto::Command
add_build_options, configuration_from_options, inherited, process_site, subclasses
Class Method Details
.init_with_program(prog) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bunto/commands/new_theme.rb', line 5 def init_with_program(prog) prog.command(:"new-theme") do |c| c.syntax "new-theme NAME" c.description "Creates a new Bunto theme scaffold" c.option "code_of_conduct", \ "-c", "--code-of-conduct", \ "Include a Code of Conduct. (defaults to false)" c.action do |args, opts| Bunto::Commands::NewTheme.process(args, opts) end end end |
.process(args, opts) ⇒ Object
rubocop:disable Metrics/AbcSize
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bunto/commands/new_theme.rb', line 20 def process(args, opts) if !args || args.empty? raise Bunto::Errors::InvalidThemeName, "You must specify a theme name." end new_theme_name = args.join("_") theme = Bunto::ThemeBuilder.new(new_theme_name, opts) if theme.path.exist? Bunto.logger.abort_with "Conflict:", "#{theme.path} already exists." end theme.create! Bunto.logger.info "Your new Bunto theme, #{theme.name.cyan}," \ " is ready for you in #{theme.path.to_s.cyan}!" Bunto.logger.info "For help getting started, read #{theme.path}/README.md." end |