Sha256: 21b3ca0c0178926d04c90dc0e230bf90b5df759bf844e6a2e0d218b7bdda2f9c

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

#!/usr/bin/env ruby

require 'gli'
require 'gli/commands/scaffold'

include GLI::App

program_desc 'gli allows you to create the scaffolding for a GLI-powered application'

version GLI::VERSION

switch :v, :desc => 'Be verbose'

switch :n, :desc => 'Dry run; don''t change the disk'

desc 'Root dir of project'
long_desc 'This is the directory where the project''s directory will be made, so if you specify a project name ''foo'' and the root dir of ''.'', the directory ''./foo'' will be created'
flag :r,:root, :default_value => '.'

desc 'Create a new GLI-based project'
long_desc <<EOS
This will create a scaffold command line project that uses GLI
for command line processing.  Specifically, this will create
an executable ready to go, as well as a lib and test directory, all
inside the directory named for your project
EOS
arg_name 'project_name [command[ command]*]'
command [:init,:scaffold] do |c|

  c.switch :e,:ext, :desc => 'Create an ext dir'

  c.switch :notest, :desc => 'Do not create a test or features dir', :negatable => false

  c.switch :force, :desc => 'Overwrite/ignore existing files and directories'

  c.switch :rvmrc, :desc => 'Create an .rvmrc based on your current RVM setup'

  c.action do |g,o,args|
    if args.length < 1
      raise 'You must specify the name of your project'
    end
    GLI::Commands::Scaffold.create_scaffold(g[:r],!o[:notest],o[:e],args[0],args[1..-1],o[:force],g[:n],o[:rvmrc])
  end
end

pre do |global,command,options,args|
  puts "Executing #{command.name}" if global[:v]
  true
end

post do |global,command,options,args|
  puts "Executed #{command.name}" if global[:v]
end
exit run(ARGV)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gli-2.0.0.rc5 bin/gli
gli-2.0.0.rc4 bin/gli
gli-2.0.0.rc3 bin/gli