Class: RhetButler::ResourceLocalizer

Inherits:
Object
  • Object
show all
Defined in:
lib/rhet-butler/resource-localizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#filesObject

Returns the value of attribute files.



6
7
8
# File 'lib/rhet-butler/resource-localizer.rb', line 6

def files
  @files
end

#source_uriObject

Returns the value of attribute source_uri.



6
7
8
# File 'lib/rhet-butler/resource-localizer.rb', line 6

def source_uri
  @source_uri
end

#store_logObject

Returns the value of attribute store_log.



6
7
8
# File 'lib/rhet-butler/resource-localizer.rb', line 6

def store_log
  @store_log
end

#target_pathObject

Returns the value of attribute target_path.



6
7
8
# File 'lib/rhet-butler/resource-localizer.rb', line 6

def target_path
  @target_path
end

Instance Method Details

#go!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rhet-butler/resource-localizer.rb', line 8

def go!
  app_url = "http://example.com/"
  transform_queue = Stasis::TransformQueue.new
  transform_queue.loader = Stasis::HTTPLoader.new
  transform_queue.mapping = Stasis::ResourceMapping.new
  transform_queue.mapping.default_uri = app_url
  transform_queue.writer = Stasis::ValiseWriter.new(@files)
  transform_queue.writer.store_log = store_log

  target_uri = transform_queue.mapping.target_link_for(source_uri)
  transform_queue.add_mapping(nil, source_uri, target_uri, target_path)
  transform_queue.go
end