class Locomotive::Wagon::PullSnippetsCommand
Public Instance Methods
_pull()
click to toggle source
# File lib/locomotive/wagon/commands/pull_sub_commands/pull_snippets_command.rb, line 5 def _pull locales.each do |locale| api_client.snippets.all(locale).each do |snippet| write_snippet(snippet, locale) end end end
write_snippet(snippet, locale = nil)
click to toggle source
# File lib/locomotive/wagon/commands/pull_sub_commands/pull_snippets_command.rb, line 13 def write_snippet(snippet, locale = nil) if (template = snippet.template).present? _template = replace_asset_urls(template) write_to_file(snippet_filepath(snippet, locale), _template) end end
Private Instance Methods
snippet_filepath(snippet, locale)
click to toggle source
# File lib/locomotive/wagon/commands/pull_sub_commands/pull_snippets_command.rb, line 22 def snippet_filepath(snippet, locale) filename = locale == default_locale ? snippet.slug : "#{snippet.slug}.#{locale}" File.join('app', 'views', 'snippets', filename + '.liquid') end