Sha256: 407f78f88e5e82a1d65b662eb112b54c178b000c37f12e4e3bbed17068d3bb98
Contents?: true
Size: 1.62 KB
Versions: 5
Compression:
Stored size: 1.62 KB
Contents
require 'rim/processor' require 'rim/rim_exception' require 'rim/rim_info' require 'rim/file_helper' require 'rim/dirty_check' module RIM class ModuleHelper < Processor attr_reader :module_info def initialize(workspace_root, module_info, logger) super(workspace_root, logger) @module_info = module_info @remote_url = get_absolute_remote_url(@module_info.remote_url) if @module_info.remote_url @remote_path = remote_path(@module_info.remote_url) if @module_info.remote_url @logger = logger end protected # fetch module +mod+ into the .rim folder # works both for initial fetch and updates def fetch_module FileUtils.mkdir_p git_path RIM::git_session(git_path) do |s| if !File.exist?(git_path + "/config") s.execute("git clone --mirror #{@remote_url} #{git_path}") do |out, e| raise RimException.new("Remote repository '#{@remote_url}' of module '#{@module_info.local_path}' not found.") if e end else s.execute("git remote update") end end git_path end # prepare empty folder: remove all files not on the ignore list and empty folders def prepare_empty_folder(local_path, ignores) ignores = FileHelper.find_matching_files(local_path, true, ignores) FileHelper.find_matching_files(local_path, true, "/**/*", File::FNM_DOTMATCH).each do |f| if File.file?(f) && !ignores.include?(f) FileUtils.rm(f) end end FileHelper.remove_empty_dirs(local_path) FileUtils.mkdir_p(local_path) end def git_path module_git_path(@remote_path) end end end
Version data entries
5 entries across 5 versions & 1 rubygems