Sha256: 7fbc21d59ed6a65ebb2d9bae85e7de87b6dba36bf3c067183105ac99a6583e9d

Contents?: true

Size: 997 Bytes

Versions: 5

Compression:

Stored size: 997 Bytes

Contents

require 'erb'
require 'rexml/document'

module Motion; module Project
  
  class Sparkle
    # for ERB
    # attr_reader :name

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

    Templates = TemplatePaths.map { |path| Dir.glob(path + '/*') }.flatten.map { |x| File.basename(x) }

    def all_templates
      @all_templates ||= begin
        templates = {}
        TemplatePaths.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; end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
motion-sparkle-0.0.5 lib/motion/project/templates.rb
motion-sparkle-0.0.4 lib/motion/project/templates.rb
motion-sparkle-0.0.3 lib/motion/project/templates.rb
motion-sparkle-0.0.2 lib/motion/project/templates.rb
motion-sparkle-0.0.1 lib/motion/project/templates.rb