Sha256: e6d5a16315291e09929bbb46ad17a5c178a63f2d6ad4f0bfad6cfe85fe54b517

Contents?: true

Size: 1.1 KB

Versions: 69

Compression:

Stored size: 1.1 KB

Contents

# Copyright 2009-2010 by le1t0@github. All rights reserved.

# might be used in other scripts as well for checking differences with deployed configs for example
# (if someone edited server configs by mistake, instead of editing inside the project)
def compare_files(local_file, remote_file)
  tmp_file = File.join('/', 'tmp', "capistrano_compare_#{Time.now.strftime("%Y%m%d%H%M%S")}.tmp")
  File.open(tmp_file, 'w') do |f|
    run "cat #{remote_file}" do |channel, stream, data|
      f.write(data)
    end
  end

  puts `diff #{local_file} #{tmp_file} && echo "files are the same!"`
  FileUtils.rm_f(tmp_file)
end

Capistrano::Configuration.instance(:must_exist).load do
  namespace :deprec do
    namespace :cap do

      task :compare do
        compare_files(ENV["LOCAL"], ENV["REMOTE"])
      end
      
      desc "Show Capistrano variables"
      task :vars do
        y variables
      end

      desc "Identify which servers are going to be touched, by which user"
      task :ident do
        run 'whoami'
        run 'ifconfig eth0 | grep "inet addr" | cut -d ":" -f 2 | cut -d " " -f 1'
      end

    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
le1t0-deprec-2.1.6.070 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.069 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.068 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.067 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.066 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.065 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.064 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.063 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.062 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.061 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.059 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.058 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.057 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.056 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.055 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.054 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.053 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.052 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.051 lib/deprec/recipes/cap.rb
le1t0-deprec-2.1.6.050 lib/deprec/recipes/cap.rb