Class: Dply::Util

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

Instance Method Summary collapse

Methods included from Helper

#cmd, #error, #git, #logger, #sh, #symlink

Instance Method Details

#install_pkgs(build_mode: false) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/dply/util.rb', line 26

def install_pkgs(build_mode: false)
  pkgs_yml = Constants::PKGS_YML
  return if not File.exists? pkgs_yml
  pkgs = Pkgs.new(pkgs_yml)
  return if pkgs.installed?(build_mode: build_mode)
  drake_install build_mode
end


34
35
36
37
38
39
40
# File 'lib/dply/util.rb', line 34

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, args) ⇒ Object



14
15
16
17
# File 'lib/dply/util.rb', line 14

def rake(task, args)
  cmd_arr = ["bundle", "exec", "rake", task, *args]
  cmd cmd_arr
end

#report_changes(previous_version, current_version) ⇒ Object



19
20
21
22
23
24
# File 'lib/dply/util.rb', line 19

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

#run(task, render_config: false, optional: false) ⇒ Object



42
43
44
45
46
47
# File 'lib/dply/util.rb', line 42

def run(task, render_config: false, optional: false)
  app_config = AppConfig.new
  logger.arrow task
  app_config.render_config if render_config
  app_config.run_task task, optional: optional
end