Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
a213d4b9
Commit
a213d4b9
authored
Jan 12, 2013
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move OS detection to task helpers and add detection of OS X
parent
fd836f54
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
lib/tasks/gitlab/info.rake
lib/tasks/gitlab/info.rake
+0
-14
lib/tasks/gitlab/task_helpers.rake
lib/tasks/gitlab/task_helpers.rake
+22
-0
No files found.
lib/tasks/gitlab/info.rake
View file @
a213d4b9
...
@@ -3,20 +3,6 @@ namespace :gitlab do
...
@@ -3,20 +3,6 @@ namespace :gitlab do
desc
"GITLAB | Show information about GitLab and its environment"
desc
"GITLAB | Show information about GitLab and its environment"
task
info: :environment
do
task
info: :environment
do
# check which OS is running
os_name
=
run
(
"lsb_release -irs"
)
os_name
||=
if
File
.
readable?
(
'/etc/system-release'
)
File
.
read
(
'/etc/system-release'
)
end
os_name
||=
if
File
.
readable?
(
'/etc/debian_version'
)
debian_version
=
File
.
read
(
'/etc/debian_version'
)
"Debian
#{
debian_version
}
"
end
os_name
||=
if
File
.
readable?
(
'/etc/SuSE-release'
)
File
.
read
(
'/etc/SuSE-release'
)
end
os_name
.
try
(
:squish!
)
# check if there is an RVM environment
# check if there is an RVM environment
rvm_version
=
run_and_match
(
"rvm --version"
,
/[\d\.]+/
).
try
(
:to_s
)
rvm_version
=
run_and_match
(
"rvm --version"
,
/[\d\.]+/
).
try
(
:to_s
)
# check Ruby version
# check Ruby version
...
...
lib/tasks/gitlab/task_helpers.rake
View file @
a213d4b9
namespace
:gitlab
do
namespace
:gitlab
do
# Check which OS is running
#
# It will primarily use lsb_relase to determine the OS.
# It has fallbacks to Debian, SuSE and OS X.
def
os_name
os_name
=
run
(
"lsb_release -irs"
)
os_name
||=
if
File
.
readable?
(
'/etc/system-release'
)
File
.
read
(
'/etc/system-release'
)
end
os_name
||=
if
File
.
readable?
(
'/etc/debian_version'
)
debian_version
=
File
.
read
(
'/etc/debian_version'
)
"Debian
#{
debian_version
}
"
end
os_name
||=
if
File
.
readable?
(
'/etc/SuSE-release'
)
File
.
read
(
'/etc/SuSE-release'
)
end
os_name
||=
if
os_x_version
=
run
(
"sw_vers -productVersion"
)
"Mac OS X
#{
os_x_version
}
"
end
os_name
.
try
(
:squish!
)
end
# Runs the given command and matches the output agains the given pattern
# Runs the given command and matches the output agains the given pattern
#
#
# Returns nil if nothing matched
# Returns nil if nothing matched
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment