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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e6529879
Commit
e6529879
authored
Feb 15, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure rake tasks produce helpful error messages for node dependency issues
parent
b36542e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
21 deletions
+57
-21
lib/tasks/eslint.rake
lib/tasks/eslint.rake
+4
-3
lib/tasks/gitlab/assets.rake
lib/tasks/gitlab/assets.rake
+11
-11
lib/tasks/karma.rake
lib/tasks/karma.rake
+2
-7
lib/tasks/yarn.rake
lib/tasks/yarn.rake
+40
-0
No files found.
lib/tasks/eslint.rake
View file @
e6529879
unless
Rails
.
env
.
production?
desc
"GitLab | Run ESLint"
task
:eslint
do
system
(
"yarn"
,
"run"
,
"eslint"
)
task
eslint:
[
'yarn:check'
]
do
sh
"yarn run eslint"
do
|
ok
,
res
|
abort
(
'rake eslint failed'
)
unless
ok
end
end
end
lib/tasks/gitlab/assets.rake
View file @
e6529879
namespace
:gitlab
do
namespace
:assets
do
desc
'GitLab | Assets | Compile all frontend assets'
task
:compile
do
Rake
::
Task
[
'assets:precompile'
].
invoke
Rake
::
Task
[
'webpack:compile'
].
invoke
Rake
::
Task
[
'gitlab:assets:fix_urls'
].
invoke
end
task
compile:
[
'yarn:check'
,
'assets:precompile'
,
'webpack:compile'
,
'gitlab:assets:fix_urls'
]
desc
'GitLab | Assets | Clean up old compiled frontend assets'
task
:clean
do
Rake
::
Task
[
'assets:clean'
].
invoke
end
task
clean:
[
'assets:clean'
]
desc
'GitLab | Assets | Remove all compiled frontend assets'
task
:purge
do
Rake
::
Task
[
'assets:clobber'
].
invoke
end
task
purge:
[
'assets:clobber'
]
desc
'GitLab | Assets | Uninstall frontend dependencies'
task
purge_modules:
[
'yarn:clobber'
]
desc
'GitLab | Assets | Fix all absolute url references in CSS'
task
:fix_urls
do
...
...
lib/tasks/karma.rake
View file @
e6529879
unless
Rails
.
env
.
production?
Rake
::
Task
[
'karma'
].
clear
if
Rake
::
Task
.
task_defined?
(
'karma'
)
namespace
:karma
do
desc
'GitLab | Karma | Generate fixtures for JavaScript tests'
RSpec
::
Core
::
RakeTask
.
new
(
:fixtures
)
do
|
t
|
...
...
@@ -10,7 +8,7 @@ unless Rails.env.production?
end
desc
'GitLab | Karma | Run JavaScript tests'
task
:tests
do
task
tests:
[
'yarn:check'
]
do
sh
"yarn run karma"
do
|
ok
,
res
|
abort
(
'rake karma:tests failed'
)
unless
ok
end
...
...
@@ -18,8 +16,5 @@ unless Rails.env.production?
end
desc
'GitLab | Karma | Shortcut for karma:fixtures and karma:tests'
task
:karma
do
Rake
::
Task
[
'karma:fixtures'
].
invoke
Rake
::
Task
[
'karma:tests'
].
invoke
end
task
karma:
[
'karma:fixtures'
,
'karma:tests'
]
end
lib/tasks/yarn.rake
0 → 100644
View file @
e6529879
namespace
:yarn
do
desc
'Ensure Yarn is installed'
task
:available
do
unless
system
(
'yarn --version'
,
out:
File
::
NULL
)
warn
(
'Error: Yarn executable was not detected in the system.'
.
color
(
:red
),
'Download Yarn at https://yarnpkg.com/en/docs/install'
.
color
(
:green
)
)
abort
end
end
desc
'Ensure Node dependencies are installed'
task
check:
[
'yarn:available'
]
do
unless
system
(
'yarn check --ignore-engines'
,
out:
File
::
NULL
)
warn
(
'Error: You have unmet dependencies. (`yarn check` command failed)'
.
color
(
:red
),
'Run `yarn install` to install missing modules.'
.
color
(
:green
)
)
abort
end
end
desc
'Install Node dependencies with Yarn'
task
install:
[
'yarn:available'
]
do
unless
system
(
'yarn install --force --pure-lockfile --ignore-engines'
)
abort
'Error: Unable to install node modules.'
.
color
(
:red
)
end
end
desc
'Remove Node dependencies'
task
:clobber
do
warn
'Purging ./node_modules directory'
.
color
(
:red
)
FileUtils
.
rm_rf
'node_modules'
end
end
desc
'Install Node dependencies with Yarn'
task
yarn:
[
'yarn:install'
]
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