Class: SmallVictories::Deployer
- Inherits:
-
Object
- Object
- SmallVictories::Deployer
- Defined in:
- lib/smallvictories/deployer.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#folder ⇒ Object
Returns the value of attribute folder.
Instance Method Summary collapse
- #copy(folder = nil) ⇒ Object
- #ignore_files ⇒ Object
-
#initialize(attributes = {}) ⇒ Deployer
constructor
A new instance of Deployer.
Constructor Details
#initialize(attributes = {}) ⇒ Deployer
Returns a new instance of Deployer.
9 10 11 |
# File 'lib/smallvictories/deployer.rb', line 9 def initialize attributes={} self.config = attributes[:config] end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/smallvictories/deployer.rb', line 6 def config @config end |
#folder ⇒ Object
Returns the value of attribute folder.
7 8 9 |
# File 'lib/smallvictories/deployer.rb', line 7 def folder @folder end |
Instance Method Details
#copy(folder = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# 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 ⇒ Object
31 32 33 |
# File 'lib/smallvictories/deployer.rb', line 31 def ignore_files ['.DS_Store', '.git', '.gitignore', config.source, CONFIG_FILE, GUARD_FILE] end |