Class: Locomotive::Wagon::PushThemeAssetsCommand
- Inherits:
-
PushBaseCommand
show all
- Defined in:
- lib/locomotive/wagon/commands/push_sub_commands/push_theme_assets_command.rb
Instance Attribute Summary
#api_client, #content_assets_pusher, #filter, #remote_site, #steam_services
Instance Method Summary
collapse
#_push, #_push_with_timezone, #default_locale, #instrument, #locales, #only, #path, push, #push, #resource_name, #with_data, #with_data?
Instance Method Details
#decorate(entity) ⇒ Object
14
15
16
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_theme_assets_command.rb', line 14
def decorate(entity)
entity end
|
#entities ⇒ Object
7
8
9
10
11
12
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_theme_assets_command.rb', line 7
def entities
repositories.theme_asset.all.map do |entity|
next if skip?(entity)
decorated = ThemeAssetDecorator.new(entity)
end.compact.sort { |a, b| a.priority <=> b.priority }
end
|
#label_for(decorated_entity) ⇒ Object
33
34
35
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_theme_assets_command.rb', line 33
def label_for(decorated_entity)
decorated_entity.relative_url
end
|
#persist(decorated_entity) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/locomotive/wagon/commands/push_sub_commands/push_theme_assets_command.rb', line 18
def persist(decorated_entity)
return if decorated_entity.realname.starts_with?('_')
precompile(decorated_entity)
resource = if (_entity = remote_entity(decorated_entity)).nil?
api_client.theme_assets.create(decorated_entity.to_hash)
else
raise SkipPersistingException.new if same?(decorated_entity, _entity)
api_client.theme_assets.update(_entity._id, decorated_entity.to_hash)
end
register_url(resource)
end
|