summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorJames Edwards-Jones <jamedjo@gmail.com>2017-02-06 15:12:27 +0000
committerJames Edwards-Jones <jamedjo@gmail.com>2017-02-06 15:12:27 +0000
commitb988faaf85c8e68d501f242b980e5e79a00e2b15 (patch)
treefaffbfe623bfcbfe1c09bddac00b2cc879baff63 /config
parent5af4cae544c8526de63e639bd6c7db730526add3 (diff)
parent53db7d1d75e1d14cb20278bd0c1a75ce24a6626d (diff)
downloadgitlab-ce-b988faaf85c8e68d501f242b980e5e79a00e2b15.tar.gz
Merge branch 'master' into 'jej-pages-to-ce'jej-pages-to-ce
# Conflicts: # db/schema.rb
Diffstat (limited to 'config')
-rw-r--r--config/application.rb32
-rw-r--r--config/dependency_decisions.yml121
-rw-r--r--config/gitlab.yml.example10
-rw-r--r--config/initializers/1_settings.rb9
-rw-r--r--config/initializers/static_files.rb31
-rw-r--r--config/karma.config.js21
-rw-r--r--config/routes/project.rb2
-rw-r--r--config/webpack.config.js125
8 files changed, 319 insertions, 32 deletions
diff --git a/config/application.rb b/config/application.rb
index f00e58a36ca..9088d3c432b 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -80,6 +80,14 @@ module Gitlab
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
+ # Configure webpack
+ config.webpack.config_file = "config/webpack.config.js"
+ config.webpack.output_dir = "public/assets/webpack"
+ config.webpack.public_path = "assets/webpack"
+
+ # Webpack dev server configuration is handled in initializers/static_files.rb
+ config.webpack.dev_server.enabled = false
+
# Enable the asset pipeline
config.assets.enabled = true
config.assets.paths << Gemojione.images_path
@@ -88,31 +96,13 @@ module Gitlab
config.assets.precompile << "print.css"
config.assets.precompile << "notify.css"
config.assets.precompile << "mailers/*.css"
- config.assets.precompile << "lib/vue_resource.js"
config.assets.precompile << "katex.css"
config.assets.precompile << "katex.js"
config.assets.precompile << "xterm/xterm.css"
- config.assets.precompile << "graphs/graphs_bundle.js"
- config.assets.precompile << "users/users_bundle.js"
- config.assets.precompile << "network/network_bundle.js"
- config.assets.precompile << "profile/profile_bundle.js"
- config.assets.precompile << "protected_branches/protected_branches_bundle.js"
- config.assets.precompile << "diff_notes/diff_notes_bundle.js"
- config.assets.precompile << "merge_request_widget/ci_bundle.js"
- config.assets.precompile << "issuable/issuable_bundle.js"
- config.assets.precompile << "boards/boards_bundle.js"
- config.assets.precompile << "cycle_analytics/cycle_analytics_bundle.js"
- config.assets.precompile << "merge_conflicts/merge_conflicts_bundle.js"
- config.assets.precompile << "boards/test_utils/simulate_drag.js"
- config.assets.precompile << "environments/environments_bundle.js"
- config.assets.precompile << "blob_edit/blob_edit_bundle.js"
- config.assets.precompile << "snippet/snippet_bundle.js"
- config.assets.precompile << "terminal/terminal_bundle.js"
- config.assets.precompile << "filtered_search/filtered_search_bundle.js"
- config.assets.precompile << "lib/utils/*.js"
- config.assets.precompile << "lib/*.js"
+ config.assets.precompile << "lib/ace.js"
+ config.assets.precompile << "lib/cropper.js"
+ config.assets.precompile << "lib/raphael.js"
config.assets.precompile << "u2f.js"
- config.assets.precompile << "vue_pipelines_index/index.js"
config.assets.precompile << "vendor/assets/fonts/*"
# Version of your assets, change this if you want to expire all your assets
diff --git a/config/dependency_decisions.yml b/config/dependency_decisions.yml
index c11296975b7..aabe859730a 100644
--- a/config/dependency_decisions.yml
+++ b/config/dependency_decisions.yml
@@ -1,9 +1,9 @@
---
-# IGNORED GROUPS AND GEMS
- - :ignore_group
- development
- :who: Connor Shea
- :why: Development gems are not distributed with the final product and are therefore exempt.
+ :why: Development gems are not distributed with the final product and are therefore
+ exempt.
:versions: []
:when: 2016-04-17 21:27:01.054140000 Z
- - :ignore_group
@@ -18,8 +18,6 @@
:why: Bundler is MIT licensed but will sometimes fail in CI.
:versions: []
:when: 2016-05-02 06:42:08.045090000 Z
-
-# LICENSE WHITELIST
- - :whitelist
- MIT
- :who: Connor Shea
@@ -86,9 +84,6 @@
:why: https://opensource.org/licenses/BSD-2-Clause
:versions: []
:when: 2016-07-26 21:24:07.248480000 Z
-
-
-# LICENSE BLACKLIST
- - :blacklist
- GPLv2
- :who: Connor Shea
@@ -107,9 +102,6 @@
:why: The OSL license is a copyleft license
:versions: []
:when: 2016-10-28 11:02:15.540105000 Z
-
-
-# GEM LICENSES
- - :license
- raphael-rails
- MIT
@@ -201,3 +193,112 @@
:why: https://github.com/jmcnevin/rubypants/blob/master/LICENSE.rdoc
:versions: []
:when: 2016-05-02 05:56:50.696858000 Z
+- - :approve
+ - after
+ - :who: Matt Lee
+ :why: https://github.com/Raynos/after/blob/master/LICENCE
+ :versions: []
+ :when: 2017-01-14 20:00:32.473125000 Z
+- - :approve
+ - amdefine
+ - :who: Matt Lee
+ :why: MIT License
+ :versions: []
+ :when: 2017-01-14 20:08:31.810633000 Z
+- - :approve
+ - base64id
+ - :who: Matt Lee
+ :why: https://github.com/faeldt/base64id/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:08:33.174760000 Z
+- - :approve
+ - blob
+ - :who: Matt Lee
+ :why: https://github.com/webmodules/blob/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:08:34.564048000 Z
+- - :approve
+ - callsite
+ - :who: Matt Lee
+ :why: https://github.com/tj/callsite/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:08:35.976025000 Z
+- - :approve
+ - component-bind
+ - :who: Matt Lee
+ :why: https://github.com/component/bind/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:08:37.291219000 Z
+- - :approve
+ - component-inherit
+ - :who: Matt Lee
+ :why: https://github.com/component/inherit/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:10:41.804804000 Z
+- - :approve
+ - fsevents
+ - :who: Matt Lee
+ :why: https://github.com/strongloop/fsevents/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:50:20.037775000 Z
+- - :approve
+ - indexof
+ - :who: Matt Lee
+ :why: https://github.com/component/indexof/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:10:43.209900000 Z
+- - :approve
+ - is-integer
+ - :who: Matt Lee
+ :why: https://github.com/parshap/js-is-integer/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:10:44.540916000 Z
+- - :approve
+ - jsonify
+ - :who: Matt Lee
+ :why: Public Domain - no formal license on this one. probably okay as its been
+ the same for along time. would prefer to see CC0
+ :versions: []
+ :when: 2017-01-14 20:10:45.857261000 Z
+- - :approve
+ - object-component
+ - :who: Matt Lee
+ :why: https://github.com/component/object/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:10:47.190148000 Z
+- - :approve
+ - optimist
+ - :who: Matt Lee
+ :why: https://github.com/substack/node-optimist/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:10:48.563077000 Z
+- - :approve
+ - path-is-inside
+ - :who: Matt Lee
+ :why: https://github.com/domenic/path-is-inside/blob/master/LICENSE.txt
+ :versions: []
+ :when: 2017-01-14 20:10:49.910497000 Z
+- - :approve
+ - rc
+ - :who: Matt Lee
+ :why: https://github.com/dominictarr/rc/blob/master/LICENSE.MIT
+ :versions: []
+ :when: 2017-01-14 20:10:51.244695000 Z
+- - :approve
+ - ripemd160
+ - :who: Matt Lee
+ :why: https://github.com/crypto-browserify/ripemd160/blob/master/LICENSE.md
+ :versions: []
+ :when: 2017-01-14 20:10:52.560282000 Z
+- - :approve
+ - select2
+ - :who: Matt Lee
+ :why: https://github.com/select2/select2/blob/master/LICENSE.md
+ :versions: []
+ :when: 2017-01-14 20:10:53.909618000 Z
+- - :approve
+ - tweetnacl
+ - :who: Matt Lee
+ :why: https://github.com/dchest/tweetnacl-js/blob/master/LICENSE
+ :versions: []
+ :when: 2017-01-14 20:10:57.812077000 Z
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 1cf24e3f3db..cc1af77a1de 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -520,6 +520,16 @@ production: &base
# Git timeout to read a commit, in seconds
timeout: 10
+ ## Webpack settings
+ # If enabled, this will tell rails to serve frontend assets from the webpack-dev-server running
+ # on a given port instead of serving directly from /assets/webpack. This is only indended for use
+ # in development.
+ webpack:
+ # dev_server:
+ # enabled: true
+ # host: localhost
+ # port: 3808
+
#
# 5. Extra customization
# ==========================
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 71046d7860e..ab59394cb0c 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -432,6 +432,15 @@ Settings['gitaly'] ||= Settingslogic.new({})
Settings.gitaly['socket_path'] ||= ENV['GITALY_SOCKET_PATH']
#
+# Webpack settings
+#
+Settings['webpack'] ||= Settingslogic.new({})
+Settings.webpack['dev_server'] ||= Settingslogic.new({})
+Settings.webpack.dev_server['enabled'] ||= false
+Settings.webpack.dev_server['host'] ||= 'localhost'
+Settings.webpack.dev_server['port'] ||= 3808
+
+#
# Testing settings
#
if Rails.env.test?
diff --git a/config/initializers/static_files.rb b/config/initializers/static_files.rb
index d6dbf8b9fbf..74aba6c5d06 100644
--- a/config/initializers/static_files.rb
+++ b/config/initializers/static_files.rb
@@ -12,4 +12,35 @@ if app.config.serve_static_files
app.paths["public"].first,
app.config.static_cache_control
)
+
+ # If webpack-dev-server is configured, proxy webpack's public directory
+ # instead of looking for static assets
+ dev_server = Gitlab.config.webpack.dev_server
+
+ if dev_server.enabled
+ settings = {
+ enabled: true,
+ host: dev_server.host,
+ port: dev_server.port,
+ manifest_host: dev_server.host,
+ manifest_port: dev_server.port,
+ }
+
+ if Rails.env.development?
+ settings.merge!(
+ host: Gitlab.config.gitlab.host,
+ port: Gitlab.config.gitlab.port,
+ https: Gitlab.config.gitlab.https,
+ )
+ app.config.middleware.insert_before(
+ Gitlab::Middleware::Static,
+ Gitlab::Middleware::WebpackProxy,
+ proxy_path: app.config.webpack.public_path,
+ proxy_host: dev_server.host,
+ proxy_port: dev_server.port,
+ )
+ end
+
+ app.config.webpack.dev_server.merge!(settings)
+ end
end
diff --git a/config/karma.config.js b/config/karma.config.js
new file mode 100644
index 00000000000..44229e2ee88
--- /dev/null
+++ b/config/karma.config.js
@@ -0,0 +1,21 @@
+var path = require('path');
+var webpackConfig = require('./webpack.config.js');
+var ROOT_PATH = path.resolve(__dirname, '..');
+
+// Karma configuration
+module.exports = function(config) {
+ config.set({
+ basePath: ROOT_PATH,
+ browsers: ['PhantomJS'],
+ frameworks: ['jasmine'],
+ files: [
+ { pattern: 'spec/javascripts/test_bundle.js', watched: false },
+ { pattern: 'spec/javascripts/fixtures/**/*@(.json|.html|.html.raw)', included: false },
+ ],
+ preprocessors: {
+ 'spec/javascripts/**/*.js?(.es6)': ['webpack', 'sourcemap'],
+ },
+ webpack: webpackConfig,
+ webpackMiddleware: { stats: 'errors-only' },
+ });
+};
diff --git a/config/routes/project.rb b/config/routes/project.rb
index ccee39803ed..c24893f4cd5 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -271,7 +271,7 @@ constraints(ProjectUrlConstrainer.new) do
resources :boards, only: [:index, :show] do
scope module: :boards do
- resources :issues, only: [:update]
+ resources :issues, only: [:index, :update]
resources :lists, only: [:index, :create, :update, :destroy] do
collection do
diff --git a/config/webpack.config.js b/config/webpack.config.js
new file mode 100644
index 00000000000..a156756f9ff
--- /dev/null
+++ b/config/webpack.config.js
@@ -0,0 +1,125 @@
+'use strict';
+
+var fs = require('fs');
+var path = require('path');
+var webpack = require('webpack');
+var StatsPlugin = require('stats-webpack-plugin');
+var CompressionPlugin = require('compression-webpack-plugin');
+
+var ROOT_PATH = path.resolve(__dirname, '..');
+var IS_PRODUCTION = process.env.NODE_ENV === 'production';
+var IS_DEV_SERVER = process.argv[1].indexOf('webpack-dev-server') !== -1;
+var DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10) || 3808;
+
+var config = {
+ context: path.join(ROOT_PATH, 'app/assets/javascripts'),
+ entry: {
+ application: './application.js',
+ blob_edit: './blob_edit/blob_edit_bundle.js',
+ boards: './boards/boards_bundle.js',
+ boards_test: './boards/test_utils/simulate_drag.js',
+ cycle_analytics: './cycle_analytics/cycle_analytics_bundle.js',
+ diff_notes: './diff_notes/diff_notes_bundle.js',
+ environments: './environments/environments_bundle.js',
+ filtered_search: './filtered_search/filtered_search_bundle.js',
+ graphs: './graphs/graphs_bundle.js',
+ issuable: './issuable/issuable_bundle.js',
+ merge_conflicts: './merge_conflicts/merge_conflicts_bundle.js',
+ merge_request_widget: './merge_request_widget/ci_bundle.js',
+ network: './network/network_bundle.js',
+ profile: './profile/profile_bundle.js',
+ protected_branches: './protected_branches/protected_branches_bundle.js',
+ snippet: './snippet/snippet_bundle.js',
+ terminal: './terminal/terminal_bundle.js',
+ users: './users/users_bundle.js',
+ lib_chart: './lib/chart.js',
+ lib_d3: './lib/d3.js',
+ lib_vue: './lib/vue_resource.js',
+ vue_pipelines: './vue_pipelines_index/index.js',
+ },
+
+ output: {
+ path: path.join(ROOT_PATH, 'public/assets/webpack'),
+ publicPath: '/assets/webpack/',
+ filename: IS_PRODUCTION ? '[name]-[chunkhash].js' : '[name].js'
+ },
+
+ devtool: 'inline-source-map',
+
+ module: {
+ loaders: [
+ {
+ test: /\.(js|es6)$/,
+ exclude: /(node_modules|vendor\/assets)/,
+ loader: 'babel-loader',
+ query: {
+ // 'use strict' was broken in sprockets-es6 due to sprockets concatination method.
+ // many es5 strict errors which were never caught ended up in our es6 assets as a result.
+ // this hack is necessary until they can be fixed.
+ blacklist: ['useStrict']
+ }
+ },
+ {
+ test: /\.(js|es6)$/,
+ loader: 'imports-loader',
+ query: 'this=>window'
+ },
+ {
+ test: /\.json$/,
+ loader: 'json-loader'
+ }
+ ]
+ },
+
+ plugins: [
+ // manifest filename must match config.webpack.manifest_filename
+ // webpack-rails only needs assetsByChunkName to function properly
+ new StatsPlugin('manifest.json', {
+ chunkModules: false,
+ source: false,
+ chunks: false,
+ modules: false,
+ assets: true
+ }),
+ new CompressionPlugin({
+ asset: '[path].gz[query]',
+ }),
+ ],
+
+ resolve: {
+ extensions: ['', '.js', '.es6', '.js.es6'],
+ alias: {
+ '~': path.join(ROOT_PATH, 'app/assets/javascripts'),
+ 'bootstrap/js': 'bootstrap-sass/assets/javascripts/bootstrap',
+ 'emoji-aliases$': path.join(ROOT_PATH, 'fixtures/emojis/aliases.json'),
+ 'vendor': path.join(ROOT_PATH, 'vendor/assets/javascripts'),
+ 'vue$': 'vue/dist/vue.js',
+ 'vue-resource$': 'vue-resource/dist/vue-resource.js'
+ }
+ }
+}
+
+if (IS_PRODUCTION) {
+ config.devtool = 'source-map';
+ config.plugins.push(
+ new webpack.NoErrorsPlugin(),
+ new webpack.optimize.UglifyJsPlugin({
+ compress: { warnings: false }
+ }),
+ new webpack.DefinePlugin({
+ 'process.env': { NODE_ENV: JSON.stringify('production') }
+ }),
+ new webpack.optimize.DedupePlugin(),
+ new webpack.optimize.OccurrenceOrderPlugin()
+ );
+}
+
+if (IS_DEV_SERVER) {
+ config.devServer = {
+ port: DEV_SERVER_PORT,
+ headers: { 'Access-Control-Allow-Origin': '*' }
+ };
+ config.output.publicPath = '//localhost:' + DEV_SERVER_PORT + config.output.publicPath;
+}
+
+module.exports = config;