Class: Xing::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/xing/cli.rb

Defined Under Namespace

Modules: Generators

Constant Summary collapse

SUPPORTED_VERBS =
%w{new}
"Xing Framework new project and code generator.  See http://github.com/XingFramework/xing-framework for platform info.\n\nUsage:\nxing [options] <command> [command options]\n\nSupported commands currently include: \#{SUPPORTED_VERBS.join(\", \")}\n\nExamples:\nxing new fabulous   # Generates a new Xing Framework project called 'fabulous'\n\nGlobal Options:\n"

Instance Method Summary collapse

Instance Method Details

#handle_cliObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/xing/cli.rb', line 23

def handle_cli
  Trollop::options do
    banner BANNER
    framework_version =
      begin
        Gem::Specification.find_by_name("xing-framework").version
      rescue Gem::LoadError
        "<developement-version>"
      end
    version "Xing CLI #{framework_version} (c) 2015 Logical Reality Design, Inc."
    stop_on SUPPORTED_VERBS
  end

  command = ARGV.shift
  case command
  when 'new'
    opts = Trollop::options do
      opt :cms, "Include content management architecture. (coming soon)"
      stop_on ['name']
    end
    name = ARGV.shift
    Trollop::die "Please specify a project name with 'xing new <name>'" unless name
    Trollop::die "The CMS option is not yet implemented." if opts[:cms]
    Xing::CLI::Generators::NewProject.new.generate(opts.merge({:name => name}))
  else
    Trollop::die "Unknown command.  Supported commands are [" + SUPPORTED_VERBS.join(" ") + "]"
  end

end