Module: FIR::Mapping

Included in:
Util::ClassMethods
Defined in:
lib/fir/util/mapping.rb

Instance Method Summary collapse

Instance Method Details

#find_or_create_bughd_full_versionObject



31
32
33
34
# File 'lib/fir/util/mapping.rb', line 31

def find_or_create_bughd_full_version
  url = bughd_api[:project_url] + "/#{@proj}/full_versions"
  post url, version: @version, build: @build, uuid: uuid
end

#mapping(*args, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fir/util/mapping.rb', line 6

def mapping *args, options
  @file_path = File.absolute_path(args.first.to_s)
  @token     = options[:token] || current_token
  @proj      = options[:proj].to_s
  @version   = options[:version].to_s
  @build     = options[:build].to_s

  check_file_exist @file_path
  check_token_cannot_be_blank @token
  check_project_id_cannot_be_blank

  logger.info "Creating bughd project's version......."
  logger_info_dividing_line

  @full_version = find_or_create_bughd_full_version

  logger.info "Uploading mapping file......."

  upload_mapping_file
  logger_info_dividing_line

  logger.info "Uploaded succeed: #{bughd_api[:domain]}/project/#{@proj}/settings"
  logger_info_blank_line
end

#upload_mapping_fileObject



36
37
38
39
40
41
# File 'lib/fir/util/mapping.rb', line 36

def upload_mapping_file
  tmp_file_path = generate_temp_mapping_file

  url = bughd_api[:full_version_url] + "/#{@full_version[:id]}"
  patch url, file: File.new(tmp_file_path, 'rb'), project_id: @proj, uuid: uuid
end