Class: Roger::Release::Processors::UrlRelativizer

Inherits:
Base
  • Object
show all
Defined in:
lib/roger/release/processors/url_relativizer.rb

Overview

URL relativizer processor The relativizer can be used to rewrite absolute paths in attributes to relative paths during release.

Instance Attribute Summary

Attributes inherited from Base

#options, #release

Instance Method Summary collapse

Methods inherited from Base

#call, #name

Instance Method Details

#default_optionsObject



11
12
13
14
15
16
17
# File 'lib/roger/release/processors/url_relativizer.rb', line 11

def default_options
  {
    url_attributes: %w(src href action),
    match: ["**/*.html"],
    skip: []
  }
end

#performObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/roger/release/processors/url_relativizer.rb', line 19

def perform
  log_call

  @resolver = Roger::Resolver.new(release.build_path)

  relativize_attributes_in_files(
    release,
    options[:url_attributes],
    release.get_files(options[:match], options[:skip])
  )
end