Class: Capistrano::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano-offroad/utils.rb

Instance Method Summary collapse

Instance Method Details

#_offroad_emit_warningsObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/capistrano-offroad/utils.rb', line 43

def _offroad_emit_warnings()
  if @_offroad_util_warnings
    puts <<-"EOF"

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                       #{@_offroad_util_warnings.length} WARNING(S) LOGGED
      READ VERY CAREFULLY, FOR I SHALL WRITE THIS ONLY ONCE
                      SCROLL UP FOR DETAILS

EOF
      @_offroad_util_warnings.each { |w| puts " - #{w}" }
      puts <<EOF

                       YOU HAVE BEEN WARNED
EOF
  end
end

#delayed_warning(short, long = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/capistrano-offroad/utils.rb', line 27

def delayed_warning(short, long=nil)
  @_offroad_util_warnings ||= []
  @_offroad_util_warnings.push short
  puts <<EOF

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                         BIG FAT WARNING:
EOF
  puts short
  puts long if long
puts <<EOF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

EOF
end

#set_from_env_or_ask(sym, question) ⇒ Object

set_from_env_or_ask :variable, “Please enter variable name: ” If there is VARIABLE in enviroment, set :variable to it, otherwise ask user for a value



19
20
21
22
23
24
25
# File 'lib/capistrano-offroad/utils.rb', line 19

def set_from_env_or_ask(sym, question)
  if ENV.has_key? sym.to_s.upcase then
    set sym, ENV[sym.to_s.upcase]
  else
    set sym do Capistrano::CLI.ui.ask question end
  end
end