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
24
# File 'lib/linner/command.rb', line 19

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

#cleanObject



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

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

#new(name) ⇒ Object



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

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



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

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