Class: RightScaleCLI::Repositories
- Inherits:
-
Thor
- Object
- Thor
- RightScaleCLI::Repositories
- Defined in:
- lib/rightscale_cli/repositories.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create(name, source, source_ref) ⇒ Object
- #destroy(id) ⇒ Object
-
#initialize(*args) ⇒ Repositories
constructor
A new instance of Repositories.
- #list ⇒ Object
Constructor Details
#initialize(*args) ⇒ Repositories
Returns a new instance of Repositories.
25 26 27 28 29 |
# File 'lib/rightscale_cli/repositories.rb', line 25 def initialize(*args) super @client = RightScaleCLI::Client.new() @logger = RightScaleCLI::Logger.new() end |
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
64 65 66 |
# File 'lib/rightscale_cli/repositories.rb', line 64 def self.(task, namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#create(name, source, source_ref) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rightscale_cli/repositories.rb', line 37 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']}'." @client.client.repositories.create({ :repository => repository }) end |
#destroy(id) ⇒ Object
60 61 62 |
# File 'lib/rightscale_cli/repositories.rb', line 60 def destroy(id) @client.client.repositories.index(:id => id).destroy end |
#list ⇒ Object
32 33 34 |
# File 'lib/rightscale_cli/repositories.rb', line 32 def list() @client.render(@client.get('repositories'), 'repositories') end |