Class: RightScaleCLI::Repositories
- Inherits:
-
Thor
- Object
- Thor
- RightScaleCLI::Repositories
- Defined in:
- lib/rightscale_cli/repositories.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
59 60 61 |
# File 'lib/rightscale_cli/repositories.rb', line 59 def self.(task, namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#create(name, source, source_ref) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rightscale_cli/repositories.rb', line 32 def create(name, source, source_ref) # create profile of the repository to add # http://reference.rightscale.com/api1.5/resources/ResourceRepositories.html#create repository = {} repository['source_type'] = 'git' # only git supported so far repository['auto_import'] = true repository['source'] = source # not yet supported by CLI repository['credentials'] = {} repository['credentials']['ssh_key'] = 'text:' # needed due to bad validation repository['name'] = "#{name}" repository['commit_reference'] = source_ref repository['description'] = "" # todo puts repository if [:verbose] $log.info "Creating RightScale repository, '#{repository['name']}'." repo = RightApi::Client.new(RightScaleCLI::Config::API).repositories.create({ :repository => repository }) end |
#destroy(id) ⇒ Object
55 56 57 |
# File 'lib/rightscale_cli/repositories.rb', line 55 def destroy(id) RightApi::Client.new(RightScaleCLI::Config::API).repositories.index(:id => id).destroy end |
#list ⇒ Object
25 26 27 28 29 |
# File 'lib/rightscale_cli/repositories.rb', line 25 def list() repositories = [] RightApi::Client.new(RightScaleCLI::Config::API).repositories.index.each { |repos| repositories.push(repos.raw) } RightScaleCLI::Output.render(repositories, 'repositories', ) end |