Class: Teamocil::Layout

Inherits:
Object
  • Object
show all
Defined in:
lib/teamocil/layout.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/teamocil/layout.rb', line 19

def self.print_available_layouts(directory: nil)
  files = Dir.glob(File.join(directory, '*.yml'))

  files.map! do |file|
    extname = File.extname(file)
    File.basename(file).gsub(extname, '')
  end

  # Always return files in alphabetical order, even if `Dir.glob` almost
  # always does it
  files.sort!

  Teamocil.puts(files)
end

Instance Method Details

#edit!Object



15
16
17
# File 'lib/teamocil/layout.rb', line 15

def edit!
  Teamocil.system("$EDITOR #{path}")
end

#execute!Object



3
4
5
6
7
8
9
# File 'lib/teamocil/layout.rb', line 3

def execute!
  if Teamocil.options[:debug]
    Teamocil.puts(shell_commands.join("\n"))
  else
    Teamocil.system(shell_commands.join('; '))
  end
end

#show!Object



11
12
13
# File 'lib/teamocil/layout.rb', line 11

def show!
  Teamocil.puts(raw_content)
end