Module: Cuken::Api::Git::Repository

Included in:
Cuken::Api::Git
Defined in:
lib/cuken/api/git/repository.rb

Instance Method Summary collapse

Instance Method Details

#check_repository_presence(repo, expect_presence = true, curr_dir = current_dir) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/cuken/api/git/repository.rb', line 45

def check_repository_presence(repo, expect_presence = true, curr_dir = current_dir)
  in_dir(curr_dir) do |pn|
    curr_path = Pathname(pn).basename.to_s
    condition = Pathname(pn).exist?
    given_repo = Pathname(repo).basename.to_s if repo
    result = given_repo == curr_path
    if condition && result
      given_repo.should == curr_path
      announce_or_puts(%{Found cookbook: #{pn}}) if @announce_env
    end
  end
end

#check_repository_table_presence(table, expect_presence = true, curr_dir = current_dir) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/cuken/api/git/repository.rb', line 36

def check_repository_table_presence(table, expect_presence = true, curr_dir = current_dir)
  table.hashes.each do |hsh|
    ckbk, ckbk_src = parse_to_repository_path(hsh)
    full_repo_src = ckbk
    announce_or_puts(%{Looking for repository: #{full_repo_src}}) if @announce_env
    check_repository_presence(full_repo_src, expect_presence, curr_dir)
  end
end

#parse_to_repository_path(hsh) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cuken/api/git/repository.rb', line 22

def parse_to_repository_path(hsh)
  case
    when not(hsh['repo'].nil? || hsh['repo'].empty?)
      ckbk = hsh['repo']
      ckbk_src = "#{ckbk}"
    when not(hsh['repository'].nil? || hsh['repository'].empty?)
      ckbk = hsh['repository']
      ckbk_src = "#{ckbk}"
    else
      src =""
  end
  return ckbk, ckbk_src
end