bin/jacana in jacana-0.1.2 vs bin/jacana in jacana-0.1.3

- old
+ new

@@ -1,6 +1,7 @@ #!/usr/bin/env ruby +# coding: utf-8 require "jacana" require "optparse" require 'fileutils' @@ -15,11 +16,10 @@ rewrite = nil php_configfile = '.rewriterule' - opt = OptionParser.new opt.on('-d VAL') do |docroot| options[:Doc_Root] = docroot end @@ -37,15 +37,43 @@ system("curl -sS https://getcomposer.org/installer | php") system("mv composer.phar /usr/local/bin/composer") end end +opt.on('-v') do + require "lib/commands/version" + puts "Version: #{Jacana::VERSION_P} - #{Jacana::VERSION_NAME} @ #{Jacana::AUTHOR}" + exit +end + + +opt.on('-h') do |help| + require "lib/commands/help" + Jacana::Help.new + exit +end + +opt.on('-i VAL,PATH,NAME') do |package| + require "lib/commands/install" + package = package.split(",") + i = Installer::Handler.new + case package[0] + when 'composer' + i.get_composer + when 'laravel' + i.get_laravel(package[1], package[2]) + when '' + puts "Command error. Please check jacana -h" + end + exit +end + opt.on('--FRAMEWORK=PATH,NAME,VAL') do |framework| framework = framework.split(",") case framework[2] when 'laravel' - if ! File.exist?('/usr/local/bin/composer') + if !File.exist?('/usr/local/bin/composer') system("curl -sS https://getcomposer.org/installer | php") system("mv composer.phar /usr/local/bin/composer") end cd(framework[0], :verbose => false)