Class: Deano::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/deano/commands/command.rb

Direct Known Subclasses

EnvCommand, NameCommand

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.commandObject



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

def self.command
  nil
end

.commandsObject



13
14
15
# File 'lib/deano/commands/command.rb', line 13

def self.commands
  @commands ||= []
end

.inherited(klass) ⇒ Object



17
18
19
# File 'lib/deano/commands/command.rb', line 17

def self.inherited(klass)
  self.commands << klass
end

Instance Method Details

#app_path(*path) ⇒ Object



40
41
42
# File 'lib/deano/commands/command.rb', line 40

def app_path(*path)
  File.expand_path(File.join(@app_dir, *path))
end

#cmd(command) ⇒ Object



21
22
23
24
# File 'lib/deano/commands/command.rb', line 21

def cmd(command)
  puts command
  system command
end

#rm(path) ⇒ Object



26
27
28
29
30
31
# File 'lib/deano/commands/command.rb', line 26

def rm(path)
  begin
    FileUtils.rm path, verbose: true
  rescue Errno::ENOENT => e
  end
end

#rm_r(path) ⇒ Object



33
34
35
36
37
38
# File 'lib/deano/commands/command.rb', line 33

def rm_r(path)
  begin
    FileUtils.rm_r path, verbose: true
  rescue Errno::ENOENT => e
  end
end

#template_path(*path) ⇒ Object



44
45
46
# File 'lib/deano/commands/command.rb', line 44

def template_path(*path)
  File.expand_path(File.join(Deano.template_dir, *path))
end