locomotivecms_mounter 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd805b0725f79d360e2dca56b557700f21345f3f
4
- data.tar.gz: f437f1070d2c438ae866e4bd686b1a5d32407103
3
+ metadata.gz: c5530907ada5da361eda74b2634561b53f9d2847
4
+ data.tar.gz: 2df3cb218d697e6494e568517085961ddb239a82
5
5
  SHA512:
6
- metadata.gz: c65468b6d09942dc0f7628990530d74a5f0467da2e3e6b77479526cade925d1e77c0a563c9d22494f625e8ef531f20ba7f8e4217504455381f6a05ba2a5d2ece
7
- data.tar.gz: 223bdc863a4e1acc7dcac5f075807441c81599a4ec292ab3126a94269052335c0212b86162eb08292b16eb95c8d004734ce4b64ee7d0228501d1fa03f4376306
6
+ metadata.gz: f94b477a217c2c01440f4eb63d519e5bdf95b1470466f1e696fc7060bfdd02225763a0331c51290e5ae3a224dae883f43ce5949b30c0b77b5e1459e2ec8b118c
7
+ data.tar.gz: 857751a0aab81a19279870a39c47a91514f21621b4fd37158a45176e2c8488235646ca2f282c948f2cbac467b0bc84c99f8d535b706cfaca3a44e0191abca734
@@ -139,7 +139,7 @@ module Locomotive
139
139
  def to_hash(translations = true)
140
140
  hash = translations ? self.attributes_with_translations : self.attributes
141
141
 
142
- hash.delete_if { |k, v| v.blank? }
142
+ hash.delete_if { |k, v| (!v.is_a?(FalseClass) && v.blank?) }
143
143
 
144
144
  hash.each { |k, v| hash[k] = v.to_s if v.is_a?(Symbol) }
145
145
 
@@ -15,6 +15,7 @@ module Locomotive
15
15
  field :template, localized: true
16
16
  field :handle
17
17
  field :listed, default: false
18
+ field :searchable
18
19
  field :templatized, default: false
19
20
  field :content_type
20
21
  field :published, default: true
@@ -38,6 +39,7 @@ module Locomotive
38
39
  alias :listed? :listed
39
40
  alias :published? :published
40
41
  alias :templatized? :templatized
42
+ alias :searchable? :searchable
41
43
 
42
44
  ## methods ##
43
45
 
@@ -331,7 +333,7 @@ module Locomotive
331
333
  # @return [ String ] The YAML version of the page
332
334
  #
333
335
  def to_yaml
334
- fields = %w(title slug redirect_url redirect_type handle published listed cache_strategy response_type position seo_title meta_description meta_keywords)
336
+ fields = %w(title slug redirect_url redirect_type handle published listed searchable cache_strategy response_type position seo_title meta_description meta_keywords)
335
337
 
336
338
  _attributes = self.attributes.delete_if do |k, v|
337
339
  !fields.include?(k.to_s) || (!v.is_a?(FalseClass) && v.blank?)
@@ -361,7 +363,7 @@ module Locomotive
361
363
  # @return [ Hash ] The params
362
364
  #
363
365
  def to_params
