Class: Chef::Knife::CookbookSCMRepoExtensions

Inherits:
CookbookSCMRepo
  • Object
show all
Defined in:
lib/chef/knife/core/coobook_scm_repo_extensions.rb

Instance Method Summary collapse

Instance Method Details

#finalize_updates_from_github(cookbook_name, github_path, sha) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/chef/knife/core/coobook_scm_repo_extensions.rb', line 5

def finalize_updates_from_github(cookbook_name, github_path, sha)
  if update_count = updated?(cookbook_name)
    ui.info "#{update_count} files updated, committing changes"
    git("add #{cookbook_name}")
    git("commit -m 'Import #{github_path} version #{sha}' -- #{cookbook_name}")
    ui.info("Creating tag cookbook-site-imported-#{cookbook_name}-#{sha}")
    git("tag -f cookbook-site-imported-#{cookbook_name}-#{sha}")
    true
  else
    ui.info("No changes made to #{cookbook_name}")
    false
  end
end

#last_log_message_from_cookbook(cookbook_name) ⇒ Object



19
20
21
# File 'lib/chef/knife/core/coobook_scm_repo_extensions.rb', line 19

def last_log_message_from_cookbook(cookbook_name)
  git("log chef-vendor-#{cookbook_name} -n 1").stdout.split("\n").last.strip
end