Class: Jekyll::Commands::Import

Inherits:
Command
  • Object
show all
Defined in:
lib/jekyll/commands/import.rb

Constant Summary collapse

IMPORTERS =
{
  :behance => 'Behance',
  :csv => 'CSV',
  :drupal6 => 'Drupal6',
  :drupal7 => 'Drupal7',
  :enki => 'Enki',
  :joomla => 'Joomla',
  :jrnl => 'Jrnl',
  :ghost => 'Ghost',
  :google_reader => 'GoogleReader',
  :marley => 'Marley',
  :mephisto => 'Mephisto',
  :mt => 'MT',
  :posterous => 'Posterous',
  :rss => 'RSS',
  :s9y => 'S9Y',
  :textpattern => 'TextPattern',
  :tumblr => 'Tumblr',
  :typo => 'Typo',
  :wordpress => 'WordPress',
  :wordpressdotcom => 'WordpressDotCom'
}

Class Method Summary collapse

Class Method Details

.abort_on_invalid_migrator(migrator) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/jekyll/commands/import.rb', line 31

def self.abort_on_invalid_migrator(migrator)
  msg = "Sorry, '#{migrator}' isn't a valid migrator. Valid choices:\n"
  IMPORTERS.keys.each do |k, v|
    msg += "* #{k}\n"
  end
  abort msg
end

.process(migrator, options) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/jekyll/commands/import.rb', line 39

def self.process(migrator, options)
  migrator = migrator.to_s.downcase

  if IMPORTERS.keys.include?(migrator.to_sym)
    if JekyllImport::Importers.const_defined?(IMPORTERS[migrator.to_sym])
      klass = JekyllImport::Importers.const_get(IMPORTERS[migrator.to_sym])
      klass.run(options.__hash__)
    end
  else
    abort_on_invalid_migrator(migrator)
  end
end