Sha256: 3ad85a648d911303ddd53850f8aeea0967644aa5ed612c7ce3a81aa1059ef764

Contents?: true

Size: 936 Bytes

Versions: 4

Compression:

Stored size: 936 Bytes

Contents

# frozen_string_literal: true

require 'erb'
require 'rexml/document'

module Motion
  module Project
    class Sparkle
      TEMPLATE_PATHS = [
        File.expand_path(File.join(__FILE__, '../appcast'))
      ].freeze

      def all_templates
        @all_templates ||= begin
          templates = {}
          TEMPLATE_PATHS.map { |path| Dir.glob("#{path}/*") }.flatten.each do |template_path|
            templates[File.basename(template_path)] = template_path
          end
          templates
        end
      end

      def copy_templates(force = false)
        all_templates.each_pair do |tmpl, path|
          result = "#{sparkle_config_path}/#{tmpl}"
          if File.exist?(result) && !force
            App.info 'Exists', result
          else
            FileUtils.cp(path, "#{sparkle_config_path}/")
            App.info 'Create', "./#{sparkle_config_path}/#{tmpl}"
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion-sparkle-sandbox-2.2 lib/motion/project/templates.rb
motion-sparkle-sandbox-2.1.1 lib/motion/project/templates.rb
motion-sparkle-sandbox-2.1.0 lib/motion/project/templates.rb
motion-sparkle-sandbox-2.0.1 lib/motion/project/templates.rb