#!/usr/bin/env ruby require "pave.rb" program :name, "Pave" program :version, Pave::VERSION program :description, "Provides a set of command line tools for Concrete5." program :help, "Authors", "Jamon Holmgren , Ryan Linton " default_command :help command :new do |c| c.syntax = "pave new APP_PATH [options]" c.description = "Create a new Concrete5 project." c.action do |args| Pave::Concrete.create(args.first) end end command :update do |c| c.syntax = "pave update" c.description = "Update pave to the latest version." c.action do Pave.update end end command :setup do |c| c.syntax = "pave setup APP_PATH" c.description = "Setup folders for project." c.action do |args| name = args.first || Dir.pwd Pave::Concrete.new(name).set_up_folders end end alias_command :"setup:app", :setup command :"setup:git" do |c| c.syntax = "pave setup:git APP_PATH" c.description = "Setup git repo for project." c.action do |args| name = args.first || Dir.pwd Pave::Concrete.new(name).set_up_git end end command :"setup:permissions" do |c| c.syntax = "pave setup:permissions APP_PATH" c.description = "Setup folder permissions for project." c.action do |args| name = args.first || Dir.pwd Pave::Concrete.new(name).modify_folder_permissions end end alias_command :"setup:chmod", :"setup:permissions" command :"setup:clean" do |c| c.syntax = "pave setup:cleanup APP_PATH" c.description = "Remove unused folders from project." c.action do |args| name = args.first || Dir.pwd Pave::Concrete.new(name).remove_extra_folders end end alias_command :"setup:cleanup", :"setup:clean" command :"virtualhost:create" do |c| c.syntax = "pave virtualhost:create VHOST" c.description = "Setup virtual host for Concrete5 project." c.action do |args| host = args.first || "#{File.basename(Dir.pwd)}.site" Pave::VirtualHost.new(host).create_vhost end end alias_command :"vh:create", :"virtualhost:create" command :"virtualhost:remove" do |c| c.syntax = "pave virtualhost:remove VHOST" c.description = "Delete virtual host." c.action do |args| host = args.first || "#{File.basename(Dir.pwd)}.site" Pave::VirtualHost.new(host).remove_vhost end end alias_command :"vh:remove", :"virtualhost:remove" alias_command :"virtualhost:delete", :"virtualhost:remove" alias_command :"vh:delete", :"virtualhost:remove" command :"virtualhost:backup" do |c| c.syntax = "pave virtualhost:backup" c.description = "Back up virtual hosts file. Restore with `pave virtualhost:restore`." c.action do Pave::VirtualHost.new("").backup_vhost end end alias_command :"vh:backup", :"virtualhost:backup" command :"virtualhost:restore" do |c| c.syntax = "pave virtualhost:restore" c.description = "Restore previously backed up virtual hosts file." c.action do Pave::VirtualHost.new("").restore_vhost end end alias_command :"vh:restore", :"virtualhost:restore" command :"virtualhost:restart" do |c| c.syntax = "pave virtualhost:restart" c.description = "Restarts apache." c.action do Pave::VirtualHost.new("").restart_apache end end alias_command :"vh:restart", :"virtualhost:restart" command :"db:create" do |c| c.syntax = "pave db:create DATABASE" c.description = "Create the Concrete5 project's database." c.action do |args| name = args.first || "#{File.basename(Dir.pwd)}" Pave::Database.create(name) end end command :"db:dump" do |c| c.syntax = "pave db:dump DATABASE" c.description = "Create SQL dump of the project's database." c.action do |args| name = args.first || "#{File.basename(Dir.pwd)}" Pave::Database.new(name).dump end end command :"db:download" do |c| c.syntax = "pave db:download" c.description = "Download the project's live database and replace local database." c.action do |args| say "`db:download` command not implemented yet." end end command :"db:upload" do |c| c.syntax = "pave db:upload" c.description = "Upload the project's local database and replace the live database." c.action do |args| say "`db:upload` command not implemented yet." end end