Class: Chef::Knife::StashProjects

Inherits:
Chef::Knife show all
Includes:
StashBase
Defined in:
lib/chef/knife/stash_projects.rb

Instance Method Summary collapse

Methods included from StashBase

#display_stash_error, #get_all_values, #get_config, #get_repo_https_url, #get_repo_ssh_url, #get_stash_connection, included

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/chef/knife/stash_projects.rb', line 17

def run
  $stdout.sync = true
  
  stash = get_stash_connection
  url = "projects"
  response = stash.get url

  if response.success?
    get_all_values stash,url,response do |values|
      values.each do |project|
        ui.info "#{project['key']}: #{project['name']}"
      end
    end
  else
    display_stash_error "Could not list Stash projects!", response
    exit 1
  end
  
end