Sha256: 31ce82b5118384071850701aa0000623826785accf1c21ac6ed7ffc1822a3cad

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/env ruby

require "jacana"
require "optparse"
require 'fileutils'

include FileUtils

options = {
    :Doc_Root => './',
    :Port => 1453,
    :Php_Path => '/usr/bin/env',
}

opt = OptionParser.new

opt.on('-d VAL') do |docroot|
  options[:Doc_Root] = docroot
end

opt.on('-p VAL') do |port|
  options[:Port] = port.to_i
end

opt.on('-s VAL') do |php_path|
  options[:Php_Path] = php_path.to_s
end

opt.on('--FRAMEWORK=PATH,NAME,VAL') do |framework|
  framework = framework.split(",")
  case framework[2]
    when 'laravel'
      cd(framework[0], :verbose => false)
      system("composer create-project laravel/laravel #{framework[1]} --prefer-dist")
      system("chmod -R 0777 #{framework[0]}/#{framework[1]}")
      system("clear")
      puts "Laravel project is created !"
      options[:Doc_Root] = framework[0] + "/" + framework[1] + "/public"
  end
end

opt.parse!

puts "Jagana PHP Handler is Started !"

jacana_server = Jacana::JacanaHttpServer.new options

trap 'INT' do
  jacana_server.shutdown
end

jacana_server.start

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jacana-0.1.0 bin/jacana
jacana-0.0.9 bin/jacana