Sha256: 69a230214fab82917ffccfd37a7f108edc667fad2dde8d8c37a6416705ed73bf

Contents?: true

Size: 2 KB

Versions: 1

Compression:

Stored size: 2 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'pave.rb'

class App
  include Methadone::Main
  include Methadone::CLILogging

  main do |command, opt| # Add args you want: |like,so|
    # your program code here
    # You can access CLI options via
    # the options Hash
    info "pave - Command line tools for Concrete5."
    info "By Jamon Holmgren"

    case command.to_sym
    when :new then Pave::Concrete.create(opt)
    when :help then show_help
    when :virtualhost then info "`virtualhost` command not implemented yet."
    when :dbcreate then info "`dbcreate` command not implemented yet."
    when :db then info "`db` command not implemented yet."
    else show_help
    end

    0 # Good!
  end

  def self.show_help
    info "Commands:"
    info "  new <websitename>"
    info "    Downloads and configures a new Concrete5 website."
    info ""
    info "Future commands (not implemented yet):"
    info "  virtualhost <domain>"
    info "    Sets up a new virtualhost on Apache, pointing to the current folder."
    info "  dbcreate <dbname>"
    info "    Sets up a new database on the local MySQL instance."
    info "  db dump"
    info "    Dumps the current database to a local file."
    info "  db download"
    info "    Downloads the remote database and replaces the local database with it."
    info "  db upload"
    info "    Uploads the local database to the remote one, replacing what's there."
  end

  def self.create(name)
    info "Creating #{name}..."
    sleep 2
    info "Done."
  end

  # supplemental methods here

  # Declare command-line interface here

  description "Command line for Concrete5 websites."
  #
  # Accept flags via:
  # on("--flag VAL","Some flag")
  # options[flag] will contain VAL
  #
  # Specify switches via:
  # on("--[no-]switch","Some switch")
  #
  # Or, just call OptionParser methods on opts
  #
  # Require an argument
  arg :command
  #
  # # Make an argument optional
  arg :opt, :optional

  version Pave::VERSION

  use_log_level_option

  go!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pave-0.0.8 bin/pave