Class: Dply::Tasks

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/dply/tasks.rb

Instance Method Summary collapse

Methods included from Helper

#cmd, #error, #git, #logger, #stringify_values!, #symlink

Instance Method Details

#build(task) ⇒ Object



28
29
30
31
32
# File 'lib/dply/tasks.rb', line 28

def build(task)
  bundle.install
  bundle.clean
  rake task
end

#deploy(target) ⇒ Object



13
14
15
16
# File 'lib/dply/tasks.rb', line 13

def deploy(target)
  bundle.install
  rake "#{target}:deploy"
end

#install_pkgs(build_mode: false, use_yum: false) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dply/tasks.rb', line 45

def install_pkgs(build_mode: false, use_yum: false)
  return if not File.exists? "pkgs.yml"
  return if pkgs.installed?(build_mode: build_mode)
  drake_exists = File.exists? (drake_command)

  if use_yum || !drake_exists
    pkgs.install(build_mode: build_mode, sudo: true)
  else
    command_install build_mode
  end
end


57
58
59
60
61
62
63
# File 'lib/dply/tasks.rb', line 57

def link(source, map)
  return if not map
  logger.bullet "symlinking #{source}"
  dest = Dir.pwd
  linker = Linker.new(source, dest, map: map)
  linker.create_symlinks
end

#rake(task) ⇒ Object



34
35
36
# File 'lib/dply/tasks.rb', line 34

def rake(task)
  bundle.rake task
end

#reload(target) ⇒ Object



18
19
20
21
# File 'lib/dply/tasks.rb', line 18

def reload(target)
  bundle.install
  rake "#{target}:reload"
end

#report_changes(previous_version, current_version) ⇒ Object



38
39
40
41
42
43
# File 'lib/dply/tasks.rb', line 38

def report_changes(previous_version, current_version)
  info = {}
  info[:current] = current_version
  info[:previous] = previous_version
  logger.remote "#{previous_version} => #{current_version}"
end

#task(task) ⇒ Object



23
24
25
26
# File 'lib/dply/tasks.rb', line 23

def task(task)
  bundle.install
  rake task
end