Class: Jekyll::Commands::Page
- Inherits:
-
Command
- Object
- Command
- Jekyll::Commands::Page
- Defined in:
- lib/jekyll/commands/page.rb
Defined Under Namespace
Classes: PageArgParser, PageFileInfo
Class Method Summary collapse
Class Method Details
.init_with_program(prog) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/jekyll/commands/page.rb', line 6 def self.init_with_program(prog) prog.command(:page) do |c| c.syntax "page NAME" c.description "Creates a new page with the given NAME" .each { |opt| c.option *opt } c.action { |args, | process args, } end end |
.options ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/jekyll/commands/page.rb', line 17 def self. [ ["extension", "-x EXTENSION", "--extension EXTENSION", "Specify the file extension"], ["layout", "-l LAYOUT", "--layout LAYOUT", "Specify the page layout"], ["force", "-f", "--force", "Overwrite a page if it already exists"], ["config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array, "Custom configuration file"], ["source", "-s", "--source SOURCE", "Custom source directory"], ] end |
.process(args = [], options = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/jekyll/commands/page.rb', line 27 def self.process(args = [], = {}) config = () params = PageArgParser.new args, , config params.validate! page = PageFileInfo.new params Compose::FileCreator.new(page, params.force?, params.source).create! end |