class Locomotive::Wagon::PushBaseCommand
Public Class Methods
push(api_client, steam_services, content_assets_pusher, remote_site) { |instance| ... }
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 9 def self.push(api_client, steam_services, content_assets_pusher, remote_site) instance = new(api_client, steam_services, content_assets_pusher, remote_site) yield instance if block_given? instance.push end
Public Instance Methods
_push()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 29 def _push entities.each do |entity| decorated = decorate(entity) begin instrument :persist, label: label_for(decorated) persist(decorated) instrument :persist_with_success rescue SkipPersistingException => e instrument :skip_persisting rescue Locomotive::Coal::ServerSideError => e instrument :persist_with_error, message: 'Locomotive Back-office error. Contact your administrator or check your application logs.' raise e rescue Exception => e instrument :persist_with_error, message: e.message raise e end end end
_push_with_timezone()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 23 def _push_with_timezone Time.use_zone(current_site.try(:timezone)) do _push end end
default_locale()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 57 def default_locale current_site.default_locale end
instrument(action = nil, payload = {}, &block)
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 48 def instrument(action = nil, payload = {}, &block) name = ['wagon.push', [*action]].flatten.compact.join('.') ActiveSupport::Notifications.instrument(name, { name: resource_name }.merge(payload), &block) end
locales()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 61 def locales current_site.locales end
only(entities)
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 77 def only(entities) @only_entities = entities.map do |entity_or_filter| Locomotive::Wagon::Glob.new(entity_or_filter.gsub(/\A\//, '')).to_regexp end end
path()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 65 def path File.expand_path(repositories.adapter.options[:path]) end
push()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 15 def push instrument do instrument :start self._push_with_timezone instrument :done end end
resource_name()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 53 def resource_name self.class.name[/::Push(\w+)Command$/, 1].underscore end
with_data()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 69 def with_data @with_data = true end
with_data?()
click to toggle source
# File lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb, line 73 def with_data? !!@with_data end