Module: AssetManager::Fetch

Defined in:
lib/asset_manager/fetch/git.rb

Class Method Summary collapse

Class Method Details

.git(source) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/asset_manager/fetch/git.rb', line 17

def self.git(source)
  target = "./.assets/#{source.split("/").last}"
  if File.exists? target
    `cd #{target} && git pull`
  else
    `git clone #{source} #{target}`
  end
  target
end

.is_git?(source) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/asset_manager/fetch/git.rb', line 5

def self.is_git?(source)
  if source[-4..-1] == ".git"
    true
  elsif source[0..5] == "git://"
    true
  elsif !source.match("github.com").nil?
    true
  else
    false
  end
end