Class: Pindo::Command::Repo::Clone
Constant Summary
DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS
Instance Attribute Summary
#args_help_flag
Class Method Summary
collapse
Instance Method Summary
collapse
command_name, #initialize_options, run, use_cache?
#pindo_log_instance
#pindo_single_config
Constructor Details
#initialize(argv) ⇒ Clone
41
42
43
44
45
46
47
|
# File 'lib/pindo/command/repo/clone.rb', line 41
def initialize(argv)
@args_repo_name = argv.shift_argument
super(argv)
@additional_args = argv.remainder!
end
|
Class Method Details
.options ⇒ Object
34
35
36
37
38
|
# File 'lib/pindo/command/repo/clone.rb', line 34
def self.options
[
].concat(super)
end
|
Instance Method Details
#run ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/pindo/command/repo/clone.rb', line 71
def run
new_branch = "master"
if !@code_git_url.nil? && !@repo_name.nil?
puts
puts "Repo Name: #{@repo_name}"
puts "Repo Url: #{@code_git_url}"
puts "New Branch: #{new_branch}"
getcode_to_dir(reponame:@repo_name, remote_url:@code_git_url, path:Dir.pwd, new_branch:new_branch, new_tag:nil)
end
end
|
#validate! ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/pindo/command/repo/clone.rb', line 51
def validate!
super
temp_config_file = "./config.json"
@repo_name = @args_repo_name if @args_repo_name
if @args_repo_name.nil? && @repo_name.nil?
if File::exist?(temp_config_file)
temp_config_file_fullname=File::expand_path(temp_config_file)
temp_config_json=JSON.parse(File.read(temp_config_file_fullname))
if temp_config_json['project_info'] && temp_config_json['project_info']['launch_project'] && temp_config_json['project_info']['launch_project']['project_git_url']
@code_git_url = temp_config_json['project_info']['launch_project']['project_git_url']
temp_url = String.new(@code_git_url)
index = temp_url.rindex('/')
temp_url = temp_url.slice(index + 1, temp_url.length)
@repo_name = temp_url.gsub!(/\.git/, "")
end
end
end
end
|