Sha256: 8aad305e8acb4c88868e649195f427014e5ab6f9971742668908e8eadbd19e4f

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 Bytes

Contents

require 'thor'
require 'pieces/builder'
require 'pieces/generator'

module Pieces
  class CLI < Thor
    desc 'init DIR', 'create new pieces app in DIR'
    def init(path = '.')
      print "Placing new pieces in #{path}... "
      Pieces::Generator.init(path: path)
      puts 'done.'
    end

    desc 'build DIR', 'build pieces in DIR'
    def build(path = '.')
      print "Building pieces into #{path}... "
      Pieces::Builder.build(path: path)
      puts 'done.'
    end

    map %w(s) => :server

    desc 'server DIR', 'serve application in DIR'
    def server(path = Dir.pwd)
      puts "Serving pieces from #{path}/build... "
      Pieces::Server.start(path: path)
    end

    map %w(--version -v) => :version

    desc '--version', 'get pieces version'
    def version
      puts "pieces v#{Pieces::VERSION}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pieces-0.4.5 lib/pieces/cli.rb
pieces-0.4.4 lib/pieces/cli.rb
pieces-0.4.3 lib/pieces/cli.rb