364
- params = self.filter_attributes %w(title parent_id slug redirect_url redirect_type handle listed published cache_strategy
366
+ params = self.filter_attributes %w(title parent_id slug redirect_url redirect_type handle listed published searchable cache_strategy
365
367
  response_type position templatized seo_title meta_description meta_keywords)
366
368
 
367
369
  # slug
@@ -392,7 +394,7 @@ module Locomotive
392
394
  # @return [ Hash ] The safe params
393
395
  #
394
396
  def to_safe_params
395
- fields = %w(title slug listed published handle cache_strategy
397
+ fields = %w(title slug listed published searchable handle cache_strategy
396
398
  redirect_url response_type templatized content_type_id position
397
399
  seo_title meta_description meta_keywords)
398
400
 
@@ -2,7 +2,7 @@
2
2
  module Locomotive
3
3
  module Mounter #:nodoc
4
4
 
5
- VERSION = '1.3.1'
5
+ VERSION = '1.3.2'
6
6
 
7
7
  end
8
8
  end
@@ -5,15 +5,14 @@ module Locomotive
5
5
 
6
6
  class Base
7
7
 
8
- # @@buffer_enabled = false
9
- # @@buffer_log = ''
10
-
11
8
  include Locomotive::Mounter::Utils::Output
12
9
 
13
10
  attr_accessor :mounting_point, :runner
14
11
 
15
12
  delegate :default_locale, :locales, :site, :sprockets, to: :mounting_point
16
13
 
14
+ delegate :content_assets_writer, to: :runner
15
+
17
16
  delegate :force?, to: :runner
18
17
 
19
18
  def initialize(mounting_point, runner)
@@ -97,7 +96,7 @@ module Locomotive
97
96
  # data.each do |attribute, errors|
98
97
  # self.log " #{attribute} => #{[*errors].join(', ')}\n".colorize(color: :red)
99
98
  # end if data.respond_to?(:keys)
100
- # nil
99
+ # nil # DEBUG
101
100
  end
102
101
  end
103
102
 
@@ -134,7 +133,7 @@ module Locomotive
134
133
  # data.each do |attribute, errors|
135
134
  # self.log "\t\t #{attribute} => #{[*errors].join(', ')}".colorize(color: :red)
136
135
  # end if data.respond_to?(:keys)
137
- # nil
136
+ # nil # DEBUG
138
137
  end
139
138
  end
140
139
 
@@ -183,22 +182,14 @@ module Locomotive
183
182
  def replace_content_assets!(source)
184
183
  return source if source.blank?
185
184
 
186
- source.to_s.gsub(/\/samples\/.*\.[a-zA-Z0-9]+/) do |match|
187
- url = self.runner.content_assets_writer.write(match)
185
+ source.to_s.gsub(/\/samples\/\S*\.[a-zA-Z0-9]+/) do |match|
186
+ url = self.content_assets_writer.write(match)
188
187
  url || match
189
188
  end
190
189
  end
191
190
 
192
191
  protected
193
192
 
194
- # def truncate(string, length = 50, separator = '[...]')
195
- # if string.length > length
196
- # string[0..(length - separator.length)] + separator
197
- # else
198
- # string
199
- # end
200
- # end
201
-
202
193
  def response_to_status(response)
203
194
  response ? :success : :error
204
195
  end
@@ -222,102 +213,6 @@ module Locomotive
222
213
  end
223
214
  end
224
215
 
225
- # # Print the the title for each kind of resource.
226
- # #
227
- # def output_title
228
- # msg = "* Pushing #{self.class.name.gsub(/Writer$/, '').demodulize}"
229
- # self.log msg.colorize(background: :white, color: :black) + "\n"
230
- # end
231
-
232
- # # Print the current locale.
233
- # #
234
- # def output_locale
235
- # locale = Locomotive::Mounter.locale.to_s
236
- # self.log " #{locale.colorize(background: :blue, color: :white)}\n"
237
- # end
238
-
239
- # # Print the message about the creation / update of a resource.
240
- # #
241
- # # @param [ Object ] resource The resource (Site, Page, ...etc).
242
- # #
243
- # def output_resource_op(resource)
244
- # self.log self.resource_message(resource)
245
- # end
246
-
247
- # # Print the message about the creation / update of a resource.
248
- # #
249
- # # @param [ Object ] resource The resource (Site, Page, ...etc).
250
- # # @param [ Symbol ] status :success, :error, :skipped
251
- # # @param [ String ] errors The error messages
252
- # #
253
- # def output_resource_op_status(resource, status = :success, errors = nil)
254
- # status_label = case status
255
- # when :success then 'done'.colorize(color: :green)
256
- # when :error then 'error'.colorize(color: :red)
257
- # when :skipped then 'skipped'.colorize(color: :magenta)
258
- # when :same then 'same'.colorize(color: :magenta)
259
- # when :not_translated then 'not translated (itself or parent)'.colorize(color: :yellow)
260
- # end
261
-
262
- # spaces = '.' * (80 - self.resource_message(resource).size)
263
- # self.log "#{spaces}[#{status_label}]\n"
264
-
265
- # if errors && status == :error
266
- # self.log "#{errors.colorize(color: :red)}\n"
267
- # end
268
- # end
269
-
270
- # # Return the message about the creation / update of a resource.
271
- # #
272
- # # @param [ Object ] resource The resource (Site, Page, ...etc).
273
- # #
274
- # # @return [ String ] The message
275
- # #
276
- # def resource_message(resource)
277
- # op_label = resource.persisted? ? 'updating': 'creating'
278
- # " #{op_label} #{truncate(resource.to_s)}"
279
- # end
280
-
281
- # # Log a message to the console or the logger depending on the options
282
- # # of the runner. Info is the log level if case the logger has been chosen.
283
- # #
284
- # # @param [ String ] message The message to log.
285
- # #
286
- # def log(message)
287
- # # puts "buffer ? #{@@buffer_enabled.inspect}"
288
- # if @@buffer_enabled
289
- # @@buffer_log << message
290
- # else
291
- # if self.runner.parameters[:console]
292
- # print message
293
- # else
294
- # Mounter.logger.info message #.gsub(/\n$/, '')
295
- # end
296
- # end
297
- # end
298
-
299
- # # Put in a buffer the logs generated when executing the block.
300
- # # It means that they will not output unless the flush_log_buffer
301
- # # method is called.
302
- # #
303
- # # @return [ Object ] Thee value returned by the call of the block
304
- # #
305
- # def buffer_log(&block)
306
- # @@buffer_log = ''
307
- # @@buffer_enabled = true
308
- # if block_given?
309
- # block.call.tap { @@buffer_enabled = false }
310
- # end
311
- # end
312
-
313
- # # Flush the logs put in a buffer.
314
- # #
315
- # def flush_log_buffer
316
- # @@buffer_enabled = false
317
- # self.log(@@buffer_log)
318
- # @@buffer_log = ''
319
- # end
320
-
321
216
  end
322
217
 
323
218
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms_mounter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-24 00:00:00.000000000 Z
11
+ date: 2013-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt