Sha256: 7623638eb8205b5f37452731d63079c6b8b8ec50331a461da10469e54ea6b30d
Contents?: true
Size: 1.55 KB
Versions: 3
Compression:
Stored size: 1.55 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 git_path = module_git_path(@remote_path) 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
esr-rim-1.2.2 | lib/rim/module_helper.rb |
esr-rim-1.2.1 | lib/rim/module_helper.rb |
esr-rim-1.2.0 | lib/rim/module_helper.rb |