Class: Pik::Checkup

Inherits:
Command show all
Defined in:
lib/pik/commands/checkup_command.rb

Instance Attribute Summary

Attributes inherited from Command

#config, #options, #output, #version

Instance Method Summary collapse

Methods inherited from Command

#add_sigint_handler, aka, choose_from, clean_gem_batch, #close, #cmd_name, cmd_name, #command_options, #create, #current_gem_bin_path, #current_version?, #default_gem_home, #delete_old_pik_batches, description, #editors, #find_config_from_path, #get_version, hl, inherited, #initialize, it, names, #parse_options, summary

Constructor Details

This class inherits a constructor from Pik::Command

Instance Method Details

#executeObject



8
9
10
11
12
13
# File 'lib/pik/commands/checkup_command.rb', line 8

def execute
  home
  rubyopt
  path
  pathext
end

#fail(test) ⇒ Object



62
63
64
65
66
# File 'lib/pik/commands/checkup_command.rb', line 62

def fail(test)
  print 'F'
  $stdout.flush
  # @output << @text[test][:fail]
end

#homeObject



27
28
29
30
31
32
33
# File 'lib/pik/commands/checkup_command.rb', line 27

def home
  if WindowsEnv.user['home'].empty?
    fail('home')        
  else
    pass('home')
  end
end

#pass(test) ⇒ Object



56
57
58
59
60
# File 'lib/pik/commands/checkup_command.rb', line 56

def pass(test)
  print '.'
  $stdout.flush
  # @output << @text[test][:pass]
end

#pathObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/pik/commands/checkup_command.rb', line 35

def path
  user_path = WindowsEnv.user['path']    || ''
  syst_path = WindowsEnv.system['path']  || ''
  dirs = (user_path + syst_path).split(';')
  dirs = dirs.select{|dir| File.exist?( File.join(dir,'ruby.exe') ) }
  unless dirs.size == 1
    fail('path')        
  else
    pass('path')
  end
end

#pathextObject



47
48
49
50
51
52
53
54
# File 'lib/pik/commands/checkup_command.rb', line 47

def pathext
  p_ext = WindowsEnv.system['pathext'].downcase
  unless p_ext.include?('.rb') && p_ext.include?('.rbw')
    fail('pathext')        
  else
    pass('pathext')
  end
end

#rubyoptObject



19
20
21
22
23
24
25
# File 'lib/pik/commands/checkup_command.rb', line 19

def rubyopt
  unless WindowsEnv.user['rubyopt'].nil? && WindowsEnv.system['rubyopt'].nil?
    fail('rubyopt')        
  else
    pass('rubyopt')
  end
end

#to_sObject



15
16
17
# File 'lib/pik/commands/checkup_command.rb', line 15

def to_s
  ERB.new(@output.join("\n\n")).result
end