Class: Locomotive::Wagon::PullThemeAssetsCommand

Inherits:
PullBaseCommand show all
Defined in:
lib/locomotive/wagon/commands/pull_sub_commands/pull_theme_assets_command.rb

Constant Summary

Constants included from AssetsConcern

AssetsConcern::REGEX

Instance Attribute Summary

Attributes inherited from PullBaseCommand

#api_client, #current_site, #env, #path

Instance Method Summary collapse

Methods inherited from PullBaseCommand

#_pull_with_timezone, #clean_attributes, #default_locale, #dump, #instrument, #instrument_base_name, #is_default_locale?, #locales, pull, #pull, #reset_file, #resource_name, #write_to_file

Methods included from AssetsConcern

#replace_asset_urls, #replace_asset_urls_in_hash

Instance Method Details

#_pullObject



5
6
7
8
9
# File 'lib/locomotive/wagon/commands/pull_sub_commands/pull_theme_assets_command.rb', line 5

def _pull
  api_client.theme_assets.all.each do |asset|
    write_theme_asset(asset)
  end
end

#write_theme_asset(asset) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/locomotive/wagon/commands/pull_sub_commands/pull_theme_assets_command.rb', line 11

def write_theme_asset(asset)
  binary = get_asset_binary(asset.url)

  if %w(javascript stylesheet).include?(asset.content_type)
    binary = replace_asset_urls(binary)
  end

  write_to_file(theme_asset_filepath(asset), binary)
end