trekyll 0.1.2 → 0.1.3

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: 4086d6bef563a8e334ebe6576f0e429173c0b2fe
4
- data.tar.gz: 8a7e7412b033519682425b48072025b6c4283ab5
3
+ metadata.gz: cd4a95998b1ab11f6393422fe10d457a130619ab
4
+ data.tar.gz: 5cacf4ff440001d152d461fe8858fe51e4a865d9
5
5
  SHA512:
6
- metadata.gz: 4a679213321360b4b869e24d213b411b2a95351aa5aea8c36bb3bcf792c68a2a14b9e921c20f76e3b2d979489069a5f0d19bbf748efbde40b950f3b3a1d842db
7
- data.tar.gz: e5d3ffef23905b472a007aacf0ca74a5f0c93d875d997d7785adfd698baf273c393bc48c8f6920984c39470fd542adb6d0128f932cc78d28abddfd41b5a9ef9c
6
+ metadata.gz: 7d4ba0b0f3eed7642c4ba867b15647425af6955f8e4e53119717178ce8fbdb4e198cc14a7da246cb8f4e408ff735088bebdd2f7ceda9c85621ac03ff8869e553
7
+ data.tar.gz: '0289cc3b9455564c9d1fb949124b763c1b16ffb528d3592efa185cb852aeac9aeea4bfa5aa3895e48dcafacb8bfbee17f7e27b1194c1bb3eeef21ce97637b30f'
data/.DS_Store CHANGED
Binary file
@@ -48,9 +48,20 @@ module Trekyll
48
48
  # Globals
49
49
  cards = board.cards
50
50
  lists = board.lists
51
-
51
+ board_custom_fields = ""
52
+
53
+ # Get board plugin fields
54
+ unless board.plugin_data.nil? then
55
+ plugins = board.plugin_data
56
+ plugins.each do |plugin|
57
+ plugin.value.map {|k,fields|
58
+ board_custom_fields = fields
59
+ }
60
+ end
61
+ end
52
62
 
53
63
  counter = 1
64
+ wgtcounter = 1
54
65
  cards.each do |card|
55
66
 
56
67
  # Create Navigation if navigation list name is defined in _nav.yml
@@ -111,7 +122,7 @@ module Trekyll
111
122
  type: #{page_type}
112
123
  title: "#{page_name.sanitize_as_page_title}"
113
124
  date: #{card.created_at}
114
- header: "#{cover_image_url}"
125
+ cover: "#{cover_image_url}"
115
126
  weight: #{counter}
116
127
  permalink: /#{f_name}/
117
128
  ---
@@ -128,17 +139,31 @@ module Trekyll
128
139
  f_name = card.name.sanitize_as_page_name
129
140
  widget_name = "#{f_name}.md"
130
141
 
142
+ # Get cover image
143
+ cover_id = card.cover_image_id
144
+ cover_image_url = ""
145
+ unless card.attachments.nil? then
146
+ card.attachments.each do |attachment|
147
+ if attachment.id == cover_id
148
+ cover_image_url = attachment.url
149
+ end
150
+ end
151
+ puts "Widget cover image: #{cover_image_url} " if cover_image_url != ""
152
+ end
153
+
131
154
  template = File.open(File.join(Dir.pwd, dir_name, widget_name),"w")
132
155
 
133
156
  #Write data into file
134
157
  template.puts <<~DOC.gsub(/\t/, '')
135
158
  ---
136
159
  name: #{card.name}
160
+ weight: #{wgtcounter}
161
+ cover: "#{cover_image_url}"
137
162
  ---
138
163
  DOC
139
164
  template.puts "#{card.desc}"
140
165
  template.close
141
-
166
+ wgtcounter = wgtcounter.next
142
167
  # Create Hard coded Blocks (like carousel's)
143
168
  elsif card.list.name == init_config.blocks then
144
169
 
@@ -191,7 +216,7 @@ module Trekyll
191
216
  end
192
217
  end
193
218
 
194
- # Gget cover image
219
+ # Get cover image
195
220
  cover_id = card.cover_image_id
196
221
  cover_image_url = ""
197
222
  unless card.attachments.nil? then
@@ -205,19 +230,46 @@ module Trekyll
205
230
 
206
231
  end
207
232
 
233
+ # Get card plugin custom fields values (Hash)
234
+ card_field_values = ""
235
+ unless card.plugin_data.nil? then
236
+ card_plugin = card.plugin_data
237
+ card_plugin.each do |plugin|
238
+ plugin.value.map {|k,v| card_field_values = v}
239
+ end
240
+ end
241
+
242
+ # Custom fields for printing in .md file
243
+ custom_fields = board_custom_fields.map do |field|
244
+ # if field type is: text, number, checkbox, date
245
+ if (0..3) === field["t"]
246
+ "#{field["n"]}: \"#{card_field_values[field["id"]]}\""
247
+ # if field type is: dropdown list
248
+ elsif field["t"] === 4
249
+ drpdwn_id = card_field_values[field["id"]]
250
+ hash_with_val = field["o"].find {|element| element["id"] === drpdwn_id}
251
+ "#{field["n"]}: \"#{hash_with_val["value"]}\""
252
+ end
253
+ end
254
+
255
+ #get widget selector from card content and replace with liquid
256
+ content = card.desc.gsub('[>','{{site.widgets| where: "name","')
257
+ content = content.gsub('<]','"}}')
258
+
208
259
  template = File.open(File.join(Dir.pwd, dir_name, file_name),"w")
209
260
  #Write data into file
210
261
  template.puts <<~DOC.gsub(/\t/, '')
211
262
  ---
212
263
  layout: post
213
- header: "#{cover_image_url}"
264
+ cover: "#{cover_image_url}"
214
265
  title: #{card.name}
215
266
  date: #{card.created_at}
216
267
  categories: #{card.list.name.sanitize_as_post_name}
217
268
  tags: #{label_name}
269
+ #{custom_fields.join("\n")}
218
270
  ---
219
271
  DOC
220
- template.puts "#{card.desc}"
272
+ template.puts "#{content}"
221
273
  template.close
222
274
  end
223
275
  end
@@ -1,3 +1,3 @@
1
1
  module Trekyll
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.1.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Canic Interactive
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trelloapi