Class: Metadata::SfdcDirectoryService
- Inherits:
-
Object
- Object
- Metadata::SfdcDirectoryService
- Defined in:
- lib/metadata_services/sfdc_directory_service.rb
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ SfdcDirectoryService
constructor
A new instance of SfdcDirectoryService.
-
#write ⇒ Object
copy files from original directory to be xml_filtered later Create zip file with contents of force.com project Return absolute path to the file.
Constructor Details
#initialize(args = {}) ⇒ SfdcDirectoryService
Returns a new instance of SfdcDirectoryService.
13 14 15 16 17 18 19 20 21 |
# File 'lib/metadata_services/sfdc_directory_service.rb', line 13 def initialize(args = {}) @args = args @output_file_name = tempfile_name("zip") @files_to_exclude = Set.new() @snippets_to_exclude = {} find_source_dir prepare_files_to_exclude prepare_xml_nodes_to_exclude end |
Instance Method Details
#write ⇒ Object
copy files from original directory to be xml_filtered later Create zip file with contents of force.com project Return absolute path to the file
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/metadata_services/sfdc_directory_service.rb', line 26 def write 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" p "filtering deployment files removing specified XML elements" write_entries(entries, "") ensure @zip_io.close # close before deleting tmpdir, or NOT_FOUND exception p "deleting temporary copy of project folder" FileUtils.remove_entry(tmpdir) end return @output_file_name end |