jekyll-import 0.13.0 → 0.14.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
- SHA1:
3
- metadata.gz: 4e855d9fab183b0627590b601d2773b2c03deab6
4
- data.tar.gz: f167d6f4b2a76aa9ccb9d03bf8c263c4f3c0d8e4
2
+ SHA256:
3
+ metadata.gz: 9a826b9d776a9cefe30d3b508c1c43b2df20f547747347dc19977bf874d78990
4
+ data.tar.gz: d71199a3e140201b618fc50dafea0c9e88c1017cc8bc1c641ea0fe74a6df764a
5
5
  SHA512:
6
- metadata.gz: 0de306ccd211d7c972362ba8624ff747f3a73e6c4cac5019cdf0c6c8d3253c1ca0fdcdc077ce2bd7372bac297da0ca8f1f16a927b34c2dd6788893f7cb0fff85
7
- data.tar.gz: 02fed28e00f8920850e0006d814ad6087a3664332679fd929f38b994bc6bd7941a4319710fcfc478cc98f434161a036d0b2b764259aeb5df88166486a9476ad1
6
+ metadata.gz: 24ca8cf7716b0affb0e5f33298728c1c66d3767a18d7997c96c70ee7c36fac23aedc4545277a0f74e3d26478c460a5d28d39a8cc331499cfa6d633871f5124b6
7
+ data.tar.gz: 7817b54acf9f131dfe7ed1896ea616e89d8b0818be7db9a39f42e73be9bb822fc4ce16d68bf0c0d8ffc00700d1e7e271b14db8d5a061567fa53379fcd757fa30
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013 Tom Preston-Werner
3
+ Copyright (c) 2013-present Tom Preston-Werner and the jekyll-import contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -28,5 +28,5 @@ irb> JekyllImport::Importers.const_get(importer_class).run(options_hash)
28
28
 
29
29
  ## Documentation
30
30
 
