Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
f621a55d583d
Commit
d9e646a7
authored
Feb 29, 2016
by
tiagonbotelho
Committed by
Yorick Peterse
Mar 07, 2016
Browse files
moves method to repository model
parent
b3da346fb3eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
f621a55d
...
...
@@ -947,12 +947,6 @@ def wiki
end
def
main_language
unless
empty_repo?
Rails
.
cache
.
fetch
([
self
,
"language"
])
do
Linguist
::
Repository
.
new
(
@repository
.
rugged
,
@repository
.
rugged
.
head
.
target_id
).
language
end
end
@main_language
=
repository
.
main_language
end
end
app/models/repository.rb
View file @
f621a55d
...
...
@@ -812,6 +812,18 @@ def ls_files(ref)
raw_repository
.
ls_files
(
actual_ref
)
end
def
main_language
return
@main_language
unless
@main_language
.
nil?
unless
empty?
@main_language
=
cache
.
fetch
(
:main_language
)
do
Linguist
::
Repository
.
new
(
rugged
,
rugged
.
head
.
target_id
).
language
end
end
end
private
def
cache
...
...
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