Sha256: f12e09d057b5098bd9583fb20eec67bb69797757eb86bfef86425248e207165f

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 Bytes

Contents

require 'thor'
require 'pieces/config'
require 'pieces/configurable'
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

2 entries across 2 versions & 1 rubygems

Version Path
pieces-0.5.1 lib/pieces/cli.rb
pieces-0.5.0 lib/pieces/cli.rb