Sha256: 2547bcc55b767c8e7a55c66419b165a473dab7a8edc4bd146bbf27219f556ea6
Contents?: true
Size: 1.49 KB
Versions: 4
Compression:
Stored size: 1.49 KB
Contents
module Templater module CLI class Manifold def initialize(destination_root, manifold, name, version) @destination_root, @manifold, @name, @version = destination_root, manifold, name, version end def version puts @version exit end def self.run(destination_root, manifold, name, version, arguments) if arguments.first and not arguments.first =~ /^-/ and not arguments.first == "help" generator_name = arguments.shift if manifold.generator(generator_name) Generator.new(generator_name, destination_root, manifold, name, version).run(arguments) else Manifold.new(destination_root, manifold, name, version).run(arguments) end else Manifold.new(destination_root, manifold, name, version).run(arguments) end end def run(arguments) @options = Templater::CLI::Parser.parse(arguments) self.help end # outputs a helpful message and quits def help puts "Usage: #{@name} generator_name [options] [args]" puts '' puts @manifold.desc puts '' puts 'Available Generators' @manifold.public_generators.each do |name, generator| print " " print name.to_s.ljust(33) print generator.desc.to_a.first.chomp if generator.desc print "\n" end puts @options[:opts] puts '' exit end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
templater-0.1.1 | lib/templater/cli/manifold.rb |
templater-0.1.3 | lib/templater/cli/manifold.rb |
templater-0.1.2 | lib/templater/cli/manifold.rb |
templater-0.1.4 | lib/templater/cli/manifold.rb |