Skip to content

Commit

Permalink
Fixes for install.rb.
Browse files Browse the repository at this point in the history
  • Loading branch information
djberg96 committed Jul 4, 2010
1 parent e5ef8ec commit e4aca37
Showing 1 changed file with 34 additions and 33 deletions.
67 changes: 34 additions & 33 deletions install.rb
Expand Up @@ -30,42 +30,43 @@
# has already been written at some point previously and skip it.
#######################################################################
if CONFIG['host_os'] =~ /linux/
cpu_file = "/proc/cpuinfo"
text_file = "doc/linux.txt"
rb_file = "lib/linux/sys/cpu.rb"
cpu_file = "/proc/cpuinfo"
text_file = "doc/linux.txt"
rb_file = "lib/linux/sys/cpu.rb"

if File.size(text_file) > 1400
puts "You appear to have already created the documentation."
puts "Skipping..."
else
puts "Dynamically generating documentation..."
fh = File.open(text_file,"a+")
if File.size(text_file) > 1400
puts "You appear to have already created the documentation."
puts "Skipping..."
else
puts "Dynamically generating documentation..."
fh = File.open(text_file, 'a')

IO.foreach(cpu_file){ |line|
next if line =~ /^$/
k,v = line.split(":")

v = v.strip.chomp
k = k.strip.gsub(/\s+/, '_').downcase

k += "?" if v =~ /yes|no/i

IO.foreach(cpu_file){ |line|
next if line =~ /^$/
k,v = line.split(":")
v.strip!.chomp!
k.strip!.gsub!(/\s+/,"_")
k.downcase!
if v =~ /yes|no/i
k += "?"
end
fh.puts("CPU.#{k}")
if v =~ /yes|no/i
k.chop!
msg = " Returns true if a " + k.gsub(/_/," ") + "exists on"
msg << " this system"
fh.puts(msg)
else
fh.puts(" Returns the " + k.gsub(/_/," "))
end
fh.puts # Add a blank line
}
fh.puts("CPU.#{k}")

fh.puts(doc)
fh.close
puts "Documentation creation complete"
end
if v =~ /yes|no/i
k.chop!
msg = " Returns true if a " + k.gsub(/_/," ") + "exists on"
msg << " this system"
fh.puts(msg)
else
fh.puts(" Returns the " + k.gsub(/_/," "))
end

fh.puts # Add a blank line
}

fh.close
puts "Documentation creation complete"
end
end

# Create the 'sys' toplevel directory if it doesn't already exist
Expand Down

0 comments on commit e4aca37

Please sign in to comment.