Class: Metadata::SfdcDirectoryService

Inherits:
Object
  • Object
show all
Defined in:
lib/metadata_services/sfdc_directory_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ SfdcDirectoryService



13
14
15
16
17
# File 'lib/metadata_services/sfdc_directory_service.rb', line 13

def initialize(args = {})
  @args = args
  @output_file_name = tempfile_name("zip")
  find_source_dir
end

Instance Method Details

#make_project_zipObject

copy files from original directory to be xml_filtered when creating zip Create zip file with contents of force.com project Return absolute path to the file



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/metadata_services/sfdc_directory_service.rb', line 22

def make_project_zip
  begin
    @zip_io = Zip::File.open(@output_file_name, Zip::File::CREATE)
    raise "package.xml NOT FOUND" unless verify_package_xml

    p "making temporary copy of project folder"
    tmpdir = Dir.mktmpdir
    FileUtils.cp_r(@input_dir_name, tmpdir)
    @input_dir_name = tmpdir.to_s + "/src"

    entries = dir_content(@input_dir_name)
    p "excluding specified components from deployment"
    write_entries(entries, "")
  ensure
    @zip_io.close # close before deleting tmpdir, or NOT_FOUND exception
    FileUtils.remove_entry(tmpdir)
    p "deleted temporary copy of project folder"
  end

  return @output_file_name
end