class Jekyll::Commands::Rename
Public Class Methods
init_with_program(prog)
click to toggle source
# 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" options.each { |opt| c.option(*opt) } c.action { |args, options| process(args, options) } end end
options()
click to toggle source
# File lib/jekyll/commands/rename.rb, line 17 def self.options [ ["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 = {})
click to toggle source
# File lib/jekyll/commands/rename.rb, line 26 def self.process(args = [], options = {}) config = configuration_from_options(options) params = RenameArgParser.new(args, options, config) params.validate! movement = RenameMovementInfo.new(params) mover = RenameMover.new(movement, params.force?, params.source) mover.move end