Skip to content

Commit

Permalink
Grab the computer name correctly base don platform
Browse files Browse the repository at this point in the history
  • Loading branch information
hemancuso committed Feb 17, 2011
1 parent 732fda6 commit 1197fb9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/strongspace/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ def computername
n = File.read(credentials_file).split("\n")[2]

if n.blank?
@computername ||= `system_profiler SPSoftwareDataType | grep "Computer Name"`.split(":").last.nice_slug

if running_on_a_mac?
@computername ||= `system_profiler SPSoftwareDataType | grep "Computer Name"`.split(":").last.nice_slug
elsif running_on_windows?
@computername ||= ENV['COMPUTERNAME'].nice_slug
else
@computername ||= `hostname`.strip.nice_slug
end

if @computername.length < 3
@computername = ENV['USER'].nice_slug
Expand Down

0 comments on commit 1197fb9

Please sign in to comment.