Sha256: 96516095ad08b754b2a6c152ed12c81a1f3b818f112c061f8e505bbde6c11831

Contents?: true

Size: 1.85 KB

Versions: 27

Compression:

Stored size: 1.85 KB

Contents

#!/usr/bin/env ruby
# 1.9 adds realpath to resolve symlinks; 1.8 doesn't
# have this method, so we add it so we get resolved symlinks
# and compatibility
unless File.respond_to? :realpath
  class File #:nodoc:
    def self.realpath path
      return realpath(File.readlink(path)) if symlink?(path)
      path
    end
  end
end

$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib') 

require 'gli'
require 'support/scaffold'
require 'gli_version'

include GLI

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

version GLI::VERSION
desc 'Be verbose'
switch :v

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|
  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

27 entries across 27 versions & 4 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/gli/bin/gli
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/gli/bin/gli
gli-1.6.0 bin/gli
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/gli/bin/gli
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/gli/bin/gli
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/gli/bin/gli
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/gli/bin/gli
gli-1.5.1 bin/gli
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/gli/bin/gli
iisconfig-0.0.1.pre2 build/bundler/ruby/1.9.1/gems/gli-1.4.0/bin/gli
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/gli/bin/gli
iisconfig-0.0.1.pre1 build/bundler/ruby/1.9.1/gems/gli-1.4.0/bin/gli
gli-1.4.0 bin/gli
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/gli/bin/gli
gli-1.3.7 bin/gli
gli-1.3.6 bin/gli
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/gli/bin/gli
gli-1.3.5 bin/gli
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/gli/bin/gli
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/gli/bin/gli