lib/roku_builder/plugins/loader.rb in roku_builder-4.24.3 vs lib/roku_builder/plugins/loader.rb in roku_builder-4.25.0

- old
+ new

@@ -38,10 +38,13 @@ options[:exclude] = true end parser.on("--remote-debug", "Sideload will enable remote debug") do options[:remoteDebug] = true end + parser.on("--build-dir DIR", "The directory to load files from when building the app") do |dir| + options[:build_dir] = dir + end end def self.dependencies [Navigator] end @@ -139,11 +142,11 @@ def build_zip(content) path = file_path(:out) File.delete(path) if File.exist?(path) io = Zip::File.open(path, Zip::File::CREATE) - writeEntries(@config.parsed[:root_dir], content[:source_files], "", content[:excludes], io) + writeEntries(build_dir, content[:source_files], "", content[:excludes], io) io.close() end # Recursively write directory contents to a zip archive # @param root_dir [String] Path of the root directory @@ -184,9 +187,14 @@ FileUtils.copy_entry(File.join(@config.parsed[:root_dir], entity), File.join(@target, entity)) rescue Errno::ENOENT @logger.warn "Missing Entry: #{entity}" end end + end + def build_dir + dir = @options[:build_dir] + dir ||= @config.parsed[:root_dir] + dir end end RokuBuilder.register_plugin(Loader) end