module Repackage::EmbeddableInterface

Public Class Methods

routes?() click to toggle source
#

Repackage::EmbeddableInterface.routes?

Define all legal routes via this Array. This Array will then be used to add more routes to any sinatra-application that needs it.

#
# File lib/repackage/www/embeddable_interface.rb, line 17
def self.routes?
  [
    'repackage',
    'repackage/*'
  ]
end

Public Instance Methods

return_sinatra_repackage() click to toggle source
#

return_sinatra_repackage

#
# File lib/repackage/www/embeddable_interface.rb, line 27
def return_sinatra_repackage
  'Please provide the name of the target archive that is to '\
  'be repackaged.'
end
return_sinatra_repackage_with_arguments( i = web_params_as_string? ) click to toggle source
#

return_sinatra_repackage_with_arguments

#
# File lib/repackage/www/embeddable_interface.rb, line 35
def return_sinatra_repackage_with_arguments(
    i = web_params_as_string?
  )
  i = i.dup if i.frozen?
  _ = ''.dup
  _ << 'The parameters given were: <b style="darkblue">'+i+'</b><br>'
  i.prepend('/') unless i.start_with? '/'
  if File.exist? i
    _ << 'Repackaging this file next.<br>'
    result = ::Repackage.new(i) {
      :do_not_delete_the_old_source
    }
    _ << 'The archive is now available at: <b>'+
          result.the_final_location_is_at?.to_s+
          '</b>'
  else
    _ << 'No file exists at '+i
  end
  return _
end