Class: Makit::RakeHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/makit/rake.rb

Overview

This class provide methods for working with the system Environment.

Class Method Summary collapse

Class Method Details

.rake_repository(url, task_name) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/makit/rake.rb', line 8

def self.rake_repository(url, task_name)
  local_path = File.join(Makit::Directories::HOME, "code", "work", Makit::Directories.get_relative_directory(url))
  if Dir.exist?(local_path)
    Dir.chdir(local_path) do
      puts "  #{local_path.to_s.colorize(:grey)}"
      "git pull".run
    end
  else
    puts "> ".colorize(:grey) + "git clone #{url} #{local_path}".colorize(:green)
    `git clone #{url} #{local_path}`
  end
  Dir.chdir(local_path) do
    puts "  #{local_path.to_s.colorize(:grey)}"
    "rake #{task_name}".run
  end
end