Sha256: 633dd47c124b422d5df554b30e256fe6a995a119cd9562938807addec2123ac0

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require "thor"
require "listen"

module Linner
  class Command < Thor
    include Thor::Actions
    map "-v" => :version

    def self.source_root
      File.dirname(__FILE__)
    end

    desc "version", "show version"
    def version
      puts Linner::VERSION
    end

    desc "build", "build assets"
    def build
      Notifier.info do
        Linner.perform compile: true
      end
    end

    desc "watch", "watch assets"
    def watch
      trap :INT do
        Notifier.exit
        exit!
      end

      @proc = Proc.new do |modified, added, removed|
        begin
          Notifier.info{ Linner.perform }
        rescue
          Notifier.error $!
        end
      end
      @proc.call

      Listen.to! env.app_folder, env.vendor_folder, env.test_folder do |modified, added, removed|
        @proc.call
      end
    end

    desc "clean", "clean assets"
    def clean
      FileUtils.rm_rf Dir.glob("#{Linner.environment.public_folder}/*")
    end

    desc "new", "create the skeleton of project"
    def new(name)
      directory('templates', name)
      chmod("#{name}/bin/server", 0755)
    end

    private
    def env
      Linner.environment
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
linner-0.2.0 lib/linner/command.rb
linner-0.1.5 lib/linner/command.rb
linner-0.1.4 lib/linner/command.rb