Class: Jekyll::Commands::Rename
- Inherits:
-
Command
- Object
- Command
- Jekyll::Commands::Rename
- Defined in:
- lib/jekyll/commands/rename.rb
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/rename.rb', line 6 def self.init_with_program(prog) prog.command(:rename) do |c| c.syntax "rename PATH NAME" c.description "Moves a file to a given NAME and sets the title and date" .each { |opt| c.option(*opt) } c.action { |args, | process(args, ) } end end |
.options ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/jekyll/commands/rename.rb', line 17 def self. [ ["force", "-f", "--force", "Overwrite a post if it already exists"], ["config", "--config CONFIG_FILE[,CONFIG_FILE2,...]", Array, "Custom configuration file"], ["date", "-d DATE", "--date DATE", "Specify the date"], ["now", "--now", "Specify the date as now"], ] end |
.process(args = [], options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/jekyll/commands/rename.rb', line 26 def self.process(args = [], = {}) config = () params = RenameArgParser.new(args, , config) params.validate! movement = RenameMovementInfo.new(params) mover = RenameMover.new(movement, params.force?, params.source) mover.move end |