Sha256: 94c6fe5376c2ae04aaf28ad0ba569e27cb3ba6ec28027867c5515ece49fa65ea

Contents?: true

Size: 678 Bytes

Versions: 3

Compression:

Stored size: 678 Bytes

Contents

# Installer capistrano helper
module Capigen::Helpers::ScriptHelper
  
  def script_install(script, files_to_put = {})
    
    files_to_put.each do |file, dest|
      put load_file(file), dest
    end

    if File.extname(script) == ".erb"
      name = script[0...script.length-4]
      dest = "/tmp/#{name}"
      run "mkdir -p #{File.dirname(dest)}"
      put load_template(script, binding), dest   
      
    else
      name = script
      dest = "/tmp/#{name}"
      run "mkdir -p #{File.dirname(dest)}"
      put load_file(name), dest
    end
    
    # If want verbose, -v
    sudo "sh #{dest}"
    
    # Cleanup
    sudo "rm -rf #{File.dirname(dest)}"    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capigen-0.1.1 lib/capigen/helpers/script_helper.rb
capigen-0.1.2 lib/capigen/helpers/script_helper.rb
capigen-0.1.3 lib/capigen/helpers/script_helper.rb