jekyll_ghost_importer 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +9 -3
- data/bin/jekyll_ghost_importer +29 -1
- data/features/import_posts.feature +31 -0
- data/jekyll_ghost_importer.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6efbcdcc0c92d880bb0109f84ccee340dd54cce8
|
4
|
+
data.tar.gz: 349ae207909497df123de057efe2624b030fda85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3365d9b8c06daed3c14017a49c8caee73e1c1227da7ece77d0afab2a05da4f9670e5c06b2033de749bd1292a0ffddd22caad4a607e1488fb46373abab2e3667d
|
7
|
+
data.tar.gz: d28969705c02a254503accfc8409a86d70f976de9b4d6d141ba33f70f89311b69dd0f46018908b1bf09b60f4f748b809f8073864347df507a0c4bba717702b4d
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
[![Code Climate](
|
2
|
-
[![Build status](https://img.shields.io/
|
3
|
-
[![Gem Version](
|
1
|
+
[![Code Climate](https://img.shields.io/codeclimate/maintainability/eloyesp/jekyll_ghost_importer.svg?maxAge=1800)](https://codeclimate.com/github/eloyesp/jekyll_ghost_importer)
|
2
|
+
[![Build status](https://img.shields.io/travis/eloyesp/jekyll_ghost_importer.svg?maxAge=1800)](https://travis-ci.org/eloyesp/jekyll_ghost_importer)
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/jekyll_ghost_importer.svg?maxAge=2592000)](https://rubygems.org/gems/jekyll_ghost_importer)
|
4
4
|
|
5
5
|
# Jekyll ghost importer
|
6
6
|
|
@@ -30,6 +30,12 @@ the backup and will create a `_drafts` folder for yours drafts.
|
|
30
30
|
- To Fahri Cihan Demirci ([@femnad](https://github.com/femnad)) for
|
31
31
|
adding support for the new backup format.
|
32
32
|
|
33
|
+
- To Kiko Beats ([@Kikobeats](https://github.com/Kikobeats)) for setting
|
34
|
+
featured posts.
|
35
|
+
|
36
|
+
- To Per Mortensen ([@proog](https://github.com/proog)) for adding support for
|
37
|
+
mobiledoc.
|
38
|
+
|
33
39
|
## Contributing
|
34
40
|
|
35
41
|
1. Fork it ( https://github.com/eloyesp/jekyll-ghost-importer/fork )
|
data/bin/jekyll_ghost_importer
CHANGED
@@ -1,4 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2017-2018 Eloy Espinaco
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify it under
|
6
|
+
# the terms of the GNU General Public License as published by the Free Software
|
7
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
8
|
+
# version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
12
|
+
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License along with
|
15
|
+
# this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#
|
17
|
+
# If you need to use this under different terms please write me directly.
|
2
18
|
|
3
19
|
require 'fileutils'
|
4
20
|
require 'json'
|
@@ -95,7 +111,19 @@ class Post
|
|
95
111
|
end
|
96
112
|
|
97
113
|
def full_body
|
98
|
-
front_matter.to_yaml + "---\n\n" +
|
114
|
+
front_matter.to_yaml + "---\n\n" + markdown
|
115
|
+
end
|
116
|
+
|
117
|
+
def markdown
|
118
|
+
if post[:markdown]
|
119
|
+
post[:markdown]
|
120
|
+
elsif post[:mobiledoc]
|
121
|
+
mobiledoc = JSON.parse post[:mobiledoc], symbolize_names: true
|
122
|
+
card = mobiledoc[:cards].find { |c| c.first == "card-markdown" }
|
123
|
+
card.last[:markdown]
|
124
|
+
else
|
125
|
+
""
|
126
|
+
end
|
99
127
|
end
|
100
128
|
|
101
129
|
def basename
|
@@ -34,6 +34,37 @@ Feature: Import posts
|
|
34
34
|
You're live!
|
35
35
|
"""
|
36
36
|
|
37
|
+
Scenario: Import a simple backup file with posts in mobiledoc format
|
38
|
+
Given a file named "GhostBackup.json" with:
|
39
|
+
"""
|
40
|
+
{
|
41
|
+
"data": {
|
42
|
+
"posts": [
|
43
|
+
{
|
44
|
+
"title": "Welcome to Ghost",
|
45
|
+
"slug": "welcome-to-ghost",
|
46
|
+
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"You're live with mobiledoc!\"}]],\"sections\":[[10,0]]}",
|
47
|
+
"featured": 0,
|
48
|
+
"status": "published",
|
49
|
+
"published_at": "2014-02-21T01:14:57.000Z"
|
50
|
+
}
|
51
|
+
]
|
52
|
+
}
|
53
|
+
}
|
54
|
+
"""
|
55
|
+
When I run `jekyll_ghost_importer GhostBackup.json`
|
56
|
+
Then a directory named "_posts" should exist
|
57
|
+
Then the file "_posts/2014-02-21-welcome-to-ghost.markdown" should contain:
|
58
|
+
"""
|
59
|
+
---
|
60
|
+
layout: post
|
61
|
+
title: Welcome to Ghost
|
62
|
+
date: '2014-02-21 01:14:57'
|
63
|
+
---
|
64
|
+
|
65
|
+
You're live with mobiledoc!
|
66
|
+
"""
|
67
|
+
|
37
68
|
Scenario: Import a backup file with two posts.
|
38
69
|
Given a file named "GhostBackup.json" with:
|
39
70
|
"""
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "jekyll_ghost_importer"
|
4
|
-
spec.version = "0.
|
4
|
+
spec.version = "1.0.0"
|
5
5
|
spec.authors = ["Eloy Espinaco"]
|
6
6
|
spec.email = ["eloyesp@gmail.com"]
|
7
7
|
spec.summary = %q{Import your posts from a ghost backup file.}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_ghost_importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Espinaco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -47,6 +47,7 @@ extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
49
|
- ".gitignore"
|
50
|
+
- ".travis.yml"
|
50
51
|
- COPYING
|
51
52
|
- Gemfile
|
52
53
|
- Guardfile
|
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
80
|
version: '0'
|
80
81
|
requirements: []
|
81
82
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.5.2
|
83
|
+
rubygems_version: 2.5.2.1
|
83
84
|
signing_key:
|
84
85
|
specification_version: 4
|
85
86
|
summary: Import your posts from a ghost backup file.
|