Module: DTK::Client::PullFromRemoteMixin::PullFromRemote
- Extended by:
- CommandBase
- Defined in:
- lib/commands/common/thor/pull_from_remote.rb
Class Method Summary
collapse
get, get_connection, handle_argument_error, post, post_file, rest_url, rotate_args
Class Method Details
.id_field(module_type) ⇒ Object
146
147
148
|
# File 'lib/commands/common/thor/pull_from_remote.rb', line 146
def self.id_field(module_type)
"#{module_type}_id"
end
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/commands/common/thor/pull_from_remote.rb', line 114
def self.perform_locally(cmd_obj,module_type,module_id,module_name,remote_params)
opts = remote_params
response = cmd_obj.Helper(:git_repo).pull_changes(module_type,module_name,opts)
if custom_message = response.data[:custom_message]
puts custom_message
elsif (response.data[:diffs].nil? || response.data[:diffs].empty?)
puts "No changes to pull from remote.".colorize(:yellow) unless response['errors']
else
puts "Changes pulled from remote".colorize(:green)
end
response
end
|
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# File 'lib/commands/common/thor/pull_from_remote.rb', line 130
def self.perform_on_server(cmd_obj,module_type,module_id,module_name,remote_params)
raise DtkError, "Module must be cloned to perform this operation; execute 'clone' command and then retry."
post_body = {
id_field(module_type) => module_id,
:remote_repo => remote_params[:remote_repo],
:module_name => module_name
}
post_body.merge!(:version => remote_params[:version]) if remote_params[:version]
response = post rest_url("#{module_type}/pull_from_remote"), post_body
puts "You have successfully pulled code on server instance." if response.ok?
response
end
|