class DTK::Client::Operation::Module::Install::CommonModule
Constants
- BaseRoute
Public Class Methods
install(module_ref, file_obj, opts = {})
click to toggle source
opts can have keys:
:has_remote_repo
# File lib/client/operation/module/install/common_module.rb, line 25 def self.install(module_ref, file_obj, opts = {}) common_post_body = PostBody.new( :module_name => module_ref.module_name, :namespace => module_ref.namespace, :version? => module_ref.version ) create_post_body = common_post_body.merge(:has_remote_repo? => opts[:has_remote_repo]) response = rest_post("#{BaseRoute}/create_empty_module", create_post_body) branch = response.required(:branch, :name) repo_url = response.required(:repo, :url) repo_dir = file_obj.parent_dir # repo dir is directory that directly holds the base file object file_obj git_response = ClientModuleDir::GitRepo.fetch_merge_and_push(:repo_dir => repo_dir, :repo_url => repo_url, :branch => branch) commit_sha = git_response.data(:head_sha) rest_post("#{BaseRoute}/update_from_repo", common_post_body.merge(:commit_sha => commit_sha, :initial_update => true)) end