Sha256: bb0d6014cfc1fd8c404750a63660d3dcdd922d7f3ccb2dc7f0b88af65819c1ce

Contents?: true

Size: 1.17 KB

Versions: 12

Compression:

Stored size: 1.17 KB

Contents

require "erb"

class Jekyll::Commands::NewTheme < Jekyll::Command
  class << self
    def init_with_program(prog)
      prog.command(:"new-theme") do |c|
        c.syntax "new-theme NAME"
        c.description "Creates a new Jekyll theme scaffold"
        c.option "code_of_conduct", \
          "-c", "--code-of-conduct", \
          "Include a Code of Conduct. (defaults to false)"

        c.action do |args, opts|
          Jekyll::Commands::NewTheme.process(args, opts)
        end
      end
    end

    # rubocop:disable Metrics/AbcSize
    def process(args, opts)
      if !args || args.empty?
        raise Jekyll::Errors::InvalidThemeName, "You must specify a theme name."
      end

      new_theme_name = args.join("_")
      theme = Jekyll::ThemeBuilder.new(new_theme_name, opts)
      if theme.path.exist?
        Jekyll.logger.abort_with "Conflict:", "#{theme.path} already exists."
      end

      theme.create!
      Jekyll.logger.info "Your new Jekyll theme, #{theme.name.cyan}," \
        " is ready for you in #{theme.path.to_s.cyan}!"
      Jekyll.logger.info "For help getting started, read #{theme.path}/README.md."
    end
    # rubocop:enable Metrics/AbcSize
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jekyll-3.5.2 lib/jekyll/commands/new_theme.rb
jekyll-3.5.1 lib/jekyll/commands/new_theme.rb
jekyll-3.4.5 lib/jekyll/commands/new_theme.rb
jekyll-3.5.0 lib/jekyll/commands/new_theme.rb
jekyll-3.4.4 lib/jekyll/commands/new_theme.rb
jekyll-3.4.3 lib/jekyll/commands/new_theme.rb
jekyll-3.4.2 lib/jekyll/commands/new_theme.rb
jekyll-3.4.1 lib/jekyll/commands/new_theme.rb
jekyll-3.4.0 lib/jekyll/commands/new_theme.rb
jekyll-3.3.1 lib/jekyll/commands/new_theme.rb
jekyll-3.3.0 lib/jekyll/commands/new_theme.rb
jekyll-3.3.0.pre.rc1 lib/jekyll/commands/new_theme.rb