Class: Linner::Command

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/linner/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



9
10
11
# File 'lib/linner/command.rb', line 9

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#buildObject



19
20
21
22
23
# File 'lib/linner/command.rb', line 19

def build
  Notifier.info do
    Linner.perform compile: true
  end
end

#cleanObject



47
48
49
# File 'lib/linner/command.rb', line 47

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

#new(name) ⇒ Object



52
53
54
55
# File 'lib/linner/command.rb', line 52

def new(name)
  directory('templates', name)
  chmod("#{name}/bin/server", 0755)
end

#versionObject



14
15
16
# File 'lib/linner/command.rb', line 14

def version
  puts Linner::VERSION
end

#watchObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/linner/command.rb', line 26

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