Class: Capistrano::Configuration

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

Instance Method Summary collapse

Instance Method Details

#_offroad_emit_warnings ⇒ Object



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 "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n                       \#{@_offroad_util_warnings.length} WARNING(S) LOGGED\n      READ VERY CAREFULLY, FOR I SHALL WRITE THIS ONLY ONCE\n                      SCROLL UP FOR DETAILS\n\n"
      @_offroad_util_warnings.each { |w| puts " - #{w}" }
      puts "\n                       YOU HAVE BEEN WARNED\n"
  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 "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n                         BIG FAT WARNING:\n"
  puts short
  puts long if long
puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"
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