Class: Chef::Knife::StashProjectRepos
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::StashProjectRepos
- Includes:
- StashBase
- Defined in:
- lib/chef/knife/stash_project_repos.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
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/chef/knife/stash_project_repos.rb', line 17 def run $stdout.sync = true key = name_args.first if key.nil? ui.fatal "You need a project key!" show_usage exit 1 end stash = get_stash_connection url = "projects/#{key}/repos" response = stash.get url if response.success? get_all_values stash,url,response do |values| values.each do |repo| ui.info "#{repo['slug']} (#{repo['name']})" end end else display_stash_error "Could not list Stash project repositories!", response exit 1 end end |