lib/bones/main.rb
# Parse the command line arguments and store the values for later use by
# the +create+ and +update+ methods.
#
Parse the command line arguments and store the values for later use by
the +create+ and +update+ methods.
Parse the command line arguments and store the values for later use by the + create + and + update + methods .
def parse( args )
    self.data = File.join(mrbones_dir, 'data')
    self.data = ::Bones.path('data') unless test(?d, data)
    self.update = false
    self.verbose = false
    opts = OptionParser.new
    opts.banner << ' project_name'
    opts.separator ''
    opts.on('-u', '--update',
            'update the rake tasks for the project') {self.update = true}
    opts.on('-v', '--verbose',
            'enable verbose output') {self.verbose = true}
    opts.on('-d', '--directory DIRECTORY', String,
            'project directory to create',
            '(defaults to project_name)') {|dir| self.output_dir = dir}
    opts.on('-s', '--skeleton NAME', String,
            'project skeleton to use') do |name|
        path = File.join(mrbones_dir, name)
        if test(?d, path)
          self.data = path 
        elsif test(?d, name)
          self.data = name
        else
          STDOUT.puts "    unknown skeleton '#{name}'"
          exit
        end
      end
    opts.separator ''
    opts.on('--freeze', 'freeze the project skeleton') {freeze; exit}
    opts.on('--unfreeze', 'use the standard project skeleton') {unfreeze; exit}
    opts.on('-i', '--info',
            'report on the project skeleton being used') do
      STDOUT.puts "the project skeleton will be copied from"
      STDOUT.write "    "
      STDOUT.puts data
      exit
    end
    opts.separator ''
    opts.separator 'common options:'
    opts.on_tail( '-h', '--help', 'show this message' ) do
      STDOUT.puts opts
      exit
    end
    opts.on_tail( '--version', 'show version' ) do
      STDOUT.puts "Mr Bones #{::Bones::VERSION}"
      exit
    end
    opts.parse! args
    self.name = args.empty? ? nil : args.join('_')
    if name.nil?
      STDOUT.puts opts
      ::Kernel.abort
    end
    self.output_dir = name if output_dir.nil?
    nil
  end
def parse ( args ) self . data = File . join ( mrbones_dir , 'data' ) self . data = :: Bones . path ( 'data' ) unless test ( ?d , data ) self . update = false self . verbose = false opts = OptionParser . new opts . banner << ' project_name' opts . separator '' opts . on ( '-u' , '--update' , 'update the rake tasks for the project' ) { self . update = true } opts . on ( '-v' , '--verbose' , 'enable verbose output' ) { self . verbose = true } opts . on ( '-d' , '--directory DIRECTORY' , String , 'project directory to create' , '(defaults to project_name)' ) { | dir | self . output_dir = dir } opts . on ( '-s' , '--skeleton NAME' , String , 'project skeleton to use' ) do | name | path = File . join ( mrbones_dir , name ) if test ( ?d , path ) self . data = path elsif test ( ?d , name ) self . data = name else STDOUT . puts "    unknown skeleton '#{name}'" exit end end opts . separator '' opts . on ( '--freeze' , 'freeze the project skeleton' ) { freeze ; exit } opts . on ( '--unfreeze' , 'use the standard project skeleton' ) { unfreeze ; exit } opts . on ( '-i' , '--info' , 'report on the project skeleton being used' ) do STDOUT . puts "the project skeleton will be copied from" STDOUT . write "    " STDOUT . puts data exit end opts . separator '' opts . separator 'common options:' opts . on_tail ( '-h' , '--help' , 'show this message' ) do STDOUT . puts opts exit end opts . on_tail ( '--version' , 'show version' ) do STDOUT . puts "Mr Bones #{::Bones::VERSION}" exit end opts . parse! args self . name = args . empty? ? nil : args . join ( '_' ) if name . nil? STDOUT . puts opts :: Kernel . abort end self . output_dir = name if output_dir . nil? nil end
Parse the command line arguments and store the values for later use by
the +create+ and +update+ methods.
Parse the command line arguments and store the values for later use by the + create + and + update + methods .
# parse the command line arguments
args
<not_specific>