Module: CPEE::Instantiation

Defined in:
lib/cpee/instantiation.rb

Defined Under Namespace

Modules: Helpers Classes: ContinueTask, HandleInstance, InstantiateGit, InstantiateUrl, InstantiateXML

Constant Summary collapse

SERVER =
File.expand_path(__dir__ + '/../instantiation.xml')

Class Method Summary collapse

Class Method Details

.implementation(opts) ⇒ Object

}}}



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/cpee/instantiation.rb', line 321

def self::implementation(opts)
  opts[:cpee] ||= 'http://localhost:9298/'
  opts[:self] ||= "http#{opts[:secure] ? 's' : ''}://#{opts[:host]}:#{opts[:port]}/"
  opts[:cblist] = Redis.new(path: "/tmp/redis.sock", db: 14)
  Proc.new do
    on resource do
      run InstantiateXML, opts[:cpee], true if post 'xmlsimple'
      on resource 'xml' do
        run InstantiateXML, opts[:cpee], false if post 'xml'
      end
      on resource 'url' do
        run InstantiateUrl, opts[:cpee], opts[:self], opts[:cblist], false if post 'url'
        run InstantiateUrl, opts[:cpee], opts[:self], opts[:cblist], true  if post 'url_info'
      end
      on resource 'git' do
        run InstantiateGit, opts[:cpee], opts[:self], opts[:cblist] if post 'git'
      end
      on resource 'instance' do
        run HandleInstance, opts[:cpee] if post 'instance'
      end
      on resource 'callback' do
        on resource do
          run ContinueTask, opts[:cpee], opts[:cblist] if post
        end
      end
    end
  end
end