Sha256: 31466f607165a9731f8c5620921a36cf5a4aab0646d480185f1391ea2cb554f0

Contents?: true

Size: 840 Bytes

Versions: 4

Compression:

Stored size: 840 Bytes

Contents

require 'erb'
require 'rexml/document'

module Motion::Project
  class Sparkle

    TEMPLATE_PATHS = [
      File.expand_path(File.join(__FILE__, '../appcast'))
    ]

    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) and !force
          App.info 'Exists', result
        else
          FileUtils.cp(path, "#{sparkle_config_path}/")
          App.info 'Create', "./#{sparkle_config_path}/#{tmpl.to_s}"
        end
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
motion-sparkle-sandbox-2.0.0 lib/motion/project/templates.rb
motion-sparkle-sandbox-0.8.0 lib/motion/project/templates.rb
motion-sparkle-sandbox-0.7.0 lib/motion/project/templates.rb
motion-sparkle-0.0.6 lib/motion/project/templates.rb