31
- jekyll-import has its own documentation site, found at http://import.jekyllrb.com.
32
- Dedicated [documentation for each migrator](http://import.jekyllrb.com/docs/home/) is available there.
31
+ jekyll-import has its own documentation site, found at https://import.jekyllrb.com.
32
+ Dedicated [documentation for each migrator](https://import.jekyllrb.com/docs/home/) is available there.
@@ -6,7 +6,7 @@ module JekyllImport
6
6
  include DrupalCommon
7
7
  extend DrupalCommon::ClassMethods
8
8
 
9
- def self.build_query(prefix, types)
9
+ def self.build_query(prefix, types, engine)
10
10
  types = types.join("' OR n.type = '")
11
11
  types = "n.type = '#{types}'"
12
12
 
@@ -6,10 +6,24 @@ module JekyllImport
6
6
  include DrupalCommon
7
7
  extend DrupalCommon::ClassMethods
8
8
 
9
- def self.build_query(prefix, types)
9
+ def self.build_query(prefix, types, engine)
10
10
  types = types.join("' OR n.type = '")
11
11
  types = "n.type = '#{types}'"
12
12
 
13
+ if engine == "postgresql"
14
+ tag_group = <<EOS
15
+ (SELECT STRING_AGG(td.name, '|')
16
+ FROM taxonomy_term_data td, taxonomy_index ti
17
+ WHERE ti.tid = td.tid AND ti.nid = n.nid) AS tags
18
+ EOS
19
+ else
20
+ tag_group = <<EOS
21
+ (SELECT GROUP_CONCAT(td.name SEPARATOR '|')
22
+ FROM taxonomy_term_data td, taxonomy_index ti
23
+ WHERE ti.tid = td.tid AND ti.nid = n.nid) AS 'tags'
24
+ EOS
25
+ end
26
+
13
27
  query = <<EOS
14
28
  SELECT n.nid,
15
29
  n.title,
@@ -18,9 +32,10 @@ module JekyllImport
18
32
  n.created,
19
33
  n.status,
20
34
  n.type,
21
- (SELECT GROUP_CONCAT(td.name SEPARATOR '|') FROM taxonomy_term_data td, taxonomy_index ti WHERE ti.tid = td.tid AND ti.nid = n.nid) AS 'tags'
35
+ #{tag_group}
22
36
  FROM #{prefix}node AS n
23
- LEFT JOIN #{prefix}field_data_body AS fdb ON fdb.entity_id = n.nid AND fdb.entity_type = 'node'
37
+ LEFT JOIN #{prefix}field_data_body AS fdb
38
+ ON fdb.entity_id = n.nid AND fdb.entity_type = 'node'
24
39
  WHERE (#{types})
25
40
  EOS
26
41
 
@@ -12,6 +12,7 @@ module JekyllImport
12
12
 
13
13
  module ClassMethods
14
14
  DEFAULTS = {
15
+ "engine" => "mysql",
15
16
  "password" => "",
16
17
  "host" => "localhost",
17
18
  "prefix" => "",
@@ -19,6 +20,7 @@ module JekyllImport
19
20
  }.freeze
20
21
 
21
22
  def specify_options(c)
23
+ c.option "engine", "--engine [mysql|postgresql]", "Database engine (default: #{DEFAULTS["engine"].inspect})"
22
24
  c.option "dbname", "--dbname DB", "Database name"
23
25
  c.option "user", "--user USER", "Database user name"
24
26
  c.option "password", "--password PW", "Database user's password (default: #{DEFAULTS["password"].inspect})"
@@ -33,12 +35,14 @@ module JekyllImport
33
35
  rubygems
34
36
  sequel
35
37
  mysql2
38
+ pg
36
39
  fileutils
37
40
  safe_yaml
38
41
  ))
39
42
  end
40
43
 
41
44
  def process(options)
45
+ engine = options.fetch("engine")
42
46
  dbname = options.fetch("dbname")
43
47
  user = options.fetch("user")
44
48
  pass = options.fetch("password", DEFAULTS["password"])
@@ -46,9 +50,13 @@ module JekyllImport
46
50
  prefix = options.fetch("prefix", DEFAULTS["prefix"])
47
51
  types = options.fetch("types", DEFAULTS["types"])
48
52
 
49
- db = Sequel.mysql2(dbname, :user => user, :password => pass, :host => host, :encoding => "utf8")
53
+ if engine == "postgresql"
54
+ db = Sequel.postgres(dbname, :user => user, :password => pass, :host => host, :encoding => "utf8")
55
+ else
56
+ db = Sequel.mysql2(dbname, :user => user, :password => pass, :host => host, :encoding => "utf8")
57
+ end
50
58
 
51
- query = self.build_query(prefix, types)
59
+ query = self.build_query(prefix, types, engine)
52
60
 
53
61
  conf = Jekyll.configuration({})
54
62
  src_dir = conf["source"]
@@ -87,7 +95,7 @@ HTML
87
95
 
88
96
  # Get the relevant fields as a hash and delete empty fields
89
97
  data = data.delete_if { |_k, v| v.nil? || v == "" }.each_pair do |_k, v|
90
- (v.is_a? String ? v.force_encoding("UTF-8") : v)
98
+ ((v.is_a? String) ? v.force_encoding("UTF-8") : v)
91
99
  end
92
100
 
93
101
  # Construct a Jekyll compatible file name
@@ -126,7 +134,7 @@ HTML
126
134
  end
127
135
  end
128
136
 
129
- def build_query(_prefix, _types)
137
+ def build_query(_prefix, _types, _engine)
130
138
  raise "The importer you are trying to use does not implement the get_query() method."
131
139
  end
132
140
 
@@ -1,3 +1,3 @@
1
1
  module JekyllImport
2
- VERSION = "0.13.0".freeze
2
+ VERSION = "0.14.0".freeze
3
3
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.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: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2018-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: jekyll
14
+ name: fastercsv
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.4'
19
+ version: '0'
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
- version: '1.4'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: fastercsv
28
+ name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,47 +53,47 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 10.1.0
61
+ version: '4.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 10.1.0
68
+ version: '4.2'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rdoc
70
+ name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 4.0.0
75
+ version: '12.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 4.0.0
82
+ version: '12.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: activesupport
84
+ name: rdoc
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.2'
89
+ version: 4.0.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.2'
96
+ version: 4.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: redgreen
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.2'
111
- - !ruby/object:Gem::Dependency
112
- name: shoulda
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '3.5'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '3.5'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: rr
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -137,75 +123,75 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: '1.0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: simplecov
126
+ name: rubocop
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
- - - "~>"
129
+ - - '='
144
130
  - !ruby/object:Gem::Version
145
- version: '0.7'
131
+ version: '0.51'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
- - - "~>"
136
+ - - '='
151
137
  - !ruby/object:Gem::Version
152
- version: '0.7'
138
+ version: '0.51'
153
139
  - !ruby/object:Gem::Dependency
154
- name: simplecov-gem-adapter
140
+ name: shoulda
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - "~>"
158
144
  - !ruby/object:Gem::Version
159
- version: 1.0.1
145
+ version: '3.5'
160
146
  type: :development
161
147
  prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
164
150
  - - "~>"
165
151
  - !ruby/object:Gem::Version
166
- version: 1.0.1
152
+ version: '3.5'
167
153
  - !ruby/object:Gem::Dependency
168
- name: rubocop
154
+ name: simplecov
169
155
  requirement: !ruby/object:Gem::Requirement
170
156
  requirements:
171
- - - ">="
157
+ - - "~>"
172
158
  - !ruby/object:Gem::Version
173
- version: '0'
159
+ version: '0.7'
174
160
  type: :development
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
178
- - - ">="
164
+ - - "~>"
179
165
  - !ruby/object:Gem::Version
180
- version: '0'
166
+ version: '0.7'
181
167
  - !ruby/object:Gem::Dependency
182
- name: sequel
168
+ name: simplecov-gem-adapter
183
169
  requirement: !ruby/object:Gem::Requirement
184
170
  requirements:
185
171
  - - "~>"
186
172
  - !ruby/object:Gem::Version
187
- version: '3.42'
173
+ version: 1.0.1
188
174
  type: :development
189
175
  prerelease: false
190
176
  version_requirements: !ruby/object:Gem::Requirement
191
177
  requirements:
192
178
  - - "~>"
193
179
  - !ruby/object:Gem::Version
194
- version: '3.42'
180
+ version: 1.0.1
195
181
  - !ruby/object:Gem::Dependency
196
- name: htmlentities
182
+ name: behance
197
183
  requirement: !ruby/object:Gem::Requirement
198
184
  requirements:
199
185
  - - "~>"
200
186
  - !ruby/object:Gem::Version
201
- version: '4.3'
187
+ version: '0.3'
202
188
  type: :development
203
189
  prerelease: false
204
190
  version_requirements: !ruby/object:Gem::Requirement
205
191
  requirements:
206
192
  - - "~>"
207
193
  - !ruby/object:Gem::Version
208
- version: '4.3'
194
+ version: '0.3'
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: hpricot
211
197
  requirement: !ruby/object:Gem::Requirement
@@ -221,19 +207,19 @@ dependencies:
221
207
  - !ruby/object:Gem::Version
222
208
  version: '0.8'
223
209
  - !ruby/object:Gem::Dependency
224
- name: pg
210
+ name: htmlentities
225
211
  requirement: !ruby/object:Gem::Requirement
226
212
  requirements:
227
213
  - - "~>"
228
214
  - !ruby/object:Gem::Version
229
- version: '0.12'
215
+ version: '4.3'
230
216
  type: :development
231
217
  prerelease: false
232
218
  version_requirements: !ruby/object:Gem::Requirement
233
219
  requirements:
234
220
  - - "~>"
235
221
  - !ruby/object:Gem::Version
236
- version: '0.12'
222
+ version: '4.3'
237
223
  - !ruby/object:Gem::Dependency
238
224
  name: mysql2
239
225
  requirement: !ruby/object:Gem::Requirement
@@ -249,35 +235,35 @@ dependencies:
249
235
  - !ruby/object:Gem::Version
250
236
  version: '0.3'
251
237
  - !ruby/object:Gem::Dependency
252
- name: sqlite3
238
+ name: open_uri_redirections
253
239
  requirement: !ruby/object:Gem::Requirement
254
240
  requirements:
255
- - - "~>"
241
+ - - ">="
256
242
  - !ruby/object:Gem::Version
257
- version: 1.3.13
243
+ version: '0'
258
244
  type: :development
259
245
  prerelease: false
260
246
  version_requirements: !ruby/object:Gem::Requirement
261
247
  requirements:
262
- - - "~>"
248
+ - - ">="
263
249
  - !ruby/object:Gem::Version
264
- version: 1.3.13
250
+ version: '0'
265
251
  - !ruby/object:Gem::Dependency
266
- name: behance
252
+ name: pg
267
253
  requirement: !ruby/object:Gem::Requirement
268
254
  requirements:
269
255
  - - "~>"
270
256
  - !ruby/object:Gem::Version
271
- version: '0.3'
257
+ version: '0.12'
272
258
  type: :development
273
259
  prerelease: false
274
260
  version_requirements: !ruby/object:Gem::Requirement
275
261
  requirements:
276
262
  - - "~>"
277
263
  - !ruby/object:Gem::Version
278
- version: '0.3'
264
+ version: '0.12'
279
265
  - !ruby/object:Gem::Dependency
280
- name: unidecode
266
+ name: reverse_markdown
281
267
  requirement: !ruby/object:Gem::Requirement
282
268
  requirements:
283
269
  - - ">="
@@ -291,21 +277,35 @@ dependencies:
291
277
  - !ruby/object:Gem::Version
292
278
  version: '0'
293
279
  - !ruby/object:Gem::Dependency
294
- name: open_uri_redirections
280
+ name: sequel
295
281
  requirement: !ruby/object:Gem::Requirement
296
282
  requirements:
297
- - - ">="
283
+ - - "~>"
298
284
  - !ruby/object:Gem::Version
299
- version: '0'
285
+ version: '3.42'
300
286
  type: :development
301
287
  prerelease: false
302
288
  version_requirements: !ruby/object:Gem::Requirement
303
289
  requirements:
304
- - - ">="
290
+ - - "~>"
305
291
  - !ruby/object:Gem::Version
306
- version: '0'
292
+ version: '3.42'
307
293
  - !ruby/object:Gem::Dependency
308
- name: reverse_markdown
294
+ name: sqlite3
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: 1.3.13
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: 1.3.13
307
+ - !ruby/object:Gem::Dependency
308
+ name: unidecode
309
309
  requirement: !ruby/object:Gem::Requirement
310
310
  requirements:
311
311
  - - ">="
@@ -395,7 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
395
395
  version: '0'
396
396
  requirements: []
397
397
  rubyforge_project:
398
- rubygems_version: 2.6.13
398
+ rubygems_version: 2.7.4
399
399
  signing_key:
400
400
  specification_version: 2
401
401
  summary: Import command for Jekyll (static site generator).