jekyll-import 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b5d74f3eddb29a55ff845369991337d004ab36f
4
- data.tar.gz: a06bcfad396653de2fd03b1146c3719ea83d73d1
3
+ metadata.gz: 0cf5aa86194fdb6bdad5d6b80ea34737f92bbf27
4
+ data.tar.gz: 56b1abb55373e60f2c5b5cd51c74fec9c3d3fac9
5
5
  SHA512:
6
- metadata.gz: e7eb1b3daf5ffd72d1127dee1298c998402987bd8eb254f293cd773b3bd5f12e2db11f12a3b97bc82cb33f54b6bdeb1842b14aac1b49b77cb91fba754e9a2567
7
- data.tar.gz: b29b9ecafc01d25924932b73d5a48d272013e2523b7da7b94c4e298cc14321e108917a99f6918acedf4f89250fbffada82aa91e55af09d2769db940859533ae3
6
+ metadata.gz: 29d66c08763920e7a6a06d12cd3557d5f86fca0909b39412fb53d0b39886dac88e14d76c7ac9cc3dfd84296d3ef4644df48fed9315046040a7c9b6e61d20368a
7
+ data.tar.gz: 50e2e862522b4f4d60a0497c443627d5218d97454623fdaf5807bf91ef8e011361a037ca63efbe639ef53ae44e25b78bcbf11fac8fac3200f51c1a2710f4b137
data/.travis.yml CHANGED
@@ -1,14 +1,12 @@
1
1
  language: ruby
2
- before_install:
3
- - gem install bundler
4
2
  install:
5
3
  - export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
6
- - travis_retry bundle install
4
+ - travis_retry ./script/bootstrap
7
5
  rvm:
8
6
  - 2.1
9
7
  - 2.0
10
8
  - 1.9.3
11
- script: bundle exec rake
9
+ script: ./script/cibuild
12
10
  notifications:
13
11
  irc: "irc.freenode.org#jekyll"
14
12
  email:
data/History.markdown CHANGED
@@ -10,6 +10,26 @@
10
10
 
11
11
  ### Development Fixes
12
12
 
13
+ ## 0.4.0 / 2014-06-29
14
+
15
+ ### Minor Enhancements
16
+
17
+ * Add easyblog importer (#136)
18
+ * WordPress: import draft posts into `_drafts` folder (#147)
19
+ * Be really permissive about which Jekyll version to use
20
+
21
+ ### Bug Fixes
22
+
23
+ * Tumblr: Photo posts with multiple photos will now all import (#145)
24
+
25
+ ### Site Enhancements
26
+
27
+ * Fix table prefix key in WordPress docs. (#150)
28
+
29
+ ### Development Fixes
30
+
31
+ * Add GitHub `script/*` conventions for easy pick-up. (#146)
32
+
13
33
  ## 0.3.0 / 2014-05-23
14
34
 
15
35
  ### Minor Enhancements
@@ -76,7 +96,7 @@
76
96
  * Drupal 7 importer should use latest revision of a post (#38)
77
97
  * Improve the handling of tags in the Drupal 6 importer. Tags with
78
98
  spaces are handled now and the importer doesn't eat tags anymore. (#42)
79
- * Upgrade to `jekyll ~> 1.3` and `safe_yaml ~> 0.9.7`
99
+ * Upgrade to `jekyll ~> 1.3` and `safe_yaml ~> 0.9.7`
80
100
  * Add license to gemspec (#83)
81
101
  * Add an `Importer.run` method for easy invocation (#88)
82
102
 
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  s.extra_rdoc_files = %w[README.markdown LICENSE]
30
30
 
31
31
  # runtime dependencies
32
- s.add_runtime_dependency('jekyll', '~> 1.4')
32
+ s.add_runtime_dependency('jekyll', '>= 1.4')
33
33
  s.add_runtime_dependency('fastercsv')
34
34
  s.add_runtime_dependency('nokogiri')
35
35
 
data/lib/jekyll-import.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
2
2
  require 'rubygems'
3
+ require 'jekyll'
3
4
  require 'jekyll/commands/import'
4
- require 'jekyll/stevenson'
5
5
  require 'colorator'
6
6
 
7
7
  require 'jekyll-import/importer'
@@ -0,0 +1,103 @@
1
+ # NOTE: This migrator is made for Joomla 2.5 database and EasyBlog 3.8.
2
+ # NOTE: This converter requires Sequel and the MySQL gems.
3
+ # The MySQL gem can be difficult to install on OS X. Once you have MySQL
4
+ # installed, running the following commands should work:
5
+ # $ sudo gem install sequel
6
+ # $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
7
+
8
+ module JekyllImport
9
+ module Importers
10
+ class Easyblog < Importer
11
+ def self.validate(options)
12
+ %w[dbname user].each do |option|
13
+ if options[option].nil?
14
+ abort "Missing mandatory option --#{option}."
15
+ end
16
+ end
17
+ end
18
+
19
+ def self.specify_options(c)
20
+ c.option 'dbname', '--dbname', 'Database name'
21
+ c.option 'user', '--user', 'Database user name'
22
+ c.option 'password', '--password', "Database user's password (default: '')"
23
+ c.option 'host', '--host', 'Database host name'
24
+ c.option 'section', '--section', 'Table prefix name'
25
+ c.option 'prefix', '--prefix', 'Table prefix name'
26
+ end
27
+
28
+ def self.require_deps
29
+ JekyllImport.require_with_fallback(%w[
30
+ rubygems
31
+ sequel
32
+ fileutils
33
+ safe_yaml
34
+ ])
35
+ end
36
+
37
+ def self.process(options)
38
+ dbname = options.fetch('dbname')
39
+ user = options.fetch('user')
40
+ pass = options.fetch('password', '')
41
+ host = options.fetch('host', "localhost")
42
+ section = options.fetch('section', '1')
43
+ table_prefix = options.fetch('prefix', "jos_")
44
+
45
+ db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
46
+
47
+ FileUtils.mkdir_p("_posts")
48
+
49
+ # Reads a MySQL database via Sequel and creates a post file for each
50
+ # post in wp_posts that has post_status = 'publish'. This restriction is
51
+ # made because 'draft' posts are not guaranteed to have valid dates.
52
+
53
+ query = "
54
+ select
55
+ ep.`title`, `permalink` as alias, concat(`intro`, `content`) as content, ep.`created`, ep.`id`, ec.`title` as category, tags
56
+ from
57
+ #{table_prefix}easyblog_post ep
58
+ left join #{table_prefix}easyblog_category ec on (ep.category_id = ec.id)
59
+ left join (
60
+ select
61
+ ept.post_id,
62
+ group_concat(et.alias order by alias separator ' ') as tags
63
+ from
64
+ #{table_prefix}easyblog_post_tag ept
65
+ join #{table_prefix}easyblog_tag et on (ept.tag_id = et.id)
66
+ group by
67
+ ept.post_id) x on (ep.id = x.post_id);
68
+ "
69
+
70
+ db[query].each do |post|
71
+ # Get required fields and construct Jekyll compatible name.
72
+ title = post[:title]
73
+ slug = post[:alias]
74
+ date = post[:created]
75
+ content = post[:content]
76
+ category = post[:category]
77
+ tags = post[:tags]
78
+ name = "%02d-%02d-%02d-%s.markdown" % [date.year, date.month, date.day,
79
+ slug]
80
+
81
+ # Get the relevant fields as a hash, delete empty fields and convert
82
+ # to YAML for the header.
83
+ data = {
84
+ 'layout' => 'post',
85
+ 'title' => title.to_s,
86
+ 'joomla_id' => post[:id],
87
+ 'joomla_url' => post[:alias],
88
+ 'category' => post[:category],
89
+ 'tags' => post[:tags],
90
+ 'date' => date
91
+ }.delete_if { |k,v| v.nil? || v == '' }.to_yaml
92
+
93
+ # Write out the data and content to file
94
+ File.open("_posts/#{name}", "w") do |f|
95
+ f.puts data
96
+ f.puts "---"
97
+ f.puts content
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -74,7 +74,7 @@ module JekyllImport
74
74
  content = html_to_markdown content
75
75
  content = add_syntax_highlights content if add_highlights
76
76
  end
77
-
77
+
78
78
  File.open("_posts/tumblr/#{post[:name]}", "w") do |f|
79
79
  f.puts post[:header].to_yaml + "---\n" + content
80
80
  end
@@ -95,12 +95,18 @@ module JekyllImport
95
95
  content << "<br/>" + post["link-description"]
96
96
  end
97
97
  when "photo"
98
- title = post["photo-caption"]
99
- content = if post["photo-link-url"].nil?
100
- "<a href=\"#{post["photo-link-url"]}\">#{content}</a>"
98
+ title = post["slug"].gsub("-"," ")
99
+ if post["photos"].size > 1
100
+ content = ""
101
+ post["photos"].each do |post_photo|
102
+ photo = fetch_photo post_photo
103
+ content << photo + "<br/>"
104
+ content << post_photo["caption"]
105
+ end
101
106
  else
102
- fetch_photo post
107
+ content = fetch_photo post
103
108
  end
109
+ content << "<br/>" + post["photo-caption"]
104
110
  when "audio"
105
111
  if !post["id3-title"].nil?
106
112
  title = post["id3-title"]
@@ -104,6 +104,7 @@ module JekyllImport
104
104
  end
105
105
 
106
106
  FileUtils.mkdir_p("_posts")
107
+ FileUtils.mkdir_p("_drafts") if options[:status].include? :draft
107
108
 
108
109
  db = Sequel.mysql2(options[:dbname], :user => options[:user], :password => options[:pass],
109
110
  :socket => options[:socket], :host => options[:host], :encoding => 'utf8')
@@ -292,7 +293,7 @@ module JekyllImport
292
293
  data = {
293
294
  'layout' => post[:type].to_s,
294
295
  'status' => post[:status].to_s,
295
- 'published' => (post[:status].to_s == "publish"),
296
+ 'published' => post[:status].to_s == 'draft' ? nil : (post[:status].to_s == 'publish'),
296
297
  'title' => title.to_s,
297
298
  'author' => {
298
299
  'display_name'=> post[:author].to_s,
@@ -317,6 +318,8 @@ module JekyllImport
317
318
  if post[:type] == 'page'
318
319
  filename = page_path(post[:id], page_name_list) + 'index.markdown'
319
320
  FileUtils.mkdir_p(File.dirname(filename))
321
+ elsif post[:status] == 'draft'
322
+ filename = "_drafts/#{slug}.md"
320
323
  else
321
324
  filename = "_posts/#{name}"
322
325
  end
@@ -1,3 +1,3 @@
1
1
  module JekyllImport
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
data/script/bootstrap ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ bundle install
data/script/cibuild ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ bundle exec rake test
@@ -3,7 +3,7 @@
3
3
  <h4>Getting Started</h4>
4
4
  {% include docs_ul.html items='home installation usage' %}
5
5
  <h4>Importers</h4>
6
- {% include docs_ul.html items='csv drupal6 drupal7 enki ghost google_reader joomla jrnl marley mephisto mt posterous rss s9y textpattern tumblr typo wordpress wordpressdotcom' %}
6
+ {% include docs_ul.html items='csv drupal6 drupal7 easyblog enki ghost google_reader joomla jrnl marley mephisto mt posterous rss s9y textpattern tumblr typo wordpress wordpressdotcom' %}
7
7
  <h4>Meta</h4>
8
8
  {% include docs_ul.html items='third-party contributing history' %}
9
9
  </aside>
@@ -5,7 +5,7 @@
5
5
  {% include docs_option.html items='home installation usage' %}
6
6
  </optgroup>
7
7
  <optgroup label="Importers">
8
- {% include docs_option.html items='csv drupal6 drupal7 enki google_reader joomla jrnl marley mephisto mt posterous rss s9y textpattern tumblr typo wordpress wordpressdotcom' %}
8
+ {% include docs_option.html items='csv drupal6 drupal7 easyblog enki google_reader joomla jrnl marley mephisto mt posterous rss s9y textpattern tumblr typo wordpress wordpressdotcom' %}
9
9
  </optgroup>
10
10
  <optgroup label="Meta">
11
11
  {% include docs_option.html items='third-party contributing history' %}
@@ -0,0 +1,19 @@
1
+ ---
2
+ layout: news_item
3
+ title: 'jekyll-import 0.4.0 Released'
4
+ date: 2014-06-29 23:04:23 -0400
5
+ author: parkr
6
+ version: 0.4.0
7
+ categories: [release]
8
+ ---
9
+
10
+ Hey! Some minor updates in this release:
11
+
12
+ * Add importer for [EasyBlog](http://stackideas.com/easyblog)
13
+ * Import all photos from a Tumblr photoset post
14
+ * Import WordPress drafts to the `_drafts` folder
15
+ * Compatibility with Jekyll 2
16
+
17
+ As always, check out the [full changelog](/docs/history/) for more details.
18
+
19
+ Happy blogging :)
data/site/docs/drupal7.md CHANGED
@@ -3,7 +3,7 @@ layout: docs
3
3
  title: Drupal 7
4
4
  prev_section: drupal6
5
5
  link_source: drupal7
6
- next_section: enki
6
+ next_section: easyblog
7
7
  permalink: /docs/drupal7/
8
8
  ---
9
9
 
@@ -0,0 +1,25 @@
1
+ ---
2
+ layout: docs
3
+ title: EasyBlog
4
+ prev_section: drupal7
5
+ link_source: easyblog
6
+ next_section: enki
7
+ permalink: /docs/easyblog/
8
+ ---
9
+
10
+ To import your posts from a [EasyBlog](http://stackideas.com/easyblog) installation, run:
11
+
12
+ {% highlight bash %}
13
+ $ ruby -rubygems -e 'require "jekyll-import";
14
+ JekyllImport::Importers::Easyblog.run({
15
+ "dbname" => "name",
16
+ "user" => "myuser",
17
+ "password" => "mypassword",
18
+ "host" => "myhost",
19
+ "prefix" => "mytableprefix"
20
+ })'
21
+ {% endhighlight %}
22
+
23
+ The only required fields are `dbname` and `user`. `password` defaults to `""`,
24
+ `host` defaults to `"localhost"`
25
+ `prefix` defaults to `"jos_"`. This will export all articles (in any state). Category and tags will be included in export.
data/site/docs/enki.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  layout: docs
3
3
  title: Enki
4
- prev_section: drupal7
4
+ prev_section: easyblog
5
5
  link_source: enki
6
6
  next_section: ghost
7
7
  permalink: /docs/enki/
data/site/docs/history.md CHANGED
@@ -5,6 +5,40 @@ permalink: "/docs/history/"
5
5
  prev_section: contributing
6
6
  ---
7
7
 
8
+ ## 0.4.0 / 2014-06-29
9
+
10
+ ### Minor Enhancements
11
+
12
+ - Add easyblog importer ([#136]({{ site.repository }}/issues/136))
13
+ - WordPress: import draft posts into `_drafts` folder ([#147]({{ site.repository }}/issues/147))
14
+ - Be really permissive about which Jekyll version to use
15
+
16
+ ### Bug Fixes
17
+
18
+ - Tumblr: Photo posts with multiple photos will now all import ([#145]({{ site.repository }}/issues/145))
19
+
20
+ ### Site Enhancements
21
+
22
+ - Fix table prefix key in WordPress docs. ([#150]({{ site.repository }}/issues/150))
23
+
24
+ ### Development Fixes
25
+
26
+ - Add GitHub `script/*` conventions for easy pick-up. ([#146]({{ site.repository }}/issues/146))
27
+
28
+ ## 0.3.0 / 2014-05-23
29
+
30
+ ### Minor Enhancements
31
+
32
+ - Import WordPress.org `author` data as hash ([#139]({{ site.repository }}/issues/139))
33
+ - Add `socket` option to the WordPress importer ([#140]({{ site.repository }}/issues/140))
34
+ - Allow the CSV importer to skip writing front matter ([#143]({{ site.repository }}/issues/143))
35
+ - WordPress.com: Download images locally and update links to them ([#134]({{ site.repository }}/issues/134))
36
+ - WordPress: Import WP pages as proper Jekyll pages instead of as posts ([#137]({{ site.repository }}/issues/137))
37
+
38
+ ### Bug Fixes
39
+
40
+ - Replace errant `continue` expression with the valid `next` expression ([#133]({{ site.repository }}/issues/133))
41
+
8
42
  ## 0.2.0 / 2014-03-16
9
43
 
10
44
  ### Major Enhancements
@@ -57,7 +91,7 @@ prev_section: contributing
57
91
  - Drupal 7 importer should use latest revision of a post ([#38]({{ site.repository }}/issues/38))
58
92
  - Improve the handling of tags in the Drupal 6 importer. Tags with
59
93
  spaces are handled now and the importer doesn't eat tags anymore. ([#42]({{ site.repository }}/issues/42))
60
- - Upgrade to `jekyll ~> 1.3` and `safe_yaml ~> 0.9.7`
94
+ - Upgrade to `jekyll ~> 1.3` and `safe_yaml ~> 0.9.7`
61
95
  - Add license to gemspec ([#83]({{ site.repository }}/issues/83))
62
96
  - Add an `Importer.run` method for easy invocation ([#88]({{ site.repository }}/issues/88))
63
97
 
@@ -18,7 +18,7 @@ $ ruby -rubygems -e 'require "jekyll-import";
18
18
  "password" => "",
19
19
  "host" => "localhost",
20
20
  "socket" => "",
21
- "prefix" => "wp_",
21
+ "table_prefix" => "wp_",
22
22
  "clean_entities" => true,
23
23
  "comments" => true,
24
24
  "categories" => true,
@@ -14,7 +14,7 @@ class TestTumblrImporter < Test::Unit::TestCase
14
14
  should "have a post" do
15
15
  assert_equal(2, @posts["posts"].size)
16
16
  end
17
-
17
+
18
18
  should "convert post into hash" do
19
19
  refute_nil(@batch, "a batch with a valid post should exist")
20
20
  end
@@ -23,31 +23,31 @@ class TestTumblrImporter < Test::Unit::TestCase
23
23
  should "have a corresponding type" do
24
24
  assert_equal("regular", @posts['posts'][0]['type'])
25
25
  end
26
-
26
+
27
27
  should "have a hash with a valid name" do
28
28
  assert_equal("2013-07-06-jekyll-test.html", @batch[0][:name])
29
29
  end
30
-
30
+
31
31
  should "have a hash with a valid layout" do
32
32
  assert_equal("post", @batch[0][:header]['layout'])
33
33
  end
34
-
34
+
35
35
  should "have a hash with a valid title" do
36
36
  assert_equal("Jekyll: Test", @batch[0][:header]['title'])
37
37
  end
38
-
38
+
39
39
  should "have a hash with valid tags" do
40
40
  assert_equal("jekyll", @batch[0][:header]['tags'][0])
41
41
  end
42
-
42
+
43
43
  should "have a hash with valid content" do
44
44
  assert_equal("<p>Testing...</p>", @batch[0][:content])
45
45
  end
46
-
46
+
47
47
  should "have a hash with a valid url" do
48
48
  assert_equal("https://github.com/post/54759400073", @batch[0][:url])
49
49
  end
50
-
50
+
51
51
  should "have a hash with a valid slug" do
52
52
  assert_equal("http://github.com/post/54759400073/jekyll-test", @batch[0][:slug])
53
53
  end
@@ -57,34 +57,52 @@ class TestTumblrImporter < Test::Unit::TestCase
57
57
  should "have a corresponding type" do
58
58
  assert_equal("answer", @posts['posts'][1]['type'])
59
59
  end
60
-
60
+
61
61
  should "have a hash with a valid name" do
62
62
  assert_equal("2014-01-01-knock-knock.html", @batch[1][:name])
63
63
  end
64
-
64
+
65
65
  should "have a hash with a valid layout" do
66
66
  assert_equal("post", @batch[1][:header]['layout'])
67
67
  end
68
-
68
+
69
69
  should "have a hash with a valid title" do
70
70
  assert_equal("Knock knock?", @batch[1][:header]['title'])
71
71
  end
72
-
72
+
73
73
  should "have a hash with valid tags" do
74
74
  assert_equal([], @batch[1][:header]['tags'])
75
75
  end
76
-
76
+
77
77
  should "have a hash with valid content" do
78
78
  assert_equal("<p>Who is there?</p>", @batch[1][:content])
79
79
  end
80
-
80
+
81
81
  should "have a hash with a valid url" do
82
82
  assert_equal("http://example.com/post/71845593082", @batch[1][:url])
83
83
  end
84
-
84
+
85
85
  should "have a hash with a valid slug" do
86
86
  assert_equal("http://example.com/post/71845593082/knock-knock", @batch[1][:slug])
87
87
  end
88
88
  end
89
89
  end
90
+
91
+ context "a Tumblr photo blog" do
92
+ setup do
93
+ @jsonPhotoPayload = '{"tumblelog":{"title":"jekyll-test","description":"","name":"jekyll-test","timezone":"US\/Eastern","cname":false,"feeds":[]},"posts-start":0,"posts-total":"2","posts-type":false,"posts":[{"id":59226212476,"url":"http:\/\/jekyll-test.tumblr.com\/post\/59226212476","url-with-slug":"http:\/\/jekyll-test.tumblr.com\/post\/59226212476\/testing-multiple-photo-blog-posts","type":"photo","date-gmt":"2013-08-24 20:37:34 GMT","date":"Sat, 24 Aug 2013 16:37:34","bookmarklet":null,"mobile":null,"feed-item":"","from-feed-id":0,"unix-timestamp":1377376654,"format":"html","reblog-key":"CTkEpLrW","slug":"testing-multiple-photo-blog-posts","photo-caption":"<p>testing multiple photo blog posts<\/p>","width":"500","height":"500","photo-url-1280":"http:\/\/31.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_500.jpg","photo-url-500":"http:\/\/31.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_500.jpg","photo-url-400":"http:\/\/31.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_400.jpg","photo-url-250":"http:\/\/24.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_250.jpg","photo-url-100":"http:\/\/31.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_100.jpg","photo-url-75":"http:\/\/24.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_75sq.jpg","photos":[{"offset":"o1","caption":"","width":"500","height":"500","photo-url-1280":"http:\/\/31.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_500.jpg","photo-url-500":"http:\/\/31.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_500.jpg","photo-url-400":"http:\/\/31.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_400.jpg","photo-url-250":"http:\/\/24.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_250.jpg","photo-url-100":"http:\/\/31.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_100.jpg","photo-url-75":"http:\/\/24.media.tumblr.com\/9c7a3d2a18322ed8720eb2efefe91542\/tumblr_ms1ymmMFhF1sgzdxzo1_75sq.jpg"},{"offset":"o2","caption":"","width":"804","height":"732","photo-url-1280":"http:\/\/24.media.tumblr.com\/deb244a5beaae6e32301c06eb32f39d9\/tumblr_ms1ymmMFhF1sgzdxzo2_1280.jpg","photo-url-500":"http:\/\/24.media.tumblr.com\/deb244a5beaae6e32301c06eb32f39d9\/tumblr_ms1ymmMFhF1sgzdxzo2_500.jpg","photo-url-400":"http:\/\/24.media.tumblr.com\/deb244a5beaae6e32301c06eb32f39d9\/tumblr_ms1ymmMFhF1sgzdxzo2_400.jpg","photo-url-250":"http:\/\/24.media.tumblr.com\/deb244a5beaae6e32301c06eb32f39d9\/tumblr_ms1ymmMFhF1sgzdxzo2_250.jpg","photo-url-100":"http:\/\/31.media.tumblr.com\/deb244a5beaae6e32301c06eb32f39d9\/tumblr_ms1ymmMFhF1sgzdxzo2_100.jpg","photo-url-75":"http:\/\/31.media.tumblr.com\/deb244a5beaae6e32301c06eb32f39d9\/tumblr_ms1ymmMFhF1sgzdxzo2_75sq.jpg"}],"tags":["jekyll"]},{"id":59226098458,"url":"http:\/\/jekyll-test.tumblr.com\/post\/59226098458","url-with-slug":"http:\/\/jekyll-test.tumblr.com\/post\/59226098458\/kitty-with-toy","type":"photo","date-gmt":"2013-08-24 20:36:09 GMT","date":"Sat, 24 Aug 2013 16:36:09","bookmarklet":null,"mobile":null,"feed-item":"","from-feed-id":0,"unix-timestamp":1377376569,"format":"html","reblog-key":"UwhVmPot","slug":"kitty-with-toy","photo-caption":"<p>kitty with toy<\/p>","width":"351","height":"600","photo-url-1280":"http:\/\/24.media.tumblr.com\/51a0da0c6fb64291508ef43fbf817085\/tumblr_ms1yk9QKGh1sgzdxzo1_400.jpg","photo-url-500":"http:\/\/24.media.tumblr.com\/51a0da0c6fb64291508ef43fbf817085\/tumblr_ms1yk9QKGh1sgzdxzo1_400.jpg","photo-url-400":"http:\/\/24.media.tumblr.com\/51a0da0c6fb64291508ef43fbf817085\/tumblr_ms1yk9QKGh1sgzdxzo1_400.jpg","photo-url-250":"http:\/\/31.media.tumblr.com\/51a0da0c6fb64291508ef43fbf817085\/tumblr_ms1yk9QKGh1sgzdxzo1_250.jpg","photo-url-100":"http:\/\/24.media.tumblr.com\/51a0da0c6fb64291508ef43fbf817085\/tumblr_ms1yk9QKGh1sgzdxzo1_100.jpg","photo-url-75":"http:\/\/31.media.tumblr.com\/51a0da0c6fb64291508ef43fbf817085\/tumblr_ms1yk9QKGh1sgzdxzo1_75sq.jpg","photos":[]}]}'
94
+ @posts = JSON.parse(@jsonPhotoPayload)
95
+ end
96
+
97
+ should "import a post with multiple photos" do
98
+ batch = @posts["posts"].map { |post| Importers::Tumblr.post_to_hash(post, 'html') }
99
+ assert_match(/tumblr_ms1ymmMFhF1sgzdxzo1_500\.jpg/, batch[0][:content])
100
+ assert_match(/tumblr_ms1ymmMFhF1sgzdxzo2_1280\.jpg/, batch[0][:content])
101
+ end
102
+ should "import a post with a single photo" do
103
+ batch = @posts["posts"].map { |post| Importers::Tumblr.post_to_hash(post, 'html') }
104
+ assert_match(/tumblr_ms1yk9QKGh1sgzdxzo1_400\.jpg/, batch[1][:content])
105
+ end
106
+ end
107
+
90
108
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2014-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.4'
27
27
  - !ruby/object:Gem::Dependency
@@ -313,6 +313,7 @@ files:
313
313
  - lib/jekyll-import/importers/csv.rb
314
314
  - lib/jekyll-import/importers/drupal6.rb
315
315
  - lib/jekyll-import/importers/drupal7.rb
316
+ - lib/jekyll-import/importers/easyblog.rb
316
317
  - lib/jekyll-import/importers/enki.rb
317
318
  - lib/jekyll-import/importers/ghost.rb
318
319
  - lib/jekyll-import/importers/google_reader.rb
@@ -332,6 +333,8 @@ files:
332
333
  - lib/jekyll-import/util.rb
333
334
  - lib/jekyll-import/version.rb
334
335
  - lib/jekyll/commands/import.rb
336
+ - script/bootstrap
337
+ - script/cibuild
335
338
  - site/.gitignore
336
339
  - site/CNAME
337
340
  - site/README
@@ -358,6 +361,7 @@ files:
358
361
  - site/_posts/2013-12-17-jekyll-import-0-1-0-released.markdown
359
362
  - site/_posts/2014-03-16-jekyll-import-0-2-0-released.markdown
360
363
  - site/_posts/2014-05-23-jekyll-import-0-3-0-released.markdown
364
+ - site/_posts/2014-06-29-jekyll-import-0-4-0-released.markdown
361
365
  - site/css/gridism.css
362
366
  - site/css/normalize.css
363
367
  - site/css/pygments.css
@@ -367,6 +371,7 @@ files:
367
371
  - site/docs/csv.md
368
372
  - site/docs/drupal6.md
369
373
  - site/docs/drupal7.md
374
+ - site/docs/easyblog.md
370
375
  - site/docs/enki.md
371
376
  - site/docs/ghost.md
372
377
  - site/docs/google_reader.md