class SmallVictories::Deployer

Attributes

config[RW]
folder[RW]

Public Class Methods

new(attributes={}) click to toggle source
# File lib/smallvictories/deployer.rb, line 9
def initialize attributes={}
  self.config = attributes[:config]
end

Public Instance Methods

copy(folder=nil) click to toggle source
# File lib/smallvictories/deployer.rb, line 13
def copy folder=nil
  folder ||= config.deploy
  deploy_path = File.join(ROOT, "#{folder}/")
  begin
    Find.find(config.full_destination_path) do |source|
      Find.prune if self.ignore_files.include?(File.basename(source))
      target = source.sub(/^#{config.full_destination_path}/, deploy_path)
      if File.directory? source
        FileUtils.mkdir target unless File.exists? target
      else
        FileUtils.copy(source, target)
      end
    end
  rescue => e
    SmallVictories.logger.error "Error deploying: #{e}"
  end
end
ignore_files() click to toggle source
# File lib/smallvictories/deployer.rb, line 31
def ignore_files
  ['.DS_Store', '.git', '.gitignore', config.source, CONFIG_FILE, GUARD_FILE]
end