##// END OF EJS Templates
frontend: use webpack instead of vulcanize
ergo -
r3171:b9c8d2ad default
parent child
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -0,0 +1,7
1 import '../../../../../bower_components/iron-ajax/iron-ajax.html';
2 import './root-styles.gen.html';
3 import './channelstream-connection/channelstream-connection.html';
4 import './rhodecode-toast/rhodecode-toast.html';
5 import './rhodecode-toggle/rhodecode-toggle.html';
6 import './rhodecode-unsafe-html/rhodecode-unsafe-html.html';
7 import './rhodecode-app/rhodecode-app.html';
@@ -0,0 +1,69
1 /* webpack.config.js */
2 require('style-loader');
3 require('css-loader');
4 var path = require('path');
5
6 const projectName = 'rhodecode-components';
7 let destinationDirectory = path.join(process.cwd(), 'rhodecode', 'public', 'js')
8
9 if (process.env.RC_STATIC_DIR) {
10 destinationDirectory = process.env.RC_STATIC_DIR;
11 }
12
13 module.exports = {
14 // Tell Webpack which file kicks off our app.
15 entry: {
16 main: path.resolve(__dirname, 'rhodecode/public/js/src/components/index.js'),
17 },
18 output: {
19 filename: 'rhodecode-components.js',
20 path: path.resolve(destinationDirectory)
21 },
22 // Tell Webpack which directories to look in to resolve import statements.
23 // Normally Webpack will look in node_modules by default but since we’re overriding
24 // the property we’ll need to tell it to look there in addition to the
25 // bower_components folder.
26 resolve: {
27 modules: [
28 path.resolve(__dirname, 'node_modules'),
29 path.resolve(__dirname, 'bower_components')
30 ]
31 },
32 // These rules tell Webpack how to process different module types.
33 // Remember, *everything* is a module in Webpack. That includes
34 // CSS, and (thanks to our loader) HTML.
35 module: {
36 rules: [
37 {
38 // If you see a file that ends in .html, send it to these loaders.
39 test: /\.html$/,
40 // This is an example of chained loaders in Webpack.
41 // Chained loaders run last to first. So it will run
42 // polymer-webpack-loader, and hand the output to
43 // babel-loader. This let's us transpile JS in our `<script>` elements.
44 use: [
45 {loader: 'babel-loader'},
46 {loader: 'polymer-webpack-loader',
47 options: {
48 processStyleLinks: true,
49 }
50 }
51 ],
52 },
53 {
54 // If you see a file that ends in .js, just send it to the babel-loader.
55 test: /\.js$/,
56 use: 'babel-loader'
57 // Optionally exclude node_modules from transpilation except for polymer-webpack-loader:
58 // exclude: /node_modules\/(?!polymer-webpack-loader\/).*/
59 },
60 // this is required because of bug:
61 // https://github.com/webpack-contrib/polymer-webpack-loader/issues/49
62 {
63 test: /intl-messageformat.min.js/,
64 use: 'imports-loader?this=>window'
65 }
66 ]
67 },
68 plugins: []
69 };
@@ -1,67 +1,68
1 syntax: glob
1 syntax: glob
2 *.egg
2 *.egg
3 *.egg-info
3 *.egg-info
4 *.idea
4 *.idea
5 *.orig
5 *.orig
6 *.pyc
6 *.pyc
7 *.sqlite-journal
7 *.sqlite-journal
8 *.swp
8 *.swp
9 *.tox
9 *.tox
10 *.DS_Store*
10 *.DS_Store*
11 rhodecode/public/js/src/components/**/*.css
11 rhodecode/public/js/src/components/**/*.css
12
12
13 syntax: regexp
13 syntax: regexp
14
14
15 #.filename
15 #.filename
16 ^\.settings$
16 ^\.settings$
17 ^\.project$
17 ^\.project$
18 ^\.pydevproject$
18 ^\.pydevproject$
19 ^\.coverage$
19 ^\.coverage$
20 ^\.cache.*$
20 ^\.cache.*$
21 ^\.rhodecode$
21 ^\.rhodecode$
22
22
23 ^rcextensions
23 ^rcextensions
24 ^.dev
24 ^.dev
25 ^._dev
25 ^._dev
26 ^build/
26 ^build/
27 ^bower_components/
27 ^bower_components/
28 ^coverage\.xml$
28 ^coverage\.xml$
29 ^data$
29 ^data$
30 ^\.eggs/
30 ^\.eggs/
31 ^configs/data$
31 ^configs/data$
32 ^dev.ini$
32 ^dev.ini$
33 ^acceptance_tests/dev.*\.ini$
33 ^acceptance_tests/dev.*\.ini$
34 ^dist/
34 ^dist/
35 ^fabfile.py
35 ^fabfile.py
36 ^htmlcov
36 ^htmlcov
37 ^junit\.xml$
37 ^junit\.xml$
38 ^node_modules/
38 ^node_modules/
39 ^node_binaries/
39 ^node_binaries/
40 ^pylint.log$
40 ^pylint.log$
41 ^rcextensions/
41 ^rcextensions/
42 ^result$
42 ^result$
43 ^rhodecode/public/css/style.css$
43 ^rhodecode/public/css/style.css$
44 ^rhodecode/public/css/style-polymer.css$
44 ^rhodecode/public/css/style-polymer.css$
45 ^rhodecode/public/js/rhodecode-components.html$
45 ^rhodecode/public/js/rhodecode-components.html$
46 ^rhodecode/public/js/scripts.js$
46 ^rhodecode/public/js/scripts.js$
47 ^rhodecode/public/js/rhodecode-components.js$
47 ^rhodecode/public/js/rhodecode-components.js$
48 ^rhodecode/public/js/app-bundle.js$
48 ^rhodecode/public/js/src/components/root-styles.gen.html$
49 ^rhodecode/public/js/src/components/root-styles.gen.html$
49 ^rhodecode/public/js/vendors/webcomponentsjs/
50 ^rhodecode/public/js/vendors/webcomponentsjs/
50 ^rhodecode\.db$
51 ^rhodecode\.db$
51 ^rhodecode\.log$
52 ^rhodecode\.log$
52 ^rhodecode_dev\.log$
53 ^rhodecode_dev\.log$
53 ^test\.db$
54 ^test\.db$
54
55
55 # ac-tests
56 # ac-tests
56 ^acceptance_tests/\.cache.*$
57 ^acceptance_tests/\.cache.*$
57 ^acceptance_tests/externals
58 ^acceptance_tests/externals
58 ^acceptance_tests/ghostdriver.log$
59 ^acceptance_tests/ghostdriver.log$
59 ^acceptance_tests/local(_.+)?\.ini$
60 ^acceptance_tests/local(_.+)?\.ini$
60
61
61 # docs
62 # docs
62 ^docs/_build$
63 ^docs/_build$
63 ^docs/result$
64 ^docs/result$
64 ^docs-internal/_build$
65 ^docs-internal/_build$
65
66
66 # Cythonized things
67 # Cythonized things
67 ^rhodecode/.*\.(c|so)$
68 ^rhodecode/.*\.(c|so)$
@@ -1,14 +1,21
1 var gruntConfig = require('./grunt_config.json');
1 var gruntConfig = require('./grunt_config.json');
2 var webpackConfig = require('./webpack.config');
3 gruntConfig["webpack"] = {
4 options: {
5 stats: !process.env.NODE_ENV || process.env.NODE_ENV === 'development'
6 },
7 prod: webpackConfig,
8 dev: Object.assign({ watch: false }, webpackConfig)
9 };
2
10
3 module.exports = function(grunt) {
11 module.exports = function(grunt) {
4 grunt.initConfig(gruntConfig);
12 grunt.initConfig(gruntConfig);
5
13
6 grunt.loadNpmTasks('grunt-contrib-less');
14 grunt.loadNpmTasks('grunt-contrib-less');
7 grunt.loadNpmTasks('grunt-contrib-concat');
15 grunt.loadNpmTasks('grunt-contrib-concat');
8 grunt.loadNpmTasks('grunt-contrib-watch');
16 grunt.loadNpmTasks('grunt-contrib-watch');
9 grunt.loadNpmTasks('grunt-contrib-jshint');
17 grunt.loadNpmTasks('grunt-contrib-jshint');
10 grunt.loadNpmTasks('grunt-vulcanize');
11 grunt.loadNpmTasks('grunt-contrib-copy');
18 grunt.loadNpmTasks('grunt-contrib-copy');
12
19 grunt.loadNpmTasks('grunt-webpack');
13 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy', 'concat:dist', 'vulcanize']);
20 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy', 'webpack', 'concat:dist']);
14 };
21 };
@@ -1,188 +1,176
1 {
1 {
2 "dirs": {
2 "dirs": {
3 "css": {
3 "css": {
4 "src":"rhodecode/public/css",
4 "src":"rhodecode/public/css",
5 "dest":"rhodecode/public/css"
5 "dest":"rhodecode/public/css"
6 },
6 },
7 "js": {
7 "js": {
8 "src": "rhodecode/public/js/src",
8 "src": "rhodecode/public/js/src",
9 "src_rc": "rhodecode/public/js/rhodecode",
9 "src_rc": "rhodecode/public/js/rhodecode",
10 "dest": "rhodecode/public/js",
10 "dest": "rhodecode/public/js",
11 "bower": "bower_components",
11 "bower": "bower_components",
12 "node_modules": "node_modules"
12 "node_modules": "node_modules"
13 }
13 }
14 },
14 },
15 "copy": {
15 "copy": {
16 "main": {
16 "main": {
17 "expand": true,
17 "expand": true,
18 "cwd": "bower_components",
18 "cwd": "bower_components",
19 "src": "webcomponentsjs/webcomponents*.*",
19 "src": "webcomponentsjs/webcomponents*.*",
20 "dest": "<%= dirs.js.dest %>/vendors"
20 "dest": "<%= dirs.js.dest %>/vendors"
21 }
21 }
22 },
22 },
23 "concat": {
23 "concat": {
24 "polymercss": {
24 "polymercss": {
25 "src": [
25 "src": [
26 "<%= dirs.js.src %>/components/root-styles-prefix.html",
26 "<%= dirs.js.src %>/components/root-styles-prefix.html",
27 "<%= dirs.css.src %>/style-polymer.css",
27 "<%= dirs.css.src %>/style-polymer.css",
28 "<%= dirs.js.src %>/components/root-styles-suffix.html"
28 "<%= dirs.js.src %>/components/root-styles-suffix.html"
29 ],
29 ],
30 "dest": "<%= dirs.js.dest %>/src/components/root-styles.gen.html",
30 "dest": "<%= dirs.js.dest %>/src/components/root-styles.gen.html",
31 "nonull": true
31 "nonull": true
32 },
32 },
33 "dist": {
33 "dist": {
34 "src": [
34 "src": [
35 "<%= dirs.js.node_modules %>/jquery/dist/jquery.min.js",
35 "<%= dirs.js.node_modules %>/jquery/dist/jquery.min.js",
36 "<%= dirs.js.node_modules %>/mousetrap/mousetrap.min.js",
36 "<%= dirs.js.node_modules %>/mousetrap/mousetrap.min.js",
37 "<%= dirs.js.node_modules %>/moment/min/moment.min.js",
37 "<%= dirs.js.node_modules %>/moment/min/moment.min.js",
38 "<%= dirs.js.node_modules %>/clipboard/dist/clipboard.min.js",
38 "<%= dirs.js.node_modules %>/clipboard/dist/clipboard.min.js",
39 "<%= dirs.js.node_modules %>/favico.js/favico-0.3.10.min.js",
39 "<%= dirs.js.node_modules %>/favico.js/favico-0.3.10.min.js",
40 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/sticky-sidebar.min.js",
40 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/sticky-sidebar.min.js",
41 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/jquery.sticky-sidebar.min.js",
41 "<%= dirs.js.node_modules %>/sticky-sidebar/dist/jquery.sticky-sidebar.min.js",
42 "<%= dirs.js.node_modules %>/waypoints/lib/noframework.waypoints.min.js",
42 "<%= dirs.js.node_modules %>/waypoints/lib/noframework.waypoints.min.js",
43 "<%= dirs.js.node_modules %>/waypoints/lib/jquery.waypoints.min.js",
43 "<%= dirs.js.node_modules %>/waypoints/lib/jquery.waypoints.min.js",
44 "<%= dirs.js.node_modules %>/appenlight-client/appenlight-client.min.js",
44 "<%= dirs.js.node_modules %>/appenlight-client/appenlight-client.min.js",
45 "<%= dirs.js.src %>/logging.js",
45 "<%= dirs.js.src %>/logging.js",
46 "<%= dirs.js.src %>/bootstrap.js",
46 "<%= dirs.js.src %>/bootstrap.js",
47 "<%= dirs.js.src %>/i18n_utils.js",
47 "<%= dirs.js.src %>/i18n_utils.js",
48 "<%= dirs.js.src %>/deform.js",
48 "<%= dirs.js.src %>/deform.js",
49 "<%= dirs.js.src %>/ejs.js",
49 "<%= dirs.js.src %>/ejs.js",
50 "<%= dirs.js.src %>/ejs_templates/utils.js",
50 "<%= dirs.js.src %>/ejs_templates/utils.js",
51 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
51 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
52 "<%= dirs.js.src %>/plugins/jquery.dataTables.js",
52 "<%= dirs.js.src %>/plugins/jquery.dataTables.js",
53 "<%= dirs.js.src %>/plugins/flavoured_checkbox.js",
53 "<%= dirs.js.src %>/plugins/flavoured_checkbox.js",
54 "<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js",
54 "<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js",
55 "<%= dirs.js.src %>/plugins/jquery.autocomplete.js",
55 "<%= dirs.js.src %>/plugins/jquery.autocomplete.js",
56 "<%= dirs.js.src %>/plugins/jquery.debounce.js",
56 "<%= dirs.js.src %>/plugins/jquery.debounce.js",
57 "<%= dirs.js.src %>/plugins/jquery.mark.js",
57 "<%= dirs.js.src %>/plugins/jquery.mark.js",
58 "<%= dirs.js.src %>/plugins/jquery.timeago.js",
58 "<%= dirs.js.src %>/plugins/jquery.timeago.js",
59 "<%= dirs.js.src %>/plugins/jquery.timeago-extension.js",
59 "<%= dirs.js.src %>/plugins/jquery.timeago-extension.js",
60 "<%= dirs.js.src %>/select2/select2.js",
60 "<%= dirs.js.src %>/select2/select2.js",
61 "<%= dirs.js.src %>/codemirror/codemirror.js",
61 "<%= dirs.js.src %>/codemirror/codemirror.js",
62 "<%= dirs.js.src %>/codemirror/codemirror_loadmode.js",
62 "<%= dirs.js.src %>/codemirror/codemirror_loadmode.js",
63 "<%= dirs.js.src %>/codemirror/codemirror_hint.js",
63 "<%= dirs.js.src %>/codemirror/codemirror_hint.js",
64 "<%= dirs.js.src %>/codemirror/codemirror_overlay.js",
64 "<%= dirs.js.src %>/codemirror/codemirror_overlay.js",
65 "<%= dirs.js.src %>/codemirror/codemirror_placeholder.js",
65 "<%= dirs.js.src %>/codemirror/codemirror_placeholder.js",
66 "<%= dirs.js.src %>/codemirror/codemirror_simplemode.js",
66 "<%= dirs.js.src %>/codemirror/codemirror_simplemode.js",
67 "<%= dirs.js.dest %>/mode/meta.js",
67 "<%= dirs.js.dest %>/mode/meta.js",
68 "<%= dirs.js.dest %>/mode/meta_ext.js",
68 "<%= dirs.js.dest %>/mode/meta_ext.js",
69 "<%= dirs.js.src_rc %>/i18n/select2/translations.js",
69 "<%= dirs.js.src_rc %>/i18n/select2/translations.js",
70 "<%= dirs.js.src %>/rhodecode/utils/array.js",
70 "<%= dirs.js.src %>/rhodecode/utils/array.js",
71 "<%= dirs.js.src %>/rhodecode/utils/string.js",
71 "<%= dirs.js.src %>/rhodecode/utils/string.js",
72 "<%= dirs.js.src %>/rhodecode/utils/pyroutes.js",
72 "<%= dirs.js.src %>/rhodecode/utils/pyroutes.js",
73 "<%= dirs.js.src %>/rhodecode/utils/ajax.js",
73 "<%= dirs.js.src %>/rhodecode/utils/ajax.js",
74 "<%= dirs.js.src %>/rhodecode/utils/autocomplete.js",
74 "<%= dirs.js.src %>/rhodecode/utils/autocomplete.js",
75 "<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js",
75 "<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js",
76 "<%= dirs.js.src %>/rhodecode/utils/ie.js",
76 "<%= dirs.js.src %>/rhodecode/utils/ie.js",
77 "<%= dirs.js.src %>/rhodecode/utils/os.js",
77 "<%= dirs.js.src %>/rhodecode/utils/os.js",
78 "<%= dirs.js.src %>/rhodecode/utils/topics.js",
78 "<%= dirs.js.src %>/rhodecode/utils/topics.js",
79 "<%= dirs.js.src %>/rhodecode/init.js",
79 "<%= dirs.js.src %>/rhodecode/init.js",
80 "<%= dirs.js.src %>/rhodecode/changelog.js",
80 "<%= dirs.js.src %>/rhodecode/changelog.js",
81 "<%= dirs.js.src %>/rhodecode/codemirror.js",
81 "<%= dirs.js.src %>/rhodecode/codemirror.js",
82 "<%= dirs.js.src %>/rhodecode/comments.js",
82 "<%= dirs.js.src %>/rhodecode/comments.js",
83 "<%= dirs.js.src %>/rhodecode/constants.js",
83 "<%= dirs.js.src %>/rhodecode/constants.js",
84 "<%= dirs.js.src %>/rhodecode/files.js",
84 "<%= dirs.js.src %>/rhodecode/files.js",
85 "<%= dirs.js.src %>/rhodecode/followers.js",
85 "<%= dirs.js.src %>/rhodecode/followers.js",
86 "<%= dirs.js.src %>/rhodecode/menus.js",
86 "<%= dirs.js.src %>/rhodecode/menus.js",
87 "<%= dirs.js.src %>/rhodecode/notifications.js",
87 "<%= dirs.js.src %>/rhodecode/notifications.js",
88 "<%= dirs.js.src %>/rhodecode/permissions.js",
88 "<%= dirs.js.src %>/rhodecode/permissions.js",
89 "<%= dirs.js.src %>/rhodecode/pjax.js",
89 "<%= dirs.js.src %>/rhodecode/pjax.js",
90 "<%= dirs.js.src %>/rhodecode/pullrequests.js",
90 "<%= dirs.js.src %>/rhodecode/pullrequests.js",
91 "<%= dirs.js.src %>/rhodecode/settings.js",
91 "<%= dirs.js.src %>/rhodecode/settings.js",
92 "<%= dirs.js.src %>/rhodecode/select2_widgets.js",
92 "<%= dirs.js.src %>/rhodecode/select2_widgets.js",
93 "<%= dirs.js.src %>/rhodecode/tooltips.js",
93 "<%= dirs.js.src %>/rhodecode/tooltips.js",
94 "<%= dirs.js.src %>/rhodecode/users.js",
94 "<%= dirs.js.src %>/rhodecode/users.js",
95 "<%= dirs.js.src %>/rhodecode/appenlight.js",
95 "<%= dirs.js.src %>/rhodecode/appenlight.js",
96 "<%= dirs.js.src %>/rhodecode.js"
96 "<%= dirs.js.src %>/rhodecode.js",
97 "<%= dirs.js.dest %>/rhodecode-components.js"
97 ],
98 ],
98 "dest": "<%= dirs.js.dest %>/scripts.js",
99 "dest": "<%= dirs.js.dest %>/scripts.js",
99 "nonull": true
100 "nonull": true
100 }
101 }
101 },
102 },
102 "less": {
103 "less": {
103 "development": {
104 "development": {
104 "options": {
105 "options": {
105 "compress": false,
106 "compress": false,
106 "yuicompress": false,
107 "yuicompress": false,
107 "optimization": 0
108 "optimization": 0
108 },
109 },
109 "files": {
110 "files": {
110 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
111 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
111 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
112 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
112 }
113 }
113 },
114 },
114 "production": {
115 "production": {
115 "options": {
116 "options": {
116 "compress": true,
117 "compress": true,
117 "yuicompress": true,
118 "yuicompress": true,
118 "optimization": 2
119 "optimization": 2
119 },
120 },
120 "files": {
121 "files": {
121 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
122 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
122 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
123 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
123 }
124 }
124 },
125 },
125 "components": {
126 "components": {
126 "files": [
127 "files": [
127 {
128 {
128 "cwd": "<%= dirs.js.src %>/components/",
129 "cwd": "<%= dirs.js.src %>/components/",
129 "dest": "<%= dirs.js.src %>/components/",
130 "dest": "<%= dirs.js.src %>/components/",
130 "src": [
131 "src": [
131 "**/*.less"
132 "**/*.less"
132 ],
133 ],
133 "expand": true,
134 "expand": true,
134 "ext": ".css"
135 "ext": ".css"
135 }
136 }
136 ]
137 ]
137 }
138 }
138 },
139 },
139 "watch": {
140 "watch": {
140 "less": {
141 "less": {
141 "files": [
142 "files": [
142 "<%= dirs.css.src %>/**/*.less",
143 "<%= dirs.css.src %>/**/*.less",
143 "<%= dirs.js.src %>/components/**/*.less"
144 "<%= dirs.js.src %>/components/**/*.less"
144 ],
145 ],
145 "tasks": [
146 "tasks": [
146 "less:development",
147 "less:development",
147 "less:components",
148 "less:components",
148 "concat:polymercss",
149 "concat:polymercss",
149 "vulcanize",
150 "webpack",
150 "concat:dist"
151 "concat:dist"
151 ]
152 ]
152 },
153 },
153 "js": {
154 "js": {
154 "files": [
155 "files": [
155 "!<%= dirs.js.src %>/components/root-styles.gen.html",
156 "!<%= dirs.js.src %>/components/root-styles.gen.html",
156 "<%= dirs.js.src %>/**/*.js",
157 "<%= dirs.js.src %>/**/*.js",
157 "<%= dirs.js.src %>/components/**/*.html"
158 "<%= dirs.js.src %>/components/**/*.html"
158 ],
159 ],
159 "tasks": [
160 "tasks": [
160 "less:components",
161 "less:components",
161 "concat:polymercss",
162 "concat:polymercss",
162 "vulcanize",
163 "webpack",
163 "concat:dist"
164 "concat:dist"
164 ]
165 ]
165 }
166 }
166 },
167 },
167 "jshint": {
168 "jshint": {
168 "rhodecode": {
169 "rhodecode": {
169 "src": "<%= dirs.js.src %>/rhodecode/**/*.js",
170 "src": "<%= dirs.js.src %>/rhodecode/**/*.js",
170 "options": {
171 "options": {
171 "jshintrc": ".jshintrc"
172 "jshintrc": ".jshintrc"
172 }
173 }
173 }
174 }
174 },
175 "vulcanize": {
176 "default": {
177 "options": {
178 "abspath": "",
179 "inlineScripts": true,
180 "inlineCss": true,
181 "stripComments": true
182 },
183 "files": {
184 "<%= dirs.js.dest %>/rhodecode-components.html": "<%= dirs.js.src %>/components/shared-components.html"
185 }
186 }
187 }
175 }
188 }
176 }
@@ -1,36 +1,50
1 {
1 {
2 "name": "rhodecode-enterprise",
2 "name": "rhodecode-enterprise",
3 "version": "1.0.0",
3 "version": "1.0.0",
4 "private": true,
4 "private": true,
5 "description" : "RhodeCode JS packaged",
5 "description" : "RhodeCode JS packaged",
6 "license": "SEE LICENSE IN LICENSE.txt",
6 "license": "SEE LICENSE IN LICENSE.txt",
7 "repository" : {
7 "repository" : {
8 "type" : "hg",
8 "type" : "hg",
9 "url" : "https://code.rhodecode.com/rhodecode-enterprise-ce"
9 "url" : "https://code.rhodecode.com/rhodecode-enterprise-ce"
10 },
10 },
11 "devDependencies": {
11 "devDependencies": {
12 "appenlight-client": "git+https://git@github.com/AppEnlight/appenlight-client-js.git#0.5.1",
12 "appenlight-client": "git+https://git@github.com/AppEnlight/appenlight-client-js.git#0.5.1",
13 "bower": "^1.8.4",
13 "bower": "^1.8.4",
14 "clipboard": "^2.0.1",
14 "clipboard": "^2.0.1",
15 "exports-loader": "^0.6.4",
15 "exports-loader": "^0.6.4",
16 "favico.js": "^0.3.10",
16 "favico.js": "^0.3.10",
17 "grunt": "^0.4.5",
17 "grunt": "^0.4.5",
18 "grunt-cli": "^1.3.1",
18 "grunt-cli": "^1.3.1",
19 "grunt-contrib-concat": "^0.5.1",
19 "grunt-contrib-concat": "^0.5.1",
20 "grunt-contrib-copy": "^1.0.0",
20 "grunt-contrib-copy": "^1.0.0",
21 "grunt-contrib-jshint": "^0.12.0",
21 "grunt-contrib-jshint": "^0.12.0",
22 "grunt-contrib-less": "^1.1.0",
22 "grunt-contrib-less": "^1.1.0",
23 "grunt-contrib-watch": "^0.6.1",
23 "grunt-contrib-watch": "^0.6.1",
24 "grunt-vulcanize": "^1.0.0",
24 "grunt-webpack": "^3.1.3",
25 "jquery": "1.11.3",
25 "jquery": "1.11.3",
26 "jshint": "^2.9.1-rc3",
26 "jshint": "^2.9.1-rc3",
27 "moment": "^2.18.1",
27 "moment": "^2.18.1",
28 "mousetrap": "^1.6.1",
28 "mousetrap": "^1.6.1",
29 "qrious": "^4.0.2",
29 "qrious": "^4.0.2",
30 "sticky-sidebar": "3.3.1",
30 "sticky-sidebar": "3.3.1",
31 "vulcanize": "^1.16.0",
32 "waypoints": "4.0.1",
31 "waypoints": "4.0.1",
33 "webpack": "4.23.1",
32 "webpack": "4.23.1",
34 "webpack-cli": "3.1.2"
33 "webpack-cli": "3.1.2",
34 "babel-core": "^6.26.3",
35 "babel-loader": "^7.1.2",
36 "babel-plugin-transform-object-rest-spread": "^6.26.0",
37 "babel-preset-env": "^1.6.0",
38 "copy-webpack-plugin": "^4.4.2",
39 "css-loader": "^0.28.11",
40 "exports-loader": "^0.6.4",
41 "html-loader": "^0.4.4",
42 "html-webpack-plugin": "^3.2.0",
43 "imports-loader": "^0.7.1",
44 "polymer-webpack-loader": "^2.0.1",
45 "style-loader": "^0.21.0",
46 "webpack-uglify-js-plugin": "^1.1.9",
47 "raw-loader": "1.0.0-beta.0",
48 "ts-loader": "^1.3.3"
35 }
49 }
36 }
50 }
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,142 +1,141
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2018 RhodeCode GmbH
3 # Copyright (C) 2010-2018 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21
21
22 import pytest
22 import pytest
23
23
24 import rhodecode
24 import rhodecode
25 from rhodecode.model.db import Repository
25 from rhodecode.model.db import Repository
26 from rhodecode.model.meta import Session
26 from rhodecode.model.meta import Session
27 from rhodecode.model.repo import RepoModel
27 from rhodecode.model.repo import RepoModel
28 from rhodecode.model.repo_group import RepoGroupModel
28 from rhodecode.model.repo_group import RepoGroupModel
29 from rhodecode.model.settings import SettingsModel
29 from rhodecode.model.settings import SettingsModel
30 from rhodecode.tests import TestController
30 from rhodecode.tests import TestController
31 from rhodecode.tests.fixture import Fixture
31 from rhodecode.tests.fixture import Fixture
32 from rhodecode.lib import helpers as h
32 from rhodecode.lib import helpers as h
33
33
34 fixture = Fixture()
34 fixture = Fixture()
35
35
36
36
37 def route_path(name, **kwargs):
37 def route_path(name, **kwargs):
38 return {
38 return {
39 'home': '/',
39 'home': '/',
40 'repo_group_home': '/{repo_group_name}'
40 'repo_group_home': '/{repo_group_name}'
41 }[name].format(**kwargs)
41 }[name].format(**kwargs)
42
42
43
43
44 class TestHomeController(TestController):
44 class TestHomeController(TestController):
45
45
46 def test_index(self):
46 def test_index(self):
47 self.log_user()
47 self.log_user()
48 response = self.app.get(route_path('home'))
48 response = self.app.get(route_path('home'))
49 # if global permission is set
49 # if global permission is set
50 response.mustcontain('Add Repository')
50 response.mustcontain('Add Repository')
51
51
52 # search for objects inside the JavaScript JSON
52 # search for objects inside the JavaScript JSON
53 for repo in Repository.getAll():
53 for repo in Repository.getAll():
54 response.mustcontain('"name_raw": "%s"' % repo.repo_name)
54 response.mustcontain('"name_raw": "%s"' % repo.repo_name)
55
55
56 def test_index_contains_statics_with_ver(self):
56 def test_index_contains_statics_with_ver(self):
57 from rhodecode.lib.base import calculate_version_hash
57 from rhodecode.lib.base import calculate_version_hash
58
58
59 self.log_user()
59 self.log_user()
60 response = self.app.get(route_path('home'))
60 response = self.app.get(route_path('home'))
61
61
62 rhodecode_version_hash = calculate_version_hash(
62 rhodecode_version_hash = calculate_version_hash(
63 {'beaker.session.secret': 'test-rc-uytcxaz'})
63 {'beaker.session.secret': 'test-rc-uytcxaz'})
64 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
64 response.mustcontain('style.css?ver={0}'.format(rhodecode_version_hash))
65 response.mustcontain('scripts.js?ver={0}'.format(rhodecode_version_hash))
65 response.mustcontain('scripts.js?ver={0}'.format(rhodecode_version_hash))
66 response.mustcontain('hodecode-components.html?ver={0}'.format(rhodecode_version_hash))
67
66
68 def test_index_contains_backend_specific_details(self, backend):
67 def test_index_contains_backend_specific_details(self, backend):
69 self.log_user()
68 self.log_user()
70 response = self.app.get(route_path('home'))
69 response = self.app.get(route_path('home'))
71 tip = backend.repo.get_commit().raw_id
70 tip = backend.repo.get_commit().raw_id
72
71
73 # html in javascript variable:
72 # html in javascript variable:
74 response.mustcontain(r'<i class=\"icon-%s\"' % (backend.alias, ))
73 response.mustcontain(r'<i class=\"icon-%s\"' % (backend.alias, ))
75 response.mustcontain(r'href=\"/%s\"' % (backend.repo_name, ))
74 response.mustcontain(r'href=\"/%s\"' % (backend.repo_name, ))
76
75
77 response.mustcontain("""/%s/changeset/%s""" % (backend.repo_name, tip))
76 response.mustcontain("""/%s/changeset/%s""" % (backend.repo_name, tip))
78 response.mustcontain("""Added a symlink""")
77 response.mustcontain("""Added a symlink""")
79
78
80 def test_index_with_anonymous_access_disabled(self):
79 def test_index_with_anonymous_access_disabled(self):
81 with fixture.anon_access(False):
80 with fixture.anon_access(False):
82 response = self.app.get(route_path('home'), status=302)
81 response = self.app.get(route_path('home'), status=302)
83 assert 'login' in response.location
82 assert 'login' in response.location
84
83
85 def test_index_page_on_groups(self, autologin_user, repo_group):
84 def test_index_page_on_groups(self, autologin_user, repo_group):
86 response = self.app.get(route_path('repo_group_home', repo_group_name='gr1'))
85 response = self.app.get(route_path('repo_group_home', repo_group_name='gr1'))
87 response.mustcontain("gr1/repo_in_group")
86 response.mustcontain("gr1/repo_in_group")
88
87
89 def test_index_page_on_group_with_trailing_slash(
88 def test_index_page_on_group_with_trailing_slash(
90 self, autologin_user, repo_group):
89 self, autologin_user, repo_group):
91 response = self.app.get(route_path('repo_group_home', repo_group_name='gr1') + '/')
90 response = self.app.get(route_path('repo_group_home', repo_group_name='gr1') + '/')
92 response.mustcontain("gr1/repo_in_group")
91 response.mustcontain("gr1/repo_in_group")
93
92
94 @pytest.fixture(scope='class')
93 @pytest.fixture(scope='class')
95 def repo_group(self, request):
94 def repo_group(self, request):
96 gr = fixture.create_repo_group('gr1')
95 gr = fixture.create_repo_group('gr1')
97 fixture.create_repo(name='gr1/repo_in_group', repo_group=gr)
96 fixture.create_repo(name='gr1/repo_in_group', repo_group=gr)
98
97
99 @request.addfinalizer
98 @request.addfinalizer
100 def cleanup():
99 def cleanup():
101 RepoModel().delete('gr1/repo_in_group')
100 RepoModel().delete('gr1/repo_in_group')
102 RepoGroupModel().delete(repo_group='gr1', force_delete=True)
101 RepoGroupModel().delete(repo_group='gr1', force_delete=True)
103 Session().commit()
102 Session().commit()
104
103
105 def test_index_with_name_with_tags(self, user_util, autologin_user):
104 def test_index_with_name_with_tags(self, user_util, autologin_user):
106 user = user_util.create_user()
105 user = user_util.create_user()
107 username = user.username
106 username = user.username
108 user.name = '<img src="/image1" onload="alert(\'Hello, World!\');">'
107 user.name = '<img src="/image1" onload="alert(\'Hello, World!\');">'
109 user.lastname = '#"><img src=x onerror=prompt(document.cookie);>'
108 user.lastname = '#"><img src=x onerror=prompt(document.cookie);>'
110
109
111 Session().add(user)
110 Session().add(user)
112 Session().commit()
111 Session().commit()
113 user_util.create_repo(owner=username)
112 user_util.create_repo(owner=username)
114
113
115 response = self.app.get(route_path('home'))
114 response = self.app.get(route_path('home'))
116 response.mustcontain(h.html_escape(user.first_name))
115 response.mustcontain(h.html_escape(user.first_name))
117 response.mustcontain(h.html_escape(user.last_name))
116 response.mustcontain(h.html_escape(user.last_name))
118
117
119 @pytest.mark.parametrize("name, state", [
118 @pytest.mark.parametrize("name, state", [
120 ('Disabled', False),
119 ('Disabled', False),
121 ('Enabled', True),
120 ('Enabled', True),
122 ])
121 ])
123 def test_index_show_version(self, autologin_user, name, state):
122 def test_index_show_version(self, autologin_user, name, state):
124 version_string = 'RhodeCode Enterprise %s' % rhodecode.__version__
123 version_string = 'RhodeCode Enterprise %s' % rhodecode.__version__
125
124
126 sett = SettingsModel().create_or_update_setting(
125 sett = SettingsModel().create_or_update_setting(
127 'show_version', state, 'bool')
126 'show_version', state, 'bool')
128 Session().add(sett)
127 Session().add(sett)
129 Session().commit()
128 Session().commit()
130 SettingsModel().invalidate_settings_cache()
129 SettingsModel().invalidate_settings_cache()
131
130
132 response = self.app.get(route_path('home'))
131 response = self.app.get(route_path('home'))
133 if state is True:
132 if state is True:
134 response.mustcontain(version_string)
133 response.mustcontain(version_string)
135 if state is False:
134 if state is False:
136 response.mustcontain(no=[version_string])
135 response.mustcontain(no=[version_string])
137
136
138 def test_logout_form_contains_csrf(self, autologin_user, csrf_token):
137 def test_logout_form_contains_csrf(self, autologin_user, csrf_token):
139 response = self.app.get(route_path('home'))
138 response = self.app.get(route_path('home'))
140 assert_response = response.assert_response()
139 assert_response = response.assert_response()
141 element = assert_response.get_element('.logout #csrf_token')
140 element = assert_response.get_element('.logout #csrf_token')
142 assert element.value == csrf_token
141 assert element.value == csrf_token
@@ -1,185 +1,185
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
2 <link rel="import" href="../channelstream-connection/channelstream-connection.html">
2 <link rel="import" href="../channelstream-connection/channelstream-connection.html">
3 <link rel="import" href="../rhodecode-toast/rhodecode-toast.html">
3 <link rel="import" href="../rhodecode-toast/rhodecode-toast.html">
4 <link rel="import" href="../rhodecode-favicon/rhodecode-favicon.html">
4 <link rel="import" href="../rhodecode-favicon/rhodecode-favicon.html">
5
5
6 <dom-module id="rhodecode-app">
6 <dom-module id="rhodecode-app">
7 <template>
7 <template>
8 <channelstream-connection
8 <channelstream-connection
9 id="channelstream-connection"
9 id="channelstream-connection"
10 on-channelstream-listen-message="receivedMessage"
10 on-channelstream-listen-message="receivedMessage"
11 on-channelstream-connected="handleConnected"
11 on-channelstream-connected="handleConnected"
12 on-channelstream-subscribed="handleSubscribed">
12 on-channelstream-subscribed="handleSubscribed">
13 </channelstream-connection>
13 </channelstream-connection>
14 <rhodecode-favicon></rhodecode-favicon>
14 <rhodecode-favicon></rhodecode-favicon>
15 </template>
15 </template>
16 <script>
16 <script>
17 ccLog = Logger.get('RhodeCodeApp');
17 var ccLog = Logger.get('RhodeCodeApp');
18 ccLog.setLevel(Logger.OFF);
18 ccLog.setLevel(Logger.OFF);
19
19
20 var rhodeCodeApp = Polymer({
20 var rhodeCodeApp = Polymer({
21 is: 'rhodecode-app',
21 is: 'rhodecode-app',
22 attached: function () {
22 attached: function () {
23 ccLog.debug('rhodeCodeApp created');
23 ccLog.debug('rhodeCodeApp created');
24 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
24 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
25 $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this));
25 $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this));
26 $.Topic('/connection_controller/subscribe').subscribe(
26 $.Topic('/connection_controller/subscribe').subscribe(
27 this.subscribeToChannelTopic.bind(this));
27 this.subscribeToChannelTopic.bind(this));
28 // this event can be used to coordinate plugins to do their
28 // this event can be used to coordinate plugins to do their
29 // initialization before channelstream is kicked off
29 // initialization before channelstream is kicked off
30 $.Topic('/__MAIN_APP__').publish({});
30 $.Topic('/__MAIN_APP__').publish({});
31
31
32 for (var i = 0; i < alertMessagePayloads.length; i++) {
32 for (var i = 0; i < alertMessagePayloads.length; i++) {
33 $.Topic('/notifications').publish(alertMessagePayloads[i]);
33 $.Topic('/notifications').publish(alertMessagePayloads[i]);
34 }
34 }
35 this.initPlugins();
35 this.initPlugins();
36 // after rest of application loads and topics get fired, launch connection
36 // after rest of application loads and topics get fired, launch connection
37 $(document).ready(function () {
37 $(document).ready(function () {
38 this.kickoffChannelstreamPlugin();
38 this.kickoffChannelstreamPlugin();
39 }.bind(this));
39 }.bind(this));
40 },
40 },
41
41
42 initPlugins: function(){
42 initPlugins: function(){
43 for (var i = 0; i < window.APPLICATION_PLUGINS.length; i++) {
43 for (var i = 0; i < window.APPLICATION_PLUGINS.length; i++) {
44 var pluginDef = window.APPLICATION_PLUGINS[i];
44 var pluginDef = window.APPLICATION_PLUGINS[i];
45 if (pluginDef.component){
45 if (pluginDef.component){
46 var pluginElem = document.createElement(pluginDef.component);
46 var pluginElem = document.createElement(pluginDef.component);
47 this.shadowRoot.appendChild(pluginElem);
47 this.shadowRoot.appendChild(pluginElem);
48 if (typeof pluginElem.init !== 'undefined'){
48 if (typeof pluginElem.init !== 'undefined'){
49 pluginElem.init();
49 pluginElem.init();
50 }
50 }
51 }
51 }
52 }
52 }
53 },
53 },
54 /** proxy to channelstream connection */
54 /** proxy to channelstream connection */
55 getChannelStreamConnection: function () {
55 getChannelStreamConnection: function () {
56 return this.$['channelstream-connection'];
56 return this.$['channelstream-connection'];
57 },
57 },
58
58
59 handleNotifications: function (data) {
59 handleNotifications: function (data) {
60 var elem = document.getElementById('notifications');
60 var elem = document.getElementById('notifications');
61 if(elem){
61 if(elem){
62 elem.handleNotification(data);
62 elem.handleNotification(data);
63 }
63 }
64
64
65 },
65 },
66
66
67 faviconUpdate: function (data) {
67 faviconUpdate: function (data) {
68 this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count;
68 this.shadowRoot.querySelector('rhodecode-favicon').counter = data.count;
69 },
69 },
70
70
71 /** opens connection to ws server */
71 /** opens connection to ws server */
72 kickoffChannelstreamPlugin: function (data) {
72 kickoffChannelstreamPlugin: function (data) {
73 ccLog.debug('kickoffChannelstreamPlugin');
73 ccLog.debug('kickoffChannelstreamPlugin');