Module: Abaddon

Extended by:
Abaddon
Included in:
Abaddon
Defined in:
lib/abaddon.rb,
lib/abaddon/help.rb,
lib/abaddon/runner.rb,
lib/abaddon/information.rb

Defined Under Namespace

Modules: Help, Information Classes: Runner

Instance Method Summary collapse

Instance Method Details

#create_directories(directories, &block) ⇒ Object



28
29
30
31
32
33
# File 'lib/abaddon.rb', line 28

def create_directories(directories, &block)
  if block_given?
    directories = directories.map { |d| block.call d }
  end
  directories.each { |d| FileUtils.mkdir "./#{d}" unless File.directory? d or File.file? d }
end

#create_files(files, &block) ⇒ Object



35
36
37
38
39
40
# File 'lib/abaddon.rb', line 35

def create_files(files, &block)
  if block_given?
    files = files.map { |f| block.call f }
  end
  files.each { |f| FileUtils.touch "./#{f}" unless File.directory? f or File.file? f }
end

#create_files_in_dirObject



42
43
# File 'lib/abaddon.rb', line 42

def create_files_in_dir
end

#load(args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/abaddon.rb', line 17

def load(args)
  template = args.first
  action = args.second || template
  if templates.include? template
    load_file template, action
    true
  else
    false
  end
end

#load_file(template, action) ⇒ Object



13
14
15
# File 'lib/abaddon.rb', line 13

def load_file(template, action)
  require_relative "./templates/#{template}/#{action}.rb"
end

#templatesObject



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

def templates
  Dir.new("#{File.dirname(__FILE__)}/templates/").entries.select { |t| t !~ /^\./ }
end