Class: JekyllImport::Importers::Drupal6
- Inherits:
-
JekyllImport::Importer
- Object
- JekyllImport::Importer
- JekyllImport::Importers::Drupal6
- Extended by:
- JekyllImport::Importers::DrupalCommon::ClassMethods
- Includes:
- DrupalCommon
- Defined in:
- lib/jekyll-import/importers/drupal6.rb
Constant Summary
Constants included from JekyllImport::Importers::DrupalCommon::ClassMethods
JekyllImport::Importers::DrupalCommon::ClassMethods::DEFAULTS
Class Method Summary collapse
- .aliases_query(prefix) ⇒ Object
- .build_query(prefix, types, _engine) ⇒ Object
- .post_data(sql_post_data) ⇒ Object
Methods included from JekyllImport::Importers::DrupalCommon::ClassMethods
process, require_deps, specify_options
Methods included from DrupalCommon
#aliases_query, #build_query, #post_data, #validate
Methods inherited from JekyllImport::Importer
inherited, run, stringify_keys, subclasses
Class Method Details
.aliases_query(prefix) ⇒ Object
38 39 40 |
# File 'lib/jekyll-import/importers/drupal6.rb', line 38 def self.aliases_query(prefix) "SELECT src AS source, dst AS alias FROM #{prefix}url_alias WHERE src = ?" end |
.build_query(prefix, types, _engine) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/jekyll-import/importers/drupal6.rb', line 11 def self.build_query(prefix, types, _engine) types = types.join("' OR n.type = '") types = "n.type = '#{types}'" query = <<SQL SELECT n.nid, n.title, nr.body, nr.teaser, n.created, n.status, ua.dst AS alias, n.type, GROUP_CONCAT( td.name SEPARATOR '|' ) AS 'tags' FROM #{prefix}node_revisions AS nr, url_alias AS ua, #{prefix}node AS n LEFT OUTER JOIN #{prefix}term_node AS tn ON tn.nid = n.nid LEFT OUTER JOIN #{prefix}term_data AS td ON tn.tid = td.tid WHERE (#{types}) AND n.vid = nr.vid AND ua.src = CONCAT( 'node/', n.nid) GROUP BY n.nid, ua.dst SQL query end |
.post_data(sql_post_data) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/jekyll-import/importers/drupal6.rb', line 42 def self.post_data(sql_post_data) content = sql_post_data[:body].to_s summary = sql_post_data[:teaser].to_s = (sql_post_data[:tags] || "").downcase.strip data = { "excerpt" => summary, "categories" => .split("|").uniq, } data["permalink"] = "/" + sql_post_data[:alias] if sql_post_data[:alias] [data, content] end |