Class: Pik::Checkup
- Inherits:
-
Object
- Object
- Pik::Checkup
- Defined in:
- lib/pik/checkup.rb
Instance Method Summary collapse
- #check ⇒ Object
- #fail(test) ⇒ Object
- #home ⇒ Object
-
#initialize(text) ⇒ Checkup
constructor
A new instance of Checkup.
- #pass(test) ⇒ Object
- #path ⇒ Object
- #pathext ⇒ Object
- #rubyopt ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(text) ⇒ Checkup
Returns a new instance of Checkup.
5 6 7 8 9 |
# File 'lib/pik/checkup.rb', line 5 def initialize(text) @text = text # pp @text @output = ["Checkup results:"] end |
Instance Method Details
#check ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pik/checkup.rb', line 11 def check home rubyopt path pathext puts puts self end |
#fail(test) ⇒ Object
67 68 69 70 |
# File 'lib/pik/checkup.rb', line 67 def fail(test) print 'F' @output << @text[test][:fail] end |
#home ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/pik/checkup.rb', line 35 def home if WindowsEnv.user['home'].empty? fail('home') else pass('home') end end |
#pass(test) ⇒ Object
61 62 63 64 65 |
# File 'lib/pik/checkup.rb', line 61 def pass(test) print '.' $stdout.flush @output << @text[test][:pass] end |
#path ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/pik/checkup.rb', line 43 def path dirs = (WindowsEnv.user['path'] + WindowsEnv.system['path']).split(';') unless dirs.grep(/ruby/) == 1 fail('path') else pass('path') end end |
#pathext ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/pik/checkup.rb', line 52 def pathext p_ext = WindowsEnv.system['pathext'].downcase unless p_ext.include?('.rb') && p_ext.include?('.rbw') fail('pathext') else pass('pathext') end end |
#rubyopt ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/pik/checkup.rb', line 27 def rubyopt unless WindowsEnv.user['rubyopt'].empty? && WindowsEnv.system['rubyopt'].empty? fail('rubyopt') else pass('rubyopt') end end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/pik/checkup.rb', line 23 def to_s ERB.new(@output.join("\n\n")).result end |