Sha256: 986506a8c9f21fc05c043717a9ac8dd6508306690fdaf4785b140e4623b9cc4a

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

#!/usr/bin/ruby
$: << File.expand_path(File.dirname(__FILE__) + '/../lib') 

require 'gli'
require 'support/scaffold'

include GLI

desc 'Be verbose'
switch :v

desc 'Show version'
switch :version

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

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'
default_value '.'
flag [:r,:root]

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.desc 'Create an ext dir'
  c.switch [:e,:ext]

  c.desc 'Do not create a test dir'
  c.switch [:notest]

  c.desc 'Overwrite/ignore existing files and directories'
  c.switch [:force]

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

pre do |global,command,options,args|
  if (!command || command.name == :help) && global[:version]
    puts "#{$0} v#{GLI::VERSION}"
    false
  else
    puts "Executing #{command.name}" if global[:v]
    true
  end
end

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

run(ARGV)

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
davetron5000-gli-0.2.1 bin/gli
davetron5000-gli-0.2.3 bin/gli
bbcloud-0.8.1 lib/bbcloud/vendor/gli-1.1.2/bin/gli
gli-1.1.2 bin/gli
gli-1.1.1 bin/gli
gli-1.1.0 bin/gli
gli-1.0.0 bin/gli
gli-0.3.1 bin/gli
gli-0.3.0 bin/gli
gli-0.2.1 bin/gli
gli-0.2.3 bin/gli