Method: Flow::Cli::Commands::Remote#upload_provision

Defined in:
lib/flow/cli/commands/remote.rb

#upload_provision(file_path) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/flow/cli/commands/remote.rb', line 133

def upload_provision(file_path)
  choosed_project_check
  basename = File.basename file_path

  api_provisions = current_api_manager.load_provisions(current_flow_id)
  old_provision = api_provisions.find { |provision| provision[:filename] == basename }
  unless old_provision.nil?
    if @cmd_helper.yes? "found a same name file, override?"
      current_api_manager.delete_provision(old_provision[:id], current_flow_id)
    else
      return puts "canceled.."
    end
  end
  current_api_manager.upload_provision(current_flow_id, file_path)
  puts "uploaded. you can run `flow-cli remote list_provisions` to check the operation."
end