Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#alcapon_message(string) ⇒ Object



52
53
54
# File 'lib/utils.rb', line 52

def alcapon_message(string)
  puts( "[alcapon]".green+" #{string}" )
end

#capez_puts_doneObject



6
7
8
# File 'lib/utils.rb', line 6

def capez_puts_done
  puts ''.green
end

#ezp5?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/utils.rb', line 34

def ezp5?
  return ( fetch( :ezpublish_version, nil ) == 5 )
end

#ezp_legacy_path(path = '') ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/utils.rb', line 38

def ezp_legacy_path(path='')
  elements = Array.new

  if( fetch( :ezp_legacy, "" ) != "" )
    elements += [ "#{ezp_legacy}" ]
  end

  if( path != '' )
    elements += [ "#{path}" ]
  end

  return File.join( elements )
end


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/utils.rb', line 10

def print_dotted( message, options={} )
  defaults_options = { :eol => false,
                       :sol => false,
                       :max_length => 40,
                       :eol_msg => false }

  options = defaults_options.merge( options )
  message = "#{message} " + "." * [0,options[:max_length]-message.length-1].max

  if options[:sol]
    message = "\n#{message}"
  end

  if options[:eol_msg]
    message += " #{options[:eol_msg]}"
  end

  if options[:eol]
    puts message
  else
    print message
  end
end

#start_spinnerObject



17
18
19
20
# File 'lib/ext/spinner.rb', line 17

def start_spinner
  @spinner_running = true
  @spinner.wakeup
end

#stop_spinnerObject

stops the spinner and backspaces over last displayed character



23
24
25
26
# File 'lib/ext/spinner.rb', line 23

def stop_spinner
  @spinner_running = false
  print "\b"
end

#unindent(string) ⇒ Object



1
2
3
4
# File 'lib/utils.rb', line 1

def unindent(string)
  indentation = string[/\A\s*/]
  string.strip.gsub(/^#{indentation}/, "")
end