Sha256: af5c397df8b88b229f9642a93221c7e126afe5981ed6279048a70ac4055d2192

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require "thor"
require "listen"

module Linner
  class Command < Thor
    include Thor::Actions

    def self.source_root
      File.dirname(__FILE__)
    end

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

    desc "watch", "watch assets"
    def watch
      proc = Proc.new do |modified, added, removed|
        begin
          Linner::Notifier.info{ Linner.perform }
        rescue
          Linner::Notifier.error $!
        end
      end
      proc.call
      listener = Listen.to "app/", "vendor/", "test/", filter: /\.(js|coffee|css|sass|scss)$/
      listener.change &proc
      trap :INT do
        Linner::Notifier.exit
        exit!
      end
      listener.start!
    end

    desc "clean", "clean assets"
    def clean
      FileUtils.rm_rf File.join(Linner.environment.public_folder, "/.")
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linner-0.1.0 lib/linner/command.rb