Class: Kuby::Plugins::RailsApp::AssetCopyTask
- Inherits:
- 
      Object
      
        - Object
- Kuby::Plugins::RailsApp::AssetCopyTask
 
- Defined in:
- lib/kuby/plugins/rails_app/asset_copy_task.rb
Overview
Works by maintaining a directory structure where each deploy creates a new directory. Each directory is given a timestamped name. Assets are symlinked into a special ‘current’ directory from each of the timestamped directories. Each invocation overrides existing symlinks if they already exist. This technique ensures assets from the previous deploy remain available while the web servers are restarting.
Constant Summary collapse
- TIMESTAMP_FORMAT =
- '%Y%m%d%H%M%S'.freeze 
- KEEP =
- 5
Instance Attribute Summary collapse
- 
  
    
      #dest_path  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute dest_path. 
- 
  
    
      #source_path  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute source_path. 
Instance Method Summary collapse
- 
  
    
      #initialize(to:, from:)  ⇒ AssetCopyTask 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of AssetCopyTask. 
- #run ⇒ Object
Constructor Details
#initialize(to:, from:) ⇒ AssetCopyTask
Returns a new instance of AssetCopyTask.
| 20 21 22 23 | # File 'lib/kuby/plugins/rails_app/asset_copy_task.rb', line 20 def initialize(to:, from:) @dest_path = to @source_path = from end | 
Instance Attribute Details
#dest_path ⇒ Object (readonly)
Returns the value of attribute dest_path.
| 18 19 20 | # File 'lib/kuby/plugins/rails_app/asset_copy_task.rb', line 18 def dest_path @dest_path end | 
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
| 18 19 20 | # File 'lib/kuby/plugins/rails_app/asset_copy_task.rb', line 18 def source_path @source_path end | 
Instance Method Details
#run ⇒ Object
| 25 26 27 28 29 30 31 32 33 | # File 'lib/kuby/plugins/rails_app/asset_copy_task.rb', line 25 def run FileUtils.mkdir_p(ts_dir) FileUtils.mkdir_p(current_dir) copy_new_assets delete_old_assets nil end |