Sha256: 5a9d9851f21d73ea149425bca904a6fa04156348932ae6f25fd6aebb5c6a0836

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby

# angular_init (short-name: ngi)
# Copyright 2015 Joshua Beam
# github.com/joshbeam/angular_init
# MIT License

# Ngi is the main module (src/ruby/angular_init.rb)
require_relative '../lib/ngi'
require_relative '../lib/ngi/utils/utils'

# This class is just a wrapper for the main process
# of ngi
class Parser
  def self.parse(args)
    p = Utils::CommandParser.new do |parser|
      config = Ngi::Delegate::Configure.new.from_json
      components = config['global']['components'].collect { |t| t['name'] }
      types = Ngi::UserInput.new(valid_inputs: components)

      parser.name = 'ngi'
      parser.version = Ngi::VERSION
      parser.banner << "\n(<command> can be one of the following)"

      parser.on(types.valid_inputs, 'Create a new component') do |command|
        Ngi::Delegate::Generator.run(type: command, config: config)
      end

      parser.on(['-o', '--options'], 'Configure ngi') do
        Ngi::Delegate::Configure.run
      end
    end

    p.parse(args)
  end
end

Parser.parse(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ngi-0.2.2 bin/ngi