Module: JekyllImport

Defined in:
lib/jekyll-import.rb,
lib/jekyll-import/util.rb,
lib/jekyll-import/version.rb,
lib/jekyll-import/importer.rb,
lib/jekyll-import/importers.rb,
lib/jekyll-import/importers/mt.rb,
lib/jekyll-import/importers/csv.rb,
lib/jekyll-import/importers/rss.rb,
lib/jekyll-import/importers/s9y.rb,
lib/jekyll-import/importers/enki.rb,
lib/jekyll-import/importers/jrnl.rb,
lib/jekyll-import/importers/typo.rb,
lib/jekyll-import/importers/ghost.rb,
lib/jekyll-import/importers/joomla.rb,
lib/jekyll-import/importers/marley.rb,
lib/jekyll-import/importers/medium.rb,
lib/jekyll-import/importers/pebble.rb,
lib/jekyll-import/importers/pluxml.rb,
lib/jekyll-import/importers/roller.rb,
lib/jekyll-import/importers/tumblr.rb,
lib/jekyll-import/importers/behance.rb,
lib/jekyll-import/importers/blogger.rb,
lib/jekyll-import/importers/drupal6.rb,
lib/jekyll-import/importers/drupal7.rb,
lib/jekyll-import/importers/drupal8.rb,
lib/jekyll-import/importers/joomla3.rb,
lib/jekyll-import/importers/dotclear.rb,
lib/jekyll-import/importers/easyblog.rb,
lib/jekyll-import/importers/mephisto.rb,
lib/jekyll-import/importers/posterous.rb,
lib/jekyll-import/importers/wordpress.rb,
lib/jekyll-import/importers/textpattern.rb,
lib/jekyll-import/importers/s9y_database.rb,
lib/jekyll-import/importers/drupal_common.rb,
lib/jekyll-import/importers/google_reader.rb,
lib/jekyll-import/importers/wordpressdotcom.rb

Defined Under Namespace

Modules: Importers, Util Classes: Importer

Constant Summary collapse

VERSION =
"0.24.0"

Class Method Summary collapse

Class Method Details

.add_importer_commands(cmd) ⇒ Object

Public: Add the subcommands for each importer

cmd - the instance of Mercenary::Command from the

Returns a list of valid subcommands



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jekyll-import.rb', line 21

def self.add_importer_commands(cmd)
  commands = []
  JekyllImport::Importer.subclasses.each do |importer|
    name = importer.to_s.split("::").last.downcase
    commands << name
    cmd.command(name.to_sym) do |c|
      c.syntax "#{name} [options]"
      importer.specify_options(c)
      c.action do |_, options|
        importer.run(options)
      end
    end
  end
  commands
end

.require_with_fallback(gems) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/jekyll-import.rb', line 37

def self.require_with_fallback(gems)
  Array[gems].flatten.each do |gem|
    begin
      require gem
    rescue LoadError
      Jekyll.logger.error "Whoops! Looks like you need to install '#{gem}' before you can use this importer."
      Jekyll.logger.error ""
      Jekyll.logger.error "If you're using bundler:"
      Jekyll.logger.error "  1. Add 'gem \"#{gem}\"' to your Gemfile"
      Jekyll.logger.error "  2. Run 'bundle install'"
      Jekyll.logger.error ""
      Jekyll.logger.error "If you're not using bundler:"
      Jekyll.logger.abort_with "  1. Run 'gem install #{gem}'."
    end
  end
end