filter pages with globbing patterns when deploying a site
did
committed Jan 04, 2016
commit a3aaf7e6a7789b1466fea867017ba092f5e9df33
Showing 1
changed file with
12 additions
and 1 deletions
locomotive/wagon/commands/push_sub_commands/push_pages_command.rb b/lib/locomotive/wagon/commands/push_sub_commands/push_pages_command.rb
+12
-1
| @@ | @@ -3,7 +3,10 @@ module Locomotive::Wagon |
| class PushPagesCommand < PushBaseCommand | |
| def entities | |
| - | repositories.page.all |
| + | repositories.page.all.map do |entity| |
| + | next if skip?(entity) |
| + | entity |
| + | end.compact |
| end | |
| def decorate(entity) | |
| @@ | @@ -67,6 +70,14 @@ module Locomotive::Wagon |
| end | |
| end | |
| + | def skip?(entity) |
| + | return false if @only_entities.blank? |
| + | |
| + | _path = entity.template_path[default_locale].gsub('./app/views/pages/', '') |
| + | |
| + | !@only_entities.any? { |regexp| regexp.match(_path) } |
| + | end |
| + | |
| end | |
| end | |