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
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?
unless
Rails
.
env
.
production?
desc
"GitLab | Run ESLint"
desc
"GitLab | Run ESLint"
task
:eslint
do
task
eslint:
[
'yarn:check'
]
do
system
(
"yarn"
,
"run"
,
"eslint"
)
sh
"yarn run eslint"
do
|
ok
,
res
|
abort
(
'rake eslint failed'
)
unless
ok
end
end
end
end
end
lib/tasks/gitlab/assets.rake
View file @
e6529879
namespace
:gitlab
do
namespace
:gitlab
do
namespace
:assets
do
namespace
:assets
do
desc
'GitLab | Assets | Compile all frontend assets'
desc
'GitLab | Assets | Compile all frontend assets'
task
:compile
do
task
compile:
[
Rake
::
Task
[
'assets:precompile'
].
invoke
'yarn:check'
,
Rake
::
Task
[
'webpack:compile'
].
invoke
'assets:precompile'
,
Rake
::
Task
[
'gitlab:assets:fix_urls'
].
invoke
'webpack:compile'
,
end
'gitlab:assets:fix_urls'
]
desc
'GitLab | Assets | Clean up old compiled frontend assets'
desc
'GitLab | Assets | Clean up old compiled frontend assets'
task
:clean
do
task
clean:
[
'assets:clean'
]
Rake
::
Task
[
'assets:clean'
].
invoke
end
desc
'GitLab | Assets | Remove all compiled frontend assets'
desc
'GitLab | Assets | Remove all compiled frontend assets'
task
:purge
do
task
purge:
[
'assets:clobber'
]
Rake
::
Task
[
'assets:clobber'
].
invoke
end
desc
'GitLab | Assets | Uninstall frontend dependencies'
task
purge_modules:
[
'yarn:clobber'
]
desc
'GitLab | Assets | Fix all absolute url references in CSS'
desc
'GitLab | Assets | Fix all absolute url references in CSS'
task
:fix_urls
do
task
:fix_urls
do
...
...
lib/tasks/karma.rake
View file @
e6529879
unless
Rails
.
env
.
production?
unless
Rails
.
env
.
production?
Rake
::
Task
[
'karma'
].
clear
if
Rake
::
Task
.
task_defined?
(
'karma'
)
namespace
:karma
do
namespace
:karma
do
desc
'GitLab | Karma | Generate fixtures for JavaScript tests'
desc
'GitLab | Karma | Generate fixtures for JavaScript tests'
RSpec
::
Core
::
RakeTask
.
new
(
:fixtures
)
do
|
t
|
RSpec
::
Core
::
RakeTask
.
new
(
:fixtures
)
do
|
t
|
...
@@ -10,7 +8,7 @@ unless Rails.env.production?
...
@@ -10,7 +8,7 @@ unless Rails.env.production?
end
end
desc
'GitLab | Karma | Run JavaScript tests'
desc
'GitLab | Karma | Run JavaScript tests'
task
:tests
do
task
tests:
[
'yarn:check'
]
do
sh
"yarn run karma"
do
|
ok
,
res
|
sh
"yarn run karma"
do
|
ok
,
res
|
abort
(
'rake karma:tests failed'
)
unless
ok
abort
(
'rake karma:tests failed'
)
unless
ok
end
end
...
@@ -18,8 +16,5 @@ unless Rails.env.production?
...
@@ -18,8 +16,5 @@ unless Rails.env.production?
end
end
desc
'GitLab | Karma | Shortcut for karma:fixtures and karma:tests'
desc
'GitLab | Karma | Shortcut for karma:fixtures and karma:tests'
task
:karma
do
task
karma:
[
'karma:fixtures'
,
'karma:tests'
]
Rake
::
Task
[
'karma:fixtures'
].
invoke
Rake
::
Task
[
'karma:tests'
].
invoke
end
end
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