jekyll_ghost_importer 0.1.0 → 0.2.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: 1f4e1614379288009878b6b78cc1c2ff88ad2e58
4
- data.tar.gz: b853b18df8322d55a5e8a883bab607d55f6f5d70
3
+ metadata.gz: 2deb5326c0dbc5b5cf946af8ae188c1690c965f2
4
+ data.tar.gz: 6c641eb72b436c202a5ac7ab85c9fb3ccf9d4adb
5
5
  SHA512:
6
- metadata.gz: 1e734942234ef4b488c73a4c95b6f2dc32f8133141cfeaab15fab6e0b5e4352c9cd5dc881540129edd7e56977a553a2786a23f7798937776facc7330838bc684
7
- data.tar.gz: 6c241ec90f74a420f37a9a14795d3f0661016b1a9ac54a11a02e9dde309ffa5371ad715357c6a55e91569241b96fcef402950ed95ddec304b2d523fd6b16b7f6
6
+ metadata.gz: 66a0aa71037c0720e8cd25f04dd928fd6b1a5d42f6797c03243fc139ada08bfb0817fe1b22de48cb34c938d689232c1b2f7a10eca85369f39a72e9ad88db5c1c
7
+ data.tar.gz: d440bcd60c1237a08848236d41c17d82674a2eb84c21fa680362e3855d2be267c76db3e14d4d532f06544489e3fd891fd747295de45163521debf602358e01ac
data/README.md CHANGED
@@ -3,6 +3,10 @@
3
3
  This program let you import your post on [ghost][1] to [jekyll][2]. It uses a
4
4
  [ghost backup][3] to read the data and creates posts and drafts from them.
5
5
 
6
+ [1]: https://ghost.org/
7
+ [2]: http://jekyllrb.com/
8
+ [3]: http://support.ghost.org/import-and-export-my-ghost-blog-settings-and-data/
9
+
6
10
  ## Installation
7
11
 
8
12
  $ gem install jekyll_ghost_importer
@@ -14,7 +18,13 @@ jekyll blog, run:
14
18
 
15
19
  $ jekyll_ghost_importer GhostBackup.json
16
20
 
17
- And then follow the instructions.
21
+ This will create the `_posts` folder and create there a file for each post in
22
+ the backup and will create a `_drafts` folder for yours drafts.
23
+
24
+ ## Thanks
25
+
26
+ - To Fahri Cihan Demirci ([@femnad](https://github.com/femnad)) for
27
+ adding support for the new backup format.
18
28
 
19
29
  ## Contributing
20
30
 
@@ -10,7 +10,11 @@ FileUtils.mkdir_p("_drafts")
10
10
 
11
11
  json = JSON.parse File.read(ARGV.pop), symbolize_names: true
12
12
 
13
- posts = json[:data][:posts]
13
+ unless json[:data].nil?
14
+ posts = json[:data][:posts]
15
+ else
16
+ posts = json[:db].first[:data][:posts]
17
+ end
14
18
 
15
19
  posts.each do |post|
16
20
  date = DateTime.parse(post[:published_at]) if post[:published_at]
@@ -152,3 +152,85 @@ Feature: Import posts
152
152
  """
153
153
  Something here
154
154
  """
155
+
156
+ Scenario: Import a backup file with the new format
157
+ Given a file named "GhostBackup.json" with:
158
+ """
159
+ {
160
+ "db": [
161
+ {
162
+ "data": {
163
+ "posts": [
164
+ {
165
+ "title": "Welcome to Ghost",
166
+ "slug": "welcome-to-ghost",
167
+ "markdown": "You're live!",
168
+ "featured": 0,
169
+ "status": "published",
170
+ "published_at": "2014-02-21T01:14:57.000Z"
171
+ }, {
172
+ "id": 2,
173
+ "uuid": "1d901d55-c286-427a-8b9b-16a7f37a8a8e",
174
+ "title": "Tengo otro blog",
175
+ "slug": "tengo-otro-blog",
176
+ "markdown": "Y con este ya son tres.",
177
+ "image": null,
178
+ "featured": 0,
179
+ "page": 0,
180
+ "status": "published",
181
+ "language": "en_US",
182
+ "meta_title": null,
183
+ "meta_description": null,
184
+ "author_id": 1,
185
+ "created_at": "2014-02-21T02:31:55.000Z",
186
+ "created_by": 1,
187
+ "updated_at": "2014-02-21T02:31:55.000Z",
188
+ "updated_by": 1,
189
+ "published_at": "2014-02-21T02:31:55.000Z",
190
+ "published_by": 1
191
+ }, {
192
+ "id": 5,
193
+ "title": "Something Software",
194
+ "slug": "something-software",
195
+ "markdown": "Something here",
196
+ "image": null,
197
+ "featured": 0,
198
+ "page": 0,
199
+ "status": "draft",
200
+ "language": "en_US",
201
+ "meta_title": null,
202
+ "meta_description": null,
203
+ "author_id": 1,
204
+ "created_at": "2014-03-04T23:22:48.000Z",
205
+ "created_by": 1,
206
+ "updated_at": "2014-03-11T23:50:56.000Z",
207
+ "updated_by": 1,
208
+ "published_at": null,
209
+ "published_by": null
210
+ }
211
+ ]
212
+ }
213
+ }
214
+ ]
215
+ }
216
+ """
217
+ When I run `jekyll_ghost_importer GhostBackup.json`
218
+ Then a directory named "_posts" should exist
219
+ And the following files should exist:
220
+ | _posts/2014-02-21-welcome-to-ghost.markdown |
221
+ | _posts/2014-02-21-tengo-otro-blog.markdown |
222
+ And the file "_posts/2014-02-21-welcome-to-ghost.markdown" should contain:
223
+ """
224
+ ---
225
+ layout: post
226
+ title: Welcome to Ghost
227
+ date: '2014-02-21 01:14:57'
228
+ ---
229
+
230
+ You're live!
231
+ """
232
+ And a directory named "_drafts" should exist
233
+ And the file "_drafts/something-software.markdown" should contain:
234
+ """
235
+ Something here
236
+ """
@@ -1,3 +1,3 @@
1
1
  module JekyllGhostImporter
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.0
4
+ version: 0.2.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: 2014-07-30 00:00:00.000000000 Z
11
+ date: 2014-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -141,3 +141,4 @@ summary: Import your posts from a ghost backup file.
141
141
  test_files:
142
142
  - features/import_posts.feature
143
143
  - features/support/requires.rb
144
+ has_rdoc: