##// END OF EJS Templates
release: Merge default into stable for release preparation
marcink -
r802:f6088673 merge stable
parent child Browse files
Show More
@@ -0,0 +1,15 b''
1 {
2 "name": "rhodecode-elements",
3 "description": "User interface for elements for rhodecode",
4 "main": "index.html",
5 "dependencies": {
6 "webcomponentsjs": "^0.7.22",
7 "polymer": "Polymer/polymer#^1.6.1",
8 "paper-button": "PolymerElements/paper-button#^1.0.13",
9 "paper-spinner": "PolymerElements/paper-spinner#^1.2.0",
10 "paper-tooltip": "PolymerElements/paper-tooltip#^1.1.2",
11 "paper-toast": "PolymerElements/paper-toast#^1.3.0",
12 "paper-toggle-button": "PolymerElements/paper-toggle-button#^1.2.0",
13 "iron-ajax": "PolymerElements/iron-ajax#^1.4.3"
14 }
15 }
@@ -0,0 +1,60 b''
1
2 =======================
3 Dependency management
4 =======================
5
6
7 Overview
8 ========
9
10 We use the Nix package manager to handle our dependencies. In general we use the
11 packages out of the package collection `nixpkgs`. For frequently changing
12 dependencies for Python and JavaScript we use the tools which are described in
13 this section to generate the needed Nix derivations.
14
15
16 Python dependencies
17 ===================
18
19 We use the tool `pip2nix` to generate the Nix derivations for our Python
20 dependencies.
21
22 Generating the dependencies should be done with the following command:
23
24 .. code:: shell
25
26 pip2nix generate --license
27
28
29 .. note::
30
31 License extraction support is still experimental, use the version from the
32 following pull request: https://github.com/ktosiek/pip2nix/pull/30
33
34
35
36 Node dependencies
37 =================
38
39 After adding new dependencies via ``npm install --save``, use `node2nix` to
40 update the corresponding Nix derivations:
41
42 .. code:: shell
43
44 cd pkgs
45 node2nix --input ../package.json \
46 -o node-packages.nix \
47 -e node-env.nix \
48 -c node-default.nix \
49 -d --flatten
50
51
52 Bower dependencies
53 ==================
54
55 Frontend dependencies are managed based on `bower`, with `bower2nix` a tool
56 exists which can generate the needed Nix derivations:
57
58 .. code:: shell
59
60 bower2nix bower.json pkgs/bower-packages.nix
@@ -0,0 +1,78 b''
1 |RCE| 4.4.0 |RNS|
2 -----------------
3
4 Release Date
5 ^^^^^^^^^^^^
6
7 - 2016-09-16
8
9
10 General
11 ^^^^^^^
12
13 - UI: introduced Polymer webcomponents into core application. RhodeCode will
14 be now shipped together with Polymer framework webcomponents. Most of
15 dynamic UI components that require large amounts of interaction
16 will be done now with Polymer.
17 - live-notifications: use rhodecode-toast for live notifications instead of
18 toastr jquery plugin.
19 - Svn: moved svn http support out of labs settings. It's tested and stable now.
20
21
22 New Features
23 ^^^^^^^^^^^^
24
25 - Integrations: integrations can now be configure on whole repo group to apply
26 same integrations on multiple projects/groups at once.
27 - Integrations: added scopes on integrations, scopes are: Global,
28 Repository Group (with/without children), Repositories, Root Repositories Only.
29 It will allow to configure exactly which projects use which integrations.
30 - Integrations: show branches/commits separately when posting push events
31 to hipchat/slack, fixes #4192.
32 - Pull-requests: summary page now shows update dates for pull request to
33 easier see which one were receantly updated.
34 - UI: hidden inline comments will be shown in side view when browsing the diffs
35 - Diffs: added inline comments toggle into pull requests diff view. #2884
36 - Live-chat: added summon reviewers functionality. You can now request
37 presence from online users into a chat for collaborative code-review.
38 This requires channelstream to be enabled.
39 - UX: added a static 502 page for gateway error. Once configured via
40 Nginx or Apache it will present a custom RhodeCode page while
41 backend servers are offline. Fixes #4202.
42
43
44 Security
45 ^^^^^^^^
46
47 - Passwords: forced password change will not allow users to put in the
48 old password as new one.
49
50
51 Performance
52 ^^^^^^^^^^^
53
54 - Vcs: refactor vcs-middleware to handle order of .ini file backends in
55 detection of vcs protocol. Detection ends now on first match and speeds
56 overall transaction speed.
57 - Summary: Improve the algorithm and performance of detection README files
58 inside summary page. In some cases we reduced cold-cache time from 50s to 1s.
59 - Safari: improved speed of large diffs on Safari browser.
60 - UX: remove position relative on diff td as it causes very slow
61 rendering in browsers.
62
63 Fixes
64 ^^^^^
65
66 - UX: change confirm password widget to have spacing between the fields to
67 match rest of ui, fixes: #4200.
68 - UX: show multiple tags/branches in changelog/summary instead of
69 truncating them.
70 - My-account: fix test notifications for IE10+
71 - Vcs: change way refs are retrieved for git so same name branch/tags and
72 remotes can be supported, fixes #298.
73 - Lexers: added small extensions table to extend syntax highlighting for file
74 sources. Fixes #4227.
75 - Search: fix bug where file path link was wrong when the repository name was
76 in the file path, fixes #4228
77 - Fixed INT overflow bug
78 - Events: send pushed commits always in the correct in order.
@@ -0,0 +1,186 b''
1 {
2 "dirs": {
3 "css": {
4 "src":"rhodecode/public/css",
5 "dest":"rhodecode/public/css"
6 },
7 "js": {
8 "src": "rhodecode/public/js/src",
9 "dest": "rhodecode/public/js"
10 }
11 },
12 "copy": {
13 "main": {
14 "expand": true,
15 "cwd": "bower_components",
16 "src": "webcomponentsjs/webcomponents-lite.js",
17 "dest": "<%= dirs.js.dest %>/vendors"
18 }
19 },
20 "concat": {
21 "polymercss": {
22 "src": [
23 "<%= dirs.js.src %>/components/root-styles-prefix.html",
24 "<%= dirs.css.src %>/style-polymer.css",
25 "<%= dirs.js.src %>/components/root-styles-suffix.html"
26 ],
27 "dest": "<%= dirs.js.dest %>/src/components/root-styles.gen.html",
28 "nonull": true
29 },
30 "dist": {
31 "src": [
32 "<%= dirs.js.src %>/jquery-1.11.1.min.js",
33 "<%= dirs.js.src %>/logging.js",
34 "<%= dirs.js.src %>/bootstrap.js",
35 "<%= dirs.js.src %>/mousetrap.js",
36 "<%= dirs.js.src %>/moment.js",
37 "<%= dirs.js.src %>/appenlight-client-0.4.1.min.js",
38 "<%= dirs.js.src %>/i18n_utils.js",
39 "<%= dirs.js.src %>/deform.js",
40 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
41 "<%= dirs.js.src %>/plugins/jquery.dataTables.js",
42 "<%= dirs.js.src %>/plugins/flavoured_checkbox.js",
43 "<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js",
44 "<%= dirs.js.src %>/plugins/jquery.autocomplete.js",
45 "<%= dirs.js.src %>/plugins/jquery.debounce.js",
46 "<%= dirs.js.src %>/plugins/jquery.mark.js",
47 "<%= dirs.js.src %>/plugins/jquery.timeago.js",
48 "<%= dirs.js.src %>/plugins/jquery.timeago-extension.js",
49 "<%= dirs.js.src %>/select2/select2.js",
50 "<%= dirs.js.src %>/codemirror/codemirror.js",
51 "<%= dirs.js.src %>/codemirror/codemirror_loadmode.js",
52 "<%= dirs.js.src %>/codemirror/codemirror_hint.js",
53 "<%= dirs.js.src %>/codemirror/codemirror_overlay.js",
54 "<%= dirs.js.src %>/codemirror/codemirror_placeholder.js",
55 "<%= dirs.js.dest %>/mode/meta.js",
56 "<%= dirs.js.dest %>/mode/meta_ext.js",
57 "<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js",
58 "<%= dirs.js.src %>/rhodecode/utils/array.js",
59 "<%= dirs.js.src %>/rhodecode/utils/string.js",
60 "<%= dirs.js.src %>/rhodecode/utils/pyroutes.js",
61 "<%= dirs.js.src %>/rhodecode/utils/ajax.js",
62 "<%= dirs.js.src %>/rhodecode/utils/autocomplete.js",
63 "<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js",
64 "<%= dirs.js.src %>/rhodecode/utils/ie.js",
65 "<%= dirs.js.src %>/rhodecode/utils/os.js",
66 "<%= dirs.js.src %>/rhodecode/utils/topics.js",
67 "<%= dirs.js.src %>/rhodecode/widgets/multiselect.js",
68 "<%= dirs.js.src %>/rhodecode/init.js",
69 "<%= dirs.js.src %>/rhodecode/codemirror.js",
70 "<%= dirs.js.src %>/rhodecode/comments.js",
71 "<%= dirs.js.src %>/rhodecode/constants.js",
72 "<%= dirs.js.src %>/rhodecode/files.js",
73 "<%= dirs.js.src %>/rhodecode/followers.js",
74 "<%= dirs.js.src %>/rhodecode/menus.js",
75 "<%= dirs.js.src %>/rhodecode/notifications.js",
76 "<%= dirs.js.src %>/rhodecode/permissions.js",
77 "<%= dirs.js.src %>/rhodecode/pjax.js",
78 "<%= dirs.js.src %>/rhodecode/pullrequests.js",
79 "<%= dirs.js.src %>/rhodecode/settings.js",
80 "<%= dirs.js.src %>/rhodecode/select2_widgets.js",
81 "<%= dirs.js.src %>/rhodecode/tooltips.js",
82 "<%= dirs.js.src %>/rhodecode/users.js",
83 "<%= dirs.js.src %>/rhodecode/appenlight.js",
84 "<%= dirs.js.src %>/rhodecode.js"
85 ],
86 "dest": "<%= dirs.js.dest %>/scripts.js",
87 "nonull": true
88 }
89 },
90 "crisper": {
91 "dist": {
92 "options": {
93 "cleanup": false,
94 "onlySplit": true
95 },
96 "src": "<%= dirs.js.dest %>/rhodecode-components.html",
97 "dest": "<%= dirs.js.dest %>/rhodecode-components.js"
98 }
99 },
100 "less": {
101 "development": {
102 "options": {
103 "compress": false,
104 "yuicompress": false,
105 "optimization": 0
106 },
107 "files": {
108 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
109 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
110 }
111 },
112 "production": {
113 "options": {
114 "compress": true,
115 "yuicompress": true,
116 "optimization": 2
117 },
118 "files": {
119 "<%= dirs.css.dest %>/style.css": "<%= dirs.css.src %>/main.less",
120 "<%= dirs.css.dest %>/style-polymer.css": "<%= dirs.css.src %>/polymer.less"
121 }
122 },
123 "components": {
124 "files": [
125 {
126 "cwd": "<%= dirs.js.src %>/components/",
127 "dest": "<%= dirs.js.src %>/components/",
128 "src": [
129 "**/*.less"
130 ],
131 "expand": true,
132 "ext": ".css"
133 }
134 ]
135 }
136 },
137 "watch": {
138 "less": {
139 "files": [
140 "<%= dirs.css.src %>/**/*.less",
141 "<%= dirs.js.src %>/components/**/*.less"
142 ],
143 "tasks": [
144 "less:development",
145 "less:components",
146 "concat:polymercss",
147 "vulcanize"
148 ]
149 },
150 "js": {
151 "files": [
152 "!<%= dirs.js.src %>/components/root-styles.gen.html",
153 "<%= dirs.js.src %>/**/*.js",
154 "<%= dirs.js.src %>/components/**/*.html"
155 ],
156 "tasks": [
157 "less:components",
158 "concat:polymercss",
159 "vulcanize",
160 "crisper",
161 "concat:dist"
162 ]
163 }
164 },
165 "jshint": {
166 "rhodecode": {
167 "src": "<%= dirs.js.src %>/rhodecode/**/*.js",
168 "options": {
169 "jshintrc": ".jshintrc"
170 }
171 }
172 },
173 "vulcanize": {
174 "default": {
175 "options": {
176 "abspath": "",
177 "inlineScripts": true,
178 "inlineCss": true,
179 "stripComments": true
180 },
181 "files": {
182 "<%= dirs.js.dest %>/rhodecode-components.html": "<%= dirs.js.src %>/components/shared-components.html"
183 }
184 }
185 }
186 }
@@ -0,0 +1,67 b''
1 # Backported buildBowerComponents so that we can also use it with the version
2 # 16.03 which is the current stable at the time of this writing.
3 #
4 # This file can be removed once building with 16.03 is not needed anymore.
5
6 { pkgs }:
7
8 { buildInputs ? [], generated, ... } @ attrs:
9
10 let
11 bower2nix-src = pkgs.fetchzip {
12 url = "https://github.com/rvl/bower2nix/archive/v3.0.1.tar.gz";
13 sha256 = "1zbvz96k2j6g0r4lvm5cgh41a73k9dgayk7x63cmg538dzznxvyb";
14 };
15
16 bower2nix = import "${bower2nix-src}/default.nix" { inherit pkgs; };
17
18 fetchbower = import ./backport-16.03-fetchbower.nix {
19 inherit (pkgs) stdenv lib;
20 inherit bower2nix;
21 };
22
23 # Fetches the bower packages. `generated` should be the result of a
24 # `bower2nix` command.
25 bowerPackages = import generated {
26 inherit (pkgs) buildEnv;
27 inherit fetchbower;
28 };
29
30 in pkgs.stdenv.mkDerivation (
31 attrs
32 //
33 {
34 name = "bower_components-" + attrs.name;
35
36 inherit bowerPackages;
37
38 builder = builtins.toFile "builder.sh" ''
39 source $stdenv/setup
40
41 # The project's bower.json is required
42 cp $src/bower.json .
43
44 # Dereference symlinks -- bower doesn't like them
45 cp --recursive --reflink=auto \
46 --dereference --no-preserve=mode \
47 $bowerPackages bc
48
49 # Bower install in offline mode -- links together the fetched
50 # bower packages.
51 HOME=$PWD bower \
52 --config.storage.packages=bc/packages \
53 --config.storage.registry=bc/registry \
54 --offline install
55
56 # Sets up a single bower_components directory within
57 # the output derivation.
58 mkdir -p $out
59 mv bower_components $out
60 '';
61
62 buildInputs = buildInputs ++ [
63 pkgs.git
64 pkgs.nodePackages.bower
65 ];
66 }
67 )
@@ -0,0 +1,26 b''
1 { stdenv, lib, bower2nix }:
2 let
3 bowerVersion = version:
4 let
5 components = lib.splitString "#" version;
6 hash = lib.last components;
7 ver = if builtins.length components == 1 then version else hash;
8 in ver;
9
10 fetchbower = name: version: target: outputHash: stdenv.mkDerivation {
11 name = "${name}-${bowerVersion version}";
12 buildCommand = ''
13 fetch-bower --quiet --out=$PWD/out "${name}" "${target}" "${version}"
14 # In some cases, the result of fetchBower is different depending
15 # on the output directory (e.g. if the bower package contains
16 # symlinks). So use a local output directory before copying to
17 # $out.
18 cp -R out $out
19 '';
20 outputHashMode = "recursive";
21 outputHashAlgo = "sha256";
22 inherit outputHash;
23 buildInputs = [ bower2nix ];
24 };
25
26 in fetchbower
@@ -0,0 +1,31 b''
1 { fetchbower, buildEnv }:
2 buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
3 (fetchbower "webcomponentsjs" "0.7.22" "^0.7.22" "0ggh3k8ssafd056ib1m5bvzi7cpz3ry7gr5176d79na1w0c3i7dz")
4 (fetchbower "polymer" "Polymer/polymer#1.6.1" "Polymer/polymer#^1.6.1" "09mm0jgk457gvwqlc155swch7gjr6fs3g7spnvhi6vh5b6518540")
5 (fetchbower "paper-button" "PolymerElements/paper-button#1.0.13" "PolymerElements/paper-button#^1.0.13" "0i3y153nqk06pn0gk282vyybnl3g1w3w41d5i9z659cgn27g3fvm")
6 (fetchbower "paper-spinner" "PolymerElements/paper-spinner#1.2.0" "PolymerElements/paper-spinner#^1.2.0" "1av1m6y81jw3hjhz1yqy3rwcgxarjzl58ldfn4q6sn51pgzngfqb")
7 (fetchbower "paper-tooltip" "PolymerElements/paper-tooltip#1.1.2" "PolymerElements/paper-tooltip#^1.1.2" "1j64nprcyk2d2bbl3qwjyr0lbjngm4wclpyfwgai1c4y6g6bigd2")
8 (fetchbower "paper-toast" "PolymerElements/paper-toast#1.3.0" "PolymerElements/paper-toast#^1.3.0" "0x9rqxsks5455s8pk4aikpp99ijdn6kxr9gvhwh99nbcqdzcxq1m")
9 (fetchbower "paper-toggle-button" "PolymerElements/paper-toggle-button#1.2.0" "PolymerElements/paper-toggle-button#^1.2.0" "0mphcng3ngspbpg4jjn0mb91nvr4xc1phq3qswib15h6sfww1b2w")
10 (fetchbower "iron-ajax" "PolymerElements/iron-ajax#1.4.3" "PolymerElements/iron-ajax#^1.4.3" "0m3dx27arwmlcp00b7n516sc5a51f40p9vapr1nvd57l3i3z0pzm")
11 (fetchbower "iron-flex-layout" "PolymerElements/iron-flex-layout#1.3.1" "PolymerElements/iron-flex-layout#^1.0.0" "0nswv3ih3bhflgcd2wjfmddqswzgqxb2xbq65jk9w3rkj26hplbl")
12 (fetchbower "paper-behaviors" "PolymerElements/paper-behaviors#1.0.12" "PolymerElements/paper-behaviors#^1.0.0" "012bqk97awgz55cn7rm9g7cckrdhkqhls3zvp8l6nd4rdwcrdzq8")
13 (fetchbower "paper-material" "PolymerElements/paper-material#1.0.6" "PolymerElements/paper-material#^1.0.0" "0rljmknfdbm5aabvx9pk77754zckj3l127c3mvnmwkpkkr353xnh")
14 (fetchbower "paper-styles" "PolymerElements/paper-styles#1.1.4" "PolymerElements/paper-styles#^1.0.0" "0j8vg74xrcxlni8i93dsab3y80f34kk30lv4yblqpkp9c3nrilf7")
15 (fetchbower "neon-animation" "PolymerElements/neon-animation#1.2.4" "PolymerElements/neon-animation#^1.0.0" "16mz9i2n5w0k5j8d6gha23cnbdgm5syz3fawyh89gdbq97bi2q5j")
16 (fetchbower "iron-a11y-announcer" "PolymerElements/iron-a11y-announcer#1.0.5" "PolymerElements/iron-a11y-announcer#^1.0.0" "0n7c7j1pwk3835s7s2jd9125wdcsqf216yi5gj07wn5s8h8p7m9d")
17 (fetchbower "iron-overlay-behavior" "PolymerElements/iron-overlay-behavior#1.8.6" "PolymerElements/iron-overlay-behavior#^1.0.9" "14brn9gz6qqskarg3fxk91xs7vg02vgcsz9a9743kidxr0l0413m")
18 (fetchbower "iron-fit-behavior" "PolymerElements/iron-fit-behavior#1.2.5" "PolymerElements/iron-fit-behavior#^1.1.0" "1msnlh8lp1xg6v4h6dkjwj9kzac5q5q208ayla3x9hi483ki6rlf")
19 (fetchbower "iron-checked-element-behavior" "PolymerElements/iron-checked-element-behavior#1.0.5" "PolymerElements/iron-checked-element-behavior#^1.0.0" "0l0yy4ah454s8bzfv076s8by7h67zy9ni6xb932qwyhx8br6c1m7")
20 (fetchbower "promise-polyfill" "polymerlabs/promise-polyfill#1.0.1" "polymerlabs/promise-polyfill#^1.0.0" "045bj2caav3famr5hhxgs1dx7n08r4s46mlzwb313vdy17is38xb")
21 (fetchbower "iron-behaviors" "PolymerElements/iron-behaviors#1.0.17" "PolymerElements/iron-behaviors#^1.0.0" "021qvkmbk32jrrmmphpmwgby4bzi5jyf47rh1bxmq2ip07ly4bpr")
22 (fetchbower "paper-ripple" "PolymerElements/paper-ripple#1.0.8" "PolymerElements/paper-ripple#^1.0.0" "0r9sq8ik7wwrw0qb82c3rw0c030ljwd3s466c9y4qbcrsbvfjnns")
23 (fetchbower "font-roboto" "PolymerElements/font-roboto#1.0.1" "PolymerElements/font-roboto#^1.0.1" "02jz43r0wkyr3yp7rq2rc08l5cwnsgca9fr54sr4rhsnl7cjpxrj")
24 (fetchbower "iron-meta" "PolymerElements/iron-meta#1.1.2" "PolymerElements/iron-meta#^1.0.0" "1wl4dx8fnsknw9z9xi8bpc4cy9x70c11x4zxwxnj73hf3smifppl")
25 (fetchbower "iron-resizable-behavior" "PolymerElements/iron-resizable-behavior#1.0.5" "PolymerElements/iron-resizable-behavior#^1.0.0" "1fd5zmbr2hax42vmcasncvk7lzi38fmb1kyii26nn8pnnjak7zkn")
26 (fetchbower "iron-selector" "PolymerElements/iron-selector#1.5.2" "PolymerElements/iron-selector#^1.0.0" "1ajv46llqzvahm5g6g75w7nfyjcslp53ji0wm96l2k94j87spv3r")
27 (fetchbower "web-animations-js" "web-animations/web-animations-js#2.2.2" "web-animations/web-animations-js#^2.2.0" "1izfvm3l67vwys0bqbhidi9rqziw2f8wv289386sc6jsxzgkzhga")
28 (fetchbower "iron-a11y-keys-behavior" "PolymerElements/iron-a11y-keys-behavior#1.1.7" "PolymerElements/iron-a11y-keys-behavior#^1.0.0" "070z46dbbz242002gmqrgy28x0y1fcqp9hnvbi05r3zphiqfx3l7")
29 (fetchbower "iron-validatable-behavior" "PolymerElements/iron-validatable-behavior#1.1.1" "PolymerElements/iron-validatable-behavior#^1.0.0" "1yhxlvywhw2klbbgm3f3cmanxfxggagph4ii635zv0c13707wslv")
30 (fetchbower "iron-form-element-behavior" "PolymerElements/iron-form-element-behavior#1.0.6" "PolymerElements/iron-form-element-behavior#^1.0.0" "0rdhxivgkdhhz2yadgdbjfc70l555p3y83vjh8rfj5hr0asyn6q1")
31 ]; }
@@ -0,0 +1,15 b''
1 # This file has been generated by node2nix 1.0.0. Do not edit!
2
3 {pkgs ? import <nixpkgs> {
4 inherit system;
5 }, system ? builtins.currentSystem}:
6
7 let
8 nodeEnv = import ./node-env.nix {
9 inherit (pkgs) stdenv python utillinux runCommand writeTextFile nodejs;
10 };
11 in
12 import ./node-packages.nix {
13 inherit (pkgs) fetchurl fetchgit;
14 inherit nodeEnv;
15 } No newline at end of file
@@ -0,0 +1,292 b''
1 # This file originates from node2nix
2
3 {stdenv, python, nodejs, utillinux, runCommand, writeTextFile}:
4
5 let
6 # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise
7 tarWrapper = runCommand "tarWrapper" {} ''
8 mkdir -p $out/bin
9
10 cat > $out/bin/tar <<EOF
11 #! ${stdenv.shell} -e
12 $(type -p tar) "\$@" --warning=no-unknown-keyword
13 EOF
14
15 chmod +x $out/bin/tar
16 '';
17
18 # Function that generates a TGZ file from a NPM project
19 buildNodeSourceDist =
20 { name, version, src, ... }:
21
22 stdenv.mkDerivation {
23 name = "node-tarball-${name}-${version}";
24 inherit src;
25 buildInputs = [ nodejs ];
26 buildPhase = ''
27 export HOME=$TMPDIR
28 tgzFile=$(npm pack)
29 '';
30 installPhase = ''
31 mkdir -p $out/tarballs
32 mv $tgzFile $out/tarballs
33 mkdir -p $out/nix-support
34 echo "file source-dist $out/tarballs/$tgzFile" >> $out/nix-support/hydra-build-products
35 '';
36 };
37
38 includeDependencies = {dependencies}:
39 stdenv.lib.optionalString (dependencies != [])
40 (stdenv.lib.concatMapStrings (dependency:
41 ''
42 # Bundle the dependencies of the package
43 mkdir -p node_modules
44 cd node_modules
45
46 # Only include dependencies if they don't exist. They may also be bundled in the package.
47 if [ ! -e "${dependency.name}" ]
48 then
49 ${composePackage dependency}
50 fi
51
52 cd ..
53 ''
54 ) dependencies);
55
56 # Recursively composes the dependencies of a package
57 composePackage = { name, packageName, src, dependencies ? [], ... }@args:
58 let
59 fixImpureDependencies = writeTextFile {
60 name = "fixDependencies.js";
61 text = ''
62 var fs = require('fs');
63 var url = require('url');
64
65 /*
66 * Replaces an impure version specification by *
67 */
68 function replaceImpureVersionSpec(versionSpec) {
69 var parsedUrl = url.parse(versionSpec);
70
71 if(versionSpec == "latest" || versionSpec == "unstable" ||
72 versionSpec.substr(0, 2) == ".." || dependency.substr(0, 2) == "./" || dependency.substr(0, 2) == "~/" || dependency.substr(0, 1) == '/')
73 return '*';
74 else if(parsedUrl.protocol == "git:" || parsedUrl.protocol == "git+ssh:" || parsedUrl.protocol == "git+http:" || parsedUrl.protocol == "git+https:" ||
75 parsedUrl.protocol == "http:" || parsedUrl.protocol == "https:")
76 return '*';
77 else
78 return versionSpec;
79 }
80
81 var packageObj = JSON.parse(fs.readFileSync('./package.json'));
82
83 /* Replace dependencies */
84 if(packageObj.dependencies !== undefined) {
85 for(var dependency in packageObj.dependencies) {
86 var versionSpec = packageObj.dependencies[dependency];
87 packageObj.dependencies[dependency] = replaceImpureVersionSpec(versionSpec);
88 }
89 }
90
91 /* Replace development dependencies */
92 if(packageObj.devDependencies !== undefined) {
93 for(var dependency in packageObj.devDependencies) {
94 var versionSpec = packageObj.devDependencies[dependency];
95 packageObj.devDependencies[dependency] = replaceImpureVersionSpec(versionSpec);
96 }
97 }
98
99 /* Replace optional dependencies */
100 if(packageObj.optionalDependencies !== undefined) {
101 for(var dependency in packageObj.optionalDependencies) {
102 var versionSpec = packageObj.optionalDependencies[dependency];
103 packageObj.optionalDependencies[dependency] = replaceImpureVersionSpec(versionSpec);
104 }
105 }
106
107 /* Write the fixed JSON file */
108 fs.writeFileSync("package.json", JSON.stringify(packageObj));
109 '';
110 };
111 in
112 ''
113 DIR=$(pwd)
114 cd $TMPDIR
115
116 unpackFile ${src}
117
118 # Make the base dir in which the target dependency resides first
119 mkdir -p "$(dirname "$DIR/${packageName}")"
120
121 if [ -f "${src}" ]
122 then
123 # Figure out what directory has been unpacked
124 packageDir=$(find . -type d -maxdepth 1 | tail -1)
125
126 # Restore write permissions to make building work
127 chmod -R u+w "$packageDir"
128
129 # Move the extracted tarball into the output folder
130 mv "$packageDir" "$DIR/${packageName}"
131 elif [ -d "${src}" ]
132 then
133 # Restore write permissions to make building work
134 chmod -R u+w $strippedName
135
136 # Move the extracted directory into the output folder
137 mv $strippedName "$DIR/${packageName}"
138 fi
139
140 # Unset the stripped name to not confuse the next unpack step
141 unset strippedName
142
143 # Some version specifiers (latest, unstable, URLs, file paths) force NPM to make remote connections or consult paths outside the Nix store.
144 # The following JavaScript replaces these by * to prevent that
145 cd "$DIR/${packageName}"
146 node ${fixImpureDependencies}
147
148 # Include the dependencies of the package
149 ${includeDependencies { inherit dependencies; }}
150 cd ..
151 ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
152 '';
153
154 # Extract the Node.js source code which is used to compile packages with
155 # native bindings
156 nodeSources = runCommand "node-sources" {} ''
157 tar --no-same-owner --no-same-permissions -xf ${nodejs.src}
158 mv node-* $out
159 '';
160
161 # Builds and composes an NPM package including all its dependencies
162 buildNodePackage = { name, packageName, version, dependencies ? [], production ? true, npmFlags ? "", dontNpmInstall ? false, preRebuild ? "", ... }@args:
163
164 stdenv.lib.makeOverridable stdenv.mkDerivation (builtins.removeAttrs args [ "dependencies" ] // {
165 name = "node-${name}-${version}";
166 buildInputs = [ tarWrapper python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ args.buildInputs or [];
167 dontStrip = args.dontStrip or true; # Striping may fail a build for some package deployments
168
169 inherit dontNpmInstall preRebuild;
170
171 unpackPhase = args.unpackPhase or "true";
172
173 buildPhase = args.buildPhase or "true";
174
175 compositionScript = composePackage args;
176 passAsFile = [ "compositionScript" ];
177
178 installPhase = args.installPhase or ''
179 # Create and enter a root node_modules/ folder
180 mkdir -p $out/lib/node_modules
181 cd $out/lib/node_modules
182
183 # Compose the package and all its dependencies
184 source $compositionScriptPath
185
186 # Patch the shebangs of the bundled modules to prevent them from
187 # calling executables outside the Nix store as much as possible
188 patchShebangs .
189
190 # Deploy the Node.js package by running npm install. Since the
191 # dependencies have been provided already by ourselves, it should not
192 # attempt to install them again, which is good, because we want to make
193 # it Nix's responsibility. If it needs to install any dependencies
194 # anyway (e.g. because the dependency parameters are
195 # incomplete/incorrect), it fails.
196 #
197 # The other responsibilities of NPM are kept -- version checks, build
198 # steps, postprocessing etc.
199
200 export HOME=$TMPDIR
201 cd "${packageName}"
202 runHook preRebuild
203 npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
204
205 if [ "$dontNpmInstall" != "1" ]
206 then
207 npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
208 fi
209
210 # Create symlink to the deployed executable folder, if applicable
211 if [ -d "$out/lib/node_modules/.bin" ]
212 then
213 ln -s $out/lib/node_modules/.bin $out/bin
214 fi
215
216 # Create symlinks to the deployed manual page folders, if applicable
217 if [ -d "$out/lib/node_modules/${packageName}/man" ]
218 then
219 mkdir -p $out/share
220 for dir in "$out/lib/node_modules/${packageName}/man/"*
221 do
222 mkdir -p $out/share/man/$(basename "$dir")
223 for page in "$dir"/*
224 do
225 ln -s $page $out/share/man/$(basename "$dir")
226 done
227 done
228 fi
229 '';
230 });
231
232 # Builds a development shell
233 buildNodeShell = { name, packageName, version, src, dependencies ? [], production ? true, npmFlags ? "", dontNpmInstall ? false, ... }@args:
234 let
235 nodeDependencies = stdenv.mkDerivation {
236 name = "node-dependencies-${name}-${version}";
237
238 buildInputs = [ tarWrapper python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ args.buildInputs or [];
239
240 includeScript = includeDependencies { inherit dependencies; };
241 passAsFile = [ "includeScript" ];
242
243 buildCommand = ''
244 mkdir -p $out/lib
245 cd $out/lib
246 source $includeScriptPath
247
248 # Create fake package.json to make the npm commands work properly
249 cat > package.json <<EOF
250 {
251 "name": "${packageName}",
252 "version": "${version}"
253 }
254 EOF
255
256 # Patch the shebangs of the bundled modules to prevent them from
257 # calling executables outside the Nix store as much as possible
258 patchShebangs .
259
260 export HOME=$TMPDIR
261 npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
262
263 ${stdenv.lib.optionalString (!dontNpmInstall) ''
264 npm --registry http://www.example.com --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
265 ''}
266
267 ln -s $out/lib/node_modules/.bin $out/bin
268 '';
269 };
270 in
271 stdenv.lib.makeOverridable stdenv.mkDerivation {
272 name = "node-shell-${name}-${version}";
273
274 buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ args.buildInputs or [];
275 buildCommand = ''
276 mkdir -p $out/bin
277 cat > $out/bin/shell <<EOF
278 #! ${stdenv.shell} -e
279 $shellHook
280 exec ${stdenv.shell}
281 EOF
282 chmod +x $out/bin/shell
283 '';
284
285 # Provide the dependencies in a development shell through the NODE_PATH environment variable
286 inherit nodeDependencies;
287 shellHook = stdenv.lib.optionalString (dependencies != []) ''
288 export NODE_PATH=$nodeDependencies/lib/node_modules
289 '';
290 };
291 in
292 { inherit buildNodeSourceDist buildNodePackage buildNodeShell; }
@@ -0,0 +1,33 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 """
22 Base module for form rendering / validation - currently just a wrapper for
23 deform - later can be replaced with something custom.
24 """
25
26 from rhodecode.translation import _
27 from deform import Button, Form, widget, ValidationFailure
28
29
30 class buttons:
31 save = Button(name='Save', type='submit')
32 reset = Button(name=_('Reset'), type='reset')
33 delete = Button(name=_('Delete'), type='submit')
This diff has been collapsed as it changes many lines, (3505 lines changed) Show them Hide them
@@ -0,0 +1,3505 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 """
22 Database Models for RhodeCode Enterprise
23 """
24
25 import os
26 import sys
27 import time
28 import hashlib
29 import logging
30 import datetime
31 import warnings
32 import ipaddress
33 import functools
34 import traceback
35 import collections
36
37
38 from sqlalchemy import *
39 from sqlalchemy.exc import IntegrityError
40 from sqlalchemy.ext.declarative import declared_attr
41 from sqlalchemy.ext.hybrid import hybrid_property
42 from sqlalchemy.orm import (
43 relationship, joinedload, class_mapper, validates, aliased)
44 from sqlalchemy.sql.expression import true
45 from beaker.cache import cache_region, region_invalidate
46 from webob.exc import HTTPNotFound
47 from zope.cachedescriptors.property import Lazy as LazyProperty
48
49 from pylons import url
50 from pylons.i18n.translation import lazy_ugettext as _
51
52 from rhodecode.lib.vcs import get_backend, get_vcs_instance
53 from rhodecode.lib.vcs.utils.helpers import get_scm
54 from rhodecode.lib.vcs.exceptions import VCSError
55 from rhodecode.lib.vcs.backends.base import (
56 EmptyCommit, Reference, MergeFailureReason)
57 from rhodecode.lib.utils2 import (
58 str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
59 time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
60 from rhodecode.lib.jsonalchemy import MutationObj, JsonType, JSONDict
61 from rhodecode.lib.ext_json import json
62 from rhodecode.lib.caching_query import FromCache
63 from rhodecode.lib.encrypt import AESCipher
64
65 from rhodecode.model.meta import Base, Session
66
67 URL_SEP = '/'
68 log = logging.getLogger(__name__)
69
70 # =============================================================================
71 # BASE CLASSES
72 # =============================================================================
73
74 # this is propagated from .ini file rhodecode.encrypted_values.secret or
75 # beaker.session.secret if first is not set.
76 # and initialized at environment.py
77 ENCRYPTION_KEY = None
78
79 # used to sort permissions by types, '#' used here is not allowed to be in
80 # usernames, and it's very early in sorted string.printable table.
81 PERMISSION_TYPE_SORT = {
82 'admin': '####',
83 'write': '###',
84 'read': '##',
85 'none': '#',
86 }
87
88
89 def display_sort(obj):
90 """
91 Sort function used to sort permissions in .permissions() function of
92 Repository, RepoGroup, UserGroup. Also it put the default user in front
93 of all other resources
94 """
95
96 if obj.username == User.DEFAULT_USER:
97 return '#####'
98 prefix = PERMISSION_TYPE_SORT.get(obj.permission.split('.')[-1], '')
99 return prefix + obj.username
100
101
102 def _hash_key(k):
103 return md5_safe(k)
104
105
106 class EncryptedTextValue(TypeDecorator):
107 """
108 Special column for encrypted long text data, use like::
109
110 value = Column("encrypted_value", EncryptedValue(), nullable=False)
111
112 This column is intelligent so if value is in unencrypted form it return
113 unencrypted form, but on save it always encrypts
114 """
115 impl = Text
116
117 def process_bind_param(self, value, dialect):
118 if not value:
119 return value
120 if value.startswith('enc$aes$') or value.startswith('enc$aes_hmac$'):
121 # protect against double encrypting if someone manually starts
122 # doing
123 raise ValueError('value needs to be in unencrypted format, ie. '
124 'not starting with enc$aes')
125 return 'enc$aes_hmac$%s' % AESCipher(
126 ENCRYPTION_KEY, hmac=True).encrypt(value)
127
128 def process_result_value(self, value, dialect):
129 import rhodecode
130
131 if not value:
132 return value
133
134 parts = value.split('$', 3)
135 if not len(parts) == 3:
136 # probably not encrypted values
137 return value
138 else:
139 if parts[0] != 'enc':
140 # parts ok but without our header ?
141 return value
142 enc_strict_mode = str2bool(rhodecode.CONFIG.get(
143 'rhodecode.encrypted_values.strict') or True)
144 # at that stage we know it's our encryption
145 if parts[1] == 'aes':
146 decrypted_data = AESCipher(ENCRYPTION_KEY).decrypt(parts[2])
147 elif parts[1] == 'aes_hmac':
148 decrypted_data = AESCipher(
149 ENCRYPTION_KEY, hmac=True,
150 strict_verification=enc_strict_mode).decrypt(parts[2])
151 else:
152 raise ValueError(
153 'Encryption type part is wrong, must be `aes` '
154 'or `aes_hmac`, got `%s` instead' % (parts[1]))
155 return decrypted_data
156
157
158 class BaseModel(object):
159 """
160 Base Model for all classes
161 """
162
163 @classmethod
164 def _get_keys(cls):
165 """return column names for this model """
166 return class_mapper(cls).c.keys()
167
168 def get_dict(self):
169 """
170 return dict with keys and values corresponding
171 to this model data """
172
173 d = {}
174 for k in self._get_keys():
175 d[k] = getattr(self, k)
176
177 # also use __json__() if present to get additional fields
178 _json_attr = getattr(self, '__json__', None)
179 if _json_attr:
180 # update with attributes from __json__
181 if callable(_json_attr):
182 _json_attr = _json_attr()
183 for k, val in _json_attr.iteritems():
184 d[k] = val
185 return d
186
187 def get_appstruct(self):
188 """return list with keys and values tuples corresponding
189 to this model data """
190
191 l = []
192 for k in self._get_keys():
193 l.append((k, getattr(self, k),))
194 return l
195
196 def populate_obj(self, populate_dict):
197 """populate model with data from given populate_dict"""
198
199 for k in self._get_keys():
200 if k in populate_dict:
201 setattr(self, k, populate_dict[k])
202
203 @classmethod
204 def query(cls):
205 return Session().query(cls)
206
207 @classmethod
208 def get(cls, id_):
209 if id_:
210 return cls.query().get(id_)
211
212 @classmethod
213 def get_or_404(cls, id_):
214 try:
215 id_ = int(id_)
216 except (TypeError, ValueError):
217 raise HTTPNotFound
218
219 res = cls.query().get(id_)
220 if not res:
221 raise HTTPNotFound
222 return res
223
224 @classmethod
225 def getAll(cls):
226 # deprecated and left for backward compatibility
227 return cls.get_all()
228
229 @classmethod
230 def get_all(cls):
231 return cls.query().all()
232
233 @classmethod
234 def delete(cls, id_):
235 obj = cls.query().get(id_)
236 Session().delete(obj)
237
238 @classmethod
239 def identity_cache(cls, session, attr_name, value):
240 exist_in_session = []
241 for (item_cls, pkey), instance in session.identity_map.items():
242 if cls == item_cls and getattr(instance, attr_name) == value:
243 exist_in_session.append(instance)
244 if exist_in_session:
245 if len(exist_in_session) == 1:
246 return exist_in_session[0]
247 log.exception(
248 'multiple objects with attr %s and '
249 'value %s found with same name: %r',
250 attr_name, value, exist_in_session)
251
252 def __repr__(self):
253 if hasattr(self, '__unicode__'):
254 # python repr needs to return str
255 try:
256 return safe_str(self.__unicode__())
257 except UnicodeDecodeError:
258 pass
259 return '<DB:%s>' % (self.__class__.__name__)
260
261
262 class RhodeCodeSetting(Base, BaseModel):
263 __tablename__ = 'rhodecode_settings'
264 __table_args__ = (
265 UniqueConstraint('app_settings_name'),
266 {'extend_existing': True, 'mysql_engine': 'InnoDB',
267 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
268 )
269
270 SETTINGS_TYPES = {
271 'str': safe_str,
272 'int': safe_int,
273 'unicode': safe_unicode,
274 'bool': str2bool,
275 'list': functools.partial(aslist, sep=',')
276 }
277 DEFAULT_UPDATE_URL = 'https://rhodecode.com/api/v1/info/versions'
278 GLOBAL_CONF_KEY = 'app_settings'
279
280 app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
281 app_settings_name = Column("app_settings_name", String(255), nullable=True, unique=None, default=None)
282 _app_settings_value = Column("app_settings_value", String(4096), nullable=True, unique=None, default=None)
283 _app_settings_type = Column("app_settings_type", String(255), nullable=True, unique=None, default=None)
284
285 def __init__(self, key='', val='', type='unicode'):
286 self.app_settings_name = key
287 self.app_settings_type = type
288 self.app_settings_value = val
289
290 @validates('_app_settings_value')
291 def validate_settings_value(self, key, val):
292 assert type(val) == unicode
293 return val
294
295 @hybrid_property
296 def app_settings_value(self):
297 v = self._app_settings_value
298 _type = self.app_settings_type
299 if _type:
300 _type = self.app_settings_type.split('.')[0]
301 # decode the encrypted value
302 if 'encrypted' in self.app_settings_type:
303 cipher = EncryptedTextValue()
304 v = safe_unicode(cipher.process_result_value(v, None))
305
306 converter = self.SETTINGS_TYPES.get(_type) or \
307 self.SETTINGS_TYPES['unicode']
308 return converter(v)
309
310 @app_settings_value.setter
311 def app_settings_value(self, val):
312 """
313 Setter that will always make sure we use unicode in app_settings_value
314
315 :param val:
316 """
317 val = safe_unicode(val)
318 # encode the encrypted value
319 if 'encrypted' in self.app_settings_type:
320 cipher = EncryptedTextValue()
321 val = safe_unicode(cipher.process_bind_param(val, None))
322 self._app_settings_value = val
323
324 @hybrid_property
325 def app_settings_type(self):
326 return self._app_settings_type
327
328 @app_settings_type.setter
329 def app_settings_type(self, val):
330 if val.split('.')[0] not in self.SETTINGS_TYPES:
331 raise Exception('type must be one of %s got %s'
332 % (self.SETTINGS_TYPES.keys(), val))
333 self._app_settings_type = val
334
335 def __unicode__(self):
336 return u"<%s('%s:%s[%s]')>" % (
337 self.__class__.__name__,
338 self.app_settings_name, self.app_settings_value,
339 self.app_settings_type
340 )
341
342
343 class RhodeCodeUi(Base, BaseModel):
344 __tablename__ = 'rhodecode_ui'
345 __table_args__ = (
346 UniqueConstraint('ui_key'),
347 {'extend_existing': True, 'mysql_engine': 'InnoDB',
348 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
349 )
350
351 HOOK_REPO_SIZE = 'changegroup.repo_size'
352 # HG
353 HOOK_PRE_PULL = 'preoutgoing.pre_pull'
354 HOOK_PULL = 'outgoing.pull_logger'
355 HOOK_PRE_PUSH = 'prechangegroup.pre_push'
356 HOOK_PUSH = 'changegroup.push_logger'
357
358 # TODO: johbo: Unify way how hooks are configured for git and hg,
359 # git part is currently hardcoded.
360
361 # SVN PATTERNS
362 SVN_BRANCH_ID = 'vcs_svn_branch'
363 SVN_TAG_ID = 'vcs_svn_tag'
364
365 ui_id = Column(
366 "ui_id", Integer(), nullable=False, unique=True, default=None,
367 primary_key=True)
368 ui_section = Column(
369 "ui_section", String(255), nullable=True, unique=None, default=None)
370 ui_key = Column(
371 "ui_key", String(255), nullable=True, unique=None, default=None)
372 ui_value = Column(
373 "ui_value", String(255), nullable=True, unique=None, default=None)
374 ui_active = Column(
375 "ui_active", Boolean(), nullable=True, unique=None, default=True)
376
377 def __repr__(self):
378 return '<%s[%s]%s=>%s]>' % (self.__class__.__name__, self.ui_section,
379 self.ui_key, self.ui_value)
380
381
382 class RepoRhodeCodeSetting(Base, BaseModel):
383 __tablename__ = 'repo_rhodecode_settings'
384 __table_args__ = (
385 UniqueConstraint(
386 'app_settings_name', 'repository_id',
387 name='uq_repo_rhodecode_setting_name_repo_id'),
388 {'extend_existing': True, 'mysql_engine': 'InnoDB',
389 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
390 )
391
392 repository_id = Column(
393 "repository_id", Integer(), ForeignKey('repositories.repo_id'),
394 nullable=False)
395 app_settings_id = Column(
396 "app_settings_id", Integer(), nullable=False, unique=True,
397 default=None, primary_key=True)
398 app_settings_name = Column(
399 "app_settings_name", String(255), nullable=True, unique=None,
400 default=None)
401 _app_settings_value = Column(
402 "app_settings_value", String(4096), nullable=True, unique=None,
403 default=None)
404 _app_settings_type = Column(
405 "app_settings_type", String(255), nullable=True, unique=None,
406 default=None)
407
408 repository = relationship('Repository')
409
410 def __init__(self, repository_id, key='', val='', type='unicode'):
411 self.repository_id = repository_id
412 self.app_settings_name = key
413 self.app_settings_type = type
414 self.app_settings_value = val
415
416 @validates('_app_settings_value')
417 def validate_settings_value(self, key, val):
418 assert type(val) == unicode
419 return val
420
421 @hybrid_property
422 def app_settings_value(self):
423 v = self._app_settings_value
424 type_ = self.app_settings_type
425 SETTINGS_TYPES = RhodeCodeSetting.SETTINGS_TYPES
426 converter = SETTINGS_TYPES.get(type_) or SETTINGS_TYPES['unicode']
427 return converter(v)
428
429 @app_settings_value.setter
430 def app_settings_value(self, val):
431 """
432 Setter that will always make sure we use unicode in app_settings_value
433
434 :param val:
435 """
436 self._app_settings_value = safe_unicode(val)
437
438 @hybrid_property
439 def app_settings_type(self):
440 return self._app_settings_type
441
442 @app_settings_type.setter
443 def app_settings_type(self, val):
444 SETTINGS_TYPES = RhodeCodeSetting.SETTINGS_TYPES
445 if val not in SETTINGS_TYPES:
446 raise Exception('type must be one of %s got %s'
447 % (SETTINGS_TYPES.keys(), val))
448 self._app_settings_type = val
449
450 def __unicode__(self):
451 return u"<%s('%s:%s:%s[%s]')>" % (
452 self.__class__.__name__, self.repository.repo_name,
453 self.app_settings_name, self.app_settings_value,
454 self.app_settings_type
455 )
456
457
458 class RepoRhodeCodeUi(Base, BaseModel):
459 __tablename__ = 'repo_rhodecode_ui'
460 __table_args__ = (
461 UniqueConstraint(
462 'repository_id', 'ui_section', 'ui_key',
463 name='uq_repo_rhodecode_ui_repository_id_section_key'),
464 {'extend_existing': True, 'mysql_engine': 'InnoDB',
465 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
466 )
467
468 repository_id = Column(
469 "repository_id", Integer(), ForeignKey('repositories.repo_id'),
470 nullable=False)
471 ui_id = Column(
472 "ui_id", Integer(), nullable=False, unique=True, default=None,
473 primary_key=True)
474 ui_section = Column(
475 "ui_section", String(255), nullable=True, unique=None, default=None)
476 ui_key = Column(
477 "ui_key", String(255), nullable=True, unique=None, default=None)
478 ui_value = Column(
479 "ui_value", String(255), nullable=True, unique=None, default=None)
480 ui_active = Column(
481 "ui_active", Boolean(), nullable=True, unique=None, default=True)
482
483 repository = relationship('Repository')
484
485 def __repr__(self):
486 return '<%s[%s:%s]%s=>%s]>' % (
487 self.__class__.__name__, self.repository.repo_name,
488 self.ui_section, self.ui_key, self.ui_value)
489
490
491 class User(Base, BaseModel):
492 __tablename__ = 'users'
493 __table_args__ = (
494 UniqueConstraint('username'), UniqueConstraint('email'),
495 Index('u_username_idx', 'username'),
496 Index('u_email_idx', 'email'),
497 {'extend_existing': True, 'mysql_engine': 'InnoDB',
498 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
499 )
500 DEFAULT_USER = 'default'
501 DEFAULT_USER_EMAIL = 'anonymous@rhodecode.org'
502 DEFAULT_GRAVATAR_URL = 'https://secure.gravatar.com/avatar/{md5email}?d=identicon&s={size}'
503
504 user_id = Column("user_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
505 username = Column("username", String(255), nullable=True, unique=None, default=None)
506 password = Column("password", String(255), nullable=True, unique=None, default=None)
507 active = Column("active", Boolean(), nullable=True, unique=None, default=True)
508 admin = Column("admin", Boolean(), nullable=True, unique=None, default=False)
509 name = Column("firstname", String(255), nullable=True, unique=None, default=None)
510 lastname = Column("lastname", String(255), nullable=True, unique=None, default=None)
511 _email = Column("email", String(255), nullable=True, unique=None, default=None)
512 last_login = Column("last_login", DateTime(timezone=False), nullable=True, unique=None, default=None)
513 extern_type = Column("extern_type", String(255), nullable=True, unique=None, default=None)
514 extern_name = Column("extern_name", String(255), nullable=True, unique=None, default=None)
515 api_key = Column("api_key", String(255), nullable=True, unique=None, default=None)
516 inherit_default_permissions = Column("inherit_default_permissions", Boolean(), nullable=False, unique=None, default=True)
517 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
518 _user_data = Column("user_data", LargeBinary(), nullable=True) # JSON data
519
520 user_log = relationship('UserLog')
521 user_perms = relationship('UserToPerm', primaryjoin="User.user_id==UserToPerm.user_id", cascade='all')
522
523 repositories = relationship('Repository')
524 repository_groups = relationship('RepoGroup')
525 user_groups = relationship('UserGroup')
526
527 user_followers = relationship('UserFollowing', primaryjoin='UserFollowing.follows_user_id==User.user_id', cascade='all')
528 followings = relationship('UserFollowing', primaryjoin='UserFollowing.user_id==User.user_id', cascade='all')
529
530 repo_to_perm = relationship('UserRepoToPerm', primaryjoin='UserRepoToPerm.user_id==User.user_id', cascade='all')
531 repo_group_to_perm = relationship('UserRepoGroupToPerm', primaryjoin='UserRepoGroupToPerm.user_id==User.user_id', cascade='all')
532 user_group_to_perm = relationship('UserUserGroupToPerm', primaryjoin='UserUserGroupToPerm.user_id==User.user_id', cascade='all')
533
534 group_member = relationship('UserGroupMember', cascade='all')
535
536 notifications = relationship('UserNotification', cascade='all')
537 # notifications assigned to this user
538 user_created_notifications = relationship('Notification', cascade='all')
539 # comments created by this user
540 user_comments = relationship('ChangesetComment', cascade='all')
541 # user profile extra info
542 user_emails = relationship('UserEmailMap', cascade='all')
543 user_ip_map = relationship('UserIpMap', cascade='all')
544 user_auth_tokens = relationship('UserApiKeys', cascade='all')
545 # gists
546 user_gists = relationship('Gist', cascade='all')
547 # user pull requests
548 user_pull_requests = relationship('PullRequest', cascade='all')
549 # external identities
550 extenal_identities = relationship(
551 'ExternalIdentity',
552 primaryjoin="User.user_id==ExternalIdentity.local_user_id",
553 cascade='all')
554
555 def __unicode__(self):
556 return u"<%s('id:%s:%s')>" % (self.__class__.__name__,
557 self.user_id, self.username)
558
559 @hybrid_property
560 def email(self):
561 return self._email
562
563 @email.setter
564 def email(self, val):
565 self._email = val.lower() if val else None
566
567 @property
568 def firstname(self):
569 # alias for future
570 return self.name
571
572 @property
573 def emails(self):
574 other = UserEmailMap.query().filter(UserEmailMap.user==self).all()
575 return [self.email] + [x.email for x in other]
576
577 @property
578 def auth_tokens(self):
579 return [self.api_key] + [x.api_key for x in self.extra_auth_tokens]
580
581 @property
582 def extra_auth_tokens(self):
583 return UserApiKeys.query().filter(UserApiKeys.user == self).all()
584
585 @property
586 def feed_token(self):
587 feed_tokens = UserApiKeys.query()\
588 .filter(UserApiKeys.user == self)\
589 .filter(UserApiKeys.role == UserApiKeys.ROLE_FEED)\
590 .all()
591 if feed_tokens:
592 return feed_tokens[0].api_key
593 else:
594 # use the main token so we don't end up with nothing...
595 return self.api_key
596
597 @classmethod
598 def extra_valid_auth_tokens(cls, user, role=None):
599 tokens = UserApiKeys.query().filter(UserApiKeys.user == user)\
600 .filter(or_(UserApiKeys.expires == -1,
601 UserApiKeys.expires >= time.time()))
602 if role:
603 tokens = tokens.filter(or_(UserApiKeys.role == role,
604 UserApiKeys.role == UserApiKeys.ROLE_ALL))
605 return tokens.all()
606
607 @property
608 def ip_addresses(self):
609 ret = UserIpMap.query().filter(UserIpMap.user == self).all()
610 return [x.ip_addr for x in ret]
611
612 @property
613 def username_and_name(self):
614 return '%s (%s %s)' % (self.username, self.firstname, self.lastname)
615
616 @property
617 def username_or_name_or_email(self):
618 full_name = self.full_name if self.full_name is not ' ' else None
619 return self.username or full_name or self.email
620
621 @property
622 def full_name(self):
623 return '%s %s' % (self.firstname, self.lastname)
624
625 @property
626 def full_name_or_username(self):
627 return ('%s %s' % (self.firstname, self.lastname)
628 if (self.firstname and self.lastname) else self.username)
629
630 @property
631 def full_contact(self):
632 return '%s %s <%s>' % (self.firstname, self.lastname, self.email)
633
634 @property
635 def short_contact(self):
636 return '%s %s' % (self.firstname, self.lastname)
637
638 @property
639 def is_admin(self):
640 return self.admin
641
642 @property
643 def AuthUser(self):
644 """
645 Returns instance of AuthUser for this user
646 """
647 from rhodecode.lib.auth import AuthUser
648 return AuthUser(user_id=self.user_id, api_key=self.api_key,
649 username=self.username)
650
651 @hybrid_property
652 def user_data(self):
653 if not self._user_data:
654 return {}
655
656 try:
657 return json.loads(self._user_data)
658 except TypeError:
659 return {}
660
661 @user_data.setter
662 def user_data(self, val):
663 if not isinstance(val, dict):
664 raise Exception('user_data must be dict, got %s' % type(val))
665 try:
666 self._user_data = json.dumps(val)
667 except Exception:
668 log.error(traceback.format_exc())
669
670 @classmethod
671 def get_by_username(cls, username, case_insensitive=False,
672 cache=False, identity_cache=False):
673 session = Session()
674
675 if case_insensitive:
676 q = cls.query().filter(
677 func.lower(cls.username) == func.lower(username))
678 else:
679 q = cls.query().filter(cls.username == username)
680
681 if cache:
682 if identity_cache:
683 val = cls.identity_cache(session, 'username', username)
684 if val:
685 return val
686 else:
687 q = q.options(
688 FromCache("sql_cache_short",
689 "get_user_by_name_%s" % _hash_key(username)))
690
691 return q.scalar()
692
693 @classmethod
694 def get_by_auth_token(cls, auth_token, cache=False, fallback=True):
695 q = cls.query().filter(cls.api_key == auth_token)
696
697 if cache:
698 q = q.options(FromCache("sql_cache_short",
699 "get_auth_token_%s" % auth_token))
700 res = q.scalar()
701
702 if fallback and not res:
703 #fallback to additional keys
704 _res = UserApiKeys.query()\
705 .filter(UserApiKeys.api_key == auth_token)\
706 .filter(or_(UserApiKeys.expires == -1,
707 UserApiKeys.expires >= time.time()))\
708 .first()
709 if _res:
710 res = _res.user
711 return res
712
713 @classmethod
714 def get_by_email(cls, email, case_insensitive=False, cache=False):
715
716 if case_insensitive:
717 q = cls.query().filter(func.lower(cls.email) == func.lower(email))
718
719 else:
720 q = cls.query().filter(cls.email == email)
721
722 if cache:
723 q = q.options(FromCache("sql_cache_short",
724 "get_email_key_%s" % _hash_key(email)))
725
726 ret = q.scalar()
727 if ret is None:
728 q = UserEmailMap.query()
729 # try fetching in alternate email map
730 if case_insensitive:
731 q = q.filter(func.lower(UserEmailMap.email) == func.lower(email))
732 else:
733 q = q.filter(UserEmailMap.email == email)
734 q = q.options(joinedload(UserEmailMap.user))
735 if cache:
736 q = q.options(FromCache("sql_cache_short",
737 "get_email_map_key_%s" % email))
738 ret = getattr(q.scalar(), 'user', None)
739
740 return ret
741
742 @classmethod
743 def get_from_cs_author(cls, author):
744 """
745 Tries to get User objects out of commit author string
746
747 :param author:
748 """
749 from rhodecode.lib.helpers import email, author_name
750 # Valid email in the attribute passed, see if they're in the system
751 _email = email(author)
752 if _email:
753 user = cls.get_by_email(_email, case_insensitive=True)
754 if user:
755 return user
756 # Maybe we can match by username?
757 _author = author_name(author)
758 user = cls.get_by_username(_author, case_insensitive=True)
759 if user:
760 return user
761
762 def update_userdata(self, **kwargs):
763 usr = self
764 old = usr.user_data
765 old.update(**kwargs)
766 usr.user_data = old
767 Session().add(usr)
768 log.debug('updated userdata with ', kwargs)
769
770 def update_lastlogin(self):
771 """Update user lastlogin"""
772 self.last_login = datetime.datetime.now()
773 Session().add(self)
774 log.debug('updated user %s lastlogin', self.username)
775
776 def update_lastactivity(self):
777 """Update user lastactivity"""
778 usr = self
779 old = usr.user_data
780 old.update({'last_activity': time.time()})
781 usr.user_data = old
782 Session().add(usr)
783 log.debug('updated user %s lastactivity', usr.username)
784
785 def update_password(self, new_password, change_api_key=False):
786 from rhodecode.lib.auth import get_crypt_password,generate_auth_token
787
788 self.password = get_crypt_password(new_password)
789 if change_api_key:
790 self.api_key = generate_auth_token(self.username)
791 Session().add(self)
792
793 @classmethod
794 def get_first_super_admin(cls):
795 user = User.query().filter(User.admin == true()).first()
796 if user is None:
797 raise Exception('FATAL: Missing administrative account!')
798 return user
799
800 @classmethod
801 def get_all_super_admins(cls):
802 """
803 Returns all admin accounts sorted by username
804 """
805 return User.query().filter(User.admin == true())\
806 .order_by(User.username.asc()).all()
807
808 @classmethod
809 def get_default_user(cls, cache=False):
810 user = User.get_by_username(User.DEFAULT_USER, cache=cache)
811 if user is None:
812 raise Exception('FATAL: Missing default account!')
813 return user
814
815 def _get_default_perms(self, user, suffix=''):
816 from rhodecode.model.permission import PermissionModel
817 return PermissionModel().get_default_perms(user.user_perms, suffix)
818
819 def get_default_perms(self, suffix=''):
820 return self._get_default_perms(self, suffix)
821
822 def get_api_data(self, include_secrets=False, details='full'):
823 """
824 Common function for generating user related data for API
825
826 :param include_secrets: By default secrets in the API data will be replaced
827 by a placeholder value to prevent exposing this data by accident. In case
828 this data shall be exposed, set this flag to ``True``.
829
830 :param details: details can be 'basic|full' basic gives only a subset of
831 the available user information that includes user_id, name and emails.
832 """
833 user = self
834 user_data = self.user_data
835 data = {
836 'user_id': user.user_id,
837 'username': user.username,
838 'firstname': user.name,
839 'lastname': user.lastname,
840 'email': user.email,
841 'emails': user.emails,
842 }
843 if details == 'basic':
844 return data
845
846 api_key_length = 40
847 api_key_replacement = '*' * api_key_length
848
849 extras = {
850 'api_key': api_key_replacement,
851 'api_keys': [api_key_replacement],
852 'active': user.active,
853 'admin': user.admin,
854 'extern_type': user.extern_type,
855 'extern_name': user.extern_name,
856 'last_login': user.last_login,
857 'ip_addresses': user.ip_addresses,
858 'language': user_data.get('language')
859 }
860 data.update(extras)
861
862 if include_secrets:
863 data['api_key'] = user.api_key
864 data['api_keys'] = user.auth_tokens
865 return data
866
867 def __json__(self):
868 data = {
869 'full_name': self.full_name,
870 'full_name_or_username': self.full_name_or_username,
871 'short_contact': self.short_contact,
872 'full_contact': self.full_contact,
873 }
874 data.update(self.get_api_data())
875 return data
876
877
878 class UserApiKeys(Base, BaseModel):
879 __tablename__ = 'user_api_keys'
880 __table_args__ = (
881 Index('uak_api_key_idx', 'api_key'),
882 Index('uak_api_key_expires_idx', 'api_key', 'expires'),
883 UniqueConstraint('api_key'),
884 {'extend_existing': True, 'mysql_engine': 'InnoDB',
885 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
886 )
887 __mapper_args__ = {}
888
889 # ApiKey role
890 ROLE_ALL = 'token_role_all'
891 ROLE_HTTP = 'token_role_http'
892 ROLE_VCS = 'token_role_vcs'
893 ROLE_API = 'token_role_api'
894 ROLE_FEED = 'token_role_feed'
895 ROLES = [ROLE_ALL, ROLE_HTTP, ROLE_VCS, ROLE_API, ROLE_FEED]
896
897 user_api_key_id = Column("user_api_key_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
898 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
899 api_key = Column("api_key", String(255), nullable=False, unique=True)
900 description = Column('description', UnicodeText().with_variant(UnicodeText(1024), 'mysql'))
901 expires = Column('expires', Float(53), nullable=False)
902 role = Column('role', String(255), nullable=True)
903 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
904
905 user = relationship('User', lazy='joined')
906
907 @classmethod
908 def _get_role_name(cls, role):
909 return {
910 cls.ROLE_ALL: _('all'),
911 cls.ROLE_HTTP: _('http/web interface'),
912 cls.ROLE_VCS: _('vcs (git/hg/svn protocol)'),
913 cls.ROLE_API: _('api calls'),
914 cls.ROLE_FEED: _('feed access'),
915 }.get(role, role)
916
917 @property
918 def expired(self):
919 if self.expires == -1:
920 return False
921 return time.time() > self.expires
922
923 @property
924 def role_humanized(self):
925 return self._get_role_name(self.role)
926
927
928 class UserEmailMap(Base, BaseModel):
929 __tablename__ = 'user_email_map'
930 __table_args__ = (
931 Index('uem_email_idx', 'email'),
932 UniqueConstraint('email'),
933 {'extend_existing': True, 'mysql_engine': 'InnoDB',
934 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
935 )
936 __mapper_args__ = {}
937
938 email_id = Column("email_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
939 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
940 _email = Column("email", String(255), nullable=True, unique=False, default=None)
941 user = relationship('User', lazy='joined')
942
943 @validates('_email')
944 def validate_email(self, key, email):
945 # check if this email is not main one
946 main_email = Session().query(User).filter(User.email == email).scalar()
947 if main_email is not None:
948 raise AttributeError('email %s is present is user table' % email)
949 return email
950
951 @hybrid_property
952 def email(self):
953 return self._email
954
955 @email.setter
956 def email(self, val):
957 self._email = val.lower() if val else None
958
959
960 class UserIpMap(Base, BaseModel):
961 __tablename__ = 'user_ip_map'
962 __table_args__ = (
963 UniqueConstraint('user_id', 'ip_addr'),
964 {'extend_existing': True, 'mysql_engine': 'InnoDB',
965 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
966 )
967 __mapper_args__ = {}
968
969 ip_id = Column("ip_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
970 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
971 ip_addr = Column("ip_addr", String(255), nullable=True, unique=False, default=None)
972 active = Column("active", Boolean(), nullable=True, unique=None, default=True)
973 description = Column("description", String(10000), nullable=True, unique=None, default=None)
974 user = relationship('User', lazy='joined')
975
976 @classmethod
977 def _get_ip_range(cls, ip_addr):
978 net = ipaddress.ip_network(ip_addr, strict=False)
979 return [str(net.network_address), str(net.broadcast_address)]
980
981 def __json__(self):
982 return {
983 'ip_addr': self.ip_addr,
984 'ip_range': self._get_ip_range(self.ip_addr),
985 }
986
987 def __unicode__(self):
988 return u"<%s('user_id:%s=>%s')>" % (self.__class__.__name__,
989 self.user_id, self.ip_addr)
990
991 class UserLog(Base, BaseModel):
992 __tablename__ = 'user_logs'
993 __table_args__ = (
994 {'extend_existing': True, 'mysql_engine': 'InnoDB',
995 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
996 )
997 user_log_id = Column("user_log_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
998 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
999 username = Column("username", String(255), nullable=True, unique=None, default=None)
1000 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True)
1001 repository_name = Column("repository_name", String(255), nullable=True, unique=None, default=None)
1002 user_ip = Column("user_ip", String(255), nullable=True, unique=None, default=None)
1003 action = Column("action", Text().with_variant(Text(1200000), 'mysql'), nullable=True, unique=None, default=None)
1004 action_date = Column("action_date", DateTime(timezone=False), nullable=True, unique=None, default=None)
1005
1006 def __unicode__(self):
1007 return u"<%s('id:%s:%s')>" % (self.__class__.__name__,
1008 self.repository_name,
1009 self.action)
1010
1011 @property
1012 def action_as_day(self):
1013 return datetime.date(*self.action_date.timetuple()[:3])
1014
1015 user = relationship('User')
1016 repository = relationship('Repository', cascade='')
1017
1018
1019 class UserGroup(Base, BaseModel):
1020 __tablename__ = 'users_groups'
1021 __table_args__ = (
1022 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1023 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
1024 )
1025
1026 users_group_id = Column("users_group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
1027 users_group_name = Column("users_group_name", String(255), nullable=False, unique=True, default=None)
1028 user_group_description = Column("user_group_description", String(10000), nullable=True, unique=None, default=None)
1029 users_group_active = Column("users_group_active", Boolean(), nullable=True, unique=None, default=None)
1030 inherit_default_permissions = Column("users_group_inherit_default_permissions", Boolean(), nullable=False, unique=None, default=True)
1031 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None)
1032 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
1033 _group_data = Column("group_data", LargeBinary(), nullable=True) # JSON data
1034
1035 members = relationship('UserGroupMember', cascade="all, delete, delete-orphan", lazy="joined")
1036 users_group_to_perm = relationship('UserGroupToPerm', cascade='all')
1037 users_group_repo_to_perm = relationship('UserGroupRepoToPerm', cascade='all')
1038 users_group_repo_group_to_perm = relationship('UserGroupRepoGroupToPerm', cascade='all')
1039 user_user_group_to_perm = relationship('UserUserGroupToPerm', cascade='all')
1040 user_group_user_group_to_perm = relationship('UserGroupUserGroupToPerm ', primaryjoin="UserGroupUserGroupToPerm.target_user_group_id==UserGroup.users_group_id", cascade='all')
1041
1042 user = relationship('User')
1043
1044 @hybrid_property
1045 def group_data(self):
1046 if not self._group_data:
1047 return {}
1048
1049 try:
1050 return json.loads(self._group_data)
1051 except TypeError:
1052 return {}
1053
1054 @group_data.setter
1055 def group_data(self, val):
1056 try:
1057 self._group_data = json.dumps(val)
1058 except Exception:
1059 log.error(traceback.format_exc())
1060
1061 def __unicode__(self):
1062 return u"<%s('id:%s:%s')>" % (self.__class__.__name__,
1063 self.users_group_id,
1064 self.users_group_name)
1065
1066 @classmethod
1067 def get_by_group_name(cls, group_name, cache=False,
1068 case_insensitive=False):
1069 if case_insensitive:
1070 q = cls.query().filter(func.lower(cls.users_group_name) ==
1071 func.lower(group_name))
1072
1073 else:
1074 q = cls.query().filter(cls.users_group_name == group_name)
1075 if cache:
1076 q = q.options(FromCache(
1077 "sql_cache_short",
1078 "get_group_%s" % _hash_key(group_name)))
1079 return q.scalar()
1080
1081 @classmethod
1082 def get(cls, user_group_id, cache=False):
1083 user_group = cls.query()
1084 if cache:
1085 user_group = user_group.options(FromCache("sql_cache_short",
1086 "get_users_group_%s" % user_group_id))
1087 return user_group.get(user_group_id)
1088
1089 def permissions(self, with_admins=True, with_owner=True):
1090 q = UserUserGroupToPerm.query().filter(UserUserGroupToPerm.user_group == self)
1091 q = q.options(joinedload(UserUserGroupToPerm.user_group),
1092 joinedload(UserUserGroupToPerm.user),
1093 joinedload(UserUserGroupToPerm.permission),)
1094
1095 # get owners and admins and permissions. We do a trick of re-writing
1096 # objects from sqlalchemy to named-tuples due to sqlalchemy session
1097 # has a global reference and changing one object propagates to all
1098 # others. This means if admin is also an owner admin_row that change
1099 # would propagate to both objects
1100 perm_rows = []
1101 for _usr in q.all():
1102 usr = AttributeDict(_usr.user.get_dict())
1103 usr.permission = _usr.permission.permission_name
1104 perm_rows.append(usr)
1105
1106 # filter the perm rows by 'default' first and then sort them by
1107 # admin,write,read,none permissions sorted again alphabetically in
1108 # each group
1109 perm_rows = sorted(perm_rows, key=display_sort)
1110
1111 _admin_perm = 'usergroup.admin'
1112 owner_row = []
1113 if with_owner:
1114 usr = AttributeDict(self.user.get_dict())
1115 usr.owner_row = True
1116 usr.permission = _admin_perm
1117 owner_row.append(usr)
1118
1119 super_admin_rows = []
1120 if with_admins:
1121 for usr in User.get_all_super_admins():
1122 # if this admin is also owner, don't double the record
1123 if usr.user_id == owner_row[0].user_id:
1124 owner_row[0].admin_row = True
1125 else:
1126 usr = AttributeDict(usr.get_dict())
1127 usr.admin_row = True
1128 usr.permission = _admin_perm
1129 super_admin_rows.append(usr)
1130
1131 return super_admin_rows + owner_row + perm_rows
1132
1133 def permission_user_groups(self):
1134 q = UserGroupUserGroupToPerm.query().filter(UserGroupUserGroupToPerm.target_user_group == self)
1135 q = q.options(joinedload(UserGroupUserGroupToPerm.user_group),
1136 joinedload(UserGroupUserGroupToPerm.target_user_group),
1137 joinedload(UserGroupUserGroupToPerm.permission),)
1138
1139 perm_rows = []
1140 for _user_group in q.all():
1141 usr = AttributeDict(_user_group.user_group.get_dict())
1142 usr.permission = _user_group.permission.permission_name
1143 perm_rows.append(usr)
1144
1145 return perm_rows
1146
1147 def _get_default_perms(self, user_group, suffix=''):
1148 from rhodecode.model.permission import PermissionModel
1149 return PermissionModel().get_default_perms(user_group.users_group_to_perm, suffix)
1150
1151 def get_default_perms(self, suffix=''):
1152 return self._get_default_perms(self, suffix)
1153
1154 def get_api_data(self, with_group_members=True, include_secrets=False):
1155 """
1156 :param include_secrets: See :meth:`User.get_api_data`, this parameter is
1157 basically forwarded.
1158
1159 """
1160 user_group = self
1161
1162 data = {
1163 'users_group_id': user_group.users_group_id,
1164 'group_name': user_group.users_group_name,
1165 'group_description': user_group.user_group_description,
1166 'active': user_group.users_group_active,
1167 'owner': user_group.user.username,
1168 }
1169 if with_group_members:
1170 users = []
1171 for user in user_group.members:
1172 user = user.user
1173 users.append(user.get_api_data(include_secrets=include_secrets))
1174 data['users'] = users
1175
1176 return data
1177
1178
1179 class UserGroupMember(Base, BaseModel):
1180 __tablename__ = 'users_groups_members'
1181 __table_args__ = (
1182 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1183 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
1184 )
1185
1186 users_group_member_id = Column("users_group_member_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
1187 users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
1188 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
1189
1190 user = relationship('User', lazy='joined')
1191 users_group = relationship('UserGroup')
1192
1193 def __init__(self, gr_id='', u_id=''):
1194 self.users_group_id = gr_id
1195 self.user_id = u_id
1196
1197
1198 class RepositoryField(Base, BaseModel):
1199 __tablename__ = 'repositories_fields'
1200 __table_args__ = (
1201 UniqueConstraint('repository_id', 'field_key'), # no-multi field
1202 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1203 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
1204 )
1205 PREFIX = 'ex_' # prefix used in form to not conflict with already existing fields
1206
1207 repo_field_id = Column("repo_field_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
1208 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None)
1209 field_key = Column("field_key", String(250))
1210 field_label = Column("field_label", String(1024), nullable=False)
1211 field_value = Column("field_value", String(10000), nullable=False)
1212 field_desc = Column("field_desc", String(1024), nullable=False)
1213 field_type = Column("field_type", String(255), nullable=False, unique=None)
1214 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
1215
1216 repository = relationship('Repository')
1217
1218 @property
1219 def field_key_prefixed(self):
1220 return 'ex_%s' % self.field_key
1221
1222 @classmethod
1223 def un_prefix_key(cls, key):
1224 if key.startswith(cls.PREFIX):
1225 return key[len(cls.PREFIX):]
1226 return key
1227
1228 @classmethod
1229 def get_by_key_name(cls, key, repo):
1230 row = cls.query()\
1231 .filter(cls.repository == repo)\
1232 .filter(cls.field_key == key).scalar()
1233 return row
1234
1235
1236 class Repository(Base, BaseModel):
1237 __tablename__ = 'repositories'
1238 __table_args__ = (
1239 Index('r_repo_name_idx', 'repo_name', mysql_length=255),
1240 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1241 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
1242 )
1243 DEFAULT_CLONE_URI = '{scheme}://{user}@{netloc}/{repo}'
1244 DEFAULT_CLONE_URI_ID = '{scheme}://{user}@{netloc}/_{repoid}'
1245
1246 STATE_CREATED = 'repo_state_created'
1247 STATE_PENDING = 'repo_state_pending'
1248 STATE_ERROR = 'repo_state_error'
1249
1250 LOCK_AUTOMATIC = 'lock_auto'
1251 LOCK_API = 'lock_api'
1252 LOCK_WEB = 'lock_web'
1253 LOCK_PULL = 'lock_pull'
1254
1255 NAME_SEP = URL_SEP
1256
1257 repo_id = Column(
1258 "repo_id", Integer(), nullable=False, unique=True, default=None,
1259 primary_key=True)
1260 _repo_name = Column(
1261 "repo_name", Text(), nullable=False, default=None)
1262 _repo_name_hash = Column(
1263 "repo_name_hash", String(255), nullable=False, unique=True)
1264 repo_state = Column("repo_state", String(255), nullable=True)
1265
1266 clone_uri = Column(
1267 "clone_uri", EncryptedTextValue(), nullable=True, unique=False,
1268 default=None)
1269 repo_type = Column(
1270 "repo_type", String(255), nullable=False, unique=False, default=None)
1271 user_id = Column(
1272 "user_id", Integer(), ForeignKey('users.user_id'), nullable=False,
1273 unique=False, default=None)
1274 private = Column(
1275 "private", Boolean(), nullable=True, unique=None, default=None)
1276 enable_statistics = Column(
1277 "statistics", Boolean(), nullable=True, unique=None, default=True)
1278 enable_downloads = Column(
1279 "downloads", Boolean(), nullable=True, unique=None, default=True)
1280 description = Column(
1281 "description", String(10000), nullable=True, unique=None, default=None)
1282 created_on = Column(
1283 'created_on', DateTime(timezone=False), nullable=True, unique=None,
1284 default=datetime.datetime.now)
1285 updated_on = Column(
1286 'updated_on', DateTime(timezone=False), nullable=True, unique=None,
1287 default=datetime.datetime.now)
1288 _landing_revision = Column(
1289 "landing_revision", String(255), nullable=False, unique=False,
1290 default=None)
1291 enable_locking = Column(
1292 "enable_locking", Boolean(), nullable=False, unique=None,
1293 default=False)
1294 _locked = Column(
1295 "locked", String(255), nullable=True, unique=False, default=None)
1296 _changeset_cache = Column(
1297 "changeset_cache", LargeBinary(), nullable=True) # JSON data
1298
1299 fork_id = Column(
1300 "fork_id", Integer(), ForeignKey('repositories.repo_id'),
1301 nullable=True, unique=False, default=None)
1302 group_id = Column(
1303 "group_id", Integer(), ForeignKey('groups.group_id'), nullable=True,
1304 unique=False, default=None)
1305
1306 user = relationship('User', lazy='joined')
1307 fork = relationship('Repository', remote_side=repo_id, lazy='joined')
1308 group = relationship('RepoGroup', lazy='joined')
1309 repo_to_perm = relationship(
1310 'UserRepoToPerm', cascade='all',
1311 order_by='UserRepoToPerm.repo_to_perm_id')
1312 users_group_to_perm = relationship('UserGroupRepoToPerm', cascade='all')
1313 stats = relationship('Statistics', cascade='all', uselist=False)
1314
1315 followers = relationship(
1316 'UserFollowing',
1317 primaryjoin='UserFollowing.follows_repo_id==Repository.repo_id',
1318 cascade='all')
1319 extra_fields = relationship(
1320 'RepositoryField', cascade="all, delete, delete-orphan")
1321 logs = relationship('UserLog')
1322 comments = relationship(
1323 'ChangesetComment', cascade="all, delete, delete-orphan")
1324 pull_requests_source = relationship(
1325 'PullRequest',
1326 primaryjoin='PullRequest.source_repo_id==Repository.repo_id',
1327 cascade="all, delete, delete-orphan")
1328 pull_requests_target = relationship(
1329 'PullRequest',
1330 primaryjoin='PullRequest.target_repo_id==Repository.repo_id',
1331 cascade="all, delete, delete-orphan")
1332 ui = relationship('RepoRhodeCodeUi', cascade="all")
1333 settings = relationship('RepoRhodeCodeSetting', cascade="all")
1334 integrations = relationship('Integration',
1335 cascade="all, delete, delete-orphan")
1336
1337 def __unicode__(self):
1338 return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
1339 safe_unicode(self.repo_name))
1340
1341 @hybrid_property
1342 def landing_rev(self):
1343 # always should return [rev_type, rev]
1344 if self._landing_revision:
1345 _rev_info = self._landing_revision.split(':')
1346 if len(_rev_info) < 2:
1347 _rev_info.insert(0, 'rev')
1348 return [_rev_info[0], _rev_info[1]]
1349 return [None, None]
1350
1351 @landing_rev.setter
1352 def landing_rev(self, val):
1353 if ':' not in val:
1354 raise ValueError('value must be delimited with `:` and consist '
1355 'of <rev_type>:<rev>, got %s instead' % val)
1356 self._landing_revision = val
1357
1358 @hybrid_property
1359 def locked(self):
1360 if self._locked:
1361 user_id, timelocked, reason = self._locked.split(':')
1362 lock_values = int(user_id), timelocked, reason
1363 else:
1364 lock_values = [None, None, None]
1365 return lock_values
1366
1367 @locked.setter
1368 def locked(self, val):
1369 if val and isinstance(val, (list, tuple)):
1370 self._locked = ':'.join(map(str, val))
1371 else:
1372 self._locked = None
1373
1374 @hybrid_property
1375 def changeset_cache(self):
1376 from rhodecode.lib.vcs.backends.base import EmptyCommit
1377 dummy = EmptyCommit().__json__()
1378 if not self._changeset_cache:
1379 return dummy
1380 try:
1381 return json.loads(self._changeset_cache)
1382 except TypeError:
1383 return dummy
1384 except Exception:
1385 log.error(traceback.format_exc())
1386 return dummy
1387
1388 @changeset_cache.setter
1389 def changeset_cache(self, val):
1390 try:
1391 self._changeset_cache = json.dumps(val)
1392 except Exception:
1393 log.error(traceback.format_exc())
1394
1395 @hybrid_property
1396 def repo_name(self):
1397 return self._repo_name
1398
1399 @repo_name.setter
1400 def repo_name(self, value):
1401 self._repo_name = value
1402 self._repo_name_hash = hashlib.sha1(safe_str(value)).hexdigest()
1403
1404 @classmethod
1405 def normalize_repo_name(cls, repo_name):
1406 """
1407 Normalizes os specific repo_name to the format internally stored inside
1408 database using URL_SEP
1409
1410 :param cls:
1411 :param repo_name:
1412 """
1413 return cls.NAME_SEP.join(repo_name.split(os.sep))
1414
1415 @classmethod
1416 def get_by_repo_name(cls, repo_name, cache=False, identity_cache=False):
1417 session = Session()
1418 q = session.query(cls).filter(cls.repo_name == repo_name)
1419
1420 if cache:
1421 if identity_cache:
1422 val = cls.identity_cache(session, 'repo_name', repo_name)
1423 if val:
1424 return val
1425 else:
1426 q = q.options(
1427 FromCache("sql_cache_short",
1428 "get_repo_by_name_%s" % _hash_key(repo_name)))
1429
1430 return q.scalar()
1431
1432 @classmethod
1433 def get_by_full_path(cls, repo_full_path):
1434 repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
1435 repo_name = cls.normalize_repo_name(repo_name)
1436 return cls.get_by_repo_name(repo_name.strip(URL_SEP))
1437
1438 @classmethod
1439 def get_repo_forks(cls, repo_id):
1440 return cls.query().filter(Repository.fork_id == repo_id)
1441
1442 @classmethod
1443 def base_path(cls):
1444 """
1445 Returns base path when all repos are stored
1446
1447 :param cls:
1448 """
1449 q = Session().query(RhodeCodeUi)\
1450 .filter(RhodeCodeUi.ui_key == cls.NAME_SEP)
1451 q = q.options(FromCache("sql_cache_short", "repository_repo_path"))
1452 return q.one().ui_value
1453
1454 @classmethod
1455 def is_valid(cls, repo_name):
1456 """
1457 returns True if given repo name is a valid filesystem repository
1458
1459 :param cls:
1460 :param repo_name:
1461 """
1462 from rhodecode.lib.utils import is_valid_repo
1463
1464 return is_valid_repo(repo_name, cls.base_path())
1465
1466 @classmethod
1467 def get_all_repos(cls, user_id=Optional(None), group_id=Optional(None),
1468 case_insensitive=True):
1469 q = Repository.query()
1470
1471 if not isinstance(user_id, Optional):
1472 q = q.filter(Repository.user_id == user_id)
1473
1474 if not isinstance(group_id, Optional):
1475 q = q.filter(Repository.group_id == group_id)
1476
1477 if case_insensitive:
1478 q = q.order_by(func.lower(Repository.repo_name))
1479 else:
1480 q = q.order_by(Repository.repo_name)
1481 return q.all()
1482
1483 @property
1484 def forks(self):
1485 """
1486 Return forks of this repo
1487 """
1488 return Repository.get_repo_forks(self.repo_id)
1489
1490 @property
1491 def parent(self):
1492 """
1493 Returns fork parent
1494 """
1495 return self.fork
1496
1497 @property
1498 def just_name(self):
1499 return self.repo_name.split(self.NAME_SEP)[-1]
1500
1501 @property
1502 def groups_with_parents(self):
1503 groups = []
1504 if self.group is None:
1505 return groups
1506
1507 cur_gr = self.group
1508 groups.insert(0, cur_gr)
1509 while 1:
1510 gr = getattr(cur_gr, 'parent_group', None)
1511 cur_gr = cur_gr.parent_group
1512 if gr is None:
1513 break
1514 groups.insert(0, gr)
1515
1516 return groups
1517
1518 @property
1519 def groups_and_repo(self):
1520 return self.groups_with_parents, self
1521
1522 @LazyProperty
1523 def repo_path(self):
1524 """
1525 Returns base full path for that repository means where it actually
1526 exists on a filesystem
1527 """
1528 q = Session().query(RhodeCodeUi).filter(
1529 RhodeCodeUi.ui_key == self.NAME_SEP)
1530 q = q.options(FromCache("sql_cache_short", "repository_repo_path"))
1531 return q.one().ui_value
1532
1533 @property
1534 def repo_full_path(self):
1535 p = [self.repo_path]
1536 # we need to split the name by / since this is how we store the
1537 # names in the database, but that eventually needs to be converted
1538 # into a valid system path
1539 p += self.repo_name.split(self.NAME_SEP)
1540 return os.path.join(*map(safe_unicode, p))
1541
1542 @property
1543 def cache_keys(self):
1544 """
1545 Returns associated cache keys for that repo
1546 """
1547 return CacheKey.query()\
1548 .filter(CacheKey.cache_args == self.repo_name)\
1549 .order_by(CacheKey.cache_key)\
1550 .all()
1551
1552 def get_new_name(self, repo_name):
1553 """
1554 returns new full repository name based on assigned group and new new
1555
1556 :param group_name:
1557 """
1558 path_prefix = self.group.full_path_splitted if self.group else []
1559 return self.NAME_SEP.join(path_prefix + [repo_name])
1560
1561 @property
1562 def _config(self):
1563 """
1564 Returns db based config object.
1565 """
1566 from rhodecode.lib.utils import make_db_config
1567 return make_db_config(clear_session=False, repo=self)
1568
1569 def permissions(self, with_admins=True, with_owner=True):
1570 q = UserRepoToPerm.query().filter(UserRepoToPerm.repository == self)
1571 q = q.options(joinedload(UserRepoToPerm.repository),
1572 joinedload(UserRepoToPerm.user),
1573 joinedload(UserRepoToPerm.permission),)
1574
1575 # get owners and admins and permissions. We do a trick of re-writing
1576 # objects from sqlalchemy to named-tuples due to sqlalchemy session
1577 # has a global reference and changing one object propagates to all
1578 # others. This means if admin is also an owner admin_row that change
1579 # would propagate to both objects
1580 perm_rows = []
1581 for _usr in q.all():
1582 usr = AttributeDict(_usr.user.get_dict())
1583 usr.permission = _usr.permission.permission_name
1584 perm_rows.append(usr)
1585
1586 # filter the perm rows by 'default' first and then sort them by
1587 # admin,write,read,none permissions sorted again alphabetically in
1588 # each group
1589 perm_rows = sorted(perm_rows, key=display_sort)
1590
1591 _admin_perm = 'repository.admin'
1592 owner_row = []
1593 if with_owner:
1594 usr = AttributeDict(self.user.get_dict())
1595 usr.owner_row = True
1596 usr.permission = _admin_perm
1597 owner_row.append(usr)
1598
1599 super_admin_rows = []
1600 if with_admins:
1601 for usr in User.get_all_super_admins():
1602 # if this admin is also owner, don't double the record
1603 if usr.user_id == owner_row[0].user_id:
1604 owner_row[0].admin_row = True
1605 else:
1606 usr = AttributeDict(usr.get_dict())
1607 usr.admin_row = True
1608 usr.permission = _admin_perm
1609 super_admin_rows.append(usr)
1610
1611 return super_admin_rows + owner_row + perm_rows
1612
1613 def permission_user_groups(self):
1614 q = UserGroupRepoToPerm.query().filter(
1615 UserGroupRepoToPerm.repository == self)
1616 q = q.options(joinedload(UserGroupRepoToPerm.repository),
1617 joinedload(UserGroupRepoToPerm.users_group),
1618 joinedload(UserGroupRepoToPerm.permission),)
1619
1620 perm_rows = []
1621 for _user_group in q.all():
1622 usr = AttributeDict(_user_group.users_group.get_dict())
1623 usr.permission = _user_group.permission.permission_name
1624 perm_rows.append(usr)
1625
1626 return perm_rows
1627
1628 def get_api_data(self, include_secrets=False):
1629 """
1630 Common function for generating repo api data
1631
1632 :param include_secrets: See :meth:`User.get_api_data`.
1633
1634 """
1635 # TODO: mikhail: Here there is an anti-pattern, we probably need to
1636 # move this methods on models level.
1637 from rhodecode.model.settings import SettingsModel
1638
1639 repo = self
1640 _user_id, _time, _reason = self.locked
1641
1642 data = {
1643 'repo_id': repo.repo_id,
1644 'repo_name': repo.repo_name,
1645 'repo_type': repo.repo_type,
1646 'clone_uri': repo.clone_uri or '',
1647 'url': url('summary_home', repo_name=self.repo_name, qualified=True),
1648 'private': repo.private,
1649 'created_on': repo.created_on,
1650 'description': repo.description,
1651 'landing_rev': repo.landing_rev,
1652 'owner': repo.user.username,
1653 'fork_of': repo.fork.repo_name if repo.fork else None,
1654 'enable_statistics': repo.enable_statistics,
1655 'enable_locking': repo.enable_locking,
1656 'enable_downloads': repo.enable_downloads,
1657 'last_changeset': repo.changeset_cache,
1658 'locked_by': User.get(_user_id).get_api_data(
1659 include_secrets=include_secrets) if _user_id else None,
1660 'locked_date': time_to_datetime(_time) if _time else None,
1661 'lock_reason': _reason if _reason else None,
1662 }
1663
1664 # TODO: mikhail: should be per-repo settings here
1665 rc_config = SettingsModel().get_all_settings()
1666 repository_fields = str2bool(
1667 rc_config.get('rhodecode_repository_fields'))
1668 if repository_fields:
1669 for f in self.extra_fields:
1670 data[f.field_key_prefixed] = f.field_value
1671
1672 return data
1673
1674 @classmethod
1675 def lock(cls, repo, user_id, lock_time=None, lock_reason=None):
1676 if not lock_time:
1677 lock_time = time.time()
1678 if not lock_reason:
1679 lock_reason = cls.LOCK_AUTOMATIC
1680 repo.locked = [user_id, lock_time, lock_reason]
1681 Session().add(repo)
1682 Session().commit()
1683
1684 @classmethod
1685 def unlock(cls, repo):
1686 repo.locked = None
1687 Session().add(repo)
1688 Session().commit()
1689
1690 @classmethod
1691 def getlock(cls, repo):
1692 return repo.locked
1693
1694 def is_user_lock(self, user_id):
1695 if self.lock[0]:
1696 lock_user_id = safe_int(self.lock[0])
1697 user_id = safe_int(user_id)
1698 # both are ints, and they are equal
1699 return all([lock_user_id, user_id]) and lock_user_id == user_id
1700
1701 return False
1702
1703 def get_locking_state(self, action, user_id, only_when_enabled=True):
1704 """
1705 Checks locking on this repository, if locking is enabled and lock is
1706 present returns a tuple of make_lock, locked, locked_by.
1707 make_lock can have 3 states None (do nothing) True, make lock
1708 False release lock, This value is later propagated to hooks, which
1709 do the locking. Think about this as signals passed to hooks what to do.
1710
1711 """
1712 # TODO: johbo: This is part of the business logic and should be moved
1713 # into the RepositoryModel.
1714
1715 if action not in ('push', 'pull'):
1716 raise ValueError("Invalid action value: %s" % repr(action))
1717
1718 # defines if locked error should be thrown to user
1719 currently_locked = False
1720 # defines if new lock should be made, tri-state
1721 make_lock = None
1722 repo = self
1723 user = User.get(user_id)
1724
1725 lock_info = repo.locked
1726
1727 if repo and (repo.enable_locking or not only_when_enabled):
1728 if action == 'push':
1729 # check if it's already locked !, if it is compare users
1730 locked_by_user_id = lock_info[0]
1731 if user.user_id == locked_by_user_id:
1732 log.debug(
1733 'Got `push` action from user %s, now unlocking', user)
1734 # unlock if we have push from user who locked
1735 make_lock = False
1736 else:
1737 # we're not the same user who locked, ban with
1738 # code defined in settings (default is 423 HTTP Locked) !
1739 log.debug('Repo %s is currently locked by %s', repo, user)
1740 currently_locked = True
1741 elif action == 'pull':
1742 # [0] user [1] date
1743 if lock_info[0] and lock_info[1]:
1744 log.debug('Repo %s is currently locked by %s', repo, user)
1745 currently_locked = True
1746 else:
1747 log.debug('Setting lock on repo %s by %s', repo, user)
1748 make_lock = True
1749
1750 else:
1751 log.debug('Repository %s do not have locking enabled', repo)
1752
1753 log.debug('FINAL locking values make_lock:%s,locked:%s,locked_by:%s',
1754 make_lock, currently_locked, lock_info)
1755
1756 from rhodecode.lib.auth import HasRepoPermissionAny
1757 perm_check = HasRepoPermissionAny('repository.write', 'repository.admin')
1758 if make_lock and not perm_check(repo_name=repo.repo_name, user=user):
1759 # if we don't have at least write permission we cannot make a lock
1760 log.debug('lock state reset back to FALSE due to lack '
1761 'of at least read permission')
1762 make_lock = False
1763
1764 return make_lock, currently_locked, lock_info
1765
1766 @property
1767 def last_db_change(self):
1768 return self.updated_on
1769
1770 @property
1771 def clone_uri_hidden(self):
1772 clone_uri = self.clone_uri
1773 if clone_uri:
1774 import urlobject
1775 url_obj = urlobject.URLObject(clone_uri)
1776 if url_obj.password:
1777 clone_uri = url_obj.with_password('*****')
1778 return clone_uri
1779
1780 def clone_url(self, **override):
1781 qualified_home_url = url('home', qualified=True)
1782
1783 uri_tmpl = None
1784 if 'with_id' in override:
1785 uri_tmpl = self.DEFAULT_CLONE_URI_ID
1786 del override['with_id']
1787
1788 if 'uri_tmpl' in override:
1789 uri_tmpl = override['uri_tmpl']
1790 del override['uri_tmpl']
1791
1792 # we didn't override our tmpl from **overrides
1793 if not uri_tmpl:
1794 uri_tmpl = self.DEFAULT_CLONE_URI
1795 try:
1796 from pylons import tmpl_context as c
1797 uri_tmpl = c.clone_uri_tmpl
1798 except Exception:
1799 # in any case if we call this outside of request context,
1800 # ie, not having tmpl_context set up
1801 pass
1802
1803 return get_clone_url(uri_tmpl=uri_tmpl,
1804 qualifed_home_url=qualified_home_url,
1805 repo_name=self.repo_name,
1806 repo_id=self.repo_id, **override)
1807
1808 def set_state(self, state):
1809 self.repo_state = state
1810 Session().add(self)
1811 #==========================================================================
1812 # SCM PROPERTIES
1813 #==========================================================================
1814
1815 def get_commit(self, commit_id=None, commit_idx=None, pre_load=None):
1816 return get_commit_safe(
1817 self.scm_instance(), commit_id, commit_idx, pre_load=pre_load)
1818
1819 def get_changeset(self, rev=None, pre_load=None):
1820 warnings.warn("Use get_commit", DeprecationWarning)
1821 commit_id = None
1822 commit_idx = None
1823 if isinstance(rev, basestring):
1824 commit_id = rev
1825 else:
1826 commit_idx = rev
1827 return self.get_commit(commit_id=commit_id, commit_idx=commit_idx,
1828 pre_load=pre_load)
1829
1830 def get_landing_commit(self):
1831 """
1832 Returns landing commit, or if that doesn't exist returns the tip
1833 """
1834 _rev_type, _rev = self.landing_rev
1835 commit = self.get_commit(_rev)
1836 if isinstance(commit, EmptyCommit):
1837 return self.get_commit()
1838 return commit
1839
1840 def update_commit_cache(self, cs_cache=None, config=None):
1841 """
1842 Update cache of last changeset for repository, keys should be::
1843
1844 short_id
1845 raw_id
1846 revision
1847 parents
1848 message
1849 date
1850 author
1851
1852 :param cs_cache:
1853 """
1854 from rhodecode.lib.vcs.backends.base import BaseChangeset
1855 if cs_cache is None:
1856 # use no-cache version here
1857 scm_repo = self.scm_instance(cache=False, config=config)
1858 if scm_repo:
1859 cs_cache = scm_repo.get_commit(
1860 pre_load=["author", "date", "message", "parents"])
1861 else:
1862 cs_cache = EmptyCommit()
1863
1864 if isinstance(cs_cache, BaseChangeset):
1865 cs_cache = cs_cache.__json__()
1866
1867 def is_outdated(new_cs_cache):
1868 if (new_cs_cache['raw_id'] != self.changeset_cache['raw_id'] or
1869 new_cs_cache['revision'] != self.changeset_cache['revision']):
1870 return True
1871 return False
1872
1873 # check if we have maybe already latest cached revision
1874 if is_outdated(cs_cache) or not self.changeset_cache:
1875 _default = datetime.datetime.fromtimestamp(0)
1876 last_change = cs_cache.get('date') or _default
1877 log.debug('updated repo %s with new cs cache %s',
1878 self.repo_name, cs_cache)
1879 self.updated_on = last_change
1880 self.changeset_cache = cs_cache
1881 Session().add(self)
1882 Session().commit()
1883 else:
1884 log.debug('Skipping update_commit_cache for repo:`%s` '
1885 'commit already with latest changes', self.repo_name)
1886
1887 @property
1888 def tip(self):
1889 return self.get_commit('tip')
1890
1891 @property
1892 def author(self):
1893 return self.tip.author
1894
1895 @property
1896 def last_change(self):
1897 return self.scm_instance().last_change
1898
1899 def get_comments(self, revisions=None):
1900 """
1901 Returns comments for this repository grouped by revisions
1902
1903 :param revisions: filter query by revisions only
1904 """
1905 cmts = ChangesetComment.query()\
1906 .filter(ChangesetComment.repo == self)
1907 if revisions:
1908 cmts = cmts.filter(ChangesetComment.revision.in_(revisions))
1909 grouped = collections.defaultdict(list)
1910 for cmt in cmts.all():
1911 grouped[cmt.revision].append(cmt)
1912 return grouped
1913
1914 def statuses(self, revisions=None):
1915 """
1916 Returns statuses for this repository
1917
1918 :param revisions: list of revisions to get statuses for
1919 """
1920 statuses = ChangesetStatus.query()\
1921 .filter(ChangesetStatus.repo == self)\
1922 .filter(ChangesetStatus.version == 0)
1923
1924 if revisions:
1925 # Try doing the filtering in chunks to avoid hitting limits
1926 size = 500
1927 status_results = []
1928 for chunk in xrange(0, len(revisions), size):
1929 status_results += statuses.filter(
1930 ChangesetStatus.revision.in_(
1931 revisions[chunk: chunk+size])
1932 ).all()
1933 else:
1934 status_results = statuses.all()
1935
1936 grouped = {}
1937
1938 # maybe we have open new pullrequest without a status?
1939 stat = ChangesetStatus.STATUS_UNDER_REVIEW
1940 status_lbl = ChangesetStatus.get_status_lbl(stat)
1941 for pr in PullRequest.query().filter(PullRequest.source_repo == self).all():
1942 for rev in pr.revisions:
1943 pr_id = pr.pull_request_id
1944 pr_repo = pr.target_repo.repo_name
1945 grouped[rev] = [stat, status_lbl, pr_id, pr_repo]
1946
1947 for stat in status_results:
1948 pr_id = pr_repo = None
1949 if stat.pull_request:
1950 pr_id = stat.pull_request.pull_request_id
1951 pr_repo = stat.pull_request.target_repo.repo_name
1952 grouped[stat.revision] = [str(stat.status), stat.status_lbl,
1953 pr_id, pr_repo]
1954 return grouped
1955
1956 # ==========================================================================
1957 # SCM CACHE INSTANCE
1958 # ==========================================================================
1959
1960 def scm_instance(self, **kwargs):
1961 import rhodecode
1962
1963 # Passing a config will not hit the cache currently only used
1964 # for repo2dbmapper
1965 config = kwargs.pop('config', None)
1966 cache = kwargs.pop('cache', None)
1967 full_cache = str2bool(rhodecode.CONFIG.get('vcs_full_cache'))
1968 # if cache is NOT defined use default global, else we have a full
1969 # control over cache behaviour
1970 if cache is None and full_cache and not config:
1971 return self._get_instance_cached()
1972 return self._get_instance(cache=bool(cache), config=config)
1973
1974 def _get_instance_cached(self):
1975 @cache_region('long_term')
1976 def _get_repo(cache_key):
1977 return self._get_instance()
1978
1979 invalidator_context = CacheKey.repo_context_cache(
1980 _get_repo, self.repo_name, None, thread_scoped=True)
1981
1982 with invalidator_context as context:
1983 context.invalidate()
1984 repo = context.compute()
1985
1986 return repo
1987
1988 def _get_instance(self, cache=True, config=None):
1989 config = config or self._config
1990 custom_wire = {
1991 'cache': cache # controls the vcs.remote cache
1992 }
1993
1994 repo = get_vcs_instance(
1995 repo_path=safe_str(self.repo_full_path),
1996 config=config,
1997 with_wire=custom_wire,
1998 create=False)
1999
2000 return repo
2001
2002 def __json__(self):
2003 return {'landing_rev': self.landing_rev}
2004
2005 def get_dict(self):
2006
2007 # Since we transformed `repo_name` to a hybrid property, we need to
2008 # keep compatibility with the code which uses `repo_name` field.
2009
2010 result = super(Repository, self).get_dict()
2011 result['repo_name'] = result.pop('_repo_name', None)
2012 return result
2013
2014
2015 class RepoGroup(Base, BaseModel):
2016 __tablename__ = 'groups'
2017 __table_args__ = (
2018 UniqueConstraint('group_name', 'group_parent_id'),
2019 CheckConstraint('group_id != group_parent_id'),
2020 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2021 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2022 )
2023 __mapper_args__ = {'order_by': 'group_name'}
2024
2025 CHOICES_SEPARATOR = '/' # used to generate select2 choices for nested groups
2026
2027 group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2028 group_name = Column("group_name", String(255), nullable=False, unique=True, default=None)
2029 group_parent_id = Column("group_parent_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=None, default=None)
2030 group_description = Column("group_description", String(10000), nullable=True, unique=None, default=None)
2031 enable_locking = Column("enable_locking", Boolean(), nullable=False, unique=None, default=False)
2032 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None)
2033 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
2034
2035 repo_group_to_perm = relationship('UserRepoGroupToPerm', cascade='all', order_by='UserRepoGroupToPerm.group_to_perm_id')
2036 users_group_to_perm = relationship('UserGroupRepoGroupToPerm', cascade='all')
2037 parent_group = relationship('RepoGroup', remote_side=group_id)
2038 user = relationship('User')
2039
2040 def __init__(self, group_name='', parent_group=None):
2041 self.group_name = group_name
2042 self.parent_group = parent_group
2043
2044 def __unicode__(self):
2045 return u"<%s('id:%s:%s')>" % (self.__class__.__name__, self.group_id,
2046 self.group_name)
2047
2048 @classmethod
2049 def _generate_choice(cls, repo_group):
2050 from webhelpers.html import literal as _literal
2051 _name = lambda k: _literal(cls.CHOICES_SEPARATOR.join(k))
2052 return repo_group.group_id, _name(repo_group.full_path_splitted)
2053
2054 @classmethod
2055 def groups_choices(cls, groups=None, show_empty_group=True):
2056 if not groups:
2057 groups = cls.query().all()
2058
2059 repo_groups = []
2060 if show_empty_group:
2061 repo_groups = [('-1', u'-- %s --' % _('No parent'))]
2062
2063 repo_groups.extend([cls._generate_choice(x) for x in groups])
2064
2065 repo_groups = sorted(
2066 repo_groups, key=lambda t: t[1].split(cls.CHOICES_SEPARATOR)[0])
2067 return repo_groups
2068
2069 @classmethod
2070 def url_sep(cls):
2071 return URL_SEP
2072
2073 @classmethod
2074 def get_by_group_name(cls, group_name, cache=False, case_insensitive=False):
2075 if case_insensitive:
2076 gr = cls.query().filter(func.lower(cls.group_name)
2077 == func.lower(group_name))
2078 else:
2079 gr = cls.query().filter(cls.group_name == group_name)
2080 if cache:
2081 gr = gr.options(FromCache(
2082 "sql_cache_short",
2083 "get_group_%s" % _hash_key(group_name)))
2084 return gr.scalar()
2085
2086 @classmethod
2087 def get_all_repo_groups(cls, user_id=Optional(None), group_id=Optional(None),
2088 case_insensitive=True):
2089 q = RepoGroup.query()
2090
2091 if not isinstance(user_id, Optional):
2092 q = q.filter(RepoGroup.user_id == user_id)
2093
2094 if not isinstance(group_id, Optional):
2095 q = q.filter(RepoGroup.group_parent_id == group_id)
2096
2097 if case_insensitive:
2098 q = q.order_by(func.lower(RepoGroup.group_name))
2099 else:
2100 q = q.order_by(RepoGroup.group_name)
2101 return q.all()
2102
2103 @property
2104 def parents(self):
2105 parents_recursion_limit = 10
2106 groups = []
2107 if self.parent_group is None:
2108 return groups
2109 cur_gr = self.parent_group
2110 groups.insert(0, cur_gr)
2111 cnt = 0
2112 while 1:
2113 cnt += 1
2114 gr = getattr(cur_gr, 'parent_group', None)
2115 cur_gr = cur_gr.parent_group
2116 if gr is None:
2117 break
2118 if cnt == parents_recursion_limit:
2119 # this will prevent accidental infinit loops
2120 log.error(('more than %s parents found for group %s, stopping '
2121 'recursive parent fetching' % (parents_recursion_limit, self)))
2122 break
2123
2124 groups.insert(0, gr)
2125 return groups
2126
2127 @property
2128 def children(self):
2129 return RepoGroup.query().filter(RepoGroup.parent_group == self)
2130
2131 @property
2132 def name(self):
2133 return self.group_name.split(RepoGroup.url_sep())[-1]
2134
2135 @property
2136 def full_path(self):
2137 return self.group_name
2138
2139 @property
2140 def full_path_splitted(self):
2141 return self.group_name.split(RepoGroup.url_sep())
2142
2143 @property
2144 def repositories(self):
2145 return Repository.query()\
2146 .filter(Repository.group == self)\
2147 .order_by(Repository.repo_name)
2148
2149 @property
2150 def repositories_recursive_count(self):
2151 cnt = self.repositories.count()
2152
2153 def children_count(group):
2154 cnt = 0
2155 for child in group.children:
2156 cnt += child.repositories.count()
2157 cnt += children_count(child)
2158 return cnt
2159
2160 return cnt + children_count(self)
2161
2162 def _recursive_objects(self, include_repos=True):
2163 all_ = []
2164
2165 def _get_members(root_gr):
2166 if include_repos:
2167 for r in root_gr.repositories:
2168 all_.append(r)
2169 childs = root_gr.children.all()
2170 if childs:
2171 for gr in childs:
2172 all_.append(gr)
2173 _get_members(gr)
2174
2175 _get_members(self)
2176 return [self] + all_
2177
2178 def recursive_groups_and_repos(self):
2179 """
2180 Recursive return all groups, with repositories in those groups
2181 """
2182 return self._recursive_objects()
2183
2184 def recursive_groups(self):
2185 """
2186 Returns all children groups for this group including children of children
2187 """
2188 return self._recursive_objects(include_repos=False)
2189
2190 def get_new_name(self, group_name):
2191 """
2192 returns new full group name based on parent and new name
2193
2194 :param group_name:
2195 """
2196 path_prefix = (self.parent_group.full_path_splitted if
2197 self.parent_group else [])
2198 return RepoGroup.url_sep().join(path_prefix + [group_name])
2199
2200 def permissions(self, with_admins=True, with_owner=True):
2201 q = UserRepoGroupToPerm.query().filter(UserRepoGroupToPerm.group == self)
2202 q = q.options(joinedload(UserRepoGroupToPerm.group),
2203 joinedload(UserRepoGroupToPerm.user),
2204 joinedload(UserRepoGroupToPerm.permission),)
2205
2206 # get owners and admins and permissions. We do a trick of re-writing
2207 # objects from sqlalchemy to named-tuples due to sqlalchemy session
2208 # has a global reference and changing one object propagates to all
2209 # others. This means if admin is also an owner admin_row that change
2210 # would propagate to both objects
2211 perm_rows = []
2212 for _usr in q.all():
2213 usr = AttributeDict(_usr.user.get_dict())
2214 usr.permission = _usr.permission.permission_name
2215 perm_rows.append(usr)
2216
2217 # filter the perm rows by 'default' first and then sort them by
2218 # admin,write,read,none permissions sorted again alphabetically in
2219 # each group
2220 perm_rows = sorted(perm_rows, key=display_sort)
2221
2222 _admin_perm = 'group.admin'
2223 owner_row = []
2224 if with_owner:
2225 usr = AttributeDict(self.user.get_dict())
2226 usr.owner_row = True
2227 usr.permission = _admin_perm
2228 owner_row.append(usr)
2229
2230 super_admin_rows = []
2231 if with_admins:
2232 for usr in User.get_all_super_admins():
2233 # if this admin is also owner, don't double the record
2234 if usr.user_id == owner_row[0].user_id:
2235 owner_row[0].admin_row = True
2236 else:
2237 usr = AttributeDict(usr.get_dict())
2238 usr.admin_row = True
2239 usr.permission = _admin_perm
2240 super_admin_rows.append(usr)
2241
2242 return super_admin_rows + owner_row + perm_rows
2243
2244 def permission_user_groups(self):
2245 q = UserGroupRepoGroupToPerm.query().filter(UserGroupRepoGroupToPerm.group == self)
2246 q = q.options(joinedload(UserGroupRepoGroupToPerm.group),
2247 joinedload(UserGroupRepoGroupToPerm.users_group),
2248 joinedload(UserGroupRepoGroupToPerm.permission),)
2249
2250 perm_rows = []
2251 for _user_group in q.all():
2252 usr = AttributeDict(_user_group.users_group.get_dict())
2253 usr.permission = _user_group.permission.permission_name
2254 perm_rows.append(usr)
2255
2256 return perm_rows
2257
2258 def get_api_data(self):
2259 """
2260 Common function for generating api data
2261
2262 """
2263 group = self
2264 data = {
2265 'group_id': group.group_id,
2266 'group_name': group.group_name,
2267 'group_description': group.group_description,
2268 'parent_group': group.parent_group.group_name if group.parent_group else None,
2269 'repositories': [x.repo_name for x in group.repositories],
2270 'owner': group.user.username,
2271 }
2272 return data
2273
2274
2275 class Permission(Base, BaseModel):
2276 __tablename__ = 'permissions'
2277 __table_args__ = (
2278 Index('p_perm_name_idx', 'permission_name'),
2279 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2280 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2281 )
2282 PERMS = [
2283 ('hg.admin', _('RhodeCode Super Administrator')),
2284
2285 ('repository.none', _('Repository no access')),
2286 ('repository.read', _('Repository read access')),
2287 ('repository.write', _('Repository write access')),
2288 ('repository.admin', _('Repository admin access')),
2289
2290 ('group.none', _('Repository group no access')),
2291 ('group.read', _('Repository group read access')),
2292 ('group.write', _('Repository group write access')),
2293 ('group.admin', _('Repository group admin access')),
2294
2295 ('usergroup.none', _('User group no access')),
2296 ('usergroup.read', _('User group read access')),
2297 ('usergroup.write', _('User group write access')),
2298 ('usergroup.admin', _('User group admin access')),
2299
2300 ('hg.repogroup.create.false', _('Repository Group creation disabled')),
2301 ('hg.repogroup.create.true', _('Repository Group creation enabled')),
2302
2303 ('hg.usergroup.create.false', _('User Group creation disabled')),
2304 ('hg.usergroup.create.true', _('User Group creation enabled')),
2305
2306 ('hg.create.none', _('Repository creation disabled')),
2307 ('hg.create.repository', _('Repository creation enabled')),
2308 ('hg.create.write_on_repogroup.true', _('Repository creation enabled with write permission to a repository group')),
2309 ('hg.create.write_on_repogroup.false', _('Repository creation disabled with write permission to a repository group')),
2310
2311 ('hg.fork.none', _('Repository forking disabled')),
2312 ('hg.fork.repository', _('Repository forking enabled')),
2313
2314 ('hg.register.none', _('Registration disabled')),
2315 ('hg.register.manual_activate', _('User Registration with manual account activation')),
2316 ('hg.register.auto_activate', _('User Registration with automatic account activation')),
2317
2318 ('hg.extern_activate.manual', _('Manual activation of external account')),
2319 ('hg.extern_activate.auto', _('Automatic activation of external account')),
2320
2321 ('hg.inherit_default_perms.false', _('Inherit object permissions from default user disabled')),
2322 ('hg.inherit_default_perms.true', _('Inherit object permissions from default user enabled')),
2323 ]
2324
2325 # definition of system default permissions for DEFAULT user
2326 DEFAULT_USER_PERMISSIONS = [
2327 'repository.read',
2328 'group.read',
2329 'usergroup.read',
2330 'hg.create.repository',
2331 'hg.repogroup.create.false',
2332 'hg.usergroup.create.false',
2333 'hg.create.write_on_repogroup.true',
2334 'hg.fork.repository',
2335 'hg.register.manual_activate',
2336 'hg.extern_activate.auto',
2337 'hg.inherit_default_perms.true',
2338 ]
2339
2340 # defines which permissions are more important higher the more important
2341 # Weight defines which permissions are more important.
2342 # The higher number the more important.
2343 PERM_WEIGHTS = {
2344 'repository.none': 0,
2345 'repository.read': 1,
2346 'repository.write': 3,
2347 'repository.admin': 4,
2348
2349 'group.none': 0,
2350 'group.read': 1,
2351 'group.write': 3,
2352 'group.admin': 4,
2353
2354 'usergroup.none': 0,
2355 'usergroup.read': 1,
2356 'usergroup.write': 3,
2357 'usergroup.admin': 4,
2358
2359 'hg.repogroup.create.false': 0,
2360 'hg.repogroup.create.true': 1,
2361
2362 'hg.usergroup.create.false': 0,
2363 'hg.usergroup.create.true': 1,
2364
2365 'hg.fork.none': 0,
2366 'hg.fork.repository': 1,
2367 'hg.create.none': 0,
2368 'hg.create.repository': 1
2369 }
2370
2371 permission_id = Column("permission_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2372 permission_name = Column("permission_name", String(255), nullable=True, unique=None, default=None)
2373 permission_longname = Column("permission_longname", String(255), nullable=True, unique=None, default=None)
2374
2375 def __unicode__(self):
2376 return u"<%s('%s:%s')>" % (
2377 self.__class__.__name__, self.permission_id, self.permission_name
2378 )
2379
2380 @classmethod
2381 def get_by_key(cls, key):
2382 return cls.query().filter(cls.permission_name == key).scalar()
2383
2384 @classmethod
2385 def get_default_repo_perms(cls, user_id, repo_id=None):
2386 q = Session().query(UserRepoToPerm, Repository, Permission)\
2387 .join((Permission, UserRepoToPerm.permission_id == Permission.permission_id))\
2388 .join((Repository, UserRepoToPerm.repository_id == Repository.repo_id))\
2389 .filter(UserRepoToPerm.user_id == user_id)
2390 if repo_id:
2391 q = q.filter(UserRepoToPerm.repository_id == repo_id)
2392 return q.all()
2393
2394 @classmethod
2395 def get_default_repo_perms_from_user_group(cls, user_id, repo_id=None):
2396 q = Session().query(UserGroupRepoToPerm, Repository, Permission)\
2397 .join(
2398 Permission,
2399 UserGroupRepoToPerm.permission_id == Permission.permission_id)\
2400 .join(
2401 Repository,
2402 UserGroupRepoToPerm.repository_id == Repository.repo_id)\
2403 .join(
2404 UserGroup,
2405 UserGroupRepoToPerm.users_group_id ==
2406 UserGroup.users_group_id)\
2407 .join(
2408 UserGroupMember,
2409 UserGroupRepoToPerm.users_group_id ==
2410 UserGroupMember.users_group_id)\
2411 .filter(
2412 UserGroupMember.user_id == user_id,
2413 UserGroup.users_group_active == true())
2414 if repo_id:
2415 q = q.filter(UserGroupRepoToPerm.repository_id == repo_id)
2416 return q.all()
2417
2418 @classmethod
2419 def get_default_group_perms(cls, user_id, repo_group_id=None):
2420 q = Session().query(UserRepoGroupToPerm, RepoGroup, Permission)\
2421 .join((Permission, UserRepoGroupToPerm.permission_id == Permission.permission_id))\
2422 .join((RepoGroup, UserRepoGroupToPerm.group_id == RepoGroup.group_id))\
2423 .filter(UserRepoGroupToPerm.user_id == user_id)
2424 if repo_group_id:
2425 q = q.filter(UserRepoGroupToPerm.group_id == repo_group_id)
2426 return q.all()
2427
2428 @classmethod
2429 def get_default_group_perms_from_user_group(
2430 cls, user_id, repo_group_id=None):
2431 q = Session().query(UserGroupRepoGroupToPerm, RepoGroup, Permission)\
2432 .join(
2433 Permission,
2434 UserGroupRepoGroupToPerm.permission_id ==
2435 Permission.permission_id)\
2436 .join(
2437 RepoGroup,
2438 UserGroupRepoGroupToPerm.group_id == RepoGroup.group_id)\
2439 .join(
2440 UserGroup,
2441 UserGroupRepoGroupToPerm.users_group_id ==
2442 UserGroup.users_group_id)\
2443 .join(
2444 UserGroupMember,
2445 UserGroupRepoGroupToPerm.users_group_id ==
2446 UserGroupMember.users_group_id)\
2447 .filter(
2448 UserGroupMember.user_id == user_id,
2449 UserGroup.users_group_active == true())
2450 if repo_group_id:
2451 q = q.filter(UserGroupRepoGroupToPerm.group_id == repo_group_id)
2452 return q.all()
2453
2454 @classmethod
2455 def get_default_user_group_perms(cls, user_id, user_group_id=None):
2456 q = Session().query(UserUserGroupToPerm, UserGroup, Permission)\
2457 .join((Permission, UserUserGroupToPerm.permission_id == Permission.permission_id))\
2458 .join((UserGroup, UserUserGroupToPerm.user_group_id == UserGroup.users_group_id))\
2459 .filter(UserUserGroupToPerm.user_id == user_id)
2460 if user_group_id:
2461 q = q.filter(UserUserGroupToPerm.user_group_id == user_group_id)
2462 return q.all()
2463
2464 @classmethod
2465 def get_default_user_group_perms_from_user_group(
2466 cls, user_id, user_group_id=None):
2467 TargetUserGroup = aliased(UserGroup, name='target_user_group')
2468 q = Session().query(UserGroupUserGroupToPerm, UserGroup, Permission)\
2469 .join(
2470 Permission,
2471 UserGroupUserGroupToPerm.permission_id ==
2472 Permission.permission_id)\
2473 .join(
2474 TargetUserGroup,
2475 UserGroupUserGroupToPerm.target_user_group_id ==
2476 TargetUserGroup.users_group_id)\
2477 .join(
2478 UserGroup,
2479 UserGroupUserGroupToPerm.user_group_id ==
2480 UserGroup.users_group_id)\
2481 .join(
2482 UserGroupMember,
2483 UserGroupUserGroupToPerm.user_group_id ==
2484 UserGroupMember.users_group_id)\
2485 .filter(
2486 UserGroupMember.user_id == user_id,
2487 UserGroup.users_group_active == true())
2488 if user_group_id:
2489 q = q.filter(
2490 UserGroupUserGroupToPerm.user_group_id == user_group_id)
2491
2492 return q.all()
2493
2494
2495 class UserRepoToPerm(Base, BaseModel):
2496 __tablename__ = 'repo_to_perm'
2497 __table_args__ = (
2498 UniqueConstraint('user_id', 'repository_id', 'permission_id'),
2499 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2500 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2501 )
2502 repo_to_perm_id = Column("repo_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2503 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2504 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2505 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None)
2506
2507 user = relationship('User')
2508 repository = relationship('Repository')
2509 permission = relationship('Permission')
2510
2511 @classmethod
2512 def create(cls, user, repository, permission):
2513 n = cls()
2514 n.user = user
2515 n.repository = repository
2516 n.permission = permission
2517 Session().add(n)
2518 return n
2519
2520 def __unicode__(self):
2521 return u'<%s => %s >' % (self.user, self.repository)
2522
2523
2524 class UserUserGroupToPerm(Base, BaseModel):
2525 __tablename__ = 'user_user_group_to_perm'
2526 __table_args__ = (
2527 UniqueConstraint('user_id', 'user_group_id', 'permission_id'),
2528 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2529 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2530 )
2531 user_user_group_to_perm_id = Column("user_user_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2532 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2533 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2534 user_group_id = Column("user_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2535
2536 user = relationship('User')
2537 user_group = relationship('UserGroup')
2538 permission = relationship('Permission')
2539
2540 @classmethod
2541 def create(cls, user, user_group, permission):
2542 n = cls()
2543 n.user = user
2544 n.user_group = user_group
2545 n.permission = permission
2546 Session().add(n)
2547 return n
2548
2549 def __unicode__(self):
2550 return u'<%s => %s >' % (self.user, self.user_group)
2551
2552
2553 class UserToPerm(Base, BaseModel):
2554 __tablename__ = 'user_to_perm'
2555 __table_args__ = (
2556 UniqueConstraint('user_id', 'permission_id'),
2557 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2558 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2559 )
2560 user_to_perm_id = Column("user_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2561 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2562 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2563
2564 user = relationship('User')
2565 permission = relationship('Permission', lazy='joined')
2566
2567 def __unicode__(self):
2568 return u'<%s => %s >' % (self.user, self.permission)
2569
2570
2571 class UserGroupRepoToPerm(Base, BaseModel):
2572 __tablename__ = 'users_group_repo_to_perm'
2573 __table_args__ = (
2574 UniqueConstraint('repository_id', 'users_group_id', 'permission_id'),
2575 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2576 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2577 )
2578 users_group_to_perm_id = Column("users_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2579 users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2580 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2581 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None)
2582
2583 users_group = relationship('UserGroup')
2584 permission = relationship('Permission')
2585 repository = relationship('Repository')
2586
2587 @classmethod
2588 def create(cls, users_group, repository, permission):
2589 n = cls()
2590 n.users_group = users_group
2591 n.repository = repository
2592 n.permission = permission
2593 Session().add(n)
2594 return n
2595
2596 def __unicode__(self):
2597 return u'<UserGroupRepoToPerm:%s => %s >' % (self.users_group, self.repository)
2598
2599
2600 class UserGroupUserGroupToPerm(Base, BaseModel):
2601 __tablename__ = 'user_group_user_group_to_perm'
2602 __table_args__ = (
2603 UniqueConstraint('target_user_group_id', 'user_group_id', 'permission_id'),
2604 CheckConstraint('target_user_group_id != user_group_id'),
2605 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2606 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2607 )
2608 user_group_user_group_to_perm_id = Column("user_group_user_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2609 target_user_group_id = Column("target_user_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2610 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2611 user_group_id = Column("user_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2612
2613 target_user_group = relationship('UserGroup', primaryjoin='UserGroupUserGroupToPerm.target_user_group_id==UserGroup.users_group_id')
2614 user_group = relationship('UserGroup', primaryjoin='UserGroupUserGroupToPerm.user_group_id==UserGroup.users_group_id')
2615 permission = relationship('Permission')
2616
2617 @classmethod
2618 def create(cls, target_user_group, user_group, permission):
2619 n = cls()
2620 n.target_user_group = target_user_group
2621 n.user_group = user_group
2622 n.permission = permission
2623 Session().add(n)
2624 return n
2625
2626 def __unicode__(self):
2627 return u'<UserGroupUserGroup:%s => %s >' % (self.target_user_group, self.user_group)
2628
2629
2630 class UserGroupToPerm(Base, BaseModel):
2631 __tablename__ = 'users_group_to_perm'
2632 __table_args__ = (
2633 UniqueConstraint('users_group_id', 'permission_id',),
2634 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2635 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2636 )
2637 users_group_to_perm_id = Column("users_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2638 users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2639 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2640
2641 users_group = relationship('UserGroup')
2642 permission = relationship('Permission')
2643
2644
2645 class UserRepoGroupToPerm(Base, BaseModel):
2646 __tablename__ = 'user_repo_group_to_perm'
2647 __table_args__ = (
2648 UniqueConstraint('user_id', 'group_id', 'permission_id'),
2649 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2650 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2651 )
2652
2653 group_to_perm_id = Column("group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2654 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2655 group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=False, unique=None, default=None)
2656 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2657
2658 user = relationship('User')
2659 group = relationship('RepoGroup')
2660 permission = relationship('Permission')
2661
2662 @classmethod
2663 def create(cls, user, repository_group, permission):
2664 n = cls()
2665 n.user = user
2666 n.group = repository_group
2667 n.permission = permission
2668 Session().add(n)
2669 return n
2670
2671
2672 class UserGroupRepoGroupToPerm(Base, BaseModel):
2673 __tablename__ = 'users_group_repo_group_to_perm'
2674 __table_args__ = (
2675 UniqueConstraint('users_group_id', 'group_id'),
2676 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2677 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2678 )
2679
2680 users_group_repo_group_to_perm_id = Column("users_group_repo_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2681 users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2682 group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=False, unique=None, default=None)
2683 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2684
2685 users_group = relationship('UserGroup')
2686 permission = relationship('Permission')
2687 group = relationship('RepoGroup')
2688
2689 @classmethod
2690 def create(cls, user_group, repository_group, permission):
2691 n = cls()
2692 n.users_group = user_group
2693 n.group = repository_group
2694 n.permission = permission
2695 Session().add(n)
2696 return n
2697
2698 def __unicode__(self):
2699 return u'<UserGroupRepoGroupToPerm:%s => %s >' % (self.users_group, self.group)
2700
2701
2702 class Statistics(Base, BaseModel):
2703 __tablename__ = 'statistics'
2704 __table_args__ = (
2705 UniqueConstraint('repository_id'),
2706 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2707 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2708 )
2709 stat_id = Column("stat_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2710 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=True, default=None)
2711 stat_on_revision = Column("stat_on_revision", Integer(), nullable=False)
2712 commit_activity = Column("commit_activity", LargeBinary(1000000), nullable=False)#JSON data
2713 commit_activity_combined = Column("commit_activity_combined", LargeBinary(), nullable=False)#JSON data
2714 languages = Column("languages", LargeBinary(1000000), nullable=False)#JSON data
2715
2716 repository = relationship('Repository', single_parent=True)
2717
2718
2719 class UserFollowing(Base, BaseModel):
2720 __tablename__ = 'user_followings'
2721 __table_args__ = (
2722 UniqueConstraint('user_id', 'follows_repository_id'),
2723 UniqueConstraint('user_id', 'follows_user_id'),
2724 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2725 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2726 )
2727
2728 user_following_id = Column("user_following_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2729 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2730 follows_repo_id = Column("follows_repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=None, default=None)
2731 follows_user_id = Column("follows_user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
2732 follows_from = Column('follows_from', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now)
2733
2734 user = relationship('User', primaryjoin='User.user_id==UserFollowing.user_id')
2735
2736 follows_user = relationship('User', primaryjoin='User.user_id==UserFollowing.follows_user_id')
2737 follows_repository = relationship('Repository', order_by='Repository.repo_name')
2738
2739 @classmethod
2740 def get_repo_followers(cls, repo_id):
2741 return cls.query().filter(cls.follows_repo_id == repo_id)
2742
2743
2744 class CacheKey(Base, BaseModel):
2745 __tablename__ = 'cache_invalidation'
2746 __table_args__ = (
2747 UniqueConstraint('cache_key'),
2748 Index('key_idx', 'cache_key'),
2749 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2750 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2751 )
2752 CACHE_TYPE_ATOM = 'ATOM'
2753 CACHE_TYPE_RSS = 'RSS'
2754 CACHE_TYPE_README = 'README'
2755
2756 cache_id = Column("cache_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2757 cache_key = Column("cache_key", String(255), nullable=True, unique=None, default=None)
2758 cache_args = Column("cache_args", String(255), nullable=True, unique=None, default=None)
2759 cache_active = Column("cache_active", Boolean(), nullable=True, unique=None, default=False)
2760
2761 def __init__(self, cache_key, cache_args=''):
2762 self.cache_key = cache_key
2763 self.cache_args = cache_args
2764 self.cache_active = False
2765
2766 def __unicode__(self):
2767 return u"<%s('%s:%s[%s]')>" % (
2768 self.__class__.__name__,
2769 self.cache_id, self.cache_key, self.cache_active)
2770
2771 def _cache_key_partition(self):
2772 prefix, repo_name, suffix = self.cache_key.partition(self.cache_args)
2773 return prefix, repo_name, suffix
2774
2775 def get_prefix(self):
2776 """
2777 Try to extract prefix from existing cache key. The key could consist
2778 of prefix, repo_name, suffix
2779 """
2780 # this returns prefix, repo_name, suffix
2781 return self._cache_key_partition()[0]
2782
2783 def get_suffix(self):
2784 """
2785 get suffix that might have been used in _get_cache_key to
2786 generate self.cache_key. Only used for informational purposes
2787 in repo_edit.html.
2788 """
2789 # prefix, repo_name, suffix
2790 return self._cache_key_partition()[2]
2791
2792 @classmethod
2793 def delete_all_cache(cls):
2794 """
2795 Delete all cache keys from database.
2796 Should only be run when all instances are down and all entries
2797 thus stale.
2798 """
2799 cls.query().delete()
2800 Session().commit()
2801
2802 @classmethod
2803 def get_cache_key(cls, repo_name, cache_type):
2804 """
2805
2806 Generate a cache key for this process of RhodeCode instance.
2807 Prefix most likely will be process id or maybe explicitly set
2808 instance_id from .ini file.
2809 """
2810 import rhodecode
2811 prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
2812
2813 repo_as_unicode = safe_unicode(repo_name)
2814 key = u'{}_{}'.format(repo_as_unicode, cache_type) \
2815 if cache_type else repo_as_unicode
2816
2817 return u'{}{}'.format(prefix, key)
2818
2819 @classmethod
2820 def set_invalidate(cls, repo_name, delete=False):
2821 """
2822 Mark all caches of a repo as invalid in the database.
2823 """
2824
2825 try:
2826 qry = Session().query(cls).filter(cls.cache_args == repo_name)
2827 if delete:
2828 log.debug('cache objects deleted for repo %s',
2829 safe_str(repo_name))
2830 qry.delete()
2831 else:
2832 log.debug('cache objects marked as invalid for repo %s',
2833 safe_str(repo_name))
2834 qry.update({"cache_active": False})
2835
2836 Session().commit()
2837 except Exception:
2838 log.exception(
2839 'Cache key invalidation failed for repository %s',
2840 safe_str(repo_name))
2841 Session().rollback()
2842
2843 @classmethod
2844 def get_active_cache(cls, cache_key):
2845 inv_obj = cls.query().filter(cls.cache_key == cache_key).scalar()
2846 if inv_obj:
2847 return inv_obj
2848 return None
2849
2850 @classmethod
2851 def repo_context_cache(cls, compute_func, repo_name, cache_type,
2852 thread_scoped=False):
2853 """
2854 @cache_region('long_term')
2855 def _heavy_calculation(cache_key):
2856 return 'result'
2857
2858 cache_context = CacheKey.repo_context_cache(
2859 _heavy_calculation, repo_name, cache_type)
2860
2861 with cache_context as context:
2862 context.invalidate()
2863 computed = context.compute()
2864
2865 assert computed == 'result'
2866 """
2867 from rhodecode.lib import caches
2868 return caches.InvalidationContext(
2869 compute_func, repo_name, cache_type, thread_scoped=thread_scoped)
2870
2871
2872 class ChangesetComment(Base, BaseModel):
2873 __tablename__ = 'changeset_comments'
2874 __table_args__ = (
2875 Index('cc_revision_idx', 'revision'),
2876 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2877 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2878 )
2879
2880 COMMENT_OUTDATED = u'comment_outdated'
2881
2882 comment_id = Column('comment_id', Integer(), nullable=False, primary_key=True)
2883 repo_id = Column('repo_id', Integer(), ForeignKey('repositories.repo_id'), nullable=False)
2884 revision = Column('revision', String(40), nullable=True)
2885 pull_request_id = Column("pull_request_id", Integer(), ForeignKey('pull_requests.pull_request_id'), nullable=True)
2886 pull_request_version_id = Column("pull_request_version_id", Integer(), ForeignKey('pull_request_versions.pull_request_version_id'), nullable=True)
2887 line_no = Column('line_no', Unicode(10), nullable=True)
2888 hl_lines = Column('hl_lines', Unicode(512), nullable=True)
2889 f_path = Column('f_path', Unicode(1000), nullable=True)
2890 user_id = Column('user_id', Integer(), ForeignKey('users.user_id'), nullable=False)
2891 text = Column('text', UnicodeText().with_variant(UnicodeText(25000), 'mysql'), nullable=False)
2892 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
2893 modified_at = Column('modified_at', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
2894 renderer = Column('renderer', Unicode(64), nullable=True)
2895 display_state = Column('display_state', Unicode(128), nullable=True)
2896
2897 author = relationship('User', lazy='joined')
2898 repo = relationship('Repository')
2899 status_change = relationship('ChangesetStatus', cascade="all, delete, delete-orphan")
2900 pull_request = relationship('PullRequest', lazy='joined')
2901 pull_request_version = relationship('PullRequestVersion')
2902
2903 @classmethod
2904 def get_users(cls, revision=None, pull_request_id=None):
2905 """
2906 Returns user associated with this ChangesetComment. ie those
2907 who actually commented
2908
2909 :param cls:
2910 :param revision:
2911 """
2912 q = Session().query(User)\
2913 .join(ChangesetComment.author)
2914 if revision:
2915 q = q.filter(cls.revision == revision)
2916 elif pull_request_id:
2917 q = q.filter(cls.pull_request_id == pull_request_id)
2918 return q.all()
2919
2920 def render(self, mentions=False):
2921 from rhodecode.lib import helpers as h
2922 return h.render(self.text, renderer=self.renderer, mentions=mentions)
2923
2924 def __repr__(self):
2925 if self.comment_id:
2926 return '<DB:ChangesetComment #%s>' % self.comment_id
2927 else:
2928 return '<DB:ChangesetComment at %#x>' % id(self)
2929
2930
2931 class ChangesetStatus(Base, BaseModel):
2932 __tablename__ = 'changeset_statuses'
2933 __table_args__ = (
2934 Index('cs_revision_idx', 'revision'),
2935 Index('cs_version_idx', 'version'),
2936 UniqueConstraint('repo_id', 'revision', 'version'),
2937 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2938 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2939 )
2940 STATUS_NOT_REVIEWED = DEFAULT = 'not_reviewed'
2941 STATUS_APPROVED = 'approved'
2942 STATUS_REJECTED = 'rejected'
2943 STATUS_UNDER_REVIEW = 'under_review'
2944
2945 STATUSES = [
2946 (STATUS_NOT_REVIEWED, _("Not Reviewed")), # (no icon) and default
2947 (STATUS_APPROVED, _("Approved")),
2948 (STATUS_REJECTED, _("Rejected")),
2949 (STATUS_UNDER_REVIEW, _("Under Review")),
2950 ]
2951
2952 changeset_status_id = Column('changeset_status_id', Integer(), nullable=False, primary_key=True)
2953 repo_id = Column('repo_id', Integer(), ForeignKey('repositories.repo_id'), nullable=False)
2954 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None)
2955 revision = Column('revision', String(40), nullable=False)
2956 status = Column('status', String(128), nullable=False, default=DEFAULT)
2957 changeset_comment_id = Column('changeset_comment_id', Integer(), ForeignKey('changeset_comments.comment_id'))
2958 modified_at = Column('modified_at', DateTime(), nullable=False, default=datetime.datetime.now)
2959 version = Column('version', Integer(), nullable=False, default=0)
2960 pull_request_id = Column("pull_request_id", Integer(), ForeignKey('pull_requests.pull_request_id'), nullable=True)
2961
2962 author = relationship('User', lazy='joined')
2963 repo = relationship('Repository')
2964 comment = relationship('ChangesetComment', lazy='joined')
2965 pull_request = relationship('PullRequest', lazy='joined')
2966
2967 def __unicode__(self):
2968 return u"<%s('%s[%s]:%s')>" % (
2969 self.__class__.__name__,
2970 self.status, self.version, self.author
2971 )
2972
2973 @classmethod
2974 def get_status_lbl(cls, value):
2975 return dict(cls.STATUSES).get(value)
2976
2977 @property
2978 def status_lbl(self):
2979 return ChangesetStatus.get_status_lbl(self.status)
2980
2981
2982 class _PullRequestBase(BaseModel):
2983 """
2984 Common attributes of pull request and version entries.
2985 """
2986
2987 # .status values
2988 STATUS_NEW = u'new'
2989 STATUS_OPEN = u'open'
2990 STATUS_CLOSED = u'closed'
2991
2992 title = Column('title', Unicode(255), nullable=True)
2993 description = Column(
2994 'description', UnicodeText().with_variant(UnicodeText(10240), 'mysql'),
2995 nullable=True)
2996 # new/open/closed status of pull request (not approve/reject/etc)
2997 status = Column('status', Unicode(255), nullable=False, default=STATUS_NEW)
2998 created_on = Column(
2999 'created_on', DateTime(timezone=False), nullable=False,
3000 default=datetime.datetime.now)
3001 updated_on = Column(
3002 'updated_on', DateTime(timezone=False), nullable=False,
3003 default=datetime.datetime.now)
3004
3005 @declared_attr
3006 def user_id(cls):
3007 return Column(
3008 "user_id", Integer(), ForeignKey('users.user_id'), nullable=False,
3009 unique=None)
3010
3011 # 500 revisions max
3012 _revisions = Column(
3013 'revisions', UnicodeText().with_variant(UnicodeText(20500), 'mysql'))
3014
3015 @declared_attr
3016 def source_repo_id(cls):
3017 # TODO: dan: rename column to source_repo_id
3018 return Column(
3019 'org_repo_id', Integer(), ForeignKey('repositories.repo_id'),
3020 nullable=False)
3021
3022 source_ref = Column('org_ref', Unicode(255), nullable=False)
3023
3024 @declared_attr
3025 def target_repo_id(cls):
3026 # TODO: dan: rename column to target_repo_id
3027 return Column(
3028 'other_repo_id', Integer(), ForeignKey('repositories.repo_id'),
3029 nullable=False)
3030
3031 target_ref = Column('other_ref', Unicode(255), nullable=False)
3032
3033 # TODO: dan: rename column to last_merge_source_rev
3034 _last_merge_source_rev = Column(
3035 'last_merge_org_rev', String(40), nullable=True)
3036 # TODO: dan: rename column to last_merge_target_rev
3037 _last_merge_target_rev = Column(
3038 'last_merge_other_rev', String(40), nullable=True)
3039 _last_merge_status = Column('merge_status', Integer(), nullable=True)
3040 merge_rev = Column('merge_rev', String(40), nullable=True)
3041
3042 @hybrid_property
3043 def revisions(self):
3044 return self._revisions.split(':') if self._revisions else []
3045
3046 @revisions.setter
3047 def revisions(self, val):
3048 self._revisions = ':'.join(val)
3049
3050 @declared_attr
3051 def author(cls):
3052 return relationship('User', lazy='joined')
3053
3054 @declared_attr
3055 def source_repo(cls):
3056 return relationship(
3057 'Repository',
3058 primaryjoin='%s.source_repo_id==Repository.repo_id' % cls.__name__)
3059
3060 @property
3061 def source_ref_parts(self):
3062 refs = self.source_ref.split(':')
3063 return Reference(refs[0], refs[1], refs[2])
3064
3065 @declared_attr
3066 def target_repo(cls):
3067 return relationship(
3068 'Repository',
3069 primaryjoin='%s.target_repo_id==Repository.repo_id' % cls.__name__)
3070
3071 @property
3072 def target_ref_parts(self):
3073 refs = self.target_ref.split(':')
3074 return Reference(refs[0], refs[1], refs[2])
3075
3076
3077 class PullRequest(Base, _PullRequestBase):
3078 __tablename__ = 'pull_requests'
3079 __table_args__ = (
3080 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3081 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3082 )
3083
3084 pull_request_id = Column(
3085 'pull_request_id', Integer(), nullable=False, primary_key=True)
3086
3087 def __repr__(self):
3088 if self.pull_request_id:
3089 return '<DB:PullRequest #%s>' % self.pull_request_id
3090 else:
3091 return '<DB:PullRequest at %#x>' % id(self)
3092
3093 reviewers = relationship('PullRequestReviewers',
3094 cascade="all, delete, delete-orphan")
3095 statuses = relationship('ChangesetStatus')
3096 comments = relationship('ChangesetComment',
3097 cascade="all, delete, delete-orphan")
3098 versions = relationship('PullRequestVersion',
3099 cascade="all, delete, delete-orphan")
3100
3101 def is_closed(self):
3102 return self.status == self.STATUS_CLOSED
3103
3104 def get_api_data(self):
3105 from rhodecode.model.pull_request import PullRequestModel
3106 pull_request = self
3107 merge_status = PullRequestModel().merge_status(pull_request)
3108 data = {
3109 'pull_request_id': pull_request.pull_request_id,
3110 'url': url('pullrequest_show', repo_name=self.target_repo.repo_name,
3111 pull_request_id=self.pull_request_id,
3112 qualified=True),
3113 'title': pull_request.title,
3114 'description': pull_request.description,
3115 'status': pull_request.status,
3116 'created_on': pull_request.created_on,
3117 'updated_on': pull_request.updated_on,
3118 'commit_ids': pull_request.revisions,
3119 'review_status': pull_request.calculated_review_status(),
3120 'mergeable': {
3121 'status': merge_status[0],
3122 'message': unicode(merge_status[1]),
3123 },
3124 'source': {
3125 'clone_url': pull_request.source_repo.clone_url(),
3126 'repository': pull_request.source_repo.repo_name,
3127 'reference': {
3128 'name': pull_request.source_ref_parts.name,
3129 'type': pull_request.source_ref_parts.type,
3130 'commit_id': pull_request.source_ref_parts.commit_id,
3131 },
3132 },
3133 'target': {
3134 'clone_url': pull_request.target_repo.clone_url(),
3135 'repository': pull_request.target_repo.repo_name,
3136 'reference': {
3137 'name': pull_request.target_ref_parts.name,
3138 'type': pull_request.target_ref_parts.type,
3139 'commit_id': pull_request.target_ref_parts.commit_id,
3140 },
3141 },
3142 'author': pull_request.author.get_api_data(include_secrets=False,
3143 details='basic'),
3144 'reviewers': [
3145 {
3146 'user': reviewer.get_api_data(include_secrets=False,
3147 details='basic'),
3148 'review_status': st[0][1].status if st else 'not_reviewed',
3149 }
3150 for reviewer, st in pull_request.reviewers_statuses()
3151 ]
3152 }
3153
3154 return data
3155
3156 def __json__(self):
3157 return {
3158 'revisions': self.revisions,
3159 }
3160
3161 def calculated_review_status(self):
3162 # TODO: anderson: 13.05.15 Used only on templates/my_account_pullrequests.html
3163 # because it's tricky on how to use ChangesetStatusModel from there
3164 warnings.warn("Use calculated_review_status from ChangesetStatusModel", DeprecationWarning)
3165 from rhodecode.model.changeset_status import ChangesetStatusModel
3166 return ChangesetStatusModel().calculated_review_status(self)
3167
3168 def reviewers_statuses(self):
3169 warnings.warn("Use reviewers_statuses from ChangesetStatusModel", DeprecationWarning)
3170 from rhodecode.model.changeset_status import ChangesetStatusModel
3171 return ChangesetStatusModel().reviewers_statuses(self)
3172
3173
3174 class PullRequestVersion(Base, _PullRequestBase):
3175 __tablename__ = 'pull_request_versions'
3176 __table_args__ = (
3177 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3178 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3179 )
3180
3181 pull_request_version_id = Column(
3182 'pull_request_version_id', Integer(), nullable=False, primary_key=True)
3183 pull_request_id = Column(
3184 'pull_request_id', Integer(),
3185 ForeignKey('pull_requests.pull_request_id'), nullable=False)
3186 pull_request = relationship('PullRequest')
3187
3188 def __repr__(self):
3189 if self.pull_request_version_id:
3190 return '<DB:PullRequestVersion #%s>' % self.pull_request_version_id
3191 else:
3192 return '<DB:PullRequestVersion at %#x>' % id(self)
3193
3194
3195 class PullRequestReviewers(Base, BaseModel):
3196 __tablename__ = 'pull_request_reviewers'
3197 __table_args__ = (
3198 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3199 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3200 )
3201
3202 def __init__(self, user=None, pull_request=None):
3203 self.user = user
3204 self.pull_request = pull_request
3205
3206 pull_requests_reviewers_id = Column(
3207 'pull_requests_reviewers_id', Integer(), nullable=False,
3208 primary_key=True)
3209 pull_request_id = Column(
3210 "pull_request_id", Integer(),
3211 ForeignKey('pull_requests.pull_request_id'), nullable=False)
3212 user_id = Column(
3213 "user_id", Integer(), ForeignKey('users.user_id'), nullable=True)
3214
3215 user = relationship('User')
3216 pull_request = relationship('PullRequest')
3217
3218
3219 class Notification(Base, BaseModel):
3220 __tablename__ = 'notifications'
3221 __table_args__ = (
3222 Index('notification_type_idx', 'type'),
3223 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3224 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3225 )
3226
3227 TYPE_CHANGESET_COMMENT = u'cs_comment'
3228 TYPE_MESSAGE = u'message'
3229 TYPE_MENTION = u'mention'
3230 TYPE_REGISTRATION = u'registration'
3231 TYPE_PULL_REQUEST = u'pull_request'
3232 TYPE_PULL_REQUEST_COMMENT = u'pull_request_comment'
3233
3234 notification_id = Column('notification_id', Integer(), nullable=False, primary_key=True)
3235 subject = Column('subject', Unicode(512), nullable=True)
3236 body = Column('body', UnicodeText().with_variant(UnicodeText(50000), 'mysql'), nullable=True)
3237 created_by = Column("created_by", Integer(), ForeignKey('users.user_id'), nullable=True)
3238 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
3239 type_ = Column('type', Unicode(255))
3240
3241 created_by_user = relationship('User')
3242 notifications_to_users = relationship('UserNotification', lazy='joined',
3243 cascade="all, delete, delete-orphan")
3244
3245 @property
3246 def recipients(self):
3247 return [x.user for x in UserNotification.query()\
3248 .filter(UserNotification.notification == self)\
3249 .order_by(UserNotification.user_id.asc()).all()]
3250
3251 @classmethod
3252 def create(cls, created_by, subject, body, recipients, type_=None):
3253 if type_ is None:
3254 type_ = Notification.TYPE_MESSAGE
3255
3256 notification = cls()
3257 notification.created_by_user = created_by
3258 notification.subject = subject
3259 notification.body = body
3260 notification.type_ = type_
3261 notification.created_on = datetime.datetime.now()
3262
3263 for u in recipients:
3264 assoc = UserNotification()
3265 assoc.notification = notification
3266
3267 # if created_by is inside recipients mark his notification
3268 # as read
3269 if u.user_id == created_by.user_id:
3270 assoc.read = True
3271
3272 u.notifications.append(assoc)
3273 Session().add(notification)
3274
3275 return notification
3276
3277 @property
3278 def description(self):
3279 from rhodecode.model.notification import NotificationModel
3280 return NotificationModel().make_description(self)
3281
3282
3283 class UserNotification(Base, BaseModel):
3284 __tablename__ = 'user_to_notification'
3285 __table_args__ = (
3286 UniqueConstraint('user_id', 'notification_id'),
3287 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3288 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
3289 )
3290 user_id = Column('user_id', Integer(), ForeignKey('users.user_id'), primary_key=True)
3291 notification_id = Column("notification_id", Integer(), ForeignKey('notifications.notification_id'), primary_key=True)
3292 read = Column('read', Boolean, default=False)
3293 sent_on = Column('sent_on', DateTime(timezone=False), nullable=True, unique=None)
3294
3295 user = relationship('User', lazy="joined")
3296 notification = relationship('Notification', lazy="joined",
3297 order_by=lambda: Notification.created_on.desc(),)
3298
3299 def mark_as_read(self):
3300 self.read = True
3301 Session().add(self)
3302
3303
3304 class Gist(Base, BaseModel):
3305 __tablename__ = 'gists'
3306 __table_args__ = (
3307 Index('g_gist_access_id_idx', 'gist_access_id'),
3308 Index('g_created_on_idx', 'created_on'),
3309 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3310 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
3311 )
3312 GIST_PUBLIC = u'public'
3313 GIST_PRIVATE = u'private'
3314 DEFAULT_FILENAME = u'gistfile1.txt'
3315
3316 ACL_LEVEL_PUBLIC = u'acl_public'
3317 ACL_LEVEL_PRIVATE = u'acl_private'
3318
3319 gist_id = Column('gist_id', Integer(), primary_key=True)
3320 gist_access_id = Column('gist_access_id', Unicode(250))
3321 gist_description = Column('gist_description', UnicodeText().with_variant(UnicodeText(1024), 'mysql'))
3322 gist_owner = Column('user_id', Integer(), ForeignKey('users.user_id'), nullable=True)
3323 gist_expires = Column('gist_expires', Float(53), nullable=False)
3324 gist_type = Column('gist_type', Unicode(128), nullable=False)
3325 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
3326 modified_at = Column('modified_at', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
3327 acl_level = Column('acl_level', Unicode(128), nullable=True)
3328
3329 owner = relationship('User')
3330
3331 def __repr__(self):
3332 return '<Gist:[%s]%s>' % (self.gist_type, self.gist_access_id)
3333
3334 @classmethod
3335 def get_or_404(cls, id_):
3336 res = cls.query().filter(cls.gist_access_id == id_).scalar()
3337 if not res:
3338 raise HTTPNotFound
3339 return res
3340
3341 @classmethod
3342 def get_by_access_id(cls, gist_access_id):
3343 return cls.query().filter(cls.gist_access_id == gist_access_id).scalar()
3344
3345 def gist_url(self):
3346 import rhodecode
3347 alias_url = rhodecode.CONFIG.get('gist_alias_url')
3348 if alias_url:
3349 return alias_url.replace('{gistid}', self.gist_access_id)
3350
3351 return url('gist', gist_id=self.gist_access_id, qualified=True)
3352
3353 @classmethod
3354 def base_path(cls):
3355 """
3356 Returns base path when all gists are stored
3357
3358 :param cls:
3359 """
3360 from rhodecode.model.gist import GIST_STORE_LOC
3361 q = Session().query(RhodeCodeUi)\
3362 .filter(RhodeCodeUi.ui_key == URL_SEP)
3363 q = q.options(FromCache("sql_cache_short", "repository_repo_path"))
3364 return os.path.join(q.one().ui_value, GIST_STORE_LOC)
3365
3366 def get_api_data(self):
3367 """
3368 Common function for generating gist related data for API
3369 """
3370 gist = self
3371 data = {
3372 'gist_id': gist.gist_id,
3373 'type': gist.gist_type,
3374 'access_id': gist.gist_access_id,
3375 'description': gist.gist_description,
3376 'url': gist.gist_url(),
3377 'expires': gist.gist_expires,
3378 'created_on': gist.created_on,
3379 'modified_at': gist.modified_at,
3380 'content': None,
3381 'acl_level': gist.acl_level,
3382 }
3383 return data
3384
3385 def __json__(self):
3386 data = dict(
3387 )
3388 data.update(self.get_api_data())
3389 return data
3390 # SCM functions
3391
3392 def scm_instance(self, **kwargs):
3393 full_repo_path = os.path.join(self.base_path(), self.gist_access_id)
3394 return get_vcs_instance(
3395 repo_path=safe_str(full_repo_path), create=False)
3396
3397
3398 class DbMigrateVersion(Base, BaseModel):
3399 __tablename__ = 'db_migrate_version'
3400 __table_args__ = (
3401 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3402 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3403 )
3404 repository_id = Column('repository_id', String(250), primary_key=True)
3405 repository_path = Column('repository_path', Text)
3406 version = Column('version', Integer)
3407
3408
3409 class ExternalIdentity(Base, BaseModel):
3410 __tablename__ = 'external_identities'
3411 __table_args__ = (
3412 Index('local_user_id_idx', 'local_user_id'),
3413 Index('external_id_idx', 'external_id'),
3414 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3415 'mysql_charset': 'utf8'})
3416
3417 external_id = Column('external_id', Unicode(255), default=u'',
3418 primary_key=True)
3419 external_username = Column('external_username', Unicode(1024), default=u'')
3420 local_user_id = Column('local_user_id', Integer(),
3421 ForeignKey('users.user_id'), primary_key=True)
3422 provider_name = Column('provider_name', Unicode(255), default=u'',
3423 primary_key=True)
3424 access_token = Column('access_token', String(1024), default=u'')
3425 alt_token = Column('alt_token', String(1024), default=u'')
3426 token_secret = Column('token_secret', String(1024), default=u'')
3427
3428 @classmethod
3429 def by_external_id_and_provider(cls, external_id, provider_name,
3430 local_user_id=None):
3431 """
3432 Returns ExternalIdentity instance based on search params
3433
3434 :param external_id:
3435 :param provider_name:
3436 :return: ExternalIdentity
3437 """
3438 query = cls.query()
3439 query = query.filter(cls.external_id == external_id)
3440 query = query.filter(cls.provider_name == provider_name)
3441 if local_user_id:
3442 query = query.filter(cls.local_user_id == local_user_id)
3443 return query.first()
3444
3445 @classmethod
3446 def user_by_external_id_and_provider(cls, external_id, provider_name):
3447 """
3448 Returns User instance based on search params
3449
3450 :param external_id:
3451 :param provider_name:
3452 :return: User
3453 """
3454 query = User.query()
3455 query = query.filter(cls.external_id == external_id)
3456 query = query.filter(cls.provider_name == provider_name)
3457 query = query.filter(User.user_id == cls.local_user_id)
3458 return query.first()
3459
3460 @classmethod
3461 def by_local_user_id(cls, local_user_id):
3462 """
3463 Returns all tokens for user
3464
3465 :param local_user_id:
3466 :return: ExternalIdentity
3467 """
3468 query = cls.query()
3469 query = query.filter(cls.local_user_id == local_user_id)
3470 return query
3471
3472
3473 class Integration(Base, BaseModel):
3474 __tablename__ = 'integrations'
3475 __table_args__ = (
3476 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3477 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
3478 )
3479
3480 integration_id = Column('integration_id', Integer(), primary_key=True)
3481 integration_type = Column('integration_type', String(255))
3482 enabled = Column('enabled', Boolean(), nullable=False)
3483 name = Column('name', String(255), nullable=False)
3484 settings = Column(
3485 'settings_json', MutationObj.as_mutable(
3486 JsonType(dialect_map=dict(mysql=UnicodeText(16384)))))
3487 repo_id = Column(
3488 'repo_id', Integer(), ForeignKey('repositories.repo_id'),
3489 nullable=True, unique=None, default=None)
3490 repo = relationship('Repository', lazy='joined')
3491
3492 repo_group_id = Column(
3493 'repo_group_id', Integer(), ForeignKey('groups.group_id'),
3494 nullable=True, unique=None, default=None)
3495 repo_group = relationship('RepoGroup', lazy='joined')
3496
3497 def __repr__(self):
3498 if self.repo:
3499 scope = 'repo=%r' % self.repo
3500 elif self.repo_group:
3501 scope = 'repo_group=%r' % self.repo_group
3502 else:
3503 scope = 'global'
3504
3505 return '<Integration(%r, %r)>' % (self.integration_type, scope)
This diff has been collapsed as it changes many lines, (3529 lines changed) Show them Hide them
@@ -0,0 +1,3529 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 """
22 Database Models for RhodeCode Enterprise
23 """
24
25 import os
26 import sys
27 import time
28 import hashlib
29 import logging
30 import datetime
31 import warnings
32 import ipaddress
33 import functools
34 import traceback
35 import collections
36
37
38 from sqlalchemy import *
39 from sqlalchemy.exc import IntegrityError
40 from sqlalchemy.ext.declarative import declared_attr
41 from sqlalchemy.ext.hybrid import hybrid_property
42 from sqlalchemy.orm import (
43 relationship, joinedload, class_mapper, validates, aliased)
44 from sqlalchemy.sql.expression import true
45 from beaker.cache import cache_region, region_invalidate
46 from webob.exc import HTTPNotFound
47 from zope.cachedescriptors.property import Lazy as LazyProperty
48
49 from pylons import url
50 from pylons.i18n.translation import lazy_ugettext as _
51
52 from rhodecode.lib.vcs import get_backend, get_vcs_instance
53 from rhodecode.lib.vcs.utils.helpers import get_scm
54 from rhodecode.lib.vcs.exceptions import VCSError
55 from rhodecode.lib.vcs.backends.base import (
56 EmptyCommit, Reference, MergeFailureReason)
57 from rhodecode.lib.utils2 import (
58 str2bool, safe_str, get_commit_safe, safe_unicode, remove_prefix, md5_safe,
59 time_to_datetime, aslist, Optional, safe_int, get_clone_url, AttributeDict)
60 from rhodecode.lib.jsonalchemy import MutationObj, JsonType, JSONDict
61 from rhodecode.lib.ext_json import json
62 from rhodecode.lib.caching_query import FromCache
63 from rhodecode.lib.encrypt import AESCipher
64
65 from rhodecode.model.meta import Base, Session
66
67 URL_SEP = '/'
68 log = logging.getLogger(__name__)
69
70 # =============================================================================
71 # BASE CLASSES
72 # =============================================================================
73
74 # this is propagated from .ini file rhodecode.encrypted_values.secret or
75 # beaker.session.secret if first is not set.
76 # and initialized at environment.py
77 ENCRYPTION_KEY = None
78
79 # used to sort permissions by types, '#' used here is not allowed to be in
80 # usernames, and it's very early in sorted string.printable table.
81 PERMISSION_TYPE_SORT = {
82 'admin': '####',
83 'write': '###',
84 'read': '##',
85 'none': '#',
86 }
87
88
89 def display_sort(obj):
90 """
91 Sort function used to sort permissions in .permissions() function of
92 Repository, RepoGroup, UserGroup. Also it put the default user in front
93 of all other resources
94 """
95
96 if obj.username == User.DEFAULT_USER:
97 return '#####'
98 prefix = PERMISSION_TYPE_SORT.get(obj.permission.split('.')[-1], '')
99 return prefix + obj.username
100
101
102 def _hash_key(k):
103 return md5_safe(k)
104
105
106 class EncryptedTextValue(TypeDecorator):
107 """
108 Special column for encrypted long text data, use like::
109
110 value = Column("encrypted_value", EncryptedValue(), nullable=False)
111
112 This column is intelligent so if value is in unencrypted form it return
113 unencrypted form, but on save it always encrypts
114 """
115 impl = Text
116
117 def process_bind_param(self, value, dialect):
118 if not value:
119 return value
120 if value.startswith('enc$aes$') or value.startswith('enc$aes_hmac$'):
121 # protect against double encrypting if someone manually starts
122 # doing
123 raise ValueError('value needs to be in unencrypted format, ie. '
124 'not starting with enc$aes')
125 return 'enc$aes_hmac$%s' % AESCipher(
126 ENCRYPTION_KEY, hmac=True).encrypt(value)
127
128 def process_result_value(self, value, dialect):
129 import rhodecode
130
131 if not value:
132 return value
133
134 parts = value.split('$', 3)
135 if not len(parts) == 3:
136 # probably not encrypted values
137 return value
138 else:
139 if parts[0] != 'enc':
140 # parts ok but without our header ?
141 return value
142 enc_strict_mode = str2bool(rhodecode.CONFIG.get(
143 'rhodecode.encrypted_values.strict') or True)
144 # at that stage we know it's our encryption
145 if parts[1] == 'aes':
146 decrypted_data = AESCipher(ENCRYPTION_KEY).decrypt(parts[2])
147 elif parts[1] == 'aes_hmac':
148 decrypted_data = AESCipher(
149 ENCRYPTION_KEY, hmac=True,
150 strict_verification=enc_strict_mode).decrypt(parts[2])
151 else:
152 raise ValueError(
153 'Encryption type part is wrong, must be `aes` '
154 'or `aes_hmac`, got `%s` instead' % (parts[1]))
155 return decrypted_data
156
157
158 class BaseModel(object):
159 """
160 Base Model for all classes
161 """
162
163 @classmethod
164 def _get_keys(cls):
165 """return column names for this model """
166 return class_mapper(cls).c.keys()
167
168 def get_dict(self):
169 """
170 return dict with keys and values corresponding
171 to this model data """
172
173 d = {}
174 for k in self._get_keys():
175 d[k] = getattr(self, k)
176
177 # also use __json__() if present to get additional fields
178 _json_attr = getattr(self, '__json__', None)
179 if _json_attr:
180 # update with attributes from __json__
181 if callable(_json_attr):
182 _json_attr = _json_attr()
183 for k, val in _json_attr.iteritems():
184 d[k] = val
185 return d
186
187 def get_appstruct(self):
188 """return list with keys and values tuples corresponding
189 to this model data """
190
191 l = []
192 for k in self._get_keys():
193 l.append((k, getattr(self, k),))
194 return l
195
196 def populate_obj(self, populate_dict):
197 """populate model with data from given populate_dict"""
198
199 for k in self._get_keys():
200 if k in populate_dict:
201 setattr(self, k, populate_dict[k])
202
203 @classmethod
204 def query(cls):
205 return Session().query(cls)
206
207 @classmethod
208 def get(cls, id_):
209 if id_:
210 return cls.query().get(id_)
211
212 @classmethod
213 def get_or_404(cls, id_):
214 try:
215 id_ = int(id_)
216 except (TypeError, ValueError):
217 raise HTTPNotFound
218
219 res = cls.query().get(id_)
220 if not res:
221 raise HTTPNotFound
222 return res
223
224 @classmethod
225 def getAll(cls):
226 # deprecated and left for backward compatibility
227 return cls.get_all()
228
229 @classmethod
230 def get_all(cls):
231 return cls.query().all()
232
233 @classmethod
234 def delete(cls, id_):
235 obj = cls.query().get(id_)
236 Session().delete(obj)
237
238 @classmethod
239 def identity_cache(cls, session, attr_name, value):
240 exist_in_session = []
241 for (item_cls, pkey), instance in session.identity_map.items():
242 if cls == item_cls and getattr(instance, attr_name) == value:
243 exist_in_session.append(instance)
244 if exist_in_session:
245 if len(exist_in_session) == 1:
246 return exist_in_session[0]
247 log.exception(
248 'multiple objects with attr %s and '
249 'value %s found with same name: %r',
250 attr_name, value, exist_in_session)
251
252 def __repr__(self):
253 if hasattr(self, '__unicode__'):
254 # python repr needs to return str
255 try:
256 return safe_str(self.__unicode__())
257 except UnicodeDecodeError:
258 pass
259 return '<DB:%s>' % (self.__class__.__name__)
260
261
262 class RhodeCodeSetting(Base, BaseModel):
263 __tablename__ = 'rhodecode_settings'
264 __table_args__ = (
265 UniqueConstraint('app_settings_name'),
266 {'extend_existing': True, 'mysql_engine': 'InnoDB',
267 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
268 )
269
270 SETTINGS_TYPES = {
271 'str': safe_str,
272 'int': safe_int,
273 'unicode': safe_unicode,
274 'bool': str2bool,
275 'list': functools.partial(aslist, sep=',')
276 }
277 DEFAULT_UPDATE_URL = 'https://rhodecode.com/api/v1/info/versions'
278 GLOBAL_CONF_KEY = 'app_settings'
279
280 app_settings_id = Column("app_settings_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
281 app_settings_name = Column("app_settings_name", String(255), nullable=True, unique=None, default=None)
282 _app_settings_value = Column("app_settings_value", String(4096), nullable=True, unique=None, default=None)
283 _app_settings_type = Column("app_settings_type", String(255), nullable=True, unique=None, default=None)
284
285 def __init__(self, key='', val='', type='unicode'):
286 self.app_settings_name = key
287 self.app_settings_type = type
288 self.app_settings_value = val
289
290 @validates('_app_settings_value')
291 def validate_settings_value(self, key, val):
292 assert type(val) == unicode
293 return val
294
295 @hybrid_property
296 def app_settings_value(self):
297 v = self._app_settings_value
298 _type = self.app_settings_type
299 if _type:
300 _type = self.app_settings_type.split('.')[0]
301 # decode the encrypted value
302 if 'encrypted' in self.app_settings_type:
303 cipher = EncryptedTextValue()
304 v = safe_unicode(cipher.process_result_value(v, None))
305
306 converter = self.SETTINGS_TYPES.get(_type) or \
307 self.SETTINGS_TYPES['unicode']
308 return converter(v)
309
310 @app_settings_value.setter
311 def app_settings_value(self, val):
312 """
313 Setter that will always make sure we use unicode in app_settings_value
314
315 :param val:
316 """
317 val = safe_unicode(val)
318 # encode the encrypted value
319 if 'encrypted' in self.app_settings_type:
320 cipher = EncryptedTextValue()
321 val = safe_unicode(cipher.process_bind_param(val, None))
322 self._app_settings_value = val
323
324 @hybrid_property
325 def app_settings_type(self):
326 return self._app_settings_type
327
328 @app_settings_type.setter
329 def app_settings_type(self, val):
330 if val.split('.')[0] not in self.SETTINGS_TYPES:
331 raise Exception('type must be one of %s got %s'
332 % (self.SETTINGS_TYPES.keys(), val))
333 self._app_settings_type = val
334
335 def __unicode__(self):
336 return u"<%s('%s:%s[%s]')>" % (
337 self.__class__.__name__,
338 self.app_settings_name, self.app_settings_value,
339 self.app_settings_type
340 )
341
342
343 class RhodeCodeUi(Base, BaseModel):
344 __tablename__ = 'rhodecode_ui'
345 __table_args__ = (
346 UniqueConstraint('ui_key'),
347 {'extend_existing': True, 'mysql_engine': 'InnoDB',
348 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
349 )
350
351 HOOK_REPO_SIZE = 'changegroup.repo_size'
352 # HG
353 HOOK_PRE_PULL = 'preoutgoing.pre_pull'
354 HOOK_PULL = 'outgoing.pull_logger'
355 HOOK_PRE_PUSH = 'prechangegroup.pre_push'
356 HOOK_PUSH = 'changegroup.push_logger'
357
358 # TODO: johbo: Unify way how hooks are configured for git and hg,
359 # git part is currently hardcoded.
360
361 # SVN PATTERNS
362 SVN_BRANCH_ID = 'vcs_svn_branch'
363 SVN_TAG_ID = 'vcs_svn_tag'
364
365 ui_id = Column(
366 "ui_id", Integer(), nullable=False, unique=True, default=None,
367 primary_key=True)
368 ui_section = Column(
369 "ui_section", String(255), nullable=True, unique=None, default=None)
370 ui_key = Column(
371 "ui_key", String(255), nullable=True, unique=None, default=None)
372 ui_value = Column(
373 "ui_value", String(255), nullable=True, unique=None, default=None)
374 ui_active = Column(
375 "ui_active", Boolean(), nullable=True, unique=None, default=True)
376
377 def __repr__(self):
378 return '<%s[%s]%s=>%s]>' % (self.__class__.__name__, self.ui_section,
379 self.ui_key, self.ui_value)
380
381
382 class RepoRhodeCodeSetting(Base, BaseModel):
383 __tablename__ = 'repo_rhodecode_settings'
384 __table_args__ = (
385 UniqueConstraint(
386 'app_settings_name', 'repository_id',
387 name='uq_repo_rhodecode_setting_name_repo_id'),
388 {'extend_existing': True, 'mysql_engine': 'InnoDB',
389 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
390 )
391
392 repository_id = Column(
393 "repository_id", Integer(), ForeignKey('repositories.repo_id'),
394 nullable=False)
395 app_settings_id = Column(
396 "app_settings_id", Integer(), nullable=False, unique=True,
397 default=None, primary_key=True)
398 app_settings_name = Column(
399 "app_settings_name", String(255), nullable=True, unique=None,
400 default=None)
401 _app_settings_value = Column(
402 "app_settings_value", String(4096), nullable=True, unique=None,
403 default=None)
404 _app_settings_type = Column(
405 "app_settings_type", String(255), nullable=True, unique=None,
406 default=None)
407
408 repository = relationship('Repository')
409
410 def __init__(self, repository_id, key='', val='', type='unicode'):
411 self.repository_id = repository_id
412 self.app_settings_name = key
413 self.app_settings_type = type
414 self.app_settings_value = val
415
416 @validates('_app_settings_value')
417 def validate_settings_value(self, key, val):
418 assert type(val) == unicode
419 return val
420
421 @hybrid_property
422 def app_settings_value(self):
423 v = self._app_settings_value
424 type_ = self.app_settings_type
425 SETTINGS_TYPES = RhodeCodeSetting.SETTINGS_TYPES
426 converter = SETTINGS_TYPES.get(type_) or SETTINGS_TYPES['unicode']
427 return converter(v)
428
429 @app_settings_value.setter
430 def app_settings_value(self, val):
431 """
432 Setter that will always make sure we use unicode in app_settings_value
433
434 :param val:
435 """
436 self._app_settings_value = safe_unicode(val)
437
438 @hybrid_property
439 def app_settings_type(self):
440 return self._app_settings_type
441
442 @app_settings_type.setter
443 def app_settings_type(self, val):
444 SETTINGS_TYPES = RhodeCodeSetting.SETTINGS_TYPES
445 if val not in SETTINGS_TYPES:
446 raise Exception('type must be one of %s got %s'
447 % (SETTINGS_TYPES.keys(), val))
448 self._app_settings_type = val
449
450 def __unicode__(self):
451 return u"<%s('%s:%s:%s[%s]')>" % (
452 self.__class__.__name__, self.repository.repo_name,
453 self.app_settings_name, self.app_settings_value,
454 self.app_settings_type
455 )
456
457
458 class RepoRhodeCodeUi(Base, BaseModel):
459 __tablename__ = 'repo_rhodecode_ui'
460 __table_args__ = (
461 UniqueConstraint(
462 'repository_id', 'ui_section', 'ui_key',
463 name='uq_repo_rhodecode_ui_repository_id_section_key'),
464 {'extend_existing': True, 'mysql_engine': 'InnoDB',
465 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
466 )
467
468 repository_id = Column(
469 "repository_id", Integer(), ForeignKey('repositories.repo_id'),
470 nullable=False)
471 ui_id = Column(
472 "ui_id", Integer(), nullable=False, unique=True, default=None,
473 primary_key=True)
474 ui_section = Column(
475 "ui_section", String(255), nullable=True, unique=None, default=None)
476 ui_key = Column(
477 "ui_key", String(255), nullable=True, unique=None, default=None)
478 ui_value = Column(
479 "ui_value", String(255), nullable=True, unique=None, default=None)
480 ui_active = Column(
481 "ui_active", Boolean(), nullable=True, unique=None, default=True)
482
483 repository = relationship('Repository')
484
485 def __repr__(self):
486 return '<%s[%s:%s]%s=>%s]>' % (
487 self.__class__.__name__, self.repository.repo_name,
488 self.ui_section, self.ui_key, self.ui_value)
489
490
491 class User(Base, BaseModel):
492 __tablename__ = 'users'
493 __table_args__ = (
494 UniqueConstraint('username'), UniqueConstraint('email'),
495 Index('u_username_idx', 'username'),
496 Index('u_email_idx', 'email'),
497 {'extend_existing': True, 'mysql_engine': 'InnoDB',
498 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
499 )
500 DEFAULT_USER = 'default'
501 DEFAULT_USER_EMAIL = 'anonymous@rhodecode.org'
502 DEFAULT_GRAVATAR_URL = 'https://secure.gravatar.com/avatar/{md5email}?d=identicon&s={size}'
503
504 user_id = Column("user_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
505 username = Column("username", String(255), nullable=True, unique=None, default=None)
506 password = Column("password", String(255), nullable=True, unique=None, default=None)
507 active = Column("active", Boolean(), nullable=True, unique=None, default=True)
508 admin = Column("admin", Boolean(), nullable=True, unique=None, default=False)
509 name = Column("firstname", String(255), nullable=True, unique=None, default=None)
510 lastname = Column("lastname", String(255), nullable=True, unique=None, default=None)
511 _email = Column("email", String(255), nullable=True, unique=None, default=None)
512 last_login = Column("last_login", DateTime(timezone=False), nullable=True, unique=None, default=None)
513 extern_type = Column("extern_type", String(255), nullable=True, unique=None, default=None)
514 extern_name = Column("extern_name", String(255), nullable=True, unique=None, default=None)
515 api_key = Column("api_key", String(255), nullable=True, unique=None, default=None)
516 inherit_default_permissions = Column("inherit_default_permissions", Boolean(), nullable=False, unique=None, default=True)
517 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
518 _user_data = Column("user_data", LargeBinary(), nullable=True) # JSON data
519
520 user_log = relationship('UserLog')
521 user_perms = relationship('UserToPerm', primaryjoin="User.user_id==UserToPerm.user_id", cascade='all')
522
523 repositories = relationship('Repository')
524 repository_groups = relationship('RepoGroup')
525 user_groups = relationship('UserGroup')
526
527 user_followers = relationship('UserFollowing', primaryjoin='UserFollowing.follows_user_id==User.user_id', cascade='all')
528 followings = relationship('UserFollowing', primaryjoin='UserFollowing.user_id==User.user_id', cascade='all')
529
530 repo_to_perm = relationship('UserRepoToPerm', primaryjoin='UserRepoToPerm.user_id==User.user_id', cascade='all')
531 repo_group_to_perm = relationship('UserRepoGroupToPerm', primaryjoin='UserRepoGroupToPerm.user_id==User.user_id', cascade='all')
532 user_group_to_perm = relationship('UserUserGroupToPerm', primaryjoin='UserUserGroupToPerm.user_id==User.user_id', cascade='all')
533
534 group_member = relationship('UserGroupMember', cascade='all')
535
536 notifications = relationship('UserNotification', cascade='all')
537 # notifications assigned to this user
538 user_created_notifications = relationship('Notification', cascade='all')
539 # comments created by this user
540 user_comments = relationship('ChangesetComment', cascade='all')
541 # user profile extra info
542 user_emails = relationship('UserEmailMap', cascade='all')
543 user_ip_map = relationship('UserIpMap', cascade='all')
544 user_auth_tokens = relationship('UserApiKeys', cascade='all')
545 # gists
546 user_gists = relationship('Gist', cascade='all')
547 # user pull requests
548 user_pull_requests = relationship('PullRequest', cascade='all')
549 # external identities
550 extenal_identities = relationship(
551 'ExternalIdentity',
552 primaryjoin="User.user_id==ExternalIdentity.local_user_id",
553 cascade='all')
554
555 def __unicode__(self):
556 return u"<%s('id:%s:%s')>" % (self.__class__.__name__,
557 self.user_id, self.username)
558
559 @hybrid_property
560 def email(self):
561 return self._email
562
563 @email.setter
564 def email(self, val):
565 self._email = val.lower() if val else None
566
567 @property
568 def firstname(self):
569 # alias for future
570 return self.name
571
572 @property
573 def emails(self):
574 other = UserEmailMap.query().filter(UserEmailMap.user==self).all()
575 return [self.email] + [x.email for x in other]
576
577 @property
578 def auth_tokens(self):
579 return [self.api_key] + [x.api_key for x in self.extra_auth_tokens]
580
581 @property
582 def extra_auth_tokens(self):
583 return UserApiKeys.query().filter(UserApiKeys.user == self).all()
584
585 @property
586 def feed_token(self):
587 feed_tokens = UserApiKeys.query()\
588 .filter(UserApiKeys.user == self)\
589 .filter(UserApiKeys.role == UserApiKeys.ROLE_FEED)\
590 .all()
591 if feed_tokens:
592 return feed_tokens[0].api_key
593 else:
594 # use the main token so we don't end up with nothing...
595 return self.api_key
596
597 @classmethod
598 def extra_valid_auth_tokens(cls, user, role=None):
599 tokens = UserApiKeys.query().filter(UserApiKeys.user == user)\
600 .filter(or_(UserApiKeys.expires == -1,
601 UserApiKeys.expires >= time.time()))
602 if role:
603 tokens = tokens.filter(or_(UserApiKeys.role == role,
604 UserApiKeys.role == UserApiKeys.ROLE_ALL))
605 return tokens.all()
606
607 @property
608 def ip_addresses(self):
609 ret = UserIpMap.query().filter(UserIpMap.user == self).all()
610 return [x.ip_addr for x in ret]
611
612 @property
613 def username_and_name(self):
614 return '%s (%s %s)' % (self.username, self.firstname, self.lastname)
615
616 @property
617 def username_or_name_or_email(self):
618 full_name = self.full_name if self.full_name is not ' ' else None
619 return self.username or full_name or self.email
620
621 @property
622 def full_name(self):
623 return '%s %s' % (self.firstname, self.lastname)
624
625 @property
626 def full_name_or_username(self):
627 return ('%s %s' % (self.firstname, self.lastname)
628 if (self.firstname and self.lastname) else self.username)
629
630 @property
631 def full_contact(self):
632 return '%s %s <%s>' % (self.firstname, self.lastname, self.email)
633
634 @property
635 def short_contact(self):
636 return '%s %s' % (self.firstname, self.lastname)
637
638 @property
639 def is_admin(self):
640 return self.admin
641
642 @property
643 def AuthUser(self):
644 """
645 Returns instance of AuthUser for this user
646 """
647 from rhodecode.lib.auth import AuthUser
648 return AuthUser(user_id=self.user_id, api_key=self.api_key,
649 username=self.username)
650
651 @hybrid_property
652 def user_data(self):
653 if not self._user_data:
654 return {}
655
656 try:
657 return json.loads(self._user_data)
658 except TypeError:
659 return {}
660
661 @user_data.setter
662 def user_data(self, val):
663 if not isinstance(val, dict):
664 raise Exception('user_data must be dict, got %s' % type(val))
665 try:
666 self._user_data = json.dumps(val)
667 except Exception:
668 log.error(traceback.format_exc())
669
670 @classmethod
671 def get_by_username(cls, username, case_insensitive=False,
672 cache=False, identity_cache=False):
673 session = Session()
674
675 if case_insensitive:
676 q = cls.query().filter(
677 func.lower(cls.username) == func.lower(username))
678 else:
679 q = cls.query().filter(cls.username == username)
680
681 if cache:
682 if identity_cache:
683 val = cls.identity_cache(session, 'username', username)
684 if val:
685 return val
686 else:
687 q = q.options(
688 FromCache("sql_cache_short",
689 "get_user_by_name_%s" % _hash_key(username)))
690
691 return q.scalar()
692
693 @classmethod
694 def get_by_auth_token(cls, auth_token, cache=False, fallback=True):
695 q = cls.query().filter(cls.api_key == auth_token)
696
697 if cache:
698 q = q.options(FromCache("sql_cache_short",
699 "get_auth_token_%s" % auth_token))
700 res = q.scalar()
701
702 if fallback and not res:
703 #fallback to additional keys
704 _res = UserApiKeys.query()\
705 .filter(UserApiKeys.api_key == auth_token)\
706 .filter(or_(UserApiKeys.expires == -1,
707 UserApiKeys.expires >= time.time()))\
708 .first()
709 if _res:
710 res = _res.user
711 return res
712
713 @classmethod
714 def get_by_email(cls, email, case_insensitive=False, cache=False):
715
716 if case_insensitive:
717 q = cls.query().filter(func.lower(cls.email) == func.lower(email))
718
719 else:
720 q = cls.query().filter(cls.email == email)
721
722 if cache:
723 q = q.options(FromCache("sql_cache_short",
724 "get_email_key_%s" % _hash_key(email)))
725
726 ret = q.scalar()
727 if ret is None:
728 q = UserEmailMap.query()
729 # try fetching in alternate email map
730 if case_insensitive:
731 q = q.filter(func.lower(UserEmailMap.email) == func.lower(email))
732 else:
733 q = q.filter(UserEmailMap.email == email)
734 q = q.options(joinedload(UserEmailMap.user))
735 if cache:
736 q = q.options(FromCache("sql_cache_short",
737 "get_email_map_key_%s" % email))
738 ret = getattr(q.scalar(), 'user', None)
739
740 return ret
741
742 @classmethod
743 def get_from_cs_author(cls, author):
744 """
745 Tries to get User objects out of commit author string
746
747 :param author:
748 """
749 from rhodecode.lib.helpers import email, author_name
750 # Valid email in the attribute passed, see if they're in the system
751 _email = email(author)
752 if _email:
753 user = cls.get_by_email(_email, case_insensitive=True)
754 if user:
755 return user
756 # Maybe we can match by username?
757 _author = author_name(author)
758 user = cls.get_by_username(_author, case_insensitive=True)
759 if user:
760 return user
761
762 def update_userdata(self, **kwargs):
763 usr = self
764 old = usr.user_data
765 old.update(**kwargs)
766 usr.user_data = old
767 Session().add(usr)
768 log.debug('updated userdata with ', kwargs)
769
770 def update_lastlogin(self):
771 """Update user lastlogin"""
772 self.last_login = datetime.datetime.now()
773 Session().add(self)
774 log.debug('updated user %s lastlogin', self.username)
775
776 def update_lastactivity(self):
777 """Update user lastactivity"""
778 usr = self
779 old = usr.user_data
780 old.update({'last_activity': time.time()})
781 usr.user_data = old
782 Session().add(usr)
783 log.debug('updated user %s lastactivity', usr.username)
784
785 def update_password(self, new_password, change_api_key=False):
786 from rhodecode.lib.auth import get_crypt_password,generate_auth_token
787
788 self.password = get_crypt_password(new_password)
789 if change_api_key:
790 self.api_key = generate_auth_token(self.username)
791 Session().add(self)
792
793 @classmethod
794 def get_first_super_admin(cls):
795 user = User.query().filter(User.admin == true()).first()
796 if user is None:
797 raise Exception('FATAL: Missing administrative account!')
798 return user
799
800 @classmethod
801 def get_all_super_admins(cls):
802 """
803 Returns all admin accounts sorted by username
804 """
805 return User.query().filter(User.admin == true())\
806 .order_by(User.username.asc()).all()
807
808 @classmethod
809 def get_default_user(cls, cache=False):
810 user = User.get_by_username(User.DEFAULT_USER, cache=cache)
811 if user is None:
812 raise Exception('FATAL: Missing default account!')
813 return user
814
815 def _get_default_perms(self, user, suffix=''):
816 from rhodecode.model.permission import PermissionModel
817 return PermissionModel().get_default_perms(user.user_perms, suffix)
818
819 def get_default_perms(self, suffix=''):
820 return self._get_default_perms(self, suffix)
821
822 def get_api_data(self, include_secrets=False, details='full'):
823 """
824 Common function for generating user related data for API
825
826 :param include_secrets: By default secrets in the API data will be replaced
827 by a placeholder value to prevent exposing this data by accident. In case
828 this data shall be exposed, set this flag to ``True``.
829
830 :param details: details can be 'basic|full' basic gives only a subset of
831 the available user information that includes user_id, name and emails.
832 """
833 user = self
834 user_data = self.user_data
835 data = {
836 'user_id': user.user_id,
837 'username': user.username,
838 'firstname': user.name,
839 'lastname': user.lastname,
840 'email': user.email,
841 'emails': user.emails,
842 }
843 if details == 'basic':
844 return data
845
846 api_key_length = 40
847 api_key_replacement = '*' * api_key_length
848
849 extras = {
850 'api_key': api_key_replacement,
851 'api_keys': [api_key_replacement],
852 'active': user.active,
853 'admin': user.admin,
854 'extern_type': user.extern_type,
855 'extern_name': user.extern_name,
856 'last_login': user.last_login,
857 'ip_addresses': user.ip_addresses,
858 'language': user_data.get('language')
859 }
860 data.update(extras)
861
862 if include_secrets:
863 data['api_key'] = user.api_key
864 data['api_keys'] = user.auth_tokens
865 return data
866
867 def __json__(self):
868 data = {
869 'full_name': self.full_name,
870 'full_name_or_username': self.full_name_or_username,
871 'short_contact': self.short_contact,
872 'full_contact': self.full_contact,
873 }
874 data.update(self.get_api_data())
875 return data
876
877
878 class UserApiKeys(Base, BaseModel):
879 __tablename__ = 'user_api_keys'
880 __table_args__ = (
881 Index('uak_api_key_idx', 'api_key'),
882 Index('uak_api_key_expires_idx', 'api_key', 'expires'),
883 UniqueConstraint('api_key'),
884 {'extend_existing': True, 'mysql_engine': 'InnoDB',
885 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
886 )
887 __mapper_args__ = {}
888
889 # ApiKey role
890 ROLE_ALL = 'token_role_all'
891 ROLE_HTTP = 'token_role_http'
892 ROLE_VCS = 'token_role_vcs'
893 ROLE_API = 'token_role_api'
894 ROLE_FEED = 'token_role_feed'
895 ROLES = [ROLE_ALL, ROLE_HTTP, ROLE_VCS, ROLE_API, ROLE_FEED]
896
897 user_api_key_id = Column("user_api_key_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
898 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
899 api_key = Column("api_key", String(255), nullable=False, unique=True)
900 description = Column('description', UnicodeText().with_variant(UnicodeText(1024), 'mysql'))
901 expires = Column('expires', Float(53), nullable=False)
902 role = Column('role', String(255), nullable=True)
903 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
904
905 user = relationship('User', lazy='joined')
906
907 @classmethod
908 def _get_role_name(cls, role):
909 return {
910 cls.ROLE_ALL: _('all'),
911 cls.ROLE_HTTP: _('http/web interface'),
912 cls.ROLE_VCS: _('vcs (git/hg/svn protocol)'),
913 cls.ROLE_API: _('api calls'),
914 cls.ROLE_FEED: _('feed access'),
915 }.get(role, role)
916
917 @property
918 def expired(self):
919 if self.expires == -1:
920 return False
921 return time.time() > self.expires
922
923 @property
924 def role_humanized(self):
925 return self._get_role_name(self.role)
926
927
928 class UserEmailMap(Base, BaseModel):
929 __tablename__ = 'user_email_map'
930 __table_args__ = (
931 Index('uem_email_idx', 'email'),
932 UniqueConstraint('email'),
933 {'extend_existing': True, 'mysql_engine': 'InnoDB',
934 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
935 )
936 __mapper_args__ = {}
937
938 email_id = Column("email_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
939 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
940 _email = Column("email", String(255), nullable=True, unique=False, default=None)
941 user = relationship('User', lazy='joined')
942
943 @validates('_email')
944 def validate_email(self, key, email):
945 # check if this email is not main one
946 main_email = Session().query(User).filter(User.email == email).scalar()
947 if main_email is not None:
948 raise AttributeError('email %s is present is user table' % email)
949 return email
950
951 @hybrid_property
952 def email(self):
953 return self._email
954
955 @email.setter
956 def email(self, val):
957 self._email = val.lower() if val else None
958
959
960 class UserIpMap(Base, BaseModel):
961 __tablename__ = 'user_ip_map'
962 __table_args__ = (
963 UniqueConstraint('user_id', 'ip_addr'),
964 {'extend_existing': True, 'mysql_engine': 'InnoDB',
965 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
966 )
967 __mapper_args__ = {}
968
969 ip_id = Column("ip_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
970 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
971 ip_addr = Column("ip_addr", String(255), nullable=True, unique=False, default=None)
972 active = Column("active", Boolean(), nullable=True, unique=None, default=True)
973 description = Column("description", String(10000), nullable=True, unique=None, default=None)
974 user = relationship('User', lazy='joined')
975
976 @classmethod
977 def _get_ip_range(cls, ip_addr):
978 net = ipaddress.ip_network(ip_addr, strict=False)
979 return [str(net.network_address), str(net.broadcast_address)]
980
981 def __json__(self):
982 return {
983 'ip_addr': self.ip_addr,
984 'ip_range': self._get_ip_range(self.ip_addr),
985 }
986
987 def __unicode__(self):
988 return u"<%s('user_id:%s=>%s')>" % (self.__class__.__name__,
989 self.user_id, self.ip_addr)
990
991 class UserLog(Base, BaseModel):
992 __tablename__ = 'user_logs'
993 __table_args__ = (
994 {'extend_existing': True, 'mysql_engine': 'InnoDB',
995 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
996 )
997 user_log_id = Column("user_log_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
998 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
999 username = Column("username", String(255), nullable=True, unique=None, default=None)
1000 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True)
1001 repository_name = Column("repository_name", String(255), nullable=True, unique=None, default=None)
1002 user_ip = Column("user_ip", String(255), nullable=True, unique=None, default=None)
1003 action = Column("action", Text().with_variant(Text(1200000), 'mysql'), nullable=True, unique=None, default=None)
1004 action_date = Column("action_date", DateTime(timezone=False), nullable=True, unique=None, default=None)
1005
1006 def __unicode__(self):
1007 return u"<%s('id:%s:%s')>" % (self.__class__.__name__,
1008 self.repository_name,
1009 self.action)
1010
1011 @property
1012 def action_as_day(self):
1013 return datetime.date(*self.action_date.timetuple()[:3])
1014
1015 user = relationship('User')
1016 repository = relationship('Repository', cascade='')
1017
1018
1019 class UserGroup(Base, BaseModel):
1020 __tablename__ = 'users_groups'
1021 __table_args__ = (
1022 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1023 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
1024 )
1025
1026 users_group_id = Column("users_group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
1027 users_group_name = Column("users_group_name", String(255), nullable=False, unique=True, default=None)
1028 user_group_description = Column("user_group_description", String(10000), nullable=True, unique=None, default=None)
1029 users_group_active = Column("users_group_active", Boolean(), nullable=True, unique=None, default=None)
1030 inherit_default_permissions = Column("users_group_inherit_default_permissions", Boolean(), nullable=False, unique=None, default=True)
1031 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None)
1032 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
1033 _group_data = Column("group_data", LargeBinary(), nullable=True) # JSON data
1034
1035 members = relationship('UserGroupMember', cascade="all, delete, delete-orphan", lazy="joined")
1036 users_group_to_perm = relationship('UserGroupToPerm', cascade='all')
1037 users_group_repo_to_perm = relationship('UserGroupRepoToPerm', cascade='all')
1038 users_group_repo_group_to_perm = relationship('UserGroupRepoGroupToPerm', cascade='all')
1039 user_user_group_to_perm = relationship('UserUserGroupToPerm', cascade='all')
1040 user_group_user_group_to_perm = relationship('UserGroupUserGroupToPerm ', primaryjoin="UserGroupUserGroupToPerm.target_user_group_id==UserGroup.users_group_id", cascade='all')
1041
1042 user = relationship('User')
1043
1044 @hybrid_property
1045 def group_data(self):
1046 if not self._group_data:
1047 return {}
1048
1049 try:
1050 return json.loads(self._group_data)
1051 except TypeError:
1052 return {}
1053
1054 @group_data.setter
1055 def group_data(self, val):
1056 try:
1057 self._group_data = json.dumps(val)
1058 except Exception:
1059 log.error(traceback.format_exc())
1060
1061 def __unicode__(self):
1062 return u"<%s('id:%s:%s')>" % (self.__class__.__name__,
1063 self.users_group_id,
1064 self.users_group_name)
1065
1066 @classmethod
1067 def get_by_group_name(cls, group_name, cache=False,
1068 case_insensitive=False):
1069 if case_insensitive:
1070 q = cls.query().filter(func.lower(cls.users_group_name) ==
1071 func.lower(group_name))
1072
1073 else:
1074 q = cls.query().filter(cls.users_group_name == group_name)
1075 if cache:
1076 q = q.options(FromCache(
1077 "sql_cache_short",
1078 "get_group_%s" % _hash_key(group_name)))
1079 return q.scalar()
1080
1081 @classmethod
1082 def get(cls, user_group_id, cache=False):
1083 user_group = cls.query()
1084 if cache:
1085 user_group = user_group.options(FromCache("sql_cache_short",
1086 "get_users_group_%s" % user_group_id))
1087 return user_group.get(user_group_id)
1088
1089 def permissions(self, with_admins=True, with_owner=True):
1090 q = UserUserGroupToPerm.query().filter(UserUserGroupToPerm.user_group == self)
1091 q = q.options(joinedload(UserUserGroupToPerm.user_group),
1092 joinedload(UserUserGroupToPerm.user),
1093 joinedload(UserUserGroupToPerm.permission),)
1094
1095 # get owners and admins and permissions. We do a trick of re-writing
1096 # objects from sqlalchemy to named-tuples due to sqlalchemy session
1097 # has a global reference and changing one object propagates to all
1098 # others. This means if admin is also an owner admin_row that change
1099 # would propagate to both objects
1100 perm_rows = []
1101 for _usr in q.all():
1102 usr = AttributeDict(_usr.user.get_dict())
1103 usr.permission = _usr.permission.permission_name
1104 perm_rows.append(usr)
1105
1106 # filter the perm rows by 'default' first and then sort them by
1107 # admin,write,read,none permissions sorted again alphabetically in
1108 # each group
1109 perm_rows = sorted(perm_rows, key=display_sort)
1110
1111 _admin_perm = 'usergroup.admin'
1112 owner_row = []
1113 if with_owner:
1114 usr = AttributeDict(self.user.get_dict())
1115 usr.owner_row = True
1116 usr.permission = _admin_perm
1117 owner_row.append(usr)
1118
1119 super_admin_rows = []
1120 if with_admins:
1121 for usr in User.get_all_super_admins():
1122 # if this admin is also owner, don't double the record
1123 if usr.user_id == owner_row[0].user_id:
1124 owner_row[0].admin_row = True
1125 else:
1126 usr = AttributeDict(usr.get_dict())
1127 usr.admin_row = True
1128 usr.permission = _admin_perm
1129 super_admin_rows.append(usr)
1130
1131 return super_admin_rows + owner_row + perm_rows
1132
1133 def permission_user_groups(self):
1134 q = UserGroupUserGroupToPerm.query().filter(UserGroupUserGroupToPerm.target_user_group == self)
1135 q = q.options(joinedload(UserGroupUserGroupToPerm.user_group),
1136 joinedload(UserGroupUserGroupToPerm.target_user_group),
1137 joinedload(UserGroupUserGroupToPerm.permission),)
1138
1139 perm_rows = []
1140 for _user_group in q.all():
1141 usr = AttributeDict(_user_group.user_group.get_dict())
1142 usr.permission = _user_group.permission.permission_name
1143 perm_rows.append(usr)
1144
1145 return perm_rows
1146
1147 def _get_default_perms(self, user_group, suffix=''):
1148 from rhodecode.model.permission import PermissionModel
1149 return PermissionModel().get_default_perms(user_group.users_group_to_perm, suffix)
1150
1151 def get_default_perms(self, suffix=''):
1152 return self._get_default_perms(self, suffix)
1153
1154 def get_api_data(self, with_group_members=True, include_secrets=False):
1155 """
1156 :param include_secrets: See :meth:`User.get_api_data`, this parameter is
1157 basically forwarded.
1158
1159 """
1160 user_group = self
1161
1162 data = {
1163 'users_group_id': user_group.users_group_id,
1164 'group_name': user_group.users_group_name,
1165 'group_description': user_group.user_group_description,
1166 'active': user_group.users_group_active,
1167 'owner': user_group.user.username,
1168 }
1169 if with_group_members:
1170 users = []
1171 for user in user_group.members:
1172 user = user.user
1173 users.append(user.get_api_data(include_secrets=include_secrets))
1174 data['users'] = users
1175
1176 return data
1177
1178
1179 class UserGroupMember(Base, BaseModel):
1180 __tablename__ = 'users_groups_members'
1181 __table_args__ = (
1182 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1183 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
1184 )
1185
1186 users_group_member_id = Column("users_group_member_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
1187 users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
1188 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
1189
1190 user = relationship('User', lazy='joined')
1191 users_group = relationship('UserGroup')
1192
1193 def __init__(self, gr_id='', u_id=''):
1194 self.users_group_id = gr_id
1195 self.user_id = u_id
1196
1197
1198 class RepositoryField(Base, BaseModel):
1199 __tablename__ = 'repositories_fields'
1200 __table_args__ = (
1201 UniqueConstraint('repository_id', 'field_key'), # no-multi field
1202 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1203 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
1204 )
1205 PREFIX = 'ex_' # prefix used in form to not conflict with already existing fields
1206
1207 repo_field_id = Column("repo_field_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
1208 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None)
1209 field_key = Column("field_key", String(250))
1210 field_label = Column("field_label", String(1024), nullable=False)
1211 field_value = Column("field_value", String(10000), nullable=False)
1212 field_desc = Column("field_desc", String(1024), nullable=False)
1213 field_type = Column("field_type", String(255), nullable=False, unique=None)
1214 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
1215
1216 repository = relationship('Repository')
1217
1218 @property
1219 def field_key_prefixed(self):
1220 return 'ex_%s' % self.field_key
1221
1222 @classmethod
1223 def un_prefix_key(cls, key):
1224 if key.startswith(cls.PREFIX):
1225 return key[len(cls.PREFIX):]
1226 return key
1227
1228 @classmethod
1229 def get_by_key_name(cls, key, repo):
1230 row = cls.query()\
1231 .filter(cls.repository == repo)\
1232 .filter(cls.field_key == key).scalar()
1233 return row
1234
1235
1236 class Repository(Base, BaseModel):
1237 __tablename__ = 'repositories'
1238 __table_args__ = (
1239 Index('r_repo_name_idx', 'repo_name', mysql_length=255),
1240 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1241 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
1242 )
1243 DEFAULT_CLONE_URI = '{scheme}://{user}@{netloc}/{repo}'
1244 DEFAULT_CLONE_URI_ID = '{scheme}://{user}@{netloc}/_{repoid}'
1245
1246 STATE_CREATED = 'repo_state_created'
1247 STATE_PENDING = 'repo_state_pending'
1248 STATE_ERROR = 'repo_state_error'
1249
1250 LOCK_AUTOMATIC = 'lock_auto'
1251 LOCK_API = 'lock_api'
1252 LOCK_WEB = 'lock_web'
1253 LOCK_PULL = 'lock_pull'
1254
1255 NAME_SEP = URL_SEP
1256
1257 repo_id = Column(
1258 "repo_id", Integer(), nullable=False, unique=True, default=None,
1259 primary_key=True)
1260 _repo_name = Column(
1261 "repo_name", Text(), nullable=False, default=None)
1262 _repo_name_hash = Column(
1263 "repo_name_hash", String(255), nullable=False, unique=True)
1264 repo_state = Column("repo_state", String(255), nullable=True)
1265
1266 clone_uri = Column(
1267 "clone_uri", EncryptedTextValue(), nullable=True, unique=False,
1268 default=None)
1269 repo_type = Column(
1270 "repo_type", String(255), nullable=False, unique=False, default=None)
1271 user_id = Column(
1272 "user_id", Integer(), ForeignKey('users.user_id'), nullable=False,
1273 unique=False, default=None)
1274 private = Column(
1275 "private", Boolean(), nullable=True, unique=None, default=None)
1276 enable_statistics = Column(
1277 "statistics", Boolean(), nullable=True, unique=None, default=True)
1278 enable_downloads = Column(
1279 "downloads", Boolean(), nullable=True, unique=None, default=True)
1280 description = Column(
1281 "description", String(10000), nullable=True, unique=None, default=None)
1282 created_on = Column(
1283 'created_on', DateTime(timezone=False), nullable=True, unique=None,
1284 default=datetime.datetime.now)
1285 updated_on = Column(
1286 'updated_on', DateTime(timezone=False), nullable=True, unique=None,
1287 default=datetime.datetime.now)
1288 _landing_revision = Column(
1289 "landing_revision", String(255), nullable=False, unique=False,
1290 default=None)
1291 enable_locking = Column(
1292 "enable_locking", Boolean(), nullable=False, unique=None,
1293 default=False)
1294 _locked = Column(
1295 "locked", String(255), nullable=True, unique=False, default=None)
1296 _changeset_cache = Column(
1297 "changeset_cache", LargeBinary(), nullable=True) # JSON data
1298
1299 fork_id = Column(
1300 "fork_id", Integer(), ForeignKey('repositories.repo_id'),
1301 nullable=True, unique=False, default=None)
1302 group_id = Column(
1303 "group_id", Integer(), ForeignKey('groups.group_id'), nullable=True,
1304 unique=False, default=None)
1305
1306 user = relationship('User', lazy='joined')
1307 fork = relationship('Repository', remote_side=repo_id, lazy='joined')
1308 group = relationship('RepoGroup', lazy='joined')
1309 repo_to_perm = relationship(
1310 'UserRepoToPerm', cascade='all',
1311 order_by='UserRepoToPerm.repo_to_perm_id')
1312 users_group_to_perm = relationship('UserGroupRepoToPerm', cascade='all')
1313 stats = relationship('Statistics', cascade='all', uselist=False)
1314
1315 followers = relationship(
1316 'UserFollowing',
1317 primaryjoin='UserFollowing.follows_repo_id==Repository.repo_id',
1318 cascade='all')
1319 extra_fields = relationship(
1320 'RepositoryField', cascade="all, delete, delete-orphan")
1321 logs = relationship('UserLog')
1322 comments = relationship(
1323 'ChangesetComment', cascade="all, delete, delete-orphan")
1324 pull_requests_source = relationship(
1325 'PullRequest',
1326 primaryjoin='PullRequest.source_repo_id==Repository.repo_id',
1327 cascade="all, delete, delete-orphan")
1328 pull_requests_target = relationship(
1329 'PullRequest',
1330 primaryjoin='PullRequest.target_repo_id==Repository.repo_id',
1331 cascade="all, delete, delete-orphan")
1332 ui = relationship('RepoRhodeCodeUi', cascade="all")
1333 settings = relationship('RepoRhodeCodeSetting', cascade="all")
1334 integrations = relationship('Integration',
1335 cascade="all, delete, delete-orphan")
1336
1337 def __unicode__(self):
1338 return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
1339 safe_unicode(self.repo_name))
1340
1341 @hybrid_property
1342 def landing_rev(self):
1343 # always should return [rev_type, rev]
1344 if self._landing_revision:
1345 _rev_info = self._landing_revision.split(':')
1346 if len(_rev_info) < 2:
1347 _rev_info.insert(0, 'rev')
1348 return [_rev_info[0], _rev_info[1]]
1349 return [None, None]
1350
1351 @landing_rev.setter
1352 def landing_rev(self, val):
1353 if ':' not in val:
1354 raise ValueError('value must be delimited with `:` and consist '
1355 'of <rev_type>:<rev>, got %s instead' % val)
1356 self._landing_revision = val
1357
1358 @hybrid_property
1359 def locked(self):
1360 if self._locked:
1361 user_id, timelocked, reason = self._locked.split(':')
1362 lock_values = int(user_id), timelocked, reason
1363 else:
1364 lock_values = [None, None, None]
1365 return lock_values
1366
1367 @locked.setter
1368 def locked(self, val):
1369 if val and isinstance(val, (list, tuple)):
1370 self._locked = ':'.join(map(str, val))
1371 else:
1372 self._locked = None
1373
1374 @hybrid_property
1375 def changeset_cache(self):
1376 from rhodecode.lib.vcs.backends.base import EmptyCommit
1377 dummy = EmptyCommit().__json__()
1378 if not self._changeset_cache:
1379 return dummy
1380 try:
1381 return json.loads(self._changeset_cache)
1382 except TypeError:
1383 return dummy
1384 except Exception:
1385 log.error(traceback.format_exc())
1386 return dummy
1387
1388 @changeset_cache.setter
1389 def changeset_cache(self, val):
1390 try:
1391 self._changeset_cache = json.dumps(val)
1392 except Exception:
1393 log.error(traceback.format_exc())
1394
1395 @hybrid_property
1396 def repo_name(self):
1397 return self._repo_name
1398
1399 @repo_name.setter
1400 def repo_name(self, value):
1401 self._repo_name = value
1402 self._repo_name_hash = hashlib.sha1(safe_str(value)).hexdigest()
1403
1404 @classmethod
1405 def normalize_repo_name(cls, repo_name):
1406 """
1407 Normalizes os specific repo_name to the format internally stored inside
1408 database using URL_SEP
1409
1410 :param cls:
1411 :param repo_name:
1412 """
1413 return cls.NAME_SEP.join(repo_name.split(os.sep))
1414
1415 @classmethod
1416 def get_by_repo_name(cls, repo_name, cache=False, identity_cache=False):
1417 session = Session()
1418 q = session.query(cls).filter(cls.repo_name == repo_name)
1419
1420 if cache:
1421 if identity_cache:
1422 val = cls.identity_cache(session, 'repo_name', repo_name)
1423 if val:
1424 return val
1425 else:
1426 q = q.options(
1427 FromCache("sql_cache_short",
1428 "get_repo_by_name_%s" % _hash_key(repo_name)))
1429
1430 return q.scalar()
1431
1432 @classmethod
1433 def get_by_full_path(cls, repo_full_path):
1434 repo_name = repo_full_path.split(cls.base_path(), 1)[-1]
1435 repo_name = cls.normalize_repo_name(repo_name)
1436 return cls.get_by_repo_name(repo_name.strip(URL_SEP))
1437
1438 @classmethod
1439 def get_repo_forks(cls, repo_id):
1440 return cls.query().filter(Repository.fork_id == repo_id)
1441
1442 @classmethod
1443 def base_path(cls):
1444 """
1445 Returns base path when all repos are stored
1446
1447 :param cls:
1448 """
1449 q = Session().query(RhodeCodeUi)\
1450 .filter(RhodeCodeUi.ui_key == cls.NAME_SEP)
1451 q = q.options(FromCache("sql_cache_short", "repository_repo_path"))
1452 return q.one().ui_value
1453
1454 @classmethod
1455 def is_valid(cls, repo_name):
1456 """
1457 returns True if given repo name is a valid filesystem repository
1458
1459 :param cls:
1460 :param repo_name:
1461 """
1462 from rhodecode.lib.utils import is_valid_repo
1463
1464 return is_valid_repo(repo_name, cls.base_path())
1465
1466 @classmethod
1467 def get_all_repos(cls, user_id=Optional(None), group_id=Optional(None),
1468 case_insensitive=True):
1469 q = Repository.query()
1470
1471 if not isinstance(user_id, Optional):
1472 q = q.filter(Repository.user_id == user_id)
1473
1474 if not isinstance(group_id, Optional):
1475 q = q.filter(Repository.group_id == group_id)
1476
1477 if case_insensitive:
1478 q = q.order_by(func.lower(Repository.repo_name))
1479 else:
1480 q = q.order_by(Repository.repo_name)
1481 return q.all()
1482
1483 @property
1484 def forks(self):
1485 """
1486 Return forks of this repo
1487 """
1488 return Repository.get_repo_forks(self.repo_id)
1489
1490 @property
1491 def parent(self):
1492 """
1493 Returns fork parent
1494 """
1495 return self.fork
1496
1497 @property
1498 def just_name(self):
1499 return self.repo_name.split(self.NAME_SEP)[-1]
1500
1501 @property
1502 def groups_with_parents(self):
1503 groups = []
1504 if self.group is None:
1505 return groups
1506
1507 cur_gr = self.group
1508 groups.insert(0, cur_gr)
1509 while 1:
1510 gr = getattr(cur_gr, 'parent_group', None)
1511 cur_gr = cur_gr.parent_group
1512 if gr is None:
1513 break
1514 groups.insert(0, gr)
1515
1516 return groups
1517
1518 @property
1519 def groups_and_repo(self):
1520 return self.groups_with_parents, self
1521
1522 @LazyProperty
1523 def repo_path(self):
1524 """
1525 Returns base full path for that repository means where it actually
1526 exists on a filesystem
1527 """
1528 q = Session().query(RhodeCodeUi).filter(
1529 RhodeCodeUi.ui_key == self.NAME_SEP)
1530 q = q.options(FromCache("sql_cache_short", "repository_repo_path"))
1531 return q.one().ui_value
1532
1533 @property
1534 def repo_full_path(self):
1535 p = [self.repo_path]
1536 # we need to split the name by / since this is how we store the
1537 # names in the database, but that eventually needs to be converted
1538 # into a valid system path
1539 p += self.repo_name.split(self.NAME_SEP)
1540 return os.path.join(*map(safe_unicode, p))
1541
1542 @property
1543 def cache_keys(self):
1544 """
1545 Returns associated cache keys for that repo
1546 """
1547 return CacheKey.query()\
1548 .filter(CacheKey.cache_args == self.repo_name)\
1549 .order_by(CacheKey.cache_key)\
1550 .all()
1551
1552 def get_new_name(self, repo_name):
1553 """
1554 returns new full repository name based on assigned group and new new
1555
1556 :param group_name:
1557 """
1558 path_prefix = self.group.full_path_splitted if self.group else []
1559 return self.NAME_SEP.join(path_prefix + [repo_name])
1560
1561 @property
1562 def _config(self):
1563 """
1564 Returns db based config object.
1565 """
1566 from rhodecode.lib.utils import make_db_config
1567 return make_db_config(clear_session=False, repo=self)
1568
1569 def permissions(self, with_admins=True, with_owner=True):
1570 q = UserRepoToPerm.query().filter(UserRepoToPerm.repository == self)
1571 q = q.options(joinedload(UserRepoToPerm.repository),
1572 joinedload(UserRepoToPerm.user),
1573 joinedload(UserRepoToPerm.permission),)
1574
1575 # get owners and admins and permissions. We do a trick of re-writing
1576 # objects from sqlalchemy to named-tuples due to sqlalchemy session
1577 # has a global reference and changing one object propagates to all
1578 # others. This means if admin is also an owner admin_row that change
1579 # would propagate to both objects
1580 perm_rows = []
1581 for _usr in q.all():
1582 usr = AttributeDict(_usr.user.get_dict())
1583 usr.permission = _usr.permission.permission_name
1584 perm_rows.append(usr)
1585
1586 # filter the perm rows by 'default' first and then sort them by
1587 # admin,write,read,none permissions sorted again alphabetically in
1588 # each group
1589 perm_rows = sorted(perm_rows, key=display_sort)
1590
1591 _admin_perm = 'repository.admin'
1592 owner_row = []
1593 if with_owner:
1594 usr = AttributeDict(self.user.get_dict())
1595 usr.owner_row = True
1596 usr.permission = _admin_perm
1597 owner_row.append(usr)
1598
1599 super_admin_rows = []
1600 if with_admins:
1601 for usr in User.get_all_super_admins():
1602 # if this admin is also owner, don't double the record
1603 if usr.user_id == owner_row[0].user_id:
1604 owner_row[0].admin_row = True
1605 else:
1606 usr = AttributeDict(usr.get_dict())
1607 usr.admin_row = True
1608 usr.permission = _admin_perm
1609 super_admin_rows.append(usr)
1610
1611 return super_admin_rows + owner_row + perm_rows
1612
1613 def permission_user_groups(self):
1614 q = UserGroupRepoToPerm.query().filter(
1615 UserGroupRepoToPerm.repository == self)
1616 q = q.options(joinedload(UserGroupRepoToPerm.repository),
1617 joinedload(UserGroupRepoToPerm.users_group),
1618 joinedload(UserGroupRepoToPerm.permission),)
1619
1620 perm_rows = []
1621 for _user_group in q.all():
1622 usr = AttributeDict(_user_group.users_group.get_dict())
1623 usr.permission = _user_group.permission.permission_name
1624 perm_rows.append(usr)
1625
1626 return perm_rows
1627
1628 def get_api_data(self, include_secrets=False):
1629 """
1630 Common function for generating repo api data
1631
1632 :param include_secrets: See :meth:`User.get_api_data`.
1633
1634 """
1635 # TODO: mikhail: Here there is an anti-pattern, we probably need to
1636 # move this methods on models level.
1637 from rhodecode.model.settings import SettingsModel
1638
1639 repo = self
1640 _user_id, _time, _reason = self.locked
1641
1642 data = {
1643 'repo_id': repo.repo_id,
1644 'repo_name': repo.repo_name,
1645 'repo_type': repo.repo_type,
1646 'clone_uri': repo.clone_uri or '',
1647 'url': url('summary_home', repo_name=self.repo_name, qualified=True),
1648 'private': repo.private,
1649 'created_on': repo.created_on,
1650 'description': repo.description,
1651 'landing_rev': repo.landing_rev,
1652 'owner': repo.user.username,
1653 'fork_of': repo.fork.repo_name if repo.fork else None,
1654 'enable_statistics': repo.enable_statistics,
1655 'enable_locking': repo.enable_locking,
1656 'enable_downloads': repo.enable_downloads,
1657 'last_changeset': repo.changeset_cache,
1658 'locked_by': User.get(_user_id).get_api_data(
1659 include_secrets=include_secrets) if _user_id else None,
1660 'locked_date': time_to_datetime(_time) if _time else None,
1661 'lock_reason': _reason if _reason else None,
1662 }
1663
1664 # TODO: mikhail: should be per-repo settings here
1665 rc_config = SettingsModel().get_all_settings()
1666 repository_fields = str2bool(
1667 rc_config.get('rhodecode_repository_fields'))
1668 if repository_fields:
1669 for f in self.extra_fields:
1670 data[f.field_key_prefixed] = f.field_value
1671
1672 return data
1673
1674 @classmethod
1675 def lock(cls, repo, user_id, lock_time=None, lock_reason=None):
1676 if not lock_time:
1677 lock_time = time.time()
1678 if not lock_reason:
1679 lock_reason = cls.LOCK_AUTOMATIC
1680 repo.locked = [user_id, lock_time, lock_reason]
1681 Session().add(repo)
1682 Session().commit()
1683
1684 @classmethod
1685 def unlock(cls, repo):
1686 repo.locked = None
1687 Session().add(repo)
1688 Session().commit()
1689
1690 @classmethod
1691 def getlock(cls, repo):
1692 return repo.locked
1693
1694 def is_user_lock(self, user_id):
1695 if self.lock[0]:
1696 lock_user_id = safe_int(self.lock[0])
1697 user_id = safe_int(user_id)
1698 # both are ints, and they are equal
1699 return all([lock_user_id, user_id]) and lock_user_id == user_id
1700
1701 return False
1702
1703 def get_locking_state(self, action, user_id, only_when_enabled=True):
1704 """
1705 Checks locking on this repository, if locking is enabled and lock is
1706 present returns a tuple of make_lock, locked, locked_by.
1707 make_lock can have 3 states None (do nothing) True, make lock
1708 False release lock, This value is later propagated to hooks, which
1709 do the locking. Think about this as signals passed to hooks what to do.
1710
1711 """
1712 # TODO: johbo: This is part of the business logic and should be moved
1713 # into the RepositoryModel.
1714
1715 if action not in ('push', 'pull'):
1716 raise ValueError("Invalid action value: %s" % repr(action))
1717
1718 # defines if locked error should be thrown to user
1719 currently_locked = False
1720 # defines if new lock should be made, tri-state
1721 make_lock = None
1722 repo = self
1723 user = User.get(user_id)
1724
1725 lock_info = repo.locked
1726
1727 if repo and (repo.enable_locking or not only_when_enabled):
1728 if action == 'push':
1729 # check if it's already locked !, if it is compare users
1730 locked_by_user_id = lock_info[0]
1731 if user.user_id == locked_by_user_id:
1732 log.debug(
1733 'Got `push` action from user %s, now unlocking', user)
1734 # unlock if we have push from user who locked
1735 make_lock = False
1736 else:
1737 # we're not the same user who locked, ban with
1738 # code defined in settings (default is 423 HTTP Locked) !
1739 log.debug('Repo %s is currently locked by %s', repo, user)
1740 currently_locked = True
1741 elif action == 'pull':
1742 # [0] user [1] date
1743 if lock_info[0] and lock_info[1]:
1744 log.debug('Repo %s is currently locked by %s', repo, user)
1745 currently_locked = True
1746 else:
1747 log.debug('Setting lock on repo %s by %s', repo, user)
1748 make_lock = True
1749
1750 else:
1751 log.debug('Repository %s do not have locking enabled', repo)
1752
1753 log.debug('FINAL locking values make_lock:%s,locked:%s,locked_by:%s',
1754 make_lock, currently_locked, lock_info)
1755
1756 from rhodecode.lib.auth import HasRepoPermissionAny
1757 perm_check = HasRepoPermissionAny('repository.write', 'repository.admin')
1758 if make_lock and not perm_check(repo_name=repo.repo_name, user=user):
1759 # if we don't have at least write permission we cannot make a lock
1760 log.debug('lock state reset back to FALSE due to lack '
1761 'of at least read permission')
1762 make_lock = False
1763
1764 return make_lock, currently_locked, lock_info
1765
1766 @property
1767 def last_db_change(self):
1768 return self.updated_on
1769
1770 @property
1771 def clone_uri_hidden(self):
1772 clone_uri = self.clone_uri
1773 if clone_uri:
1774 import urlobject
1775 url_obj = urlobject.URLObject(clone_uri)
1776 if url_obj.password:
1777 clone_uri = url_obj.with_password('*****')
1778 return clone_uri
1779
1780 def clone_url(self, **override):
1781 qualified_home_url = url('home', qualified=True)
1782
1783 uri_tmpl = None
1784 if 'with_id' in override:
1785 uri_tmpl = self.DEFAULT_CLONE_URI_ID
1786 del override['with_id']
1787
1788 if 'uri_tmpl' in override:
1789 uri_tmpl = override['uri_tmpl']
1790 del override['uri_tmpl']
1791
1792 # we didn't override our tmpl from **overrides
1793 if not uri_tmpl:
1794 uri_tmpl = self.DEFAULT_CLONE_URI
1795 try:
1796 from pylons import tmpl_context as c
1797 uri_tmpl = c.clone_uri_tmpl
1798 except Exception:
1799 # in any case if we call this outside of request context,
1800 # ie, not having tmpl_context set up
1801 pass
1802
1803 return get_clone_url(uri_tmpl=uri_tmpl,
1804 qualifed_home_url=qualified_home_url,
1805 repo_name=self.repo_name,
1806 repo_id=self.repo_id, **override)
1807
1808 def set_state(self, state):
1809 self.repo_state = state
1810 Session().add(self)
1811 #==========================================================================
1812 # SCM PROPERTIES
1813 #==========================================================================
1814
1815 def get_commit(self, commit_id=None, commit_idx=None, pre_load=None):
1816 return get_commit_safe(
1817 self.scm_instance(), commit_id, commit_idx, pre_load=pre_load)
1818
1819 def get_changeset(self, rev=None, pre_load=None):
1820 warnings.warn("Use get_commit", DeprecationWarning)
1821 commit_id = None
1822 commit_idx = None
1823 if isinstance(rev, basestring):
1824 commit_id = rev
1825 else:
1826 commit_idx = rev
1827 return self.get_commit(commit_id=commit_id, commit_idx=commit_idx,
1828 pre_load=pre_load)
1829
1830 def get_landing_commit(self):
1831 """
1832 Returns landing commit, or if that doesn't exist returns the tip
1833 """
1834 _rev_type, _rev = self.landing_rev
1835 commit = self.get_commit(_rev)
1836 if isinstance(commit, EmptyCommit):
1837 return self.get_commit()
1838 return commit
1839
1840 def update_commit_cache(self, cs_cache=None, config=None):
1841 """
1842 Update cache of last changeset for repository, keys should be::
1843
1844 short_id
1845 raw_id
1846 revision
1847 parents
1848 message
1849 date
1850 author
1851
1852 :param cs_cache:
1853 """
1854 from rhodecode.lib.vcs.backends.base import BaseChangeset
1855 if cs_cache is None:
1856 # use no-cache version here
1857 scm_repo = self.scm_instance(cache=False, config=config)
1858 if scm_repo:
1859 cs_cache = scm_repo.get_commit(
1860 pre_load=["author", "date", "message", "parents"])
1861 else:
1862 cs_cache = EmptyCommit()
1863
1864 if isinstance(cs_cache, BaseChangeset):
1865 cs_cache = cs_cache.__json__()
1866
1867 def is_outdated(new_cs_cache):
1868 if (new_cs_cache['raw_id'] != self.changeset_cache['raw_id'] or
1869 new_cs_cache['revision'] != self.changeset_cache['revision']):
1870 return True
1871 return False
1872
1873 # check if we have maybe already latest cached revision
1874 if is_outdated(cs_cache) or not self.changeset_cache:
1875 _default = datetime.datetime.fromtimestamp(0)
1876 last_change = cs_cache.get('date') or _default
1877 log.debug('updated repo %s with new cs cache %s',
1878 self.repo_name, cs_cache)
1879 self.updated_on = last_change
1880 self.changeset_cache = cs_cache
1881 Session().add(self)
1882 Session().commit()
1883 else:
1884 log.debug('Skipping update_commit_cache for repo:`%s` '
1885 'commit already with latest changes', self.repo_name)
1886
1887 @property
1888 def tip(self):
1889 return self.get_commit('tip')
1890
1891 @property
1892 def author(self):
1893 return self.tip.author
1894
1895 @property
1896 def last_change(self):
1897 return self.scm_instance().last_change
1898
1899 def get_comments(self, revisions=None):
1900 """
1901 Returns comments for this repository grouped by revisions
1902
1903 :param revisions: filter query by revisions only
1904 """
1905 cmts = ChangesetComment.query()\
1906 .filter(ChangesetComment.repo == self)
1907 if revisions:
1908 cmts = cmts.filter(ChangesetComment.revision.in_(revisions))
1909 grouped = collections.defaultdict(list)
1910 for cmt in cmts.all():
1911 grouped[cmt.revision].append(cmt)
1912 return grouped
1913
1914 def statuses(self, revisions=None):
1915 """
1916 Returns statuses for this repository
1917
1918 :param revisions: list of revisions to get statuses for
1919 """
1920 statuses = ChangesetStatus.query()\
1921 .filter(ChangesetStatus.repo == self)\
1922 .filter(ChangesetStatus.version == 0)
1923
1924 if revisions:
1925 # Try doing the filtering in chunks to avoid hitting limits
1926 size = 500
1927 status_results = []
1928 for chunk in xrange(0, len(revisions), size):
1929 status_results += statuses.filter(
1930 ChangesetStatus.revision.in_(
1931 revisions[chunk: chunk+size])
1932 ).all()
1933 else:
1934 status_results = statuses.all()
1935
1936 grouped = {}
1937
1938 # maybe we have open new pullrequest without a status?
1939 stat = ChangesetStatus.STATUS_UNDER_REVIEW
1940 status_lbl = ChangesetStatus.get_status_lbl(stat)
1941 for pr in PullRequest.query().filter(PullRequest.source_repo == self).all():
1942 for rev in pr.revisions:
1943 pr_id = pr.pull_request_id
1944 pr_repo = pr.target_repo.repo_name
1945 grouped[rev] = [stat, status_lbl, pr_id, pr_repo]
1946
1947 for stat in status_results:
1948 pr_id = pr_repo = None
1949 if stat.pull_request:
1950 pr_id = stat.pull_request.pull_request_id
1951 pr_repo = stat.pull_request.target_repo.repo_name
1952 grouped[stat.revision] = [str(stat.status), stat.status_lbl,
1953 pr_id, pr_repo]
1954 return grouped
1955
1956 # ==========================================================================
1957 # SCM CACHE INSTANCE
1958 # ==========================================================================
1959
1960 def scm_instance(self, **kwargs):
1961 import rhodecode
1962
1963 # Passing a config will not hit the cache currently only used
1964 # for repo2dbmapper
1965 config = kwargs.pop('config', None)
1966 cache = kwargs.pop('cache', None)
1967 full_cache = str2bool(rhodecode.CONFIG.get('vcs_full_cache'))
1968 # if cache is NOT defined use default global, else we have a full
1969 # control over cache behaviour
1970 if cache is None and full_cache and not config:
1971 return self._get_instance_cached()
1972 return self._get_instance(cache=bool(cache), config=config)
1973
1974 def _get_instance_cached(self):
1975 @cache_region('long_term')
1976 def _get_repo(cache_key):
1977 return self._get_instance()
1978
1979 invalidator_context = CacheKey.repo_context_cache(
1980 _get_repo, self.repo_name, None, thread_scoped=True)
1981
1982 with invalidator_context as context:
1983 context.invalidate()
1984 repo = context.compute()
1985
1986 return repo
1987
1988 def _get_instance(self, cache=True, config=None):
1989 config = config or self._config
1990 custom_wire = {
1991 'cache': cache # controls the vcs.remote cache
1992 }
1993
1994 repo = get_vcs_instance(
1995 repo_path=safe_str(self.repo_full_path),
1996 config=config,
1997 with_wire=custom_wire,
1998 create=False)
1999
2000 return repo
2001
2002 def __json__(self):
2003 return {'landing_rev': self.landing_rev}
2004
2005 def get_dict(self):
2006
2007 # Since we transformed `repo_name` to a hybrid property, we need to
2008 # keep compatibility with the code which uses `repo_name` field.
2009
2010 result = super(Repository, self).get_dict()
2011 result['repo_name'] = result.pop('_repo_name', None)
2012 return result
2013
2014
2015 class RepoGroup(Base, BaseModel):
2016 __tablename__ = 'groups'
2017 __table_args__ = (
2018 UniqueConstraint('group_name', 'group_parent_id'),
2019 CheckConstraint('group_id != group_parent_id'),
2020 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2021 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2022 )
2023 __mapper_args__ = {'order_by': 'group_name'}
2024
2025 CHOICES_SEPARATOR = '/' # used to generate select2 choices for nested groups
2026
2027 group_id = Column("group_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2028 group_name = Column("group_name", String(255), nullable=False, unique=True, default=None)
2029 group_parent_id = Column("group_parent_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=None, default=None)
2030 group_description = Column("group_description", String(10000), nullable=True, unique=None, default=None)
2031 enable_locking = Column("enable_locking", Boolean(), nullable=False, unique=None, default=False)
2032 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None)
2033 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
2034
2035 repo_group_to_perm = relationship('UserRepoGroupToPerm', cascade='all', order_by='UserRepoGroupToPerm.group_to_perm_id')
2036 users_group_to_perm = relationship('UserGroupRepoGroupToPerm', cascade='all')
2037 parent_group = relationship('RepoGroup', remote_side=group_id)
2038 user = relationship('User')
2039
2040 def __init__(self, group_name='', parent_group=None):
2041 self.group_name = group_name
2042 self.parent_group = parent_group
2043
2044 def __unicode__(self):
2045 return u"<%s('id:%s:%s')>" % (self.__class__.__name__, self.group_id,
2046 self.group_name)
2047
2048 @classmethod
2049 def _generate_choice(cls, repo_group):
2050 from webhelpers.html import literal as _literal
2051 _name = lambda k: _literal(cls.CHOICES_SEPARATOR.join(k))
2052 return repo_group.group_id, _name(repo_group.full_path_splitted)
2053
2054 @classmethod
2055 def groups_choices(cls, groups=None, show_empty_group=True):
2056 if not groups:
2057 groups = cls.query().all()
2058
2059 repo_groups = []
2060 if show_empty_group:
2061 repo_groups = [('-1', u'-- %s --' % _('No parent'))]
2062
2063 repo_groups.extend([cls._generate_choice(x) for x in groups])
2064
2065 repo_groups = sorted(
2066 repo_groups, key=lambda t: t[1].split(cls.CHOICES_SEPARATOR)[0])
2067 return repo_groups
2068
2069 @classmethod
2070 def url_sep(cls):
2071 return URL_SEP
2072
2073 @classmethod
2074 def get_by_group_name(cls, group_name, cache=False, case_insensitive=False):
2075 if case_insensitive:
2076 gr = cls.query().filter(func.lower(cls.group_name)
2077 == func.lower(group_name))
2078 else:
2079 gr = cls.query().filter(cls.group_name == group_name)
2080 if cache:
2081 gr = gr.options(FromCache(
2082 "sql_cache_short",
2083 "get_group_%s" % _hash_key(group_name)))
2084 return gr.scalar()
2085
2086 @classmethod
2087 def get_all_repo_groups(cls, user_id=Optional(None), group_id=Optional(None),
2088 case_insensitive=True):
2089 q = RepoGroup.query()
2090
2091 if not isinstance(user_id, Optional):
2092 q = q.filter(RepoGroup.user_id == user_id)
2093
2094 if not isinstance(group_id, Optional):
2095 q = q.filter(RepoGroup.group_parent_id == group_id)
2096
2097 if case_insensitive:
2098 q = q.order_by(func.lower(RepoGroup.group_name))
2099 else:
2100 q = q.order_by(RepoGroup.group_name)
2101 return q.all()
2102
2103 @property
2104 def parents(self):
2105 parents_recursion_limit = 10
2106 groups = []
2107 if self.parent_group is None:
2108 return groups
2109 cur_gr = self.parent_group
2110 groups.insert(0, cur_gr)
2111 cnt = 0
2112 while 1:
2113 cnt += 1
2114 gr = getattr(cur_gr, 'parent_group', None)
2115 cur_gr = cur_gr.parent_group
2116 if gr is None:
2117 break
2118 if cnt == parents_recursion_limit:
2119 # this will prevent accidental infinit loops
2120 log.error(('more than %s parents found for group %s, stopping '
2121 'recursive parent fetching' % (parents_recursion_limit, self)))
2122 break
2123
2124 groups.insert(0, gr)
2125 return groups
2126
2127 @property
2128 def children(self):
2129 return RepoGroup.query().filter(RepoGroup.parent_group == self)
2130
2131 @property
2132 def name(self):
2133 return self.group_name.split(RepoGroup.url_sep())[-1]
2134
2135 @property
2136 def full_path(self):
2137 return self.group_name
2138
2139 @property
2140 def full_path_splitted(self):
2141 return self.group_name.split(RepoGroup.url_sep())
2142
2143 @property
2144 def repositories(self):
2145 return Repository.query()\
2146 .filter(Repository.group == self)\
2147 .order_by(Repository.repo_name)
2148
2149 @property
2150 def repositories_recursive_count(self):
2151 cnt = self.repositories.count()
2152
2153 def children_count(group):
2154 cnt = 0
2155 for child in group.children:
2156 cnt += child.repositories.count()
2157 cnt += children_count(child)
2158 return cnt
2159
2160 return cnt + children_count(self)
2161
2162 def _recursive_objects(self, include_repos=True):
2163 all_ = []
2164
2165 def _get_members(root_gr):
2166 if include_repos:
2167 for r in root_gr.repositories:
2168 all_.append(r)
2169 childs = root_gr.children.all()
2170 if childs:
2171 for gr in childs:
2172 all_.append(gr)
2173 _get_members(gr)
2174
2175 _get_members(self)
2176 return [self] + all_
2177
2178 def recursive_groups_and_repos(self):
2179 """
2180 Recursive return all groups, with repositories in those groups
2181 """
2182 return self._recursive_objects()
2183
2184 def recursive_groups(self):
2185 """
2186 Returns all children groups for this group including children of children
2187 """
2188 return self._recursive_objects(include_repos=False)
2189
2190 def get_new_name(self, group_name):
2191 """
2192 returns new full group name based on parent and new name
2193
2194 :param group_name:
2195 """
2196 path_prefix = (self.parent_group.full_path_splitted if
2197 self.parent_group else [])
2198 return RepoGroup.url_sep().join(path_prefix + [group_name])
2199
2200 def permissions(self, with_admins=True, with_owner=True):
2201 q = UserRepoGroupToPerm.query().filter(UserRepoGroupToPerm.group == self)
2202 q = q.options(joinedload(UserRepoGroupToPerm.group),
2203 joinedload(UserRepoGroupToPerm.user),
2204 joinedload(UserRepoGroupToPerm.permission),)
2205
2206 # get owners and admins and permissions. We do a trick of re-writing
2207 # objects from sqlalchemy to named-tuples due to sqlalchemy session
2208 # has a global reference and changing one object propagates to all
2209 # others. This means if admin is also an owner admin_row that change
2210 # would propagate to both objects
2211 perm_rows = []
2212 for _usr in q.all():
2213 usr = AttributeDict(_usr.user.get_dict())
2214 usr.permission = _usr.permission.permission_name
2215 perm_rows.append(usr)
2216
2217 # filter the perm rows by 'default' first and then sort them by
2218 # admin,write,read,none permissions sorted again alphabetically in
2219 # each group
2220 perm_rows = sorted(perm_rows, key=display_sort)
2221
2222 _admin_perm = 'group.admin'
2223 owner_row = []
2224 if with_owner:
2225 usr = AttributeDict(self.user.get_dict())
2226 usr.owner_row = True
2227 usr.permission = _admin_perm
2228 owner_row.append(usr)
2229
2230 super_admin_rows = []
2231 if with_admins:
2232 for usr in User.get_all_super_admins():
2233 # if this admin is also owner, don't double the record
2234 if usr.user_id == owner_row[0].user_id:
2235 owner_row[0].admin_row = True
2236 else:
2237 usr = AttributeDict(usr.get_dict())
2238 usr.admin_row = True
2239 usr.permission = _admin_perm
2240 super_admin_rows.append(usr)
2241
2242 return super_admin_rows + owner_row + perm_rows
2243
2244 def permission_user_groups(self):
2245 q = UserGroupRepoGroupToPerm.query().filter(UserGroupRepoGroupToPerm.group == self)
2246 q = q.options(joinedload(UserGroupRepoGroupToPerm.group),
2247 joinedload(UserGroupRepoGroupToPerm.users_group),
2248 joinedload(UserGroupRepoGroupToPerm.permission),)
2249
2250 perm_rows = []
2251 for _user_group in q.all():
2252 usr = AttributeDict(_user_group.users_group.get_dict())
2253 usr.permission = _user_group.permission.permission_name
2254 perm_rows.append(usr)
2255
2256 return perm_rows
2257
2258 def get_api_data(self):
2259 """
2260 Common function for generating api data
2261
2262 """
2263 group = self
2264 data = {
2265 'group_id': group.group_id,
2266 'group_name': group.group_name,
2267 'group_description': group.group_description,
2268 'parent_group': group.parent_group.group_name if group.parent_group else None,
2269 'repositories': [x.repo_name for x in group.repositories],
2270 'owner': group.user.username,
2271 }
2272 return data
2273
2274
2275 class Permission(Base, BaseModel):
2276 __tablename__ = 'permissions'
2277 __table_args__ = (
2278 Index('p_perm_name_idx', 'permission_name'),
2279 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2280 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2281 )
2282 PERMS = [
2283 ('hg.admin', _('RhodeCode Super Administrator')),
2284
2285 ('repository.none', _('Repository no access')),
2286 ('repository.read', _('Repository read access')),
2287 ('repository.write', _('Repository write access')),
2288 ('repository.admin', _('Repository admin access')),
2289
2290 ('group.none', _('Repository group no access')),
2291 ('group.read', _('Repository group read access')),
2292 ('group.write', _('Repository group write access')),
2293 ('group.admin', _('Repository group admin access')),
2294
2295 ('usergroup.none', _('User group no access')),
2296 ('usergroup.read', _('User group read access')),
2297 ('usergroup.write', _('User group write access')),
2298 ('usergroup.admin', _('User group admin access')),
2299
2300 ('hg.repogroup.create.false', _('Repository Group creation disabled')),
2301 ('hg.repogroup.create.true', _('Repository Group creation enabled')),
2302
2303 ('hg.usergroup.create.false', _('User Group creation disabled')),
2304 ('hg.usergroup.create.true', _('User Group creation enabled')),
2305
2306 ('hg.create.none', _('Repository creation disabled')),
2307 ('hg.create.repository', _('Repository creation enabled')),
2308 ('hg.create.write_on_repogroup.true', _('Repository creation enabled with write permission to a repository group')),
2309 ('hg.create.write_on_repogroup.false', _('Repository creation disabled with write permission to a repository group')),
2310
2311 ('hg.fork.none', _('Repository forking disabled')),
2312 ('hg.fork.repository', _('Repository forking enabled')),
2313
2314 ('hg.register.none', _('Registration disabled')),
2315 ('hg.register.manual_activate', _('User Registration with manual account activation')),
2316 ('hg.register.auto_activate', _('User Registration with automatic account activation')),
2317
2318 ('hg.extern_activate.manual', _('Manual activation of external account')),
2319 ('hg.extern_activate.auto', _('Automatic activation of external account')),
2320
2321 ('hg.inherit_default_perms.false', _('Inherit object permissions from default user disabled')),
2322 ('hg.inherit_default_perms.true', _('Inherit object permissions from default user enabled')),
2323 ]
2324
2325 # definition of system default permissions for DEFAULT user
2326 DEFAULT_USER_PERMISSIONS = [
2327 'repository.read',
2328 'group.read',
2329 'usergroup.read',
2330 'hg.create.repository',
2331 'hg.repogroup.create.false',
2332 'hg.usergroup.create.false',
2333 'hg.create.write_on_repogroup.true',
2334 'hg.fork.repository',
2335 'hg.register.manual_activate',
2336 'hg.extern_activate.auto',
2337 'hg.inherit_default_perms.true',
2338 ]
2339
2340 # defines which permissions are more important higher the more important
2341 # Weight defines which permissions are more important.
2342 # The higher number the more important.
2343 PERM_WEIGHTS = {
2344 'repository.none': 0,
2345 'repository.read': 1,
2346 'repository.write': 3,
2347 'repository.admin': 4,
2348
2349 'group.none': 0,
2350 'group.read': 1,
2351 'group.write': 3,
2352 'group.admin': 4,
2353
2354 'usergroup.none': 0,
2355 'usergroup.read': 1,
2356 'usergroup.write': 3,
2357 'usergroup.admin': 4,
2358
2359 'hg.repogroup.create.false': 0,
2360 'hg.repogroup.create.true': 1,
2361
2362 'hg.usergroup.create.false': 0,
2363 'hg.usergroup.create.true': 1,
2364
2365 'hg.fork.none': 0,
2366 'hg.fork.repository': 1,
2367 'hg.create.none': 0,
2368 'hg.create.repository': 1
2369 }
2370
2371 permission_id = Column("permission_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2372 permission_name = Column("permission_name", String(255), nullable=True, unique=None, default=None)
2373 permission_longname = Column("permission_longname", String(255), nullable=True, unique=None, default=None)
2374
2375 def __unicode__(self):
2376 return u"<%s('%s:%s')>" % (
2377 self.__class__.__name__, self.permission_id, self.permission_name
2378 )
2379
2380 @classmethod
2381 def get_by_key(cls, key):
2382 return cls.query().filter(cls.permission_name == key).scalar()
2383
2384 @classmethod
2385 def get_default_repo_perms(cls, user_id, repo_id=None):
2386 q = Session().query(UserRepoToPerm, Repository, Permission)\
2387 .join((Permission, UserRepoToPerm.permission_id == Permission.permission_id))\
2388 .join((Repository, UserRepoToPerm.repository_id == Repository.repo_id))\
2389 .filter(UserRepoToPerm.user_id == user_id)
2390 if repo_id:
2391 q = q.filter(UserRepoToPerm.repository_id == repo_id)
2392 return q.all()
2393
2394 @classmethod
2395 def get_default_repo_perms_from_user_group(cls, user_id, repo_id=None):
2396 q = Session().query(UserGroupRepoToPerm, Repository, Permission)\
2397 .join(
2398 Permission,
2399 UserGroupRepoToPerm.permission_id == Permission.permission_id)\
2400 .join(
2401 Repository,
2402 UserGroupRepoToPerm.repository_id == Repository.repo_id)\
2403 .join(
2404 UserGroup,
2405 UserGroupRepoToPerm.users_group_id ==
2406 UserGroup.users_group_id)\
2407 .join(
2408 UserGroupMember,
2409 UserGroupRepoToPerm.users_group_id ==
2410 UserGroupMember.users_group_id)\
2411 .filter(
2412 UserGroupMember.user_id == user_id,
2413 UserGroup.users_group_active == true())
2414 if repo_id:
2415 q = q.filter(UserGroupRepoToPerm.repository_id == repo_id)
2416 return q.all()
2417
2418 @classmethod
2419 def get_default_group_perms(cls, user_id, repo_group_id=None):
2420 q = Session().query(UserRepoGroupToPerm, RepoGroup, Permission)\
2421 .join((Permission, UserRepoGroupToPerm.permission_id == Permission.permission_id))\
2422 .join((RepoGroup, UserRepoGroupToPerm.group_id == RepoGroup.group_id))\
2423 .filter(UserRepoGroupToPerm.user_id == user_id)
2424 if repo_group_id:
2425 q = q.filter(UserRepoGroupToPerm.group_id == repo_group_id)
2426 return q.all()
2427
2428 @classmethod
2429 def get_default_group_perms_from_user_group(
2430 cls, user_id, repo_group_id=None):
2431 q = Session().query(UserGroupRepoGroupToPerm, RepoGroup, Permission)\
2432 .join(
2433 Permission,
2434 UserGroupRepoGroupToPerm.permission_id ==
2435 Permission.permission_id)\
2436 .join(
2437 RepoGroup,
2438 UserGroupRepoGroupToPerm.group_id == RepoGroup.group_id)\
2439 .join(
2440 UserGroup,
2441 UserGroupRepoGroupToPerm.users_group_id ==
2442 UserGroup.users_group_id)\
2443 .join(
2444 UserGroupMember,
2445 UserGroupRepoGroupToPerm.users_group_id ==
2446 UserGroupMember.users_group_id)\
2447 .filter(
2448 UserGroupMember.user_id == user_id,
2449 UserGroup.users_group_active == true())
2450 if repo_group_id:
2451 q = q.filter(UserGroupRepoGroupToPerm.group_id == repo_group_id)
2452 return q.all()
2453
2454 @classmethod
2455 def get_default_user_group_perms(cls, user_id, user_group_id=None):
2456 q = Session().query(UserUserGroupToPerm, UserGroup, Permission)\
2457 .join((Permission, UserUserGroupToPerm.permission_id == Permission.permission_id))\
2458 .join((UserGroup, UserUserGroupToPerm.user_group_id == UserGroup.users_group_id))\
2459 .filter(UserUserGroupToPerm.user_id == user_id)
2460 if user_group_id:
2461 q = q.filter(UserUserGroupToPerm.user_group_id == user_group_id)
2462 return q.all()
2463
2464 @classmethod
2465 def get_default_user_group_perms_from_user_group(
2466 cls, user_id, user_group_id=None):
2467 TargetUserGroup = aliased(UserGroup, name='target_user_group')
2468 q = Session().query(UserGroupUserGroupToPerm, UserGroup, Permission)\
2469 .join(
2470 Permission,
2471 UserGroupUserGroupToPerm.permission_id ==
2472 Permission.permission_id)\
2473 .join(
2474 TargetUserGroup,
2475 UserGroupUserGroupToPerm.target_user_group_id ==
2476 TargetUserGroup.users_group_id)\
2477 .join(
2478 UserGroup,
2479 UserGroupUserGroupToPerm.user_group_id ==
2480 UserGroup.users_group_id)\
2481 .join(
2482 UserGroupMember,
2483 UserGroupUserGroupToPerm.user_group_id ==
2484 UserGroupMember.users_group_id)\
2485 .filter(
2486 UserGroupMember.user_id == user_id,
2487 UserGroup.users_group_active == true())
2488 if user_group_id:
2489 q = q.filter(
2490 UserGroupUserGroupToPerm.user_group_id == user_group_id)
2491
2492 return q.all()
2493
2494
2495 class UserRepoToPerm(Base, BaseModel):
2496 __tablename__ = 'repo_to_perm'
2497 __table_args__ = (
2498 UniqueConstraint('user_id', 'repository_id', 'permission_id'),
2499 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2500 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2501 )
2502 repo_to_perm_id = Column("repo_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2503 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2504 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2505 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None)
2506
2507 user = relationship('User')
2508 repository = relationship('Repository')
2509 permission = relationship('Permission')
2510
2511 @classmethod
2512 def create(cls, user, repository, permission):
2513 n = cls()
2514 n.user = user
2515 n.repository = repository
2516 n.permission = permission
2517 Session().add(n)
2518 return n
2519
2520 def __unicode__(self):
2521 return u'<%s => %s >' % (self.user, self.repository)
2522
2523
2524 class UserUserGroupToPerm(Base, BaseModel):
2525 __tablename__ = 'user_user_group_to_perm'
2526 __table_args__ = (
2527 UniqueConstraint('user_id', 'user_group_id', 'permission_id'),
2528 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2529 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2530 )
2531 user_user_group_to_perm_id = Column("user_user_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2532 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2533 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2534 user_group_id = Column("user_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2535
2536 user = relationship('User')
2537 user_group = relationship('UserGroup')
2538 permission = relationship('Permission')
2539
2540 @classmethod
2541 def create(cls, user, user_group, permission):
2542 n = cls()
2543 n.user = user
2544 n.user_group = user_group
2545 n.permission = permission
2546 Session().add(n)
2547 return n
2548
2549 def __unicode__(self):
2550 return u'<%s => %s >' % (self.user, self.user_group)
2551
2552
2553 class UserToPerm(Base, BaseModel):
2554 __tablename__ = 'user_to_perm'
2555 __table_args__ = (
2556 UniqueConstraint('user_id', 'permission_id'),
2557 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2558 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2559 )
2560 user_to_perm_id = Column("user_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2561 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2562 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2563
2564 user = relationship('User')
2565 permission = relationship('Permission', lazy='joined')
2566
2567 def __unicode__(self):
2568 return u'<%s => %s >' % (self.user, self.permission)
2569
2570
2571 class UserGroupRepoToPerm(Base, BaseModel):
2572 __tablename__ = 'users_group_repo_to_perm'
2573 __table_args__ = (
2574 UniqueConstraint('repository_id', 'users_group_id', 'permission_id'),
2575 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2576 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2577 )
2578 users_group_to_perm_id = Column("users_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2579 users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2580 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2581 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None)
2582
2583 users_group = relationship('UserGroup')
2584 permission = relationship('Permission')
2585 repository = relationship('Repository')
2586
2587 @classmethod
2588 def create(cls, users_group, repository, permission):
2589 n = cls()
2590 n.users_group = users_group
2591 n.repository = repository
2592 n.permission = permission
2593 Session().add(n)
2594 return n
2595
2596 def __unicode__(self):
2597 return u'<UserGroupRepoToPerm:%s => %s >' % (self.users_group, self.repository)
2598
2599
2600 class UserGroupUserGroupToPerm(Base, BaseModel):
2601 __tablename__ = 'user_group_user_group_to_perm'
2602 __table_args__ = (
2603 UniqueConstraint('target_user_group_id', 'user_group_id', 'permission_id'),
2604 CheckConstraint('target_user_group_id != user_group_id'),
2605 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2606 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2607 )
2608 user_group_user_group_to_perm_id = Column("user_group_user_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2609 target_user_group_id = Column("target_user_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2610 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2611 user_group_id = Column("user_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2612
2613 target_user_group = relationship('UserGroup', primaryjoin='UserGroupUserGroupToPerm.target_user_group_id==UserGroup.users_group_id')
2614 user_group = relationship('UserGroup', primaryjoin='UserGroupUserGroupToPerm.user_group_id==UserGroup.users_group_id')
2615 permission = relationship('Permission')
2616
2617 @classmethod
2618 def create(cls, target_user_group, user_group, permission):
2619 n = cls()
2620 n.target_user_group = target_user_group
2621 n.user_group = user_group
2622 n.permission = permission
2623 Session().add(n)
2624 return n
2625
2626 def __unicode__(self):
2627 return u'<UserGroupUserGroup:%s => %s >' % (self.target_user_group, self.user_group)
2628
2629
2630 class UserGroupToPerm(Base, BaseModel):
2631 __tablename__ = 'users_group_to_perm'
2632 __table_args__ = (
2633 UniqueConstraint('users_group_id', 'permission_id',),
2634 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2635 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2636 )
2637 users_group_to_perm_id = Column("users_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2638 users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2639 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2640
2641 users_group = relationship('UserGroup')
2642 permission = relationship('Permission')
2643
2644
2645 class UserRepoGroupToPerm(Base, BaseModel):
2646 __tablename__ = 'user_repo_group_to_perm'
2647 __table_args__ = (
2648 UniqueConstraint('user_id', 'group_id', 'permission_id'),
2649 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2650 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2651 )
2652
2653 group_to_perm_id = Column("group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2654 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2655 group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=False, unique=None, default=None)
2656 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2657
2658 user = relationship('User')
2659 group = relationship('RepoGroup')
2660 permission = relationship('Permission')
2661
2662 @classmethod
2663 def create(cls, user, repository_group, permission):
2664 n = cls()
2665 n.user = user
2666 n.group = repository_group
2667 n.permission = permission
2668 Session().add(n)
2669 return n
2670
2671
2672 class UserGroupRepoGroupToPerm(Base, BaseModel):
2673 __tablename__ = 'users_group_repo_group_to_perm'
2674 __table_args__ = (
2675 UniqueConstraint('users_group_id', 'group_id'),
2676 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2677 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2678 )
2679
2680 users_group_repo_group_to_perm_id = Column("users_group_repo_group_to_perm_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2681 users_group_id = Column("users_group_id", Integer(), ForeignKey('users_groups.users_group_id'), nullable=False, unique=None, default=None)
2682 group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=False, unique=None, default=None)
2683 permission_id = Column("permission_id", Integer(), ForeignKey('permissions.permission_id'), nullable=False, unique=None, default=None)
2684
2685 users_group = relationship('UserGroup')
2686 permission = relationship('Permission')
2687 group = relationship('RepoGroup')
2688
2689 @classmethod
2690 def create(cls, user_group, repository_group, permission):
2691 n = cls()
2692 n.users_group = user_group
2693 n.group = repository_group
2694 n.permission = permission
2695 Session().add(n)
2696 return n
2697
2698 def __unicode__(self):
2699 return u'<UserGroupRepoGroupToPerm:%s => %s >' % (self.users_group, self.group)
2700
2701
2702 class Statistics(Base, BaseModel):
2703 __tablename__ = 'statistics'
2704 __table_args__ = (
2705 UniqueConstraint('repository_id'),
2706 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2707 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2708 )
2709 stat_id = Column("stat_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2710 repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=True, default=None)
2711 stat_on_revision = Column("stat_on_revision", Integer(), nullable=False)
2712 commit_activity = Column("commit_activity", LargeBinary(1000000), nullable=False)#JSON data
2713 commit_activity_combined = Column("commit_activity_combined", LargeBinary(), nullable=False)#JSON data
2714 languages = Column("languages", LargeBinary(1000000), nullable=False)#JSON data
2715
2716 repository = relationship('Repository', single_parent=True)
2717
2718
2719 class UserFollowing(Base, BaseModel):
2720 __tablename__ = 'user_followings'
2721 __table_args__ = (
2722 UniqueConstraint('user_id', 'follows_repository_id'),
2723 UniqueConstraint('user_id', 'follows_user_id'),
2724 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2725 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2726 )
2727
2728 user_following_id = Column("user_following_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2729 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None)
2730 follows_repo_id = Column("follows_repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=None, default=None)
2731 follows_user_id = Column("follows_user_id", Integer(), ForeignKey('users.user_id'), nullable=True, unique=None, default=None)
2732 follows_from = Column('follows_from', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now)
2733
2734 user = relationship('User', primaryjoin='User.user_id==UserFollowing.user_id')
2735
2736 follows_user = relationship('User', primaryjoin='User.user_id==UserFollowing.follows_user_id')
2737 follows_repository = relationship('Repository', order_by='Repository.repo_name')
2738
2739 @classmethod
2740 def get_repo_followers(cls, repo_id):
2741 return cls.query().filter(cls.follows_repo_id == repo_id)
2742
2743
2744 class CacheKey(Base, BaseModel):
2745 __tablename__ = 'cache_invalidation'
2746 __table_args__ = (
2747 UniqueConstraint('cache_key'),
2748 Index('key_idx', 'cache_key'),
2749 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2750 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2751 )
2752 CACHE_TYPE_ATOM = 'ATOM'
2753 CACHE_TYPE_RSS = 'RSS'
2754 CACHE_TYPE_README = 'README'
2755
2756 cache_id = Column("cache_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
2757 cache_key = Column("cache_key", String(255), nullable=True, unique=None, default=None)
2758 cache_args = Column("cache_args", String(255), nullable=True, unique=None, default=None)
2759 cache_active = Column("cache_active", Boolean(), nullable=True, unique=None, default=False)
2760
2761 def __init__(self, cache_key, cache_args=''):
2762 self.cache_key = cache_key
2763 self.cache_args = cache_args
2764 self.cache_active = False
2765
2766 def __unicode__(self):
2767 return u"<%s('%s:%s[%s]')>" % (
2768 self.__class__.__name__,
2769 self.cache_id, self.cache_key, self.cache_active)
2770
2771 def _cache_key_partition(self):
2772 prefix, repo_name, suffix = self.cache_key.partition(self.cache_args)
2773 return prefix, repo_name, suffix
2774
2775 def get_prefix(self):
2776 """
2777 Try to extract prefix from existing cache key. The key could consist
2778 of prefix, repo_name, suffix
2779 """
2780 # this returns prefix, repo_name, suffix
2781 return self._cache_key_partition()[0]
2782
2783 def get_suffix(self):
2784 """
2785 get suffix that might have been used in _get_cache_key to
2786 generate self.cache_key. Only used for informational purposes
2787 in repo_edit.html.
2788 """
2789 # prefix, repo_name, suffix
2790 return self._cache_key_partition()[2]
2791
2792 @classmethod
2793 def delete_all_cache(cls):
2794 """
2795 Delete all cache keys from database.
2796 Should only be run when all instances are down and all entries
2797 thus stale.
2798 """
2799 cls.query().delete()
2800 Session().commit()
2801
2802 @classmethod
2803 def get_cache_key(cls, repo_name, cache_type):
2804 """
2805
2806 Generate a cache key for this process of RhodeCode instance.
2807 Prefix most likely will be process id or maybe explicitly set
2808 instance_id from .ini file.
2809 """
2810 import rhodecode
2811 prefix = safe_unicode(rhodecode.CONFIG.get('instance_id') or '')
2812
2813 repo_as_unicode = safe_unicode(repo_name)
2814 key = u'{}_{}'.format(repo_as_unicode, cache_type) \
2815 if cache_type else repo_as_unicode
2816
2817 return u'{}{}'.format(prefix, key)
2818
2819 @classmethod
2820 def set_invalidate(cls, repo_name, delete=False):
2821 """
2822 Mark all caches of a repo as invalid in the database.
2823 """
2824
2825 try:
2826 qry = Session().query(cls).filter(cls.cache_args == repo_name)
2827 if delete:
2828 log.debug('cache objects deleted for repo %s',
2829 safe_str(repo_name))
2830 qry.delete()
2831 else:
2832 log.debug('cache objects marked as invalid for repo %s',
2833 safe_str(repo_name))
2834 qry.update({"cache_active": False})
2835
2836 Session().commit()
2837 except Exception:
2838 log.exception(
2839 'Cache key invalidation failed for repository %s',
2840 safe_str(repo_name))
2841 Session().rollback()
2842
2843 @classmethod
2844 def get_active_cache(cls, cache_key):
2845 inv_obj = cls.query().filter(cls.cache_key == cache_key).scalar()
2846 if inv_obj:
2847 return inv_obj
2848 return None
2849
2850 @classmethod
2851 def repo_context_cache(cls, compute_func, repo_name, cache_type,
2852 thread_scoped=False):
2853 """
2854 @cache_region('long_term')
2855 def _heavy_calculation(cache_key):
2856 return 'result'
2857
2858 cache_context = CacheKey.repo_context_cache(
2859 _heavy_calculation, repo_name, cache_type)
2860
2861 with cache_context as context:
2862 context.invalidate()
2863 computed = context.compute()
2864
2865 assert computed == 'result'
2866 """
2867 from rhodecode.lib import caches
2868 return caches.InvalidationContext(
2869 compute_func, repo_name, cache_type, thread_scoped=thread_scoped)
2870
2871
2872 class ChangesetComment(Base, BaseModel):
2873 __tablename__ = 'changeset_comments'
2874 __table_args__ = (
2875 Index('cc_revision_idx', 'revision'),
2876 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2877 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
2878 )
2879
2880 COMMENT_OUTDATED = u'comment_outdated'
2881
2882 comment_id = Column('comment_id', Integer(), nullable=False, primary_key=True)
2883 repo_id = Column('repo_id', Integer(), ForeignKey('repositories.repo_id'), nullable=False)
2884 revision = Column('revision', String(40), nullable=True)
2885 pull_request_id = Column("pull_request_id", Integer(), ForeignKey('pull_requests.pull_request_id'), nullable=True)
2886 pull_request_version_id = Column("pull_request_version_id", Integer(), ForeignKey('pull_request_versions.pull_request_version_id'), nullable=True)
2887 line_no = Column('line_no', Unicode(10), nullable=True)
2888 hl_lines = Column('hl_lines', Unicode(512), nullable=True)
2889 f_path = Column('f_path', Unicode(1000), nullable=True)
2890 user_id = Column('user_id', Integer(), ForeignKey('users.user_id'), nullable=False)
2891 text = Column('text', UnicodeText().with_variant(UnicodeText(25000), 'mysql'), nullable=False)
2892 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
2893 modified_at = Column('modified_at', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
2894 renderer = Column('renderer', Unicode(64), nullable=True)
2895 display_state = Column('display_state', Unicode(128), nullable=True)
2896
2897 author = relationship('User', lazy='joined')
2898 repo = relationship('Repository')
2899 status_change = relationship('ChangesetStatus', cascade="all, delete, delete-orphan")
2900 pull_request = relationship('PullRequest', lazy='joined')
2901 pull_request_version = relationship('PullRequestVersion')
2902
2903 @classmethod
2904 def get_users(cls, revision=None, pull_request_id=None):
2905 """
2906 Returns user associated with this ChangesetComment. ie those
2907 who actually commented
2908
2909 :param cls:
2910 :param revision:
2911 """
2912 q = Session().query(User)\
2913 .join(ChangesetComment.author)
2914 if revision:
2915 q = q.filter(cls.revision == revision)
2916 elif pull_request_id:
2917 q = q.filter(cls.pull_request_id == pull_request_id)
2918 return q.all()
2919
2920 def render(self, mentions=False):
2921 from rhodecode.lib import helpers as h
2922 return h.render(self.text, renderer=self.renderer, mentions=mentions)
2923
2924 def __repr__(self):
2925 if self.comment_id:
2926 return '<DB:ChangesetComment #%s>' % self.comment_id
2927 else:
2928 return '<DB:ChangesetComment at %#x>' % id(self)
2929
2930
2931 class ChangesetStatus(Base, BaseModel):
2932 __tablename__ = 'changeset_statuses'
2933 __table_args__ = (
2934 Index('cs_revision_idx', 'revision'),
2935 Index('cs_version_idx', 'version'),
2936 UniqueConstraint('repo_id', 'revision', 'version'),
2937 {'extend_existing': True, 'mysql_engine': 'InnoDB',
2938 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
2939 )
2940 STATUS_NOT_REVIEWED = DEFAULT = 'not_reviewed'
2941 STATUS_APPROVED = 'approved'
2942 STATUS_REJECTED = 'rejected'
2943 STATUS_UNDER_REVIEW = 'under_review'
2944
2945 STATUSES = [
2946 (STATUS_NOT_REVIEWED, _("Not Reviewed")), # (no icon) and default
2947 (STATUS_APPROVED, _("Approved")),
2948 (STATUS_REJECTED, _("Rejected")),
2949 (STATUS_UNDER_REVIEW, _("Under Review")),
2950 ]
2951
2952 changeset_status_id = Column('changeset_status_id', Integer(), nullable=False, primary_key=True)
2953 repo_id = Column('repo_id', Integer(), ForeignKey('repositories.repo_id'), nullable=False)
2954 user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None)
2955 revision = Column('revision', String(40), nullable=False)
2956 status = Column('status', String(128), nullable=False, default=DEFAULT)
2957 changeset_comment_id = Column('changeset_comment_id', Integer(), ForeignKey('changeset_comments.comment_id'))
2958 modified_at = Column('modified_at', DateTime(), nullable=False, default=datetime.datetime.now)
2959 version = Column('version', Integer(), nullable=False, default=0)
2960 pull_request_id = Column("pull_request_id", Integer(), ForeignKey('pull_requests.pull_request_id'), nullable=True)
2961
2962 author = relationship('User', lazy='joined')
2963 repo = relationship('Repository')
2964 comment = relationship('ChangesetComment', lazy='joined')
2965 pull_request = relationship('PullRequest', lazy='joined')
2966
2967 def __unicode__(self):
2968 return u"<%s('%s[%s]:%s')>" % (
2969 self.__class__.__name__,
2970 self.status, self.version, self.author
2971 )
2972
2973 @classmethod
2974 def get_status_lbl(cls, value):
2975 return dict(cls.STATUSES).get(value)
2976
2977 @property
2978 def status_lbl(self):
2979 return ChangesetStatus.get_status_lbl(self.status)
2980
2981
2982 class _PullRequestBase(BaseModel):
2983 """
2984 Common attributes of pull request and version entries.
2985 """
2986
2987 # .status values
2988 STATUS_NEW = u'new'
2989 STATUS_OPEN = u'open'
2990 STATUS_CLOSED = u'closed'
2991
2992 title = Column('title', Unicode(255), nullable=True)
2993 description = Column(
2994 'description', UnicodeText().with_variant(UnicodeText(10240), 'mysql'),
2995 nullable=True)
2996 # new/open/closed status of pull request (not approve/reject/etc)
2997 status = Column('status', Unicode(255), nullable=False, default=STATUS_NEW)
2998 created_on = Column(
2999 'created_on', DateTime(timezone=False), nullable=False,
3000 default=datetime.datetime.now)
3001 updated_on = Column(
3002 'updated_on', DateTime(timezone=False), nullable=False,
3003 default=datetime.datetime.now)
3004
3005 @declared_attr
3006 def user_id(cls):
3007 return Column(
3008 "user_id", Integer(), ForeignKey('users.user_id'), nullable=False,
3009 unique=None)
3010
3011 # 500 revisions max
3012 _revisions = Column(
3013 'revisions', UnicodeText().with_variant(UnicodeText(20500), 'mysql'))
3014
3015 @declared_attr
3016 def source_repo_id(cls):
3017 # TODO: dan: rename column to source_repo_id
3018 return Column(
3019 'org_repo_id', Integer(), ForeignKey('repositories.repo_id'),
3020 nullable=False)
3021
3022 source_ref = Column('org_ref', Unicode(255), nullable=False)
3023
3024 @declared_attr
3025 def target_repo_id(cls):
3026 # TODO: dan: rename column to target_repo_id
3027 return Column(
3028 'other_repo_id', Integer(), ForeignKey('repositories.repo_id'),
3029 nullable=False)
3030
3031 target_ref = Column('other_ref', Unicode(255), nullable=False)
3032
3033 # TODO: dan: rename column to last_merge_source_rev
3034 _last_merge_source_rev = Column(
3035 'last_merge_org_rev', String(40), nullable=True)
3036 # TODO: dan: rename column to last_merge_target_rev
3037 _last_merge_target_rev = Column(
3038 'last_merge_other_rev', String(40), nullable=True)
3039 _last_merge_status = Column('merge_status', Integer(), nullable=True)
3040 merge_rev = Column('merge_rev', String(40), nullable=True)
3041
3042 @hybrid_property
3043 def revisions(self):
3044 return self._revisions.split(':') if self._revisions else []
3045
3046 @revisions.setter
3047 def revisions(self, val):
3048 self._revisions = ':'.join(val)
3049
3050 @declared_attr
3051 def author(cls):
3052 return relationship('User', lazy='joined')
3053
3054 @declared_attr
3055 def source_repo(cls):
3056 return relationship(
3057 'Repository',
3058 primaryjoin='%s.source_repo_id==Repository.repo_id' % cls.__name__)
3059
3060 @property
3061 def source_ref_parts(self):
3062 refs = self.source_ref.split(':')
3063 return Reference(refs[0], refs[1], refs[2])
3064
3065 @declared_attr
3066 def target_repo(cls):
3067 return relationship(
3068 'Repository',
3069 primaryjoin='%s.target_repo_id==Repository.repo_id' % cls.__name__)
3070
3071 @property
3072 def target_ref_parts(self):
3073 refs = self.target_ref.split(':')
3074 return Reference(refs[0], refs[1], refs[2])
3075
3076
3077 class PullRequest(Base, _PullRequestBase):
3078 __tablename__ = 'pull_requests'
3079 __table_args__ = (
3080 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3081 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3082 )
3083
3084 pull_request_id = Column(
3085 'pull_request_id', Integer(), nullable=False, primary_key=True)
3086
3087 def __repr__(self):
3088 if self.pull_request_id:
3089 return '<DB:PullRequest #%s>' % self.pull_request_id
3090 else:
3091 return '<DB:PullRequest at %#x>' % id(self)
3092
3093 reviewers = relationship('PullRequestReviewers',
3094 cascade="all, delete, delete-orphan")
3095 statuses = relationship('ChangesetStatus')
3096 comments = relationship('ChangesetComment',
3097 cascade="all, delete, delete-orphan")
3098 versions = relationship('PullRequestVersion',
3099 cascade="all, delete, delete-orphan")
3100
3101 def is_closed(self):
3102 return self.status == self.STATUS_CLOSED
3103
3104 def get_api_data(self):
3105 from rhodecode.model.pull_request import PullRequestModel
3106 pull_request = self
3107 merge_status = PullRequestModel().merge_status(pull_request)
3108 data = {
3109 'pull_request_id': pull_request.pull_request_id,
3110 'url': url('pullrequest_show', repo_name=self.target_repo.repo_name,
3111 pull_request_id=self.pull_request_id,
3112 qualified=True),
3113 'title': pull_request.title,
3114 'description': pull_request.description,
3115 'status': pull_request.status,
3116 'created_on': pull_request.created_on,
3117 'updated_on': pull_request.updated_on,
3118 'commit_ids': pull_request.revisions,
3119 'review_status': pull_request.calculated_review_status(),
3120 'mergeable': {
3121 'status': merge_status[0],
3122 'message': unicode(merge_status[1]),
3123 },
3124 'source': {
3125 'clone_url': pull_request.source_repo.clone_url(),
3126 'repository': pull_request.source_repo.repo_name,
3127 'reference': {
3128 'name': pull_request.source_ref_parts.name,
3129 'type': pull_request.source_ref_parts.type,
3130 'commit_id': pull_request.source_ref_parts.commit_id,
3131 },
3132 },
3133 'target': {
3134 'clone_url': pull_request.target_repo.clone_url(),
3135 'repository': pull_request.target_repo.repo_name,
3136 'reference': {
3137 'name': pull_request.target_ref_parts.name,
3138 'type': pull_request.target_ref_parts.type,
3139 'commit_id': pull_request.target_ref_parts.commit_id,
3140 },
3141 },
3142 'author': pull_request.author.get_api_data(include_secrets=False,
3143 details='basic'),
3144 'reviewers': [
3145 {
3146 'user': reviewer.get_api_data(include_secrets=False,
3147 details='basic'),
3148 'review_status': st[0][1].status if st else 'not_reviewed',
3149 }
3150 for reviewer, st in pull_request.reviewers_statuses()
3151 ]
3152 }
3153
3154 return data
3155
3156 def __json__(self):
3157 return {
3158 'revisions': self.revisions,
3159 }
3160
3161 def calculated_review_status(self):
3162 # TODO: anderson: 13.05.15 Used only on templates/my_account_pullrequests.html
3163 # because it's tricky on how to use ChangesetStatusModel from there
3164 warnings.warn("Use calculated_review_status from ChangesetStatusModel", DeprecationWarning)
3165 from rhodecode.model.changeset_status import ChangesetStatusModel
3166 return ChangesetStatusModel().calculated_review_status(self)
3167
3168 def reviewers_statuses(self):
3169 warnings.warn("Use reviewers_statuses from ChangesetStatusModel", DeprecationWarning)
3170 from rhodecode.model.changeset_status import ChangesetStatusModel
3171 return ChangesetStatusModel().reviewers_statuses(self)
3172
3173
3174 class PullRequestVersion(Base, _PullRequestBase):
3175 __tablename__ = 'pull_request_versions'
3176 __table_args__ = (
3177 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3178 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3179 )
3180
3181 pull_request_version_id = Column(
3182 'pull_request_version_id', Integer(), nullable=False, primary_key=True)
3183 pull_request_id = Column(
3184 'pull_request_id', Integer(),
3185 ForeignKey('pull_requests.pull_request_id'), nullable=False)
3186 pull_request = relationship('PullRequest')
3187
3188 def __repr__(self):
3189 if self.pull_request_version_id:
3190 return '<DB:PullRequestVersion #%s>' % self.pull_request_version_id
3191 else:
3192 return '<DB:PullRequestVersion at %#x>' % id(self)
3193
3194
3195 class PullRequestReviewers(Base, BaseModel):
3196 __tablename__ = 'pull_request_reviewers'
3197 __table_args__ = (
3198 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3199 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3200 )
3201
3202 def __init__(self, user=None, pull_request=None):
3203 self.user = user
3204 self.pull_request = pull_request
3205
3206 pull_requests_reviewers_id = Column(
3207 'pull_requests_reviewers_id', Integer(), nullable=False,
3208 primary_key=True)
3209 pull_request_id = Column(
3210 "pull_request_id", Integer(),
3211 ForeignKey('pull_requests.pull_request_id'), nullable=False)
3212 user_id = Column(
3213 "user_id", Integer(), ForeignKey('users.user_id'), nullable=True)
3214
3215 user = relationship('User')
3216 pull_request = relationship('PullRequest')
3217
3218
3219 class Notification(Base, BaseModel):
3220 __tablename__ = 'notifications'
3221 __table_args__ = (
3222 Index('notification_type_idx', 'type'),
3223 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3224 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3225 )
3226
3227 TYPE_CHANGESET_COMMENT = u'cs_comment'
3228 TYPE_MESSAGE = u'message'
3229 TYPE_MENTION = u'mention'
3230 TYPE_REGISTRATION = u'registration'
3231 TYPE_PULL_REQUEST = u'pull_request'
3232 TYPE_PULL_REQUEST_COMMENT = u'pull_request_comment'
3233
3234 notification_id = Column('notification_id', Integer(), nullable=False, primary_key=True)
3235 subject = Column('subject', Unicode(512), nullable=True)
3236 body = Column('body', UnicodeText().with_variant(UnicodeText(50000), 'mysql'), nullable=True)
3237 created_by = Column("created_by", Integer(), ForeignKey('users.user_id'), nullable=True)
3238 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
3239 type_ = Column('type', Unicode(255))
3240
3241 created_by_user = relationship('User')
3242 notifications_to_users = relationship('UserNotification', lazy='joined',
3243 cascade="all, delete, delete-orphan")
3244
3245 @property
3246 def recipients(self):
3247 return [x.user for x in UserNotification.query()\
3248 .filter(UserNotification.notification == self)\
3249 .order_by(UserNotification.user_id.asc()).all()]
3250
3251 @classmethod
3252 def create(cls, created_by, subject, body, recipients, type_=None):
3253 if type_ is None:
3254 type_ = Notification.TYPE_MESSAGE
3255
3256 notification = cls()
3257 notification.created_by_user = created_by
3258 notification.subject = subject
3259 notification.body = body
3260 notification.type_ = type_
3261 notification.created_on = datetime.datetime.now()
3262
3263 for u in recipients:
3264 assoc = UserNotification()
3265 assoc.notification = notification
3266
3267 # if created_by is inside recipients mark his notification
3268 # as read
3269 if u.user_id == created_by.user_id:
3270 assoc.read = True
3271
3272 u.notifications.append(assoc)
3273 Session().add(notification)
3274
3275 return notification
3276
3277 @property
3278 def description(self):
3279 from rhodecode.model.notification import NotificationModel
3280 return NotificationModel().make_description(self)
3281
3282
3283 class UserNotification(Base, BaseModel):
3284 __tablename__ = 'user_to_notification'
3285 __table_args__ = (
3286 UniqueConstraint('user_id', 'notification_id'),
3287 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3288 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
3289 )
3290 user_id = Column('user_id', Integer(), ForeignKey('users.user_id'), primary_key=True)
3291 notification_id = Column("notification_id", Integer(), ForeignKey('notifications.notification_id'), primary_key=True)
3292 read = Column('read', Boolean, default=False)
3293 sent_on = Column('sent_on', DateTime(timezone=False), nullable=True, unique=None)
3294
3295 user = relationship('User', lazy="joined")
3296 notification = relationship('Notification', lazy="joined",
3297 order_by=lambda: Notification.created_on.desc(),)
3298
3299 def mark_as_read(self):
3300 self.read = True
3301 Session().add(self)
3302
3303
3304 class Gist(Base, BaseModel):
3305 __tablename__ = 'gists'
3306 __table_args__ = (
3307 Index('g_gist_access_id_idx', 'gist_access_id'),
3308 Index('g_created_on_idx', 'created_on'),
3309 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3310 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
3311 )
3312 GIST_PUBLIC = u'public'
3313 GIST_PRIVATE = u'private'
3314 DEFAULT_FILENAME = u'gistfile1.txt'
3315
3316 ACL_LEVEL_PUBLIC = u'acl_public'
3317 ACL_LEVEL_PRIVATE = u'acl_private'
3318
3319 gist_id = Column('gist_id', Integer(), primary_key=True)
3320 gist_access_id = Column('gist_access_id', Unicode(250))
3321 gist_description = Column('gist_description', UnicodeText().with_variant(UnicodeText(1024), 'mysql'))
3322 gist_owner = Column('user_id', Integer(), ForeignKey('users.user_id'), nullable=True)
3323 gist_expires = Column('gist_expires', Float(53), nullable=False)
3324 gist_type = Column('gist_type', Unicode(128), nullable=False)
3325 created_on = Column('created_on', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
3326 modified_at = Column('modified_at', DateTime(timezone=False), nullable=False, default=datetime.datetime.now)
3327 acl_level = Column('acl_level', Unicode(128), nullable=True)
3328
3329 owner = relationship('User')
3330
3331 def __repr__(self):
3332 return '<Gist:[%s]%s>' % (self.gist_type, self.gist_access_id)
3333
3334 @classmethod
3335 def get_or_404(cls, id_):
3336 res = cls.query().filter(cls.gist_access_id == id_).scalar()
3337 if not res:
3338 raise HTTPNotFound
3339 return res
3340
3341 @classmethod
3342 def get_by_access_id(cls, gist_access_id):
3343 return cls.query().filter(cls.gist_access_id == gist_access_id).scalar()
3344
3345 def gist_url(self):
3346 import rhodecode
3347 alias_url = rhodecode.CONFIG.get('gist_alias_url')
3348 if alias_url:
3349 return alias_url.replace('{gistid}', self.gist_access_id)
3350
3351 return url('gist', gist_id=self.gist_access_id, qualified=True)
3352
3353 @classmethod
3354 def base_path(cls):
3355 """
3356 Returns base path when all gists are stored
3357
3358 :param cls:
3359 """
3360 from rhodecode.model.gist import GIST_STORE_LOC
3361 q = Session().query(RhodeCodeUi)\
3362 .filter(RhodeCodeUi.ui_key == URL_SEP)
3363 q = q.options(FromCache("sql_cache_short", "repository_repo_path"))
3364 return os.path.join(q.one().ui_value, GIST_STORE_LOC)
3365
3366 def get_api_data(self):
3367 """
3368 Common function for generating gist related data for API
3369 """
3370 gist = self
3371 data = {
3372 'gist_id': gist.gist_id,
3373 'type': gist.gist_type,
3374 'access_id': gist.gist_access_id,
3375 'description': gist.gist_description,
3376 'url': gist.gist_url(),
3377 'expires': gist.gist_expires,
3378 'created_on': gist.created_on,
3379 'modified_at': gist.modified_at,
3380 'content': None,
3381 'acl_level': gist.acl_level,
3382 }
3383 return data
3384
3385 def __json__(self):
3386 data = dict(
3387 )
3388 data.update(self.get_api_data())
3389 return data
3390 # SCM functions
3391
3392 def scm_instance(self, **kwargs):
3393 full_repo_path = os.path.join(self.base_path(), self.gist_access_id)
3394 return get_vcs_instance(
3395 repo_path=safe_str(full_repo_path), create=False)
3396
3397
3398 class DbMigrateVersion(Base, BaseModel):
3399 __tablename__ = 'db_migrate_version'
3400 __table_args__ = (
3401 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3402 'mysql_charset': 'utf8', 'sqlite_autoincrement': True},
3403 )
3404 repository_id = Column('repository_id', String(250), primary_key=True)
3405 repository_path = Column('repository_path', Text)
3406 version = Column('version', Integer)
3407
3408
3409 class ExternalIdentity(Base, BaseModel):
3410 __tablename__ = 'external_identities'
3411 __table_args__ = (
3412 Index('local_user_id_idx', 'local_user_id'),
3413 Index('external_id_idx', 'external_id'),
3414 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3415 'mysql_charset': 'utf8'})
3416
3417 external_id = Column('external_id', Unicode(255), default=u'',
3418 primary_key=True)
3419 external_username = Column('external_username', Unicode(1024), default=u'')
3420 local_user_id = Column('local_user_id', Integer(),
3421 ForeignKey('users.user_id'), primary_key=True)
3422 provider_name = Column('provider_name', Unicode(255), default=u'',
3423 primary_key=True)
3424 access_token = Column('access_token', String(1024), default=u'')
3425 alt_token = Column('alt_token', String(1024), default=u'')
3426 token_secret = Column('token_secret', String(1024), default=u'')
3427
3428 @classmethod
3429 def by_external_id_and_provider(cls, external_id, provider_name,
3430 local_user_id=None):
3431 """
3432 Returns ExternalIdentity instance based on search params
3433
3434 :param external_id:
3435 :param provider_name:
3436 :return: ExternalIdentity
3437 """
3438 query = cls.query()
3439 query = query.filter(cls.external_id == external_id)
3440 query = query.filter(cls.provider_name == provider_name)
3441 if local_user_id:
3442 query = query.filter(cls.local_user_id == local_user_id)
3443 return query.first()
3444
3445 @classmethod
3446 def user_by_external_id_and_provider(cls, external_id, provider_name):
3447 """
3448 Returns User instance based on search params
3449
3450 :param external_id:
3451 :param provider_name:
3452 :return: User
3453 """
3454 query = User.query()
3455 query = query.filter(cls.external_id == external_id)
3456 query = query.filter(cls.provider_name == provider_name)
3457 query = query.filter(User.user_id == cls.local_user_id)
3458 return query.first()
3459
3460 @classmethod
3461 def by_local_user_id(cls, local_user_id):
3462 """
3463 Returns all tokens for user
3464
3465 :param local_user_id:
3466 :return: ExternalIdentity
3467 """
3468 query = cls.query()
3469 query = query.filter(cls.local_user_id == local_user_id)
3470 return query
3471
3472
3473 class Integration(Base, BaseModel):
3474 __tablename__ = 'integrations'
3475 __table_args__ = (
3476 {'extend_existing': True, 'mysql_engine': 'InnoDB',
3477 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}
3478 )
3479
3480 integration_id = Column('integration_id', Integer(), primary_key=True)
3481 integration_type = Column('integration_type', String(255))
3482 enabled = Column('enabled', Boolean(), nullable=False)
3483 name = Column('name', String(255), nullable=False)
3484 child_repos_only = Column('child_repos_only', Boolean(), nullable=True)
3485
3486 settings = Column(
3487 'settings_json', MutationObj.as_mutable(
3488 JsonType(dialect_map=dict(mysql=UnicodeText(16384)))))
3489 repo_id = Column(
3490 'repo_id', Integer(), ForeignKey('repositories.repo_id'),
3491 nullable=True, unique=None, default=None)
3492 repo = relationship('Repository', lazy='joined')
3493
3494 repo_group_id = Column(
3495 'repo_group_id', Integer(), ForeignKey('groups.group_id'),
3496 nullable=True, unique=None, default=None)
3497 repo_group = relationship('RepoGroup', lazy='joined')
3498
3499 @hybrid_property
3500 def scope(self):
3501 if self.repo:
3502 return self.repo
3503 if self.repo_group:
3504 return self.repo_group
3505 if self.child_repos_only:
3506 return 'root_repos'
3507 return 'global'
3508
3509 @scope.setter
3510 def scope(self, value):
3511 self.repo = None
3512 self.repo_id = None
3513 self.repo_group_id = None
3514 self.repo_group = None
3515 self.child_repos_only = None
3516 if isinstance(value, Repository):
3517 self.repo = value
3518 elif isinstance(value, RepoGroup):
3519 self.repo_group = value
3520 elif value == 'root_repos':
3521 self.child_repos_only = True
3522 elif value == 'global':
3523 pass
3524 else:
3525 raise Exception("invalid scope: %s, must be one of "
3526 "['global', 'root_repos', <RepoGroup>. <Repository>]" % value)
3527
3528 def __repr__(self):
3529 return '<Integration(%r, %r)>' % (self.integration_type, self.scope)
@@ -0,0 +1,36 b''
1 import logging
2 import datetime
3
4 from sqlalchemy import *
5 from sqlalchemy.exc import DatabaseError
6 from sqlalchemy.orm import relation, backref, class_mapper, joinedload
7 from sqlalchemy.orm.session import Session
8 from sqlalchemy.ext.declarative import declarative_base
9
10 from rhodecode.lib.dbmigrate.migrate import *
11 from rhodecode.lib.dbmigrate.migrate.changeset import *
12 from rhodecode.lib.utils2 import str2bool
13
14 from rhodecode.model.meta import Base
15 from rhodecode.model import meta
16 from rhodecode.lib.dbmigrate.versions import _reset_base, notify
17
18 log = logging.getLogger(__name__)
19
20
21 def upgrade(migrate_engine):
22 """
23 Upgrade operations go here.
24 Don't create your own engine; bind migrate_engine to your metadata
25 """
26 _reset_base(migrate_engine)
27 from rhodecode.lib.dbmigrate.schema import db_4_4_0_0
28
29 tbl = db_4_4_0_0.Integration.__table__
30 repo_group_id = db_4_4_0_0.Integration.repo_group_id
31 repo_group_id.create(table=tbl)
32
33
34 def downgrade(migrate_engine):
35 meta = MetaData()
36 meta.bind = migrate_engine
@@ -0,0 +1,35 b''
1 import logging
2 import datetime
3
4 from sqlalchemy import *
5 from sqlalchemy.exc import DatabaseError
6 from sqlalchemy.orm import relation, backref, class_mapper, joinedload
7 from sqlalchemy.orm.session import Session
8 from sqlalchemy.ext.declarative import declarative_base
9
10 from rhodecode.lib.dbmigrate.migrate import *
11 from rhodecode.lib.dbmigrate.migrate.changeset import *
12 from rhodecode.lib.utils2 import str2bool
13
14 from rhodecode.model.meta import Base
15 from rhodecode.model import meta
16 from rhodecode.lib.dbmigrate.versions import _reset_base, notify
17
18 log = logging.getLogger(__name__)
19
20
21 def upgrade(migrate_engine):
22 """
23 Upgrade operations go here.
24 Don't create your own engine; bind migrate_engine to your metadata
25 """
26 _reset_base(migrate_engine)
27 from rhodecode.lib.dbmigrate.schema import db_4_4_0_1
28
29 tbl = db_4_4_0_1.Integration.__table__
30 child_repos_only = db_4_4_0_1.Integration.child_repos_only
31 child_repos_only.create(table=tbl)
32
33 def downgrade(migrate_engine):
34 meta = MetaData()
35 meta.bind = migrate_engine
@@ -0,0 +1,85 b''
1 import logging
2
3 from sqlalchemy import *
4
5 from rhodecode.model import init_model_encryption, meta
6 from rhodecode.lib.utils2 import safe_str
7 from rhodecode.lib.dbmigrate.versions import _reset_base, notify
8
9 log = logging.getLogger(__name__)
10
11
12 def get_all_settings(models):
13 settings = {
14 'rhodecode_' + result.app_settings_name: result.app_settings_value
15 for result in models.RhodeCodeSetting.query()
16 }
17 return settings
18
19
20 def get_ui_by_section_and_key(models, section, key):
21 q = models.RhodeCodeUi.query()
22 q = q.filter(models.RhodeCodeUi.ui_section == section)
23 q = q.filter(models.RhodeCodeUi.ui_key == key)
24 return q.scalar()
25
26
27 def create_ui_section_value(models, Session, section, val, key=None, active=True):
28 new_ui = models.RhodeCodeUi()
29 new_ui.ui_section = section
30 new_ui.ui_value = val
31 new_ui.ui_active = active
32 new_ui.ui_key = key
33
34 Session().add(new_ui)
35 return new_ui
36
37
38 def create_or_update_ui(
39 models, Session, section, key, value=None, active=None):
40 ui = get_ui_by_section_and_key(models, section, key)
41 if not ui:
42 active = True if active is None else active
43 create_ui_section_value(
44 models, Session, section, value, key=key, active=active)
45 else:
46 if active is not None:
47 ui.ui_active = active
48 if value is not None:
49 ui.ui_value = value
50 Session().add(ui)
51
52
53 def upgrade(migrate_engine):
54 """
55 Upgrade operations go here.
56 Don't create your own engine; bind migrate_engine to your metadata
57 """
58 _reset_base(migrate_engine)
59 from rhodecode.lib.dbmigrate.schema import db_4_4_0_1
60 init_model_encryption(db_4_4_0_1)
61 fixups(db_4_4_0_1, meta.Session)
62
63
64 def downgrade(migrate_engine):
65 meta = MetaData()
66 meta.bind = migrate_engine
67
68
69 def fixups(models, Session):
70 current_settings = get_all_settings(models)
71
72 svn_proxy_enabled = safe_str(current_settings.get(
73 'rhodecode_proxy_subversion_http_requests', 'False'))
74 svn_proxy_url = current_settings.get(
75 'rhodecode_subversion_http_server_url', '')
76
77 create_or_update_ui(
78 models, Session, 'vcs_svn_proxy', 'http_requests_enabled',
79 value=svn_proxy_enabled)
80
81 create_or_update_ui(
82 models, Session, 'vcs_svn_proxy', 'http_server_url',
83 value=svn_proxy_url)
84
85 Session().commit()
@@ -0,0 +1,226 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2016-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import os
22
23 import deform
24 import colander
25
26 from rhodecode.translation import _
27 from rhodecode.model.db import Repository, RepoGroup
28 from rhodecode.model.validation_schema import validators, preparers
29
30
31 def integration_scope_choices(permissions):
32 """
33 Return list of (value, label) choices for integration scopes depending on
34 the permissions
35 """
36 result = [('', _('Pick a scope:'))]
37 if 'hg.admin' in permissions['global']:
38 result.extend([
39 ('global', _('Global (all repositories)')),
40 ('root-repos', _('Top level repositories only')),
41 ])
42
43 repo_choices = [
44 ('repo:%s' % repo_name, '/' + repo_name)
45 for repo_name, repo_perm
46 in permissions['repositories'].items()
47 if repo_perm == 'repository.admin'
48 ]
49 repogroup_choices = [
50 ('repogroup:%s' % repo_group_name, '/' + repo_group_name + '/ (child repos only)')
51 for repo_group_name, repo_group_perm
52 in permissions['repositories_groups'].items()
53 if repo_group_perm == 'group.admin'
54 ]
55 repogroup_recursive_choices = [
56 ('repogroup-recursive:%s' % repo_group_name, '/' + repo_group_name + '/ (recursive)')
57 for repo_group_name, repo_group_perm
58 in permissions['repositories_groups'].items()
59 if repo_group_perm == 'group.admin'
60 ]
61 result.extend(
62 sorted(repogroup_recursive_choices + repogroup_choices + repo_choices,
63 key=lambda (choice, label): choice.split(':', 1)[1]
64 )
65 )
66 return result
67
68
69 @colander.deferred
70 def deferred_integration_scopes_validator(node, kw):
71 perms = kw.get('permissions')
72 def _scope_validator(_node, scope):
73 is_super_admin = 'hg.admin' in perms['global']
74
75 if scope.get('repo'):
76 if (is_super_admin or perms['repositories'].get(
77 scope['repo'].repo_name) == 'repository.admin'):
78 return True
79 msg = _('Only repo admins can create integrations')
80 raise colander.Invalid(_node, msg)
81 elif scope.get('repo_group'):
82 if (is_super_admin or perms['repositories_groups'].get(
83 scope['repo_group'].group_name) == 'group.admin'):
84 return True
85
86 msg = _('Only repogroup admins can create integrations')
87 raise colander.Invalid(_node, msg)
88 else:
89 if is_super_admin:
90 return True
91 msg = _('Only superadmins can create global integrations')
92 raise colander.Invalid(_node, msg)
93
94 return _scope_validator
95
96
97 @colander.deferred
98 def deferred_integration_scopes_widget(node, kw):
99 if kw.get('no_scope'):
100 return deform.widget.TextInputWidget(readonly=True)
101
102 choices = integration_scope_choices(kw.get('permissions'))
103 widget = deform.widget.Select2Widget(values=choices)
104 return widget
105
106
107 class IntegrationScopeType(colander.SchemaType):
108 def serialize(self, node, appstruct):
109 if appstruct is colander.null:
110 return colander.null
111
112 if appstruct.get('repo'):
113 return 'repo:%s' % appstruct['repo'].repo_name
114 elif appstruct.get('repo_group'):
115 if appstruct.get('child_repos_only'):
116 return 'repogroup:%s' % appstruct['repo_group'].group_name
117 else:
118 return 'repogroup-recursive:%s' % (
119 appstruct['repo_group'].group_name)
120 else:
121 if appstruct.get('child_repos_only'):
122 return 'root-repos'
123 else:
124 return 'global'
125
126 raise colander.Invalid(node, '%r is not a valid scope' % appstruct)
127
128 def deserialize(self, node, cstruct):
129 if cstruct is colander.null:
130 return colander.null
131
132 if cstruct.startswith('repo:'):
133 repo = Repository.get_by_repo_name(cstruct.split(':')[1])
134 if repo:
135 return {
136 'repo': repo,
137 'repo_group': None,
138 'child_repos_only': None,
139 }
140 elif cstruct.startswith('repogroup-recursive:'):
141 repo_group = RepoGroup.get_by_group_name(cstruct.split(':')[1])
142 if repo_group:
143 return {
144 'repo': None,
145 'repo_group': repo_group,
146 'child_repos_only': False
147 }
148 elif cstruct.startswith('repogroup:'):
149 repo_group = RepoGroup.get_by_group_name(cstruct.split(':')[1])
150 if repo_group:
151 return {
152 'repo': None,
153 'repo_group': repo_group,
154 'child_repos_only': True
155 }
156 elif cstruct == 'global':
157 return {
158 'repo': None,
159 'repo_group': None,
160 'child_repos_only': False
161 }
162 elif cstruct == 'root-repos':
163 return {
164 'repo': None,
165 'repo_group': None,
166 'child_repos_only': True
167 }
168
169 raise colander.Invalid(node, '%r is not a valid scope' % cstruct)
170
171
172 class IntegrationOptionsSchemaBase(colander.MappingSchema):
173
174 name = colander.SchemaNode(
175 colander.String(),
176 description=_('Short name for this integration.'),
177 missing=colander.required,
178 title=_('Integration name'),
179 )
180
181 scope = colander.SchemaNode(
182 IntegrationScopeType(),
183 description=_(
184 'Scope of the integration. Recursive means the integration '
185 ' runs on all repos of that group and children recursively.'),
186 title=_('Integration scope'),
187 validator=deferred_integration_scopes_validator,
188 widget=deferred_integration_scopes_widget,
189 missing=colander.required,
190 )
191
192 enabled = colander.SchemaNode(
193 colander.Bool(),
194 default=True,
195 description=_('Enable or disable this integration.'),
196 missing=False,
197 title=_('Enabled'),
198 )
199
200
201
202 def make_integration_schema(IntegrationType, settings=None):
203 """
204 Return a colander schema for an integration type
205
206 :param IntegrationType: the integration type class
207 :param settings: existing integration settings dict (optional)
208 """
209
210 settings = settings or {}
211 settings_schema = IntegrationType(settings=settings).settings_schema()
212
213 class IntegrationSchema(colander.Schema):
214 options = IntegrationOptionsSchemaBase()
215
216 schema = IntegrationSchema()
217 schema['options'].title = _('General integration options')
218
219 settings_schema.name = 'settings'
220 settings_schema.title = _('{integration_type} settings').format(
221 integration_type=IntegrationType.display_name)
222 schema.add(settings_schema)
223
224 return schema
225
226
@@ -0,0 +1,61 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2016-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import colander
22
23 from rhodecode import forms
24 from rhodecode.model.db import User
25 from rhodecode.translation import _
26 from rhodecode.lib.auth import check_password
27
28
29 @colander.deferred
30 def deferred_user_password_validator(node, kw):
31 username = kw.get('username')
32 user = User.get_by_username(username)
33
34 def _user_password_validator(node, value):
35 if not check_password(value, user.password):
36 msg = _('Password is incorrect')
37 raise colander.Invalid(node, msg)
38 return _user_password_validator
39
40
41 class ChangePasswordSchema(colander.Schema):
42
43 current_password = colander.SchemaNode(
44 colander.String(),
45 missing=colander.required,
46 widget=forms.widget.PasswordWidget(redisplay=True),
47 validator=deferred_user_password_validator)
48
49 new_password = colander.SchemaNode(
50 colander.String(),
51 missing=colander.required,
52 widget=forms.widget.CheckedPasswordWidget(redisplay=True),
53 validator=colander.Length(min=6))
54
55
56 def validator(self, form, values):
57 if values['current_password'] == values['new_password']:
58 exc = colander.Invalid(form)
59 exc['new_password'] = _('New password must be different '
60 'to old password')
61 raise exc
@@ -0,0 +1,24 b''
1 //Primary CSS
2 //--- IMPORTS ------------------//
3 @import 'helpers';
4 @import 'mixins';
5 @import 'variables';
6 @import 'buttons';
7 @import 'alerts';
8
9 :root {
10 --primary-color: @rcblue;
11 --light-primary-color: @rclightblue;
12 --dark-primary-color: @rcdarkblue;
13 --primary-text-color: @text-color;
14
15 --paper-spinner-layer-1-color: @grey6;
16 --paper-spinner-layer-2-color: @grey5;
17 --paper-spinner-layer-3-color: @grey4;
18 --paper-spinner-layer-4-color: @grey3;
19 }
20
21 .paper-toggle-button {
22 display: inline;
23 }
24
@@ -0,0 +1,106 b''
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
2 <link rel="import" href="../../../../../../bower_components/iron-ajax/iron-ajax.html">
3
4 <!--
5
6 `<channelstream-connection>` allows you to connect and interact with channelstream server
7 abstracting websocket/long-polling connections from you.
8
9 In typical use, just slap some `<channelstream-connection>` at the top of your body:
10
11 <body>
12 <channelstream-connection
13 username="{{user.username}}"
14 connect-url="http://127.0.0.1:8000/demo/connect"
15 disconnect-url="http://127.0.0.1:8000/disconnect"
16 subscribe-url="http://127.0.0.1:8000/demo/subscribe"
17 message-url="http://127.0.0.1:8000/demo/message"
18 long-poll-url="http://127.0.0.1:8000/listen"
19 websocket-url="http://127.0.0.1:8000/ws"
20 channels-url='["channel1", "channel2"]' />
21
22 Then you can do `channelstreamElem.connect()` to kick off your connection.
23 This element also handles automatic reconnections.
24
25 ## Default handlers
26
27 By default element has a listener attached that will fire `startListening()` handler on `channelstream-connected` event.
28
29 By default element has a listener attached that will fire `retryConnection()` handler on `channelstream-connect-error` event,
30 this handler will forever try to re-establish connection to the server incrementing intervals between retries up to 1 minute.
31
32 -->
33 <dom-module id="channelstream-connection">
34 <template>
35
36 <iron-ajax
37 id="ajaxConnect"
38 url=""
39 handle-as="json"
40 method="post"
41 content-type="application/json"
42 loading="{{loadingConnect}}"
43 last-response="{{connectLastResponse}}"
44 on-response="_handleConnect"
45 on-error="_handleConnectError"
46 debounce-duration="100"></iron-ajax>
47
48 <iron-ajax
49 id="ajaxDisconnect"
50 url=""
51 handle-as="json"
52 method="post"
53 content-type="application/json"
54 loading="{{loadingDisconnect}}"
55 last-response="{{_disconnectLastResponse}}"
56 on-response="_handleDisconnect"
57 debounce-duration="100"></iron-ajax>
58
59 <iron-ajax
60 id="ajaxSubscribe"
61 url=""
62 handle-as="json"
63 method="post"
64 content-type="application/json"
65 loading="{{loadingSubscribe}}"
66 last-response="{{subscribeLastResponse}}"
67 on-response="_handleSubscribe"
68 debounce-duration="100"></iron-ajax>
69
70 <iron-ajax
71 id="ajaxUnsubscribe"
72 url=""
73 handle-as="json"
74 method="post"
75 content-type="application/json"
76 loading="{{loadingUnsubscribe}}"
77 last-response="{{unsubscribeLastResponse}}"
78 on-response="_handleUnsubscribe"
79 debounce-duration="100"></iron-ajax>
80
81 <iron-ajax
82 id="ajaxMessage"
83 url=""
84 handle-as="json"
85 method="post"
86 content-type="application/json"
87 loading="{{loadingMessage}}"
88 last-response="{{messageLastResponse}}"
89 on-response="_handleMessage"
90 on-error="_handleMessageError"
91 debounce-duration="100"></iron-ajax>
92
93 <iron-ajax
94 id="ajaxListen"
95 url=""
96 handle-as="text"
97 loading="{{loadingListen}}"
98 last-response="{{listenLastResponse}}"
99 on-request="_handleListenOpen"
100 on-error="_handleListenError"
101 on-response="_handleListenMessageEvent"
102 debounce-duration="100"></iron-ajax>
103
104 </template>
105 <script src="channelstream-connection.js"></script>
106 </dom-module>
This diff has been collapsed as it changes many lines, (502 lines changed) Show them Hide them
@@ -0,0 +1,502 b''
1 Polymer({
2 is: 'channelstream-connection',
3
4 /**
5 * Fired when `channels` array changes.
6 *
7 * @event channelstream-channels-changed
8 */
9
10 /**
11 * Fired when `connect()` method succeeds.
12 *
13 * @event channelstream-connected
14 */
15
16 /**
17 * Fired when `connect` fails.
18 *
19 * @event channelstream-connect-error
20 */
21
22 /**
23 * Fired when `disconnect()` succeeds.
24 *
25 * @event channelstream-disconnected
26 */
27
28 /**
29 * Fired when `message()` succeeds.
30 *
31 * @event channelstream-message-sent
32 */
33
34 /**
35 * Fired when `message()` fails.
36 *
37 * @event channelstream-message-error
38 */
39
40 /**
41 * Fired when `subscribe()` succeeds.
42 *
43 * @event channelstream-subscribed
44 */
45
46 /**
47 * Fired when `subscribe()` fails.
48 *
49 * @event channelstream-subscribe-error
50 */
51
52 /**
53 * Fired when `unsubscribe()` succeeds.
54 *
55 * @event channelstream-unsubscribed
56 */
57
58 /**
59 * Fired when `unsubscribe()` fails.
60 *
61 * @event channelstream-unsubscribe-error
62 */
63
64 /**
65 * Fired when listening connection receives a message.
66 *
67 * @event channelstream-listen-message
68 */
69
70 /**
71 * Fired when listening connection is opened.
72 *
73 * @event channelstream-listen-opened
74 */
75
76 /**
77 * Fired when listening connection is closed.
78 *
79 * @event channelstream-listen-closed
80 */
81
82 /**
83 * Fired when listening connection suffers an error.
84 *
85 * @event channelstream-listen-error
86 */
87
88 properties: {
89 isReady: Boolean,
90 /** List of channels user should be subscribed to. */
91 channels: {
92 type: Array,
93 value: function () {
94 return []
95 },
96 notify: true
97 },
98 /** Username of connecting user. */
99 username: {
100 type: String,
101 value: 'Anonymous',
102 reflectToAttribute: true
103 },
104 /** Connection identifier. */
105 connectionId: {
106 type: String,
107 reflectToAttribute: true
108 },
109 /** Websocket instance. */
110 websocket: {
111 type: Object,
112 value: null
113 },
114 /** Websocket connection url. */
115 websocketUrl: {
116 type: String,
117 value: ''
118 },
119 /** URL used in `connect()`. */
120 connectUrl: {
121 type: String,
122 value: ''
123 },
124 /** URL used in `disconnect()`. */
125 disconnectUrl: {
126 type: String,
127 value: ''
128 },
129 /** URL used in `subscribe()`. */
130 subscribeUrl: {
131 type: String,
132 value: ''
133 },
134 /** URL used in `unsubscribe()`. */
135 unsubscribeUrl: {
136 type: String,
137 value: ''
138 },
139 /** URL used in `message()`. */
140 messageUrl: {
141 type: String,
142 value: ''
143 },
144 /** Long-polling connection url. */
145 longPollUrl: {
146 type: String,
147 value: ''
148 },
149 /** Long-polling connection url. */
150 shouldReconnect: {
151 type: Boolean,
152 value: true
153 },
154 /** Should send heartbeats. */
155 heartbeats: {
156 type: Boolean,
157 value: true
158 },
159 /** How much should every retry interval increase (in milliseconds) */
160 increaseBounceIv: {
161 type: Number,
162 value: 2000
163 },
164 _currentBounceIv: {
165 type: Number,
166 reflectToAttribute: true,
167 value: 0
168 },
169 /** Should use websockets or long-polling by default */
170 useWebsocket: {
171 type: Boolean,
172 reflectToAttribute: true,
173 value: true
174 },
175 connected: {
176 type: Boolean,
177 reflectToAttribute: true,
178 value: false
179 }
180 },
181
182 observers: [
183 '_handleChannelsChange(channels.splices)'
184 ],
185
186 listeners: {
187 'channelstream-connected': 'startListening',
188 'channelstream-connect-error': 'retryConnection',
189 },
190
191 /**
192 * Mutators hold functions that you can set locally to change the data
193 * that the client is sending to all endpoints
194 * you can call it like `elem.mutators('connect', yourFunc())`
195 * mutators will be executed in order they were pushed onto arrays
196 *
197 */
198 mutators: {
199 connect: function () {
200 return []
201 }(),
202 message: function () {
203 return []
204 }(),
205 subscribe: function () {
206 return []
207 }(),
208 unsubscribe: function () {
209 return []
210 }(),
211 disconnect: function () {
212 return []
213 }()
214 },
215 ready: function () {
216 this.isReady = true;
217 },
218
219 /**
220 * Connects user and fetches connection id from the server.
221 *
222 */
223 connect: function () {
224 var request = this.$['ajaxConnect'];
225 request.url = this.connectUrl;
226 request.body = {
227 username: this.username,
228 channels: this.channels
229 };
230 for (var i = 0; i < this.mutators.connect.length; i++) {
231 this.mutators.connect[i](request);
232 }
233 request.generateRequest()
234 },
235 /**
236 * Overwrite with custom function that will
237 */
238 addMutator: function (type, func) {
239 this.mutators[type].push(func);
240 },
241 /**
242 * Subscribes user to channels.
243 *
244 */
245 subscribe: function (channels) {
246 var request = this.$['ajaxSubscribe'];
247 request.url = this.subscribeUrl;
248 request.body = {
249 channels: channels,
250 conn_id: this.connectionId
251 };
252 for (var i = 0; i < this.mutators.subscribe.length; i++) {
253 this.mutators.subscribe[i](request);
254 }
255 if (request.body.channels.length) {
256 request.generateRequest();
257 }
258 },
259 /**
260 * Unsubscribes user from channels.
261 *
262 */
263 unsubscribe: function (unsubscribe) {
264 var request = this.$['ajaxUnsubscribe'];
265
266 request.url = this.unsubscribeUrl;
267 request.body = {
268 channels: unsubscribe,
269 conn_id: this.connectionId
270 };
271 for (var i = 0; i < this.mutators.unsubscribe.length; i++) {
272 this.mutators.unsubscribe[i](request);
273 }
274 request.generateRequest()
275 },
276
277 /**
278 * calculates list of channels we should add user to based on difference
279 * between channels property and passed channel list
280 */
281 calculateSubscribe: function (channels) {
282 var currentlySubscribed = this.channels;
283 var toSubscribe = [];
284 for (var i = 0; i < channels.length; i++) {
285 if (currentlySubscribed.indexOf(channels[i]) === -1) {
286 toSubscribe.push(channels[i]);
287 }
288 }
289 return toSubscribe
290 },
291 /**
292 * calculates list of channels we should remove user from based difference
293 * between channels property and passed channel list
294 */
295 calculateUnsubscribe: function (channels) {
296 var currentlySubscribed = this.channels;
297 var toUnsubscribe = [];
298 for (var i = 0; i < channels.length; i++) {
299 if (currentlySubscribed.indexOf(channels[i]) !== -1) {
300 toUnsubscribe.push(channels[i]);
301 }
302 }
303 return toUnsubscribe
304 },
305 /**
306 * Marks the connection as expired.
307 *
308 */
309 disconnect: function () {
310 var request = this.$['ajaxDisconnect'];
311 request.url = this.disconnectUrl;
312 request.params = {
313 conn_id: this.connectionId
314 };
315 for (var i = 0; i < this.mutators.disconnect.length; i++) {
316 this.mutators.disconnect[i](request);
317 }
318 // mark connection as expired
319 request.generateRequest();
320 // disconnect existing connection
321 this.closeConnection();
322 },
323
324 /**
325 * Sends a message to the server.
326 *
327 */
328 message: function (message) {
329 var request = this.$['ajaxMessage'];
330 request.url = this.messageUrl;
331 request.body = message;
332 for (var i = 0; i < this.mutators.message.length; i++) {
333 this.mutators.message[i](request)
334 }
335 request.generateRequest();
336 },
337 /**
338 * Opens "long lived" (websocket/longpoll) connection to the channelstream server.
339 *
340 */
341 startListening: function (event) {
342 this.fire('start-listening', {});
343 if (this.useWebsocket) {
344 this.useWebsocket = window.WebSocket ? true : false;
345 }
346 if (this.useWebsocket) {
347 this.openWebsocket();
348 }
349 else {
350 this.openLongPoll();
351 }
352 },
353 /**
354 * Opens websocket connection.
355 *
356 */
357 openWebsocket: function () {
358 var url = this.websocketUrl + '?conn_id=' + this.connectionId;
359 this.websocket = new WebSocket(url);
360 this.websocket.onopen = this._handleListenOpen.bind(this);
361 this.websocket.onclose = this._handleListenCloseEvent.bind(this);
362 this.websocket.onerror = this._handleListenErrorEvent.bind(this);
363 this.websocket.onmessage = this._handleListenMessageEvent.bind(this);
364 },
365 /**
366 * Opens long-poll connection.
367 *
368 */
369 openLongPoll: function () {
370 var request = this.$['ajaxListen'];
371 request.url = this.longPollUrl + '?conn_id=' + this.connectionId;
372 request.generateRequest()
373 },
374 /**
375 * Retries `connect()` call while incrementing interval between tries up to 1 minute.
376 *
377 */
378 retryConnection: function () {
379 if (!this.shouldReconnect) {
380 return;
381 }
382 if (this._currentBounceIv < 60000) {
383 this._currentBounceIv = this._currentBounceIv + this.increaseBounceIv;
384 }
385 else {
386 this._currentBounceIv = 60000;
387 }
388 setTimeout(this.connect.bind(this), this._currentBounceIv);
389 },
390 /**
391 * Closes listening connection.
392 *
393 */
394 closeConnection: function () {
395 var request = this.$['ajaxListen'];
396 if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
397 this.websocket.onclose = null;
398 this.websocket.onerror = null;
399 this.websocket.close();
400 }
401 if (request.loading) {
402 request.lastRequest.abort();
403 }
404 this.connected = false;
405 },
406
407 _handleChannelsChange: function (event) {
408 // do not fire the event if set() didn't mutate anything
409 // is this a reliable way to do it?
410 if (!this.isReady || event === undefined) {
411 return
412 }
413 this.fire('channelstream-channels-changed', event)
414 },
415
416 _handleListenOpen: function (event) {
417 this.connected = true;
418 this.fire('channelstream-listen-opened', event);
419 this.createHeartBeats();
420 },
421
422 createHeartBeats: function () {
423 if (typeof self._heartbeat === 'undefined' && this.websocket !== null
424 && this.heartbeats) {
425 self._heartbeat = setInterval(this._sendHeartBeat.bind(this), 10000);
426 }
427 },
428
429 _sendHeartBeat: function () {
430 if (this.websocket.readyState === WebSocket.OPEN && this.heartbeats) {
431 this.websocket.send(JSON.stringify({type: 'heartbeat'}));
432 }
433 },
434
435 _handleListenError: function (event) {
436 this.connected = false;
437 this.retryConnection();
438 },
439 _handleConnectError: function (event) {
440 this.connected = false;
441 this.fire('channelstream-connect-error', event.detail);
442 },
443
444 _handleListenMessageEvent: function (event) {
445 var data = null;
446 // comes from iron-ajax
447 if (event.detail) {
448 data = JSON.parse(event.detail.response)
449 // comes from websocket
450 setTimeout(this.openLongPoll.bind(this), 0);
451 } else {
452 data = JSON.parse(event.data)
453 }
454 this.fire('channelstream-listen-message', data);
455
456 },
457
458 _handleListenCloseEvent: function (event) {
459 this.connected = false;
460 this.fire('channelstream-listen-closed', event.detail);
461 this.retryConnection();
462 },
463
464 _handleListenErrorEvent: function (event) {
465 this.connected = false;
466 this.fire('channelstream-listen-error', {})
467 },
468
469 _handleConnect: function (event) {
470 this.currentBounceIv = 0;
471 this.connectionId = event.detail.response.conn_id;
472 this.fire('channelstream-connected', event.detail.response);
473 },
474
475 _handleDisconnect: function (event) {
476 this.connected = false;
477 this.fire('channelstream-disconnected', {});
478 },
479
480 _handleMessage: function (event) {
481 this.fire('channelstream-message-sent', event.detail.response);
482 },
483 _handleMessageError: function (event) {
484 this.fire('channelstream-message-error', event.detail);
485 },
486
487 _handleSubscribe: function (event) {
488 this.fire('channelstream-subscribed', event.detail.response);
489 },
490
491 _handleSubscribeError: function (event) {
492 this.fire('channelstream-subscribe-error', event.detail);
493 },
494
495 _handleUnsubscribe: function (event) {
496 this.fire('channelstream-unsubscribed', event.detail.response);
497 },
498
499 _handleUnsubscribeError: function (event) {
500 this.fire('channelstream-unsubscribe-error', event.detail);
501 }
502 });
@@ -0,0 +1,15 b''
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
2 <link rel="import" href="../channelstream-connection/channelstream-connection.html">
3
4 <dom-module id="rhodecode-app">
5 <template>
6 <rhodecode-toast id="notifications"></rhodecode-toast>
7 <channelstream-connection
8 id="channelstream-connection"
9 on-channelstream-listen-message="receivedMessage"
10 on-channelstream-connected="handleConnected"
11 on-channelstream-subscribed="handleSubscribed">
12 </channelstream-connection>
13 </template>
14 <script src="rhodecode-app.js"></script>
15 </dom-module>
@@ -0,0 +1,129 b''
1 ccLog = Logger.get('RhodeCodeApp');
2 ccLog.setLevel(Logger.OFF);
3
4 var rhodeCodeApp = Polymer({
5 is: 'rhodecode-app',
6 created: function () {
7 ccLog.debug('rhodeCodeApp created');
8 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
9
10 $.Topic('/plugins/__REGISTER__').subscribe(
11 this.kickoffChannelstreamPlugin.bind(this)
12 );
13
14 $.Topic('/connection_controller/subscribe').subscribe(
15 this.subscribeToChannelTopic.bind(this));
16 },
17
18 /** proxy to channelstream connection */
19 getChannelStreamConnection: function () {
20 return this.$['channelstream-connection'];
21 },
22
23 handleNotifications: function (data) {
24 this.$['notifications'].handleNotification(data);
25 },
26
27 /** opens connection to ws server */
28 kickoffChannelstreamPlugin: function (data) {
29 ccLog.debug('kickoffChannelstreamPlugin');
30 var channels = ['broadcast'];
31 var addChannels = this.checkViewChannels();
32 for (var i = 0; i < addChannels.length; i++) {
33 channels.push(addChannels[i]);
34 }
35 if (window.CHANNELSTREAM_SETTINGS && CHANNELSTREAM_SETTINGS.enabled){
36 var channelstreamConnection = this.$['channelstream-connection'];
37 channelstreamConnection.connectUrl = CHANNELSTREAM_URLS.connect;
38 channelstreamConnection.subscribeUrl = CHANNELSTREAM_URLS.subscribe;
39 channelstreamConnection.websocketUrl = CHANNELSTREAM_URLS.ws + '/ws';
40 channelstreamConnection.longPollUrl = CHANNELSTREAM_URLS.longpoll + '/listen';
41 // some channels might already be registered by topic
42 for (var i = 0; i < channels.length; i++) {
43 channelstreamConnection.push('channels', channels[i]);
44 }
45 // append any additional channels registered in other plugins
46 $.Topic('/connection_controller/subscribe').processPrepared();
47 channelstreamConnection.connect();
48 }
49 },
50
51 checkViewChannels: function () {
52 var channels = []
53 // subscribe to PR repo channel for PR's'
54 if (templateContext.pull_request_data.pull_request_id) {
55 var channelName = '/repo$' + templateContext.repo_name + '$/pr/' +
56 String(templateContext.pull_request_data.pull_request_id);
57 channels.push(channelName);
58 }
59 return channels;
60 },
61
62 /** subscribes users from channels in channelstream */
63 subscribeToChannelTopic: function (channels) {
64 var channelstreamConnection = this.$['channelstream-connection'];
65 var toSubscribe = channelstreamConnection.calculateSubscribe(channels);
66 ccLog.debug('subscribeToChannelTopic', toSubscribe);
67 if (toSubscribe.length > 0) {
68 // if we are connected then subscribe
69 if (channelstreamConnection.connected) {
70 channelstreamConnection.subscribe(toSubscribe);
71 }
72 // not connected? just push channels onto the stack
73 else {
74 for (var i = 0; i < toSubscribe.length; i++) {
75 channelstreamConnection.push('channels', toSubscribe[i]);
76 }
77 }
78 }
79 },
80
81 /** publish received messages into correct topic */
82 receivedMessage: function (event) {
83 for (var i = 0; i < event.detail.length; i++) {
84 var message = event.detail[i];
85 if (message.message.topic) {
86 ccLog.debug('publishing', message.message.topic);
87 $.Topic(message.message.topic).publish(message);
88 }
89 else if (message.type === 'presence'){
90 $.Topic('/connection_controller/presence').publish(message);
91 }
92 else {
93 ccLog.warn('unhandled message', message);
94 }
95 }
96 },
97
98 handleConnected: function (event) {
99 var channelstreamConnection = this.$['channelstream-connection'];
100 channelstreamConnection.set('channelsState',
101 event.detail.channels_info);
102 channelstreamConnection.set('userState', event.detail.state);
103 channelstreamConnection.set('channels', event.detail.channels);
104 this.propagageChannelsState();
105 },
106 handleSubscribed: function (event) {
107 var channelstreamConnection = this.$['channelstream-connection'];
108 var channelInfo = event.detail.channels_info;
109 var channelKeys = Object.keys(event.detail.channels_info);
110 for (var i = 0; i < channelKeys.length; i++) {
111 var key = channelKeys[i];
112 channelstreamConnection.set(['channelsState', key], channelInfo[key]);
113 }
114 channelstreamConnection.set('channels', event.detail.channels);
115 this.propagageChannelsState();
116 },
117 /** propagates channel states on topics */
118 propagageChannelsState: function (event) {
119 var channelstreamConnection = this.$['channelstream-connection'];
120 var channel_data = channelstreamConnection.channelsState;
121 var channels = channelstreamConnection.channels;
122 for (var i = 0; i < channels.length; i++) {
123 var key = channels[i];
124 $.Topic('/connection_controller/channel_update').publish(
125 {channel: key, state: channel_data[key]}
126 );
127 }
128 }
129 });
@@ -0,0 +1,30 b''
1 <link rel="import" href="../../../../../../bower_components/paper-button/paper-button.html">
2 <link rel="import" href="../../../../../../bower_components/paper-toast/paper-toast.html">
3 <link rel="import" href="../rhodecode-unsafe-html/rhodecode-unsafe-html.html">
4 <dom-module id="rhodecode-toast">
5 <template>
6 <style include="shared-styles"></style>
7 <link rel="stylesheet" href="rhodecode-toast.css">
8
9 <paper-toast id="p-toast"
10 duration="0"
11 horizontal-offset="100"
12 horizontal-align="auto"
13 vertical-align="top"
14 on-iron-overlay-closed="handleClosed"
15 always-on-top>
16 <div class="toast-message-holder">
17 <template is="dom-repeat" items="{{toasts}}">
18 <div class$="alert alert-{{item.level}}">
19 <rhodecode-unsafe-html text="{{item.message}}"></rhodecode-unsafe-html>
20 </div>
21 </template>
22 </div>
23 <div class="toast-close">
24 <button on-tap="dismissNotifications" class="btn btn-default">{{_gettext('Close now')}}</button>
25 </div>
26 </paper-toast>
27 </template>
28
29 <script src="rhodecode-toast.js"></script>
30 </dom-module>
@@ -0,0 +1,38 b''
1 Polymer({
2 is: 'rhodecode-toast',
3 properties: {
4 toasts: {
5 type: Array,
6 value: function(){
7 return []
8 }
9 }
10 },
11 observers: [
12 '_changedToasts(toasts.splices)'
13 ],
14 _changedToasts: function(newValue, oldValue){
15 this.$['p-toast'].notifyResize();
16 },
17 dismissNotifications: function(){
18 this.$['p-toast'].close();
19 },
20 handleClosed: function(){
21 this.splice('toasts', 0);
22 },
23 open: function(){
24 this.$['p-toast'].open();
25 },
26 handleNotification: function(data){
27 if (!templateContext.rhodecode_user.notification_status && !data.message.force) {
28 // do not act if notifications are disabled
29 return
30 }
31 this.push('toasts',{
32 level: data.message.level,
33 message: data.message.message
34 });
35 this.open();
36 },
37 _gettext: _gettext
38 });
@@ -0,0 +1,29 b''
1 @import '../../../../css/variables';
2 @import '../../../../css/mixins';
3
4 paper-toast{
5 width: 100%;
6 min-width: 400px;
7 padding: 0px;
8 --paper-toast-background-color: transparent;
9 --paper-toast-color: #000000;
10 .box-shadow(none);
11 }
12 paper-toast a{
13 font-weight: bold
14 }
15
16 .toast-message-holder {
17 }
18 .toast-close {
19 right: -5px;
20 position: absolute;
21 bottom: -45px;
22 paper-button{
23 .box-shadow(0 2px 5px 0 rgba(0, 0, 0, 0.15));
24 }
25 }
26 paper-toast .alert{
27 margin: @padding 0 0 0;
28 .box-shadow(0 2px 5px 0 rgba(0, 0, 0, 0.15));
29 }
@@ -0,0 +1,21 b''
1 <link rel="import" href="../../../../../../bower_components/paper-toggle-button/paper-toggle-button.html">
2 <link rel="import" href="../../../../../../bower_components/paper-spinner/paper-spinner.html">
3 <link rel="import" href="../../../../../../bower_components/paper-tooltip/paper-tooltip.html">
4
5 <dom-module id="rhodecode-toggle">
6
7 <style include="shared-styles"></style>
8 <link rel="stylesheet" href="rhodecode-toggle.css">
9
10 <template>
11 <div class="rc-toggle">
12 <paper-toggle-button checked={{checked}}>[[labelStatus(checked)]]</paper-toggle-button>
13 <paper-tooltip>[[tooltipText]]</paper-tooltip>
14 <template is="dom-if" if="[[shouldShow(noSpinner)]]">
15 <paper-spinner active=[[active]]></paper-spinner>
16 </template>
17 </div>
18 </template>
19
20 <script src="rhodecode-toggle.js"></script>
21 </dom-module> No newline at end of file
@@ -0,0 +1,16 b''
1 Polymer({
2 is: 'rhodecode-toggle',
3 properties: {
4 noSpinner: { type: Boolean, value: false, reflectToAttribute:true},
5 tooltipText: { type: String, value: "Click to toggle", reflectToAttribute:true},
6 checked: { type: Boolean, value: false, reflectToAttribute:true},
7 active: { type: Boolean, value: false, reflectToAttribute:true, notify:true}
8 },
9 shouldShow: function(){
10 return !this.noSpinner
11 },
12 labelStatus: function(isActive){
13 return this.checked? 'Enabled' : "Disabled"
14 }
15
16 }); No newline at end of file
@@ -0,0 +1,14 b''
1 @import '../../../../css/variables';
2
3 .rc-toggle {
4 float: left;
5 position: relative;
6
7 paper-spinner {
8 position: absolute;
9 top: 0;
10 left: -30px;
11 width: 20px;
12 height: 20px;
13 }
14 } No newline at end of file
@@ -0,0 +1,9 b''
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
2
3 <dom-module id="rhodecode-unsafe-html">
4 <template>
5 <style include="shared-styles"></style>
6 <content></content>
7 </template>
8 <script src="rhodecode-unsafe-html.js"></script>
9 </dom-module>
@@ -0,0 +1,12 b''
1 Polymer({
2 is: 'rhodecode-unsafe-html',
3 properties: {
4 text: {
5 type: String,
6 observer: '_handleText'
7 }
8 },
9 _handleText: function(newVal, oldVal){
10 this.innerHTML = this.text;
11 }
12 })
@@ -0,0 +1,3 b''
1 <dom-module id="root-styles">
2 <template>
3 <style>
@@ -0,0 +1,3 b''
1 </style>
2 </template>
3 </dom-module>
@@ -0,0 +1,8 b''
1 <!-- required for stamped out templates that might use common elements -->
2 <link rel="import" href="../../../../../bower_components/iron-ajax/iron-ajax.html">
3 <link rel="import" href="shared-styles.html">
4 <link rel="import" href="channelstream-connection/channelstream-connection.html">
5 <link rel="import" href="rhodecode-app/rhodecode-app.html">
6 <link rel="import" href="rhodecode-toast/rhodecode-toast.html">
7 <link rel="import" href="rhodecode-toggle/rhodecode-toggle.html">
8 <link rel="import" href="rhodecode-unsafe-html/rhodecode-unsafe-html.html">
@@ -0,0 +1,5 b''
1 <dom-module id="shared-styles">
2 <template>
3 <link rel="stylesheet" href="../../../css/style-polymer.css">
4 </template>
5 </dom-module>
This diff has been collapsed as it changes many lines, (2505 lines changed) Show them Hide them
@@ -0,0 +1,2505 b''
1 /**
2 * @license
3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 * Code distributed by Google as part of the polymer project is also
8 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 */
10 // @version 0.7.22
11 (function() {
12 window.WebComponents = window.WebComponents || {
13 flags: {}
14 };
15 var file = "webcomponents-lite.js";
16 var script = document.querySelector('script[src*="' + file + '"]');
17 var flags = {};
18 if (!flags.noOpts) {
19 location.search.slice(1).split("&").forEach(function(option) {
20 var parts = option.split("=");
21 var match;
22 if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
23 flags[match[1]] = parts[1] || true;
24 }
25 });
26 if (script) {
27 for (var i = 0, a; a = script.attributes[i]; i++) {
28 if (a.name !== "src") {
29 flags[a.name] = a.value || true;
30 }
31 }
32 }
33 if (flags.log && flags.log.split) {
34 var parts = flags.log.split(",");
35 flags.log = {};
36 parts.forEach(function(f) {
37 flags.log[f] = true;
38 });
39 } else {
40 flags.log = {};
41 }
42 }
43 if (flags.register) {
44 window.CustomElements = window.CustomElements || {
45 flags: {}
46 };
47 window.CustomElements.flags.register = flags.register;
48 }
49 WebComponents.flags = flags;
50 })();
51
52 (function(scope) {
53 "use strict";
54 var hasWorkingUrl = false;
55 if (!scope.forceJURL) {
56 try {
57 var u = new URL("b", "http://a");
58 u.pathname = "c%20d";
59 hasWorkingUrl = u.href === "http://a/c%20d";
60 } catch (e) {}
61 }
62 if (hasWorkingUrl) return;
63 var relative = Object.create(null);
64 relative["ftp"] = 21;
65 relative["file"] = 0;
66 relative["gopher"] = 70;
67 relative["http"] = 80;
68 relative["https"] = 443;
69 relative["ws"] = 80;
70 relative["wss"] = 443;
71 var relativePathDotMapping = Object.create(null);
72 relativePathDotMapping["%2e"] = ".";
73 relativePathDotMapping[".%2e"] = "..";
74 relativePathDotMapping["%2e."] = "..";
75 relativePathDotMapping["%2e%2e"] = "..";
76 function isRelativeScheme(scheme) {
77 return relative[scheme] !== undefined;
78 }
79 function invalid() {
80 clear.call(this);
81 this._isInvalid = true;
82 }
83 function IDNAToASCII(h) {
84 if ("" == h) {
85 invalid.call(this);
86 }
87 return h.toLowerCase();
88 }
89 function percentEscape(c) {
90 var unicode = c.charCodeAt(0);
91 if (unicode > 32 && unicode < 127 && [ 34, 35, 60, 62, 63, 96 ].indexOf(unicode) == -1) {
92 return c;
93 }
94 return encodeURIComponent(c);
95 }
96 function percentEscapeQuery(c) {
97 var unicode = c.charCodeAt(0);
98 if (unicode > 32 && unicode < 127 && [ 34, 35, 60, 62, 96 ].indexOf(unicode) == -1) {
99 return c;
100 }
101 return encodeURIComponent(c);
102 }
103 var EOF = undefined, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
104 function parse(input, stateOverride, base) {
105 function err(message) {
106 errors.push(message);
107 }
108 var state = stateOverride || "scheme start", cursor = 0, buffer = "", seenAt = false, seenBracket = false, errors = [];
109 loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) {
110 var c = input[cursor];
111 switch (state) {
112 case "scheme start":
113 if (c && ALPHA.test(c)) {
114 buffer += c.toLowerCase();
115 state = "scheme";
116 } else if (!stateOverride) {
117 buffer = "";
118 state = "no scheme";
119 continue;
120 } else {
121 err("Invalid scheme.");
122 break loop;
123 }
124 break;
125
126 case "scheme":
127 if (c && ALPHANUMERIC.test(c)) {
128 buffer += c.toLowerCase();
129 } else if (":" == c) {
130 this._scheme = buffer;
131 buffer = "";
132 if (stateOverride) {
133 break loop;
134 }
135 if (isRelativeScheme(this._scheme)) {
136 this._isRelative = true;
137 }
138 if ("file" == this._scheme) {
139 state = "relative";
140 } else if (this._isRelative && base && base._scheme == this._scheme) {
141 state = "relative or authority";
142 } else if (this._isRelative) {
143 state = "authority first slash";
144 } else {
145 state = "scheme data";
146 }
147 } else if (!stateOverride) {
148 buffer = "";
149 cursor = 0;
150 state = "no scheme";
151 continue;
152 } else if (EOF == c) {
153 break loop;
154 } else {
155 err("Code point not allowed in scheme: " + c);
156 break loop;
157 }
158 break;
159
160 case "scheme data":
161 if ("?" == c) {
162 this._query = "?";
163 state = "query";
164 } else if ("#" == c) {
165 this._fragment = "#";
166 state = "fragment";
167 } else {
168 if (EOF != c && " " != c && "\n" != c && "\r" != c) {
169 this._schemeData += percentEscape(c);
170 }
171 }
172 break;
173
174 case "no scheme":
175 if (!base || !isRelativeScheme(base._scheme)) {
176 err("Missing scheme.");
177 invalid.call(this);
178 } else {
179 state = "relative";
180 continue;
181 }
182 break;
183
184 case "relative or authority":
185 if ("/" == c && "/" == input[cursor + 1]) {
186 state = "authority ignore slashes";
187 } else {
188 err("Expected /, got: " + c);
189 state = "relative";
190 continue;
191 }
192 break;
193
194 case "relative":
195 this._isRelative = true;
196 if ("file" != this._scheme) this._scheme = base._scheme;
197 if (EOF == c) {
198 this._host = base._host;
199 this._port = base._port;
200 this._path = base._path.slice();
201 this._query = base._query;
202 this._username = base._username;
203 this._password = base._password;
204 break loop;
205 } else if ("/" == c || "\\" == c) {
206 if ("\\" == c) err("\\ is an invalid code point.");
207 state = "relative slash";
208 } else if ("?" == c) {
209 this._host = base._host;
210 this._port = base._port;
211 this._path = base._path.slice();
212 this._query = "?";
213 this._username = base._username;
214 this._password = base._password;
215 state = "query";
216 } else if ("#" == c) {
217 this._host = base._host;
218 this._port = base._port;
219 this._path = base._path.slice();
220 this._query = base._query;
221 this._fragment = "#";
222 this._username = base._username;
223 this._password = base._password;
224 state = "fragment";
225 } else {
226 var nextC = input[cursor + 1];
227 var nextNextC = input[cursor + 2];
228 if ("file" != this._scheme || !ALPHA.test(c) || nextC != ":" && nextC != "|" || EOF != nextNextC && "/" != nextNextC && "\\" != nextNextC && "?" != nextNextC && "#" != nextNextC) {
229 this._host = base._host;
230 this._port = base._port;
231 this._username = base._username;
232 this._password = base._password;
233 this._path = base._path.slice();
234 this._path.pop();
235 }
236 state = "relative path";
237 continue;
238 }
239 break;
240
241 case "relative slash":
242 if ("/" == c || "\\" == c) {
243 if ("\\" == c) {
244 err("\\ is an invalid code point.");
245 }
246 if ("file" == this._scheme) {
247 state = "file host";
248 } else {
249 state = "authority ignore slashes";
250 }
251 } else {
252 if ("file" != this._scheme) {
253 this._host = base._host;
254 this._port = base._port;
255 this._username = base._username;
256 this._password = base._password;
257 }
258 state = "relative path";
259 continue;
260 }
261 break;
262
263 case "authority first slash":
264 if ("/" == c) {
265 state = "authority second slash";
266 } else {
267 err("Expected '/', got: " + c);
268 state = "authority ignore slashes";
269 continue;
270 }
271 break;
272
273 case "authority second slash":
274 state = "authority ignore slashes";
275 if ("/" != c) {
276 err("Expected '/', got: " + c);
277 continue;
278 }
279 break;
280
281 case "authority ignore slashes":
282 if ("/" != c && "\\" != c) {
283 state = "authority";
284 continue;
285 } else {
286 err("Expected authority, got: " + c);
287 }
288 break;
289
290 case "authority":
291 if ("@" == c) {
292 if (seenAt) {
293 err("@ already seen.");
294 buffer += "%40";
295 }
296 seenAt = true;
297 for (var i = 0; i < buffer.length; i++) {
298 var cp = buffer[i];
299 if (" " == cp || "\n" == cp || "\r" == cp) {
300 err("Invalid whitespace in authority.");
301 continue;
302 }
303 if (":" == cp && null === this._password) {
304 this._password = "";
305 continue;
306 }
307 var tempC = percentEscape(cp);
308 null !== this._password ? this._password += tempC : this._username += tempC;
309 }
310 buffer = "";
311 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) {
312 cursor -= buffer.length;
313 buffer = "";
314 state = "host";
315 continue;
316 } else {
317 buffer += c;
318 }
319 break;
320
321 case "file host":
322 if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) {
323 if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ":" || buffer[1] == "|")) {
324 state = "relative path";
325 } else if (buffer.length == 0) {
326 state = "relative path start";
327 } else {
328 this._host = IDNAToASCII.call(this, buffer);
329 buffer = "";
330 state = "relative path start";
331 }
332 continue;
333 } else if (" " == c || "\n" == c || "\r" == c) {
334 err("Invalid whitespace in file host.");
335 } else {
336 buffer += c;
337 }
338 break;
339
340 case "host":
341 case "hostname":
342 if (":" == c && !seenBracket) {
343 this._host = IDNAToASCII.call(this, buffer);
344 buffer = "";
345 state = "port";
346 if ("hostname" == stateOverride) {
347 break loop;
348 }
349 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) {
350 this._host = IDNAToASCII.call(this, buffer);
351 buffer = "";
352 state = "relative path start";
353 if (stateOverride) {
354 break loop;
355 }
356 continue;
357 } else if (" " != c && "\n" != c && "\r" != c) {
358 if ("[" == c) {
359 seenBracket = true;
360 } else if ("]" == c) {
361 seenBracket = false;
362 }
363 buffer += c;
364 } else {
365 err("Invalid code point in host/hostname: " + c);
366 }
367 break;
368
369 case "port":
370 if (/[0-9]/.test(c)) {
371 buffer += c;
372 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c || stateOverride) {
373 if ("" != buffer) {
374 var temp = parseInt(buffer, 10);
375 if (temp != relative[this._scheme]) {
376 this._port = temp + "";
377 }
378 buffer = "";
379 }
380 if (stateOverride) {
381 break loop;
382 }
383 state = "relative path start";
384 continue;
385 } else if (" " == c || "\n" == c || "\r" == c) {
386 err("Invalid code point in port: " + c);
387 } else {
388 invalid.call(this);
389 }
390 break;
391
392 case "relative path start":
393 if ("\\" == c) err("'\\' not allowed in path.");
394 state = "relative path";
395 if ("/" != c && "\\" != c) {
396 continue;
397 }
398 break;
399
400 case "relative path":
401 if (EOF == c || "/" == c || "\\" == c || !stateOverride && ("?" == c || "#" == c)) {
402 if ("\\" == c) {
403 err("\\ not allowed in relative path.");
404 }
405 var tmp;
406 if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
407 buffer = tmp;
408 }
409 if (".." == buffer) {
410 this._path.pop();
411 if ("/" != c && "\\" != c) {
412 this._path.push("");
413 }
414 } else if ("." == buffer && "/" != c && "\\" != c) {
415 this._path.push("");
416 } else if ("." != buffer) {
417 if ("file" == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == "|") {
418 buffer = buffer[0] + ":";
419 }
420 this._path.push(buffer);
421 }
422 buffer = "";
423 if ("?" == c) {
424 this._query = "?";
425 state = "query";
426 } else if ("#" == c) {
427 this._fragment = "#";
428 state = "fragment";
429 }
430 } else if (" " != c && "\n" != c && "\r" != c) {
431 buffer += percentEscape(c);
432 }
433 break;
434
435 case "query":
436 if (!stateOverride && "#" == c) {
437 this._fragment = "#";
438 state = "fragment";
439 } else if (EOF != c && " " != c && "\n" != c && "\r" != c) {
440 this._query += percentEscapeQuery(c);
441 }
442 break;
443
444 case "fragment":
445 if (EOF != c && " " != c && "\n" != c && "\r" != c) {
446 this._fragment += c;
447 }
448 break;
449 }
450 cursor++;
451 }
452 }
453 function clear() {
454 this._scheme = "";
455 this._schemeData = "";
456 this._username = "";
457 this._password = null;
458 this._host = "";
459 this._port = "";
460 this._path = [];
461 this._query = "";
462 this._fragment = "";
463 this._isInvalid = false;
464 this._isRelative = false;
465 }
466 function jURL(url, base) {
467 if (base !== undefined && !(base instanceof jURL)) base = new jURL(String(base));
468 this._url = url;
469 clear.call(this);
470 var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, "");
471 parse.call(this, input, null, base);
472 }
473 jURL.prototype = {
474 toString: function() {
475 return this.href;
476 },
477 get href() {
478 if (this._isInvalid) return this._url;
479 var authority = "";
480 if ("" != this._username || null != this._password) {
481 authority = this._username + (null != this._password ? ":" + this._password : "") + "@";
482 }
483 return this.protocol + (this._isRelative ? "//" + authority + this.host : "") + this.pathname + this._query + this._fragment;
484 },
485 set href(href) {
486 clear.call(this);
487 parse.call(this, href);
488 },
489 get protocol() {
490 return this._scheme + ":";
491 },
492 set protocol(protocol) {
493 if (this._isInvalid) return;
494 parse.call(this, protocol + ":", "scheme start");
495 },
496 get host() {
497 return this._isInvalid ? "" : this._port ? this._host + ":" + this._port : this._host;
498 },
499 set host(host) {
500 if (this._isInvalid || !this._isRelative) return;
501 parse.call(this, host, "host");
502 },
503 get hostname() {
504 return this._host;
505 },
506 set hostname(hostname) {
507 if (this._isInvalid || !this._isRelative) return;
508 parse.call(this, hostname, "hostname");
509 },
510 get port() {
511 return this._port;
512 },
513 set port(port) {
514 if (this._isInvalid || !this._isRelative) return;
515 parse.call(this, port, "port");
516 },
517 get pathname() {
518 return this._isInvalid ? "" : this._isRelative ? "/" + this._path.join("/") : this._schemeData;
519 },
520 set pathname(pathname) {
521 if (this._isInvalid || !this._isRelative) return;
522 this._path = [];
523 parse.call(this, pathname, "relative path start");
524 },
525 get search() {
526 return this._isInvalid || !this._query || "?" == this._query ? "" : this._query;
527 },
528 set search(search) {
529 if (this._isInvalid || !this._isRelative) return;
530 this._query = "?";
531 if ("?" == search[0]) search = search.slice(1);
532 parse.call(this, search, "query");
533 },
534 get hash() {
535 return this._isInvalid || !this._fragment || "#" == this._fragment ? "" : this._fragment;
536 },
537 set hash(hash) {
538 if (this._isInvalid) return;
539 this._fragment = "#";
540 if ("#" == hash[0]) hash = hash.slice(1);
541 parse.call(this, hash, "fragment");
542 },
543 get origin() {
544 var host;
545 if (this._isInvalid || !this._scheme) {
546 return "";
547 }
548 switch (this._scheme) {
549 case "data":
550 case "file":
551 case "javascript":
552 case "mailto":
553 return "null";
554 }
555 host = this.host;
556 if (!host) {
557 return "";
558 }
559 return this._scheme + "://" + host;
560 }
561 };
562 var OriginalURL = scope.URL;
563 if (OriginalURL) {
564 jURL.createObjectURL = function(blob) {
565 return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
566 };
567 jURL.revokeObjectURL = function(url) {
568 OriginalURL.revokeObjectURL(url);
569 };
570 }
571 scope.URL = jURL;
572 })(self);
573
574 if (typeof WeakMap === "undefined") {
575 (function() {
576 var defineProperty = Object.defineProperty;
577 var counter = Date.now() % 1e9;
578 var WeakMap = function() {
579 this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
580 };
581 WeakMap.prototype = {
582 set: function(key, value) {
583 var entry = key[this.name];
584 if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
585 value: [ key, value ],
586 writable: true
587 });
588 return this;
589 },
590 get: function(key) {
591 var entry;
592 return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
593 },
594 "delete": function(key) {
595 var entry = key[this.name];
596 if (!entry || entry[0] !== key) return false;
597 entry[0] = entry[1] = undefined;
598 return true;
599 },
600 has: function(key) {
601 var entry = key[this.name];
602 if (!entry) return false;
603 return entry[0] === key;
604 }
605 };
606 window.WeakMap = WeakMap;
607 })();
608 }
609
610 (function(global) {
611 if (global.JsMutationObserver) {
612 return;
613 }
614 var registrationsTable = new WeakMap();
615 var setImmediate;
616 if (/Trident|Edge/.test(navigator.userAgent)) {
617 setImmediate = setTimeout;
618 } else if (window.setImmediate) {
619 setImmediate = window.setImmediate;
620 } else {
621 var setImmediateQueue = [];
622 var sentinel = String(Math.random());
623 window.addEventListener("message", function(e) {
624 if (e.data === sentinel) {
625 var queue = setImmediateQueue;
626 setImmediateQueue = [];
627 queue.forEach(function(func) {
628 func();
629 });
630 }
631 });
632 setImmediate = function(func) {
633 setImmediateQueue.push(func);
634 window.postMessage(sentinel, "*");
635 };
636 }
637 var isScheduled = false;
638 var scheduledObservers = [];
639 function scheduleCallback(observer) {
640 scheduledObservers.push(observer);
641 if (!isScheduled) {
642 isScheduled = true;
643 setImmediate(dispatchCallbacks);
644 }
645 }
646 function wrapIfNeeded(node) {
647 return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
648 }
649 function dispatchCallbacks() {
650 isScheduled = false;
651 var observers = scheduledObservers;
652 scheduledObservers = [];
653 observers.sort(function(o1, o2) {
654 return o1.uid_ - o2.uid_;
655 });
656 var anyNonEmpty = false;
657 observers.forEach(function(observer) {
658 var queue = observer.takeRecords();
659 removeTransientObserversFor(observer);
660 if (queue.length) {
661 observer.callback_(queue, observer);
662 anyNonEmpty = true;
663 }
664 });
665 if (anyNonEmpty) dispatchCallbacks();
666 }
667 function removeTransientObserversFor(observer) {
668 observer.nodes_.forEach(function(node) {
669 var registrations = registrationsTable.get(node);
670 if (!registrations) return;
671 registrations.forEach(function(registration) {
672 if (registration.observer === observer) registration.removeTransientObservers();
673 });
674 });
675 }
676 function forEachAncestorAndObserverEnqueueRecord(target, callback) {
677 for (var node = target; node; node = node.parentNode) {
678 var registrations = registrationsTable.get(node);
679 if (registrations) {
680 for (var j = 0; j < registrations.length; j++) {
681 var registration = registrations[j];
682 var options = registration.options;
683 if (node !== target && !options.subtree) continue;
684 var record = callback(options);
685 if (record) registration.enqueue(record);
686 }
687 }
688 }
689 }
690 var uidCounter = 0;
691 function JsMutationObserver(callback) {
692 this.callback_ = callback;
693 this.nodes_ = [];
694 this.records_ = [];
695 this.uid_ = ++uidCounter;
696 }
697 JsMutationObserver.prototype = {
698 observe: function(target, options) {
699 target = wrapIfNeeded(target);
700 if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
701 throw new SyntaxError();
702 }
703 var registrations = registrationsTable.get(target);
704 if (!registrations) registrationsTable.set(target, registrations = []);
705 var registration;
706 for (var i = 0; i < registrations.length; i++) {
707 if (registrations[i].observer === this) {
708 registration = registrations[i];
709 registration.removeListeners();
710 registration.options = options;
711 break;
712 }
713 }
714 if (!registration) {
715 registration = new Registration(this, target, options);
716 registrations.push(registration);
717 this.nodes_.push(target);
718 }
719 registration.addListeners();
720 },
721 disconnect: function() {
722 this.nodes_.forEach(function(node) {
723 var registrations = registrationsTable.get(node);
724 for (var i = 0; i < registrations.length; i++) {
725 var registration = registrations[i];
726 if (registration.observer === this) {
727 registration.removeListeners();
728 registrations.splice(i, 1);
729 break;
730 }
731 }
732 }, this);
733 this.records_ = [];
734 },
735 takeRecords: function() {
736 var copyOfRecords = this.records_;
737 this.records_ = [];
738 return copyOfRecords;
739 }
740 };
741 function MutationRecord(type, target) {
742 this.type = type;
743 this.target = target;
744 this.addedNodes = [];
745 this.removedNodes = [];
746 this.previousSibling = null;
747 this.nextSibling = null;
748 this.attributeName = null;
749 this.attributeNamespace = null;
750 this.oldValue = null;
751 }
752 function copyMutationRecord(original) {
753 var record = new MutationRecord(original.type, original.target);
754 record.addedNodes = original.addedNodes.slice();
755 record.removedNodes = original.removedNodes.slice();
756 record.previousSibling = original.previousSibling;
757 record.nextSibling = original.nextSibling;
758 record.attributeName = original.attributeName;
759 record.attributeNamespace = original.attributeNamespace;
760 record.oldValue = original.oldValue;
761 return record;
762 }
763 var currentRecord, recordWithOldValue;
764 function getRecord(type, target) {
765 return currentRecord = new MutationRecord(type, target);
766 }
767 function getRecordWithOldValue(oldValue) {
768 if (recordWithOldValue) return recordWithOldValue;
769 recordWithOldValue = copyMutationRecord(currentRecord);
770 recordWithOldValue.oldValue = oldValue;
771 return recordWithOldValue;
772 }
773 function clearRecords() {
774 currentRecord = recordWithOldValue = undefined;
775 }
776 function recordRepresentsCurrentMutation(record) {
777 return record === recordWithOldValue || record === currentRecord;
778 }
779 function selectRecord(lastRecord, newRecord) {
780 if (lastRecord === newRecord) return lastRecord;
781 if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
782 return null;
783 }
784 function Registration(observer, target, options) {
785 this.observer = observer;
786 this.target = target;
787 this.options = options;
788 this.transientObservedNodes = [];
789 }
790 Registration.prototype = {
791 enqueue: function(record) {
792 var records = this.observer.records_;
793 var length = records.length;
794 if (records.length > 0) {
795 var lastRecord = records[length - 1];
796 var recordToReplaceLast = selectRecord(lastRecord, record);
797 if (recordToReplaceLast) {
798 records[length - 1] = recordToReplaceLast;
799 return;
800 }
801 } else {
802 scheduleCallback(this.observer);
803 }
804 records[length] = record;
805 },
806 addListeners: function() {
807 this.addListeners_(this.target);
808 },
809 addListeners_: function(node) {
810 var options = this.options;
811 if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
812 if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
813 if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
814 if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
815 },
816 removeListeners: function() {
817 this.removeListeners_(this.target);
818 },
819 removeListeners_: function(node) {
820 var options = this.options;
821 if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
822 if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
823 if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
824 if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
825 },
826 addTransientObserver: function(node) {
827 if (node === this.target) return;
828 this.addListeners_(node);
829 this.transientObservedNodes.push(node);
830 var registrations = registrationsTable.get(node);
831 if (!registrations) registrationsTable.set(node, registrations = []);
832 registrations.push(this);
833 },
834 removeTransientObservers: function() {
835 var transientObservedNodes = this.transientObservedNodes;
836 this.transientObservedNodes = [];
837 transientObservedNodes.forEach(function(node) {
838 this.removeListeners_(node);
839 var registrations = registrationsTable.get(node);
840 for (var i = 0; i < registrations.length; i++) {
841 if (registrations[i] === this) {
842 registrations.splice(i, 1);
843 break;
844 }
845 }
846 }, this);
847 },
848 handleEvent: function(e) {
849 e.stopImmediatePropagation();
850 switch (e.type) {
851 case "DOMAttrModified":
852 var name = e.attrName;
853 var namespace = e.relatedNode.namespaceURI;
854 var target = e.target;
855 var record = new getRecord("attributes", target);
856 record.attributeName = name;
857 record.attributeNamespace = namespace;
858 var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
859 forEachAncestorAndObserverEnqueueRecord(target, function(options) {
860 if (!options.attributes) return;
861 if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
862 return;
863 }
864 if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
865 return record;
866 });
867 break;
868
869 case "DOMCharacterDataModified":
870 var target = e.target;
871 var record = getRecord("characterData", target);
872 var oldValue = e.prevValue;
873 forEachAncestorAndObserverEnqueueRecord(target, function(options) {
874 if (!options.characterData) return;
875 if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
876 return record;
877 });
878 break;
879
880 case "DOMNodeRemoved":
881 this.addTransientObserver(e.target);
882
883 case "DOMNodeInserted":
884 var changedNode = e.target;
885 var addedNodes, removedNodes;
886 if (e.type === "DOMNodeInserted") {
887 addedNodes = [ changedNode ];
888 removedNodes = [];
889 } else {
890 addedNodes = [];
891 removedNodes = [ changedNode ];
892 }
893 var previousSibling = changedNode.previousSibling;
894 var nextSibling = changedNode.nextSibling;
895 var record = getRecord("childList", e.target.parentNode);
896 record.addedNodes = addedNodes;
897 record.removedNodes = removedNodes;
898 record.previousSibling = previousSibling;
899 record.nextSibling = nextSibling;
900 forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
901 if (!options.childList) return;
902 return record;
903 });
904 }
905 clearRecords();
906 }
907 };
908 global.JsMutationObserver = JsMutationObserver;
909 if (!global.MutationObserver) {
910 global.MutationObserver = JsMutationObserver;
911 JsMutationObserver._isPolyfilled = true;
912 }
913 })(self);
914
915 (function() {
916 var needsTemplate = typeof HTMLTemplateElement === "undefined";
917 if (/Trident/.test(navigator.userAgent)) {
918 (function() {
919 var importNode = document.importNode;
920 document.importNode = function() {
921 var n = importNode.apply(document, arguments);
922 if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
923 var f = document.createDocumentFragment();
924 f.appendChild(n);
925 return f;
926 } else {
927 return n;
928 }
929 };
930 })();
931 }
932 var needsCloning = function() {
933 if (!needsTemplate) {
934 var t = document.createElement("template");
935 var t2 = document.createElement("template");
936 t2.content.appendChild(document.createElement("div"));
937 t.content.appendChild(t2);
938 var clone = t.cloneNode(true);
939 return clone.content.childNodes.length === 0 || clone.content.firstChild.content.childNodes.length === 0;
940 }
941 }();
942 var TEMPLATE_TAG = "template";
943 var TemplateImpl = function() {};
944 if (needsTemplate) {
945 var contentDoc = document.implementation.createHTMLDocument("template");
946 var canDecorate = true;
947 var templateStyle = document.createElement("style");
948 templateStyle.textContent = TEMPLATE_TAG + "{display:none;}";
949 var head = document.head;
950 head.insertBefore(templateStyle, head.firstElementChild);
951 TemplateImpl.prototype = Object.create(HTMLElement.prototype);
952 TemplateImpl.decorate = function(template) {
953 if (template.content) {
954 return;
955 }
956 template.content = contentDoc.createDocumentFragment();
957 var child;
958 while (child = template.firstChild) {
959 template.content.appendChild(child);
960 }
961 template.cloneNode = function(deep) {
962 return TemplateImpl.cloneNode(this, deep);
963 };
964 if (canDecorate) {
965 try {
966 Object.defineProperty(template, "innerHTML", {
967 get: function() {
968 var o = "";
969 for (var e = this.content.firstChild; e; e = e.nextSibling) {
970 o += e.outerHTML || escapeData(e.data);
971 }
972 return o;
973 },
974 set: function(text) {
975 contentDoc.body.innerHTML = text;
976 TemplateImpl.bootstrap(contentDoc);
977 while (this.content.firstChild) {
978 this.content.removeChild(this.content.firstChild);
979 }
980 while (contentDoc.body.firstChild) {
981 this.content.appendChild(contentDoc.body.firstChild);
982 }
983 },
984 configurable: true
985 });
986 } catch (err) {
987 canDecorate = false;
988 }
989 }
990 TemplateImpl.bootstrap(template.content);
991 };
992 TemplateImpl.bootstrap = function(doc) {
993 var templates = doc.querySelectorAll(TEMPLATE_TAG);
994 for (var i = 0, l = templates.length, t; i < l && (t = templates[i]); i++) {
995 TemplateImpl.decorate(t);
996 }
997 };
998 document.addEventListener("DOMContentLoaded", function() {
999 TemplateImpl.bootstrap(document);
1000 });
1001 var createElement = document.createElement;
1002 document.createElement = function() {
1003 "use strict";
1004 var el = createElement.apply(document, arguments);
1005 if (el.localName === "template") {
1006 TemplateImpl.decorate(el);
1007 }
1008 return el;
1009 };
1010 var escapeDataRegExp = /[&\u00A0<>]/g;
1011 function escapeReplace(c) {
1012 switch (c) {
1013 case "&":
1014 return "&amp;";
1015
1016 case "<":
1017 return "&lt;";
1018
1019 case ">":
1020 return "&gt;";
1021
1022 case " ":
1023 return "&nbsp;";
1024 }
1025 }
1026 function escapeData(s) {
1027 return s.replace(escapeDataRegExp, escapeReplace);
1028 }
1029 }
1030 if (needsTemplate || needsCloning) {
1031 var nativeCloneNode = Node.prototype.cloneNode;
1032 TemplateImpl.cloneNode = function(template, deep) {
1033 var clone = nativeCloneNode.call(template, false);
1034 if (this.decorate) {
1035 this.decorate(clone);
1036 }
1037 if (deep) {
1038 clone.content.appendChild(nativeCloneNode.call(template.content, true));
1039 this.fixClonedDom(clone.content, template.content);
1040 }
1041 return clone;
1042 };
1043 TemplateImpl.fixClonedDom = function(clone, source) {
1044 if (!source.querySelectorAll) return;
1045 var s$ = source.querySelectorAll(TEMPLATE_TAG);
1046 var t$ = clone.querySelectorAll(TEMPLATE_TAG);
1047 for (var i = 0, l = t$.length, t, s; i < l; i++) {
1048 s = s$[i];
1049 t = t$[i];
1050 if (this.decorate) {
1051 this.decorate(s);
1052 }
1053 t.parentNode.replaceChild(s.cloneNode(true), t);
1054 }
1055 };
1056 var originalImportNode = document.importNode;
1057 Node.prototype.cloneNode = function(deep) {
1058 var dom = nativeCloneNode.call(this, deep);
1059 if (deep) {
1060 TemplateImpl.fixClonedDom(dom, this);
1061 }
1062 return dom;
1063 };
1064 document.importNode = function(element, deep) {
1065 if (element.localName === TEMPLATE_TAG) {
1066 return TemplateImpl.cloneNode(element, deep);
1067 } else {
1068 var dom = originalImportNode.call(document, element, deep);
1069 if (deep) {
1070 TemplateImpl.fixClonedDom(dom, element);
1071 }
1072 return dom;
1073 }
1074 };
1075 if (needsCloning) {
1076 HTMLTemplateElement.prototype.cloneNode = function(deep) {
1077 return TemplateImpl.cloneNode(this, deep);
1078 };
1079 }
1080 }
1081 if (needsTemplate) {
1082 window.HTMLTemplateElement = TemplateImpl;
1083 }
1084 })();
1085
1086 (function(scope) {
1087 "use strict";
1088 if (!window.performance) {
1089 var start = Date.now();
1090 window.performance = {
1091 now: function() {
1092 return Date.now() - start;
1093 }
1094 };
1095 }
1096 if (!window.requestAnimationFrame) {
1097 window.requestAnimationFrame = function() {
1098 var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
1099 return nativeRaf ? function(callback) {
1100 return nativeRaf(function() {
1101 callback(performance.now());
1102 });
1103 } : function(callback) {
1104 return window.setTimeout(callback, 1e3 / 60);
1105 };
1106 }();
1107 }
1108 if (!window.cancelAnimationFrame) {
1109 window.cancelAnimationFrame = function() {
1110 return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
1111 clearTimeout(id);
1112 };
1113 }();
1114 }
1115 var workingDefaultPrevented = function() {
1116 var e = document.createEvent("Event");
1117 e.initEvent("foo", true, true);
1118 e.preventDefault();
1119 return e.defaultPrevented;
1120 }();
1121 if (!workingDefaultPrevented) {
1122 var origPreventDefault = Event.prototype.preventDefault;
1123 Event.prototype.preventDefault = function() {
1124 if (!this.cancelable) {
1125 return;
1126 }
1127 origPreventDefault.call(this);
1128 Object.defineProperty(this, "defaultPrevented", {
1129 get: function() {
1130 return true;
1131 },
1132 configurable: true
1133 });
1134 };
1135 }
1136 var isIE = /Trident/.test(navigator.userAgent);
1137 if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
1138 window.CustomEvent = function(inType, params) {
1139 params = params || {};
1140 var e = document.createEvent("CustomEvent");
1141 e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
1142 return e;
1143 };
1144 window.CustomEvent.prototype = window.Event.prototype;
1145 }
1146 if (!window.Event || isIE && typeof window.Event !== "function") {
1147 var origEvent = window.Event;
1148 window.Event = function(inType, params) {
1149 params = params || {};
1150 var e = document.createEvent("Event");
1151 e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
1152 return e;
1153 };
1154 window.Event.prototype = origEvent.prototype;
1155 }
1156 })(window.WebComponents);
1157
1158 window.HTMLImports = window.HTMLImports || {
1159 flags: {}
1160 };
1161
1162 (function(scope) {
1163 var IMPORT_LINK_TYPE = "import";
1164 var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
1165 var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
1166 var wrap = function(node) {
1167 return hasShadowDOMPolyfill ? window.ShadowDOMPolyfill.wrapIfNeeded(node) : node;
1168 };
1169 var rootDocument = wrap(document);
1170 var currentScriptDescriptor = {
1171 get: function() {
1172 var script = window.HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
1173 return wrap(script);
1174 },
1175 configurable: true
1176 };
1177 Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
1178 Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
1179 var isIE = /Trident/.test(navigator.userAgent);
1180 function whenReady(callback, doc) {
1181 doc = doc || rootDocument;
1182 whenDocumentReady(function() {
1183 watchImportsLoad(callback, doc);
1184 }, doc);
1185 }
1186 var requiredReadyState = isIE ? "complete" : "interactive";
1187 var READY_EVENT = "readystatechange";
1188 function isDocumentReady(doc) {
1189 return doc.readyState === "complete" || doc.readyState === requiredReadyState;
1190 }
1191 function whenDocumentReady(callback, doc) {
1192 if (!isDocumentReady(doc)) {
1193 var checkReady = function() {
1194 if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
1195 doc.removeEventListener(READY_EVENT, checkReady);
1196 whenDocumentReady(callback, doc);
1197 }
1198 };
1199 doc.addEventListener(READY_EVENT, checkReady);
1200 } else if (callback) {
1201 callback();
1202 }
1203 }
1204 function markTargetLoaded(event) {
1205 event.target.__loaded = true;
1206 }
1207 function watchImportsLoad(callback, doc) {
1208 var imports = doc.querySelectorAll("link[rel=import]");
1209 var parsedCount = 0, importCount = imports.length, newImports = [], errorImports = [];
1210 function checkDone() {
1211 if (parsedCount == importCount && callback) {
1212 callback({
1213 allImports: imports,
1214 loadedImports: newImports,
1215 errorImports: errorImports
1216 });
1217 }
1218 }
1219 function loadedImport(e) {
1220 markTargetLoaded(e);
1221 newImports.push(this);
1222 parsedCount++;
1223 checkDone();
1224 }
1225 function errorLoadingImport(e) {
1226 errorImports.push(this);
1227 parsedCount++;
1228 checkDone();
1229 }
1230 if (importCount) {
1231 for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) {
1232 if (isImportLoaded(imp)) {
1233 newImports.push(this);
1234 parsedCount++;
1235 checkDone();
1236 } else {
1237 imp.addEventListener("load", loadedImport);
1238 imp.addEventListener("error", errorLoadingImport);
1239 }
1240 }
1241 } else {
1242 checkDone();
1243 }
1244 }
1245 function isImportLoaded(link) {
1246 return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
1247 }
1248 if (useNative) {
1249 new MutationObserver(function(mxns) {
1250 for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
1251 if (m.addedNodes) {
1252 handleImports(m.addedNodes);
1253 }
1254 }
1255 }).observe(document.head, {
1256 childList: true
1257 });
1258 function handleImports(nodes) {
1259 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1260 if (isImport(n)) {
1261 handleImport(n);
1262 }
1263 }
1264 }
1265 function isImport(element) {
1266 return element.localName === "link" && element.rel === "import";
1267 }
1268 function handleImport(element) {
1269 var loaded = element.import;
1270 if (loaded) {
1271 markTargetLoaded({
1272 target: element
1273 });
1274 } else {
1275 element.addEventListener("load", markTargetLoaded);
1276 element.addEventListener("error", markTargetLoaded);
1277 }
1278 }
1279 (function() {
1280 if (document.readyState === "loading") {
1281 var imports = document.querySelectorAll("link[rel=import]");
1282 for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
1283 handleImport(imp);
1284 }
1285 }
1286 })();
1287 }
1288 whenReady(function(detail) {
1289 window.HTMLImports.ready = true;
1290 window.HTMLImports.readyTime = new Date().getTime();
1291 var evt = rootDocument.createEvent("CustomEvent");
1292 evt.initCustomEvent("HTMLImportsLoaded", true, true, detail);
1293 rootDocument.dispatchEvent(evt);
1294 });
1295 scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
1296 scope.useNative = useNative;
1297 scope.rootDocument = rootDocument;
1298 scope.whenReady = whenReady;
1299 scope.isIE = isIE;
1300 })(window.HTMLImports);
1301
1302 (function(scope) {
1303 var modules = [];
1304 var addModule = function(module) {
1305 modules.push(module);
1306 };
1307 var initializeModules = function() {
1308 modules.forEach(function(module) {
1309 module(scope);
1310 });
1311 };
1312 scope.addModule = addModule;
1313 scope.initializeModules = initializeModules;
1314 })(window.HTMLImports);
1315
1316 window.HTMLImports.addModule(function(scope) {
1317 var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
1318 var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
1319 var path = {
1320 resolveUrlsInStyle: function(style, linkUrl) {
1321 var doc = style.ownerDocument;
1322 var resolver = doc.createElement("a");
1323 style.textContent = this.resolveUrlsInCssText(style.textContent, linkUrl, resolver);
1324 return style;
1325 },
1326 resolveUrlsInCssText: function(cssText, linkUrl, urlObj) {
1327 var r = this.replaceUrls(cssText, urlObj, linkUrl, CSS_URL_REGEXP);
1328 r = this.replaceUrls(r, urlObj, linkUrl, CSS_IMPORT_REGEXP);
1329 return r;
1330 },
1331 replaceUrls: function(text, urlObj, linkUrl, regexp) {
1332 return text.replace(regexp, function(m, pre, url, post) {
1333 var urlPath = url.replace(/["']/g, "");
1334 if (linkUrl) {
1335 urlPath = new URL(urlPath, linkUrl).href;
1336 }
1337 urlObj.href = urlPath;
1338 urlPath = urlObj.href;
1339 return pre + "'" + urlPath + "'" + post;
1340 });
1341 }
1342 };
1343 scope.path = path;
1344 });
1345
1346 window.HTMLImports.addModule(function(scope) {
1347 var xhr = {
1348 async: true,
1349 ok: function(request) {
1350 return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
1351 },
1352 load: function(url, next, nextContext) {
1353 var request = new XMLHttpRequest();
1354 if (scope.flags.debug || scope.flags.bust) {
1355 url += "?" + Math.random();
1356 }
1357 request.open("GET", url, xhr.async);
1358 request.addEventListener("readystatechange", function(e) {
1359 if (request.readyState === 4) {
1360 var redirectedUrl = null;
1361 try {
1362 var locationHeader = request.getResponseHeader("Location");
1363 if (locationHeader) {
1364 redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
1365 }
1366 } catch (e) {
1367 console.error(e.message);
1368 }
1369 next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
1370 }
1371 });
1372 request.send();
1373 return request;
1374 },
1375 loadDocument: function(url, next, nextContext) {
1376 this.load(url, next, nextContext).responseType = "document";
1377 }
1378 };
1379 scope.xhr = xhr;
1380 });
1381
1382 window.HTMLImports.addModule(function(scope) {
1383 var xhr = scope.xhr;
1384 var flags = scope.flags;
1385 var Loader = function(onLoad, onComplete) {
1386 this.cache = {};
1387 this.onload = onLoad;
1388 this.oncomplete = onComplete;
1389 this.inflight = 0;
1390 this.pending = {};
1391 };
1392 Loader.prototype = {
1393 addNodes: function(nodes) {
1394 this.inflight += nodes.length;
1395 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1396 this.require(n);
1397 }
1398 this.checkDone();
1399 },
1400 addNode: function(node) {
1401 this.inflight++;
1402 this.require(node);
1403 this.checkDone();
1404 },
1405 require: function(elt) {
1406 var url = elt.src || elt.href;
1407 elt.__nodeUrl = url;
1408 if (!this.dedupe(url, elt)) {
1409 this.fetch(url, elt);
1410 }
1411 },
1412 dedupe: function(url, elt) {
1413 if (this.pending[url]) {
1414 this.pending[url].push(elt);
1415 return true;
1416 }
1417 var resource;
1418 if (this.cache[url]) {
1419 this.onload(url, elt, this.cache[url]);
1420 this.tail();
1421 return true;
1422 }
1423 this.pending[url] = [ elt ];
1424 return false;
1425 },
1426 fetch: function(url, elt) {
1427 flags.load && console.log("fetch", url, elt);
1428 if (!url) {
1429 setTimeout(function() {
1430 this.receive(url, elt, {
1431 error: "href must be specified"
1432 }, null);
1433 }.bind(this), 0);
1434 } else if (url.match(/^data:/)) {
1435 var pieces = url.split(",");
1436 var header = pieces[0];
1437 var body = pieces[1];
1438 if (header.indexOf(";base64") > -1) {
1439 body = atob(body);
1440 } else {
1441 body = decodeURIComponent(body);
1442 }
1443 setTimeout(function() {
1444 this.receive(url, elt, null, body);
1445 }.bind(this), 0);
1446 } else {
1447 var receiveXhr = function(err, resource, redirectedUrl) {
1448 this.receive(url, elt, err, resource, redirectedUrl);
1449 }.bind(this);
1450 xhr.load(url, receiveXhr);
1451 }
1452 },
1453 receive: function(url, elt, err, resource, redirectedUrl) {
1454 this.cache[url] = resource;
1455 var $p = this.pending[url];
1456 for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
1457 this.onload(url, p, resource, err, redirectedUrl);
1458 this.tail();
1459 }
1460 this.pending[url] = null;
1461 },
1462 tail: function() {
1463 --this.inflight;
1464 this.checkDone();
1465 },
1466 checkDone: function() {
1467 if (!this.inflight) {
1468 this.oncomplete();
1469 }
1470 }
1471 };
1472 scope.Loader = Loader;
1473 });
1474
1475 window.HTMLImports.addModule(function(scope) {
1476 var Observer = function(addCallback) {
1477 this.addCallback = addCallback;
1478 this.mo = new MutationObserver(this.handler.bind(this));
1479 };
1480 Observer.prototype = {
1481 handler: function(mutations) {
1482 for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
1483 if (m.type === "childList" && m.addedNodes.length) {
1484 this.addedNodes(m.addedNodes);
1485 }
1486 }
1487 },
1488 addedNodes: function(nodes) {
1489 if (this.addCallback) {
1490 this.addCallback(nodes);
1491 }
1492 for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
1493 if (n.children && n.children.length) {
1494 this.addedNodes(n.children);
1495 }
1496 }
1497 },
1498 observe: function(root) {
1499 this.mo.observe(root, {
1500 childList: true,
1501 subtree: true
1502 });
1503 }
1504 };
1505 scope.Observer = Observer;
1506 });
1507
1508 window.HTMLImports.addModule(function(scope) {
1509 var path = scope.path;
1510 var rootDocument = scope.rootDocument;
1511 var flags = scope.flags;
1512 var isIE = scope.isIE;
1513 var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
1514 var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
1515 var importParser = {
1516 documentSelectors: IMPORT_SELECTOR,
1517 importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
1518 map: {
1519 link: "parseLink",
1520 script: "parseScript",
1521 style: "parseStyle"
1522 },
1523 dynamicElements: [],
1524 parseNext: function() {
1525 var next = this.nextToParse();
1526 if (next) {
1527 this.parse(next);
1528 }
1529 },
1530 parse: function(elt) {
1531 if (this.isParsed(elt)) {
1532 flags.parse && console.log("[%s] is already parsed", elt.localName);
1533 return;
1534 }
1535 var fn = this[this.map[elt.localName]];
1536 if (fn) {
1537 this.markParsing(elt);
1538 fn.call(this, elt);
1539 }
1540 },
1541 parseDynamic: function(elt, quiet) {
1542 this.dynamicElements.push(elt);
1543 if (!quiet) {
1544 this.parseNext();
1545 }
1546 },
1547 markParsing: function(elt) {
1548 flags.parse && console.log("parsing", elt);
1549 this.parsingElement = elt;
1550 },
1551 markParsingComplete: function(elt) {
1552 elt.__importParsed = true;
1553 this.markDynamicParsingComplete(elt);
1554 if (elt.__importElement) {
1555 elt.__importElement.__importParsed = true;
1556 this.markDynamicParsingComplete(elt.__importElement);
1557 }
1558 this.parsingElement = null;
1559 flags.parse && console.log("completed", elt);
1560 },
1561 markDynamicParsingComplete: function(elt) {
1562 var i = this.dynamicElements.indexOf(elt);
1563 if (i >= 0) {
1564 this.dynamicElements.splice(i, 1);
1565 }
1566 },
1567 parseImport: function(elt) {
1568 elt.import = elt.__doc;
1569 if (window.HTMLImports.__importsParsingHook) {
1570 window.HTMLImports.__importsParsingHook(elt);
1571 }
1572 if (elt.import) {
1573 elt.import.__importParsed = true;
1574 }
1575 this.markParsingComplete(elt);
1576 if (elt.__resource && !elt.__error) {
1577 elt.dispatchEvent(new CustomEvent("load", {
1578 bubbles: false
1579 }));
1580 } else {
1581 elt.dispatchEvent(new CustomEvent("error", {
1582 bubbles: false
1583 }));
1584 }
1585 if (elt.__pending) {
1586 var fn;
1587 while (elt.__pending.length) {
1588 fn = elt.__pending.shift();
1589 if (fn) {
1590 fn({
1591 target: elt
1592 });
1593 }
1594 }
1595 }
1596 this.parseNext();
1597 },
1598 parseLink: function(linkElt) {
1599 if (nodeIsImport(linkElt)) {
1600 this.parseImport(linkElt);
1601 } else {
1602 linkElt.href = linkElt.href;
1603 this.parseGeneric(linkElt);
1604 }
1605 },
1606 parseStyle: function(elt) {
1607 var src = elt;
1608 elt = cloneStyle(elt);
1609 src.__appliedElement = elt;
1610 elt.__importElement = src;
1611 this.parseGeneric(elt);
1612 },
1613 parseGeneric: function(elt) {
1614 this.trackElement(elt);
1615 this.addElementToDocument(elt);
1616 },
1617 rootImportForElement: function(elt) {
1618 var n = elt;
1619 while (n.ownerDocument.__importLink) {
1620 n = n.ownerDocument.__importLink;
1621 }
1622 return n;
1623 },
1624 addElementToDocument: function(elt) {
1625 var port = this.rootImportForElement(elt.__importElement || elt);
1626 port.parentNode.insertBefore(elt, port);
1627 },
1628 trackElement: function(elt, callback) {
1629 var self = this;
1630 var done = function(e) {
1631 elt.removeEventListener("load", done);
1632 elt.removeEventListener("error", done);
1633 if (callback) {
1634 callback(e);
1635 }
1636 self.markParsingComplete(elt);
1637 self.parseNext();
1638 };
1639 elt.addEventListener("load", done);
1640 elt.addEventListener("error", done);
1641 if (isIE && elt.localName === "style") {
1642 var fakeLoad = false;
1643 if (elt.textContent.indexOf("@import") == -1) {
1644 fakeLoad = true;
1645 } else if (elt.sheet) {
1646 fakeLoad = true;
1647 var csr = elt.sheet.cssRules;
1648 var len = csr ? csr.length : 0;
1649 for (var i = 0, r; i < len && (r = csr[i]); i++) {
1650 if (r.type === CSSRule.IMPORT_RULE) {
1651 fakeLoad = fakeLoad && Boolean(r.styleSheet);
1652 }
1653 }
1654 }
1655 if (fakeLoad) {
1656 setTimeout(function() {
1657 elt.dispatchEvent(new CustomEvent("load", {
1658 bubbles: false
1659 }));
1660 });
1661 }
1662 }
1663 },
1664 parseScript: function(scriptElt) {
1665 var script = document.createElement("script");
1666 script.__importElement = scriptElt;
1667 script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
1668 scope.currentScript = scriptElt;
1669 this.trackElement(script, function(e) {
1670 if (script.parentNode) {
1671 script.parentNode.removeChild(script);
1672 }
1673 scope.currentScript = null;
1674 });
1675 this.addElementToDocument(script);
1676 },
1677 nextToParse: function() {
1678 this._mayParse = [];
1679 return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
1680 },
1681 nextToParseInDoc: function(doc, link) {
1682 if (doc && this._mayParse.indexOf(doc) < 0) {
1683 this._mayParse.push(doc);
1684 var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
1685 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1686 if (!this.isParsed(n)) {
1687 if (this.hasResource(n)) {
1688 return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n;
1689 } else {
1690 return;
1691 }
1692 }
1693 }
1694 }
1695 return link;
1696 },
1697 nextToParseDynamic: function() {
1698 return this.dynamicElements[0];
1699 },
1700 parseSelectorsForNode: function(node) {
1701 var doc = node.ownerDocument || node;
1702 return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
1703 },
1704 isParsed: function(node) {
1705 return node.__importParsed;
1706 },
1707 needsDynamicParsing: function(elt) {
1708 return this.dynamicElements.indexOf(elt) >= 0;
1709 },
1710 hasResource: function(node) {
1711 if (nodeIsImport(node) && node.__doc === undefined) {
1712 return false;
1713 }
1714 return true;
1715 }
1716 };
1717 function nodeIsImport(elt) {
1718 return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
1719 }
1720 function generateScriptDataUrl(script) {
1721 var scriptContent = generateScriptContent(script);
1722 return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
1723 }
1724 function generateScriptContent(script) {
1725 return script.textContent + generateSourceMapHint(script);
1726 }
1727 function generateSourceMapHint(script) {
1728 var owner = script.ownerDocument;
1729 owner.__importedScripts = owner.__importedScripts || 0;
1730 var moniker = script.ownerDocument.baseURI;
1731 var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
1732 owner.__importedScripts++;
1733 return "\n//# sourceURL=" + moniker + num + ".js\n";
1734 }
1735 function cloneStyle(style) {
1736 var clone = style.ownerDocument.createElement("style");
1737 clone.textContent = style.textContent;
1738 path.resolveUrlsInStyle(clone);
1739 return clone;
1740 }
1741 scope.parser = importParser;
1742 scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
1743 });
1744
1745 window.HTMLImports.addModule(function(scope) {
1746 var flags = scope.flags;
1747 var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
1748 var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
1749 var rootDocument = scope.rootDocument;
1750 var Loader = scope.Loader;
1751 var Observer = scope.Observer;
1752 var parser = scope.parser;
1753 var importer = {
1754 documents: {},
1755 documentPreloadSelectors: IMPORT_SELECTOR,
1756 importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
1757 loadNode: function(node) {
1758 importLoader.addNode(node);
1759 },
1760 loadSubtree: function(parent) {
1761 var nodes = this.marshalNodes(parent);
1762 importLoader.addNodes(nodes);
1763 },
1764 marshalNodes: function(parent) {
1765 return parent.querySelectorAll(this.loadSelectorsForNode(parent));
1766 },
1767 loadSelectorsForNode: function(node) {
1768 var doc = node.ownerDocument || node;
1769 return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
1770 },
1771 loaded: function(url, elt, resource, err, redirectedUrl) {
1772 flags.load && console.log("loaded", url, elt);
1773 elt.__resource = resource;
1774 elt.__error = err;
1775 if (isImportLink(elt)) {
1776 var doc = this.documents[url];
1777 if (doc === undefined) {
1778 doc = err ? null : makeDocument(resource, redirectedUrl || url);
1779 if (doc) {
1780 doc.__importLink = elt;
1781 this.bootDocument(doc);
1782 }
1783 this.documents[url] = doc;
1784 }
1785 elt.__doc = doc;
1786 }
1787 parser.parseNext();
1788 },
1789 bootDocument: function(doc) {
1790 this.loadSubtree(doc);
1791 this.observer.observe(doc);
1792 parser.parseNext();
1793 },
1794 loadedAll: function() {
1795 parser.parseNext();
1796 }
1797 };
1798 var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
1799 importer.observer = new Observer();
1800 function isImportLink(elt) {
1801 return isLinkRel(elt, IMPORT_LINK_TYPE);
1802 }
1803 function isLinkRel(elt, rel) {
1804 return elt.localName === "link" && elt.getAttribute("rel") === rel;
1805 }
1806 function hasBaseURIAccessor(doc) {
1807 return !!Object.getOwnPropertyDescriptor(doc, "baseURI");
1808 }
1809 function makeDocument(resource, url) {
1810 var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
1811 doc._URL = url;
1812 var base = doc.createElement("base");
1813 base.setAttribute("href", url);
1814 if (!doc.baseURI && !hasBaseURIAccessor(doc)) {
1815 Object.defineProperty(doc, "baseURI", {
1816 value: url
1817 });
1818 }
1819 var meta = doc.createElement("meta");
1820 meta.setAttribute("charset", "utf-8");
1821 doc.head.appendChild(meta);
1822 doc.head.appendChild(base);
1823 doc.body.innerHTML = resource;
1824 if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
1825 HTMLTemplateElement.bootstrap(doc);
1826 }
1827 return doc;
1828 }
1829 if (!document.baseURI) {
1830 var baseURIDescriptor = {
1831 get: function() {
1832 var base = document.querySelector("base");
1833 return base ? base.href : window.location.href;
1834 },
1835 configurable: true
1836 };
1837 Object.defineProperty(document, "baseURI", baseURIDescriptor);
1838 Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
1839 }
1840 scope.importer = importer;
1841 scope.importLoader = importLoader;
1842 });
1843
1844 window.HTMLImports.addModule(function(scope) {
1845 var parser = scope.parser;
1846 var importer = scope.importer;
1847 var dynamic = {
1848 added: function(nodes) {
1849 var owner, parsed, loading;
1850 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
1851 if (!owner) {
1852 owner = n.ownerDocument;
1853 parsed = parser.isParsed(owner);
1854 }
1855 loading = this.shouldLoadNode(n);
1856 if (loading) {
1857 importer.loadNode(n);
1858 }
1859 if (this.shouldParseNode(n) && parsed) {
1860 parser.parseDynamic(n, loading);
1861 }
1862 }
1863 },
1864 shouldLoadNode: function(node) {
1865 return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
1866 },
1867 shouldParseNode: function(node) {
1868 return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
1869 }
1870 };
1871 importer.observer.addCallback = dynamic.added.bind(dynamic);
1872 var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
1873 });
1874
1875 (function(scope) {
1876 var initializeModules = scope.initializeModules;
1877 var isIE = scope.isIE;
1878 if (scope.useNative) {
1879 return;
1880 }
1881 initializeModules();
1882 var rootDocument = scope.rootDocument;
1883 function bootstrap() {
1884 window.HTMLImports.importer.bootDocument(rootDocument);
1885 }
1886 if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
1887 bootstrap();
1888 } else {
1889 document.addEventListener("DOMContentLoaded", bootstrap);
1890 }
1891 })(window.HTMLImports);
1892
1893 window.CustomElements = window.CustomElements || {
1894 flags: {}
1895 };
1896
1897 (function(scope) {
1898 var flags = scope.flags;
1899 var modules = [];
1900 var addModule = function(module) {
1901 modules.push(module);
1902 };
1903 var initializeModules = function() {
1904 modules.forEach(function(module) {
1905 module(scope);
1906 });
1907 };
1908 scope.addModule = addModule;
1909 scope.initializeModules = initializeModules;
1910 scope.hasNative = Boolean(document.registerElement);
1911 scope.isIE = /Trident/.test(navigator.userAgent);
1912 scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || window.HTMLImports.useNative);
1913 })(window.CustomElements);
1914
1915 window.CustomElements.addModule(function(scope) {
1916 var IMPORT_LINK_TYPE = window.HTMLImports ? window.HTMLImports.IMPORT_LINK_TYPE : "none";
1917 function forSubtree(node, cb) {
1918 findAllElements(node, function(e) {
1919 if (cb(e)) {
1920 return true;
1921 }
1922 forRoots(e, cb);
1923 });
1924 forRoots(node, cb);
1925 }
1926 function findAllElements(node, find, data) {
1927 var e = node.firstElementChild;
1928 if (!e) {
1929 e = node.firstChild;
1930 while (e && e.nodeType !== Node.ELEMENT_NODE) {
1931 e = e.nextSibling;
1932 }
1933 }
1934 while (e) {
1935 if (find(e, data) !== true) {
1936 findAllElements(e, find, data);
1937 }
1938 e = e.nextElementSibling;
1939 }
1940 return null;
1941 }
1942 function forRoots(node, cb) {
1943 var root = node.shadowRoot;
1944 while (root) {
1945 forSubtree(root, cb);
1946 root = root.olderShadowRoot;
1947 }
1948 }
1949 function forDocumentTree(doc, cb) {
1950 _forDocumentTree(doc, cb, []);
1951 }
1952 function _forDocumentTree(doc, cb, processingDocuments) {
1953 doc = window.wrap(doc);
1954 if (processingDocuments.indexOf(doc) >= 0) {
1955 return;
1956 }
1957 processingDocuments.push(doc);
1958 var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
1959 for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
1960 if (n.import) {
1961 _forDocumentTree(n.import, cb, processingDocuments);
1962 }
1963 }
1964 cb(doc);
1965 }
1966 scope.forDocumentTree = forDocumentTree;
1967 scope.forSubtree = forSubtree;
1968 });
1969
1970 window.CustomElements.addModule(function(scope) {
1971 var flags = scope.flags;
1972 var forSubtree = scope.forSubtree;
1973 var forDocumentTree = scope.forDocumentTree;
1974 function addedNode(node, isAttached) {
1975 return added(node, isAttached) || addedSubtree(node, isAttached);
1976 }
1977 function added(node, isAttached) {
1978 if (scope.upgrade(node, isAttached)) {
1979 return true;
1980 }
1981 if (isAttached) {
1982 attached(node);
1983 }
1984 }
1985 function addedSubtree(node, isAttached) {
1986 forSubtree(node, function(e) {
1987 if (added(e, isAttached)) {
1988 return true;
1989 }
1990 });
1991 }
1992 var hasThrottledAttached = window.MutationObserver._isPolyfilled && flags["throttle-attached"];
1993 scope.hasPolyfillMutations = hasThrottledAttached;
1994 scope.hasThrottledAttached = hasThrottledAttached;
1995 var isPendingMutations = false;
1996 var pendingMutations = [];
1997 function deferMutation(fn) {
1998 pendingMutations.push(fn);
1999 if (!isPendingMutations) {
2000 isPendingMutations = true;
2001 setTimeout(takeMutations);
2002 }
2003 }
2004 function takeMutations() {
2005 isPendingMutations = false;
2006 var $p = pendingMutations;
2007 for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
2008 p();
2009 }
2010 pendingMutations = [];
2011 }
2012 function attached(element) {
2013 if (hasThrottledAttached) {
2014 deferMutation(function() {
2015 _attached(element);
2016 });
2017 } else {
2018 _attached(element);
2019 }
2020 }
2021 function _attached(element) {
2022 if (element.__upgraded__ && !element.__attached) {
2023 element.__attached = true;
2024 if (element.attachedCallback) {
2025 element.attachedCallback();
2026 }
2027 }
2028 }
2029 function detachedNode(node) {
2030 detached(node);
2031 forSubtree(node, function(e) {
2032 detached(e);
2033 });
2034 }
2035 function detached(element) {
2036 if (hasThrottledAttached) {
2037 deferMutation(function() {
2038 _detached(element);
2039 });
2040 } else {
2041 _detached(element);
2042 }
2043 }
2044 function _detached(element) {
2045 if (element.__upgraded__ && element.__attached) {
2046 element.__attached = false;
2047 if (element.detachedCallback) {
2048 element.detachedCallback();
2049 }
2050 }
2051 }
2052 function inDocument(element) {
2053 var p = element;
2054 var doc = window.wrap(document);
2055 while (p) {
2056 if (p == doc) {
2057 return true;
2058 }
2059 p = p.parentNode || p.nodeType === Node.DOCUMENT_FRAGMENT_NODE && p.host;
2060 }
2061 }
2062 function watchShadow(node) {
2063 if (node.shadowRoot && !node.shadowRoot.__watched) {
2064 flags.dom && console.log("watching shadow-root for: ", node.localName);
2065 var root = node.shadowRoot;
2066 while (root) {
2067 observe(root);
2068 root = root.olderShadowRoot;
2069 }
2070 }
2071 }
2072 function handler(root, mutations) {
2073 if (flags.dom) {
2074 var mx = mutations[0];
2075 if (mx && mx.type === "childList" && mx.addedNodes) {
2076 if (mx.addedNodes) {
2077 var d = mx.addedNodes[0];
2078 while (d && d !== document && !d.host) {
2079 d = d.parentNode;
2080 }
2081 var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
2082 u = u.split("/?").shift().split("/").pop();
2083 }
2084 }
2085 console.group("mutations (%d) [%s]", mutations.length, u || "");
2086 }
2087 var isAttached = inDocument(root);
2088 mutations.forEach(function(mx) {
2089 if (mx.type === "childList") {
2090 forEach(mx.addedNodes, function(n) {
2091 if (!n.localName) {
2092 return;
2093 }
2094 addedNode(n, isAttached);
2095 });
2096 forEach(mx.removedNodes, function(n) {
2097 if (!n.localName) {
2098 return;
2099 }
2100 detachedNode(n);
2101 });
2102 }
2103 });
2104 flags.dom && console.groupEnd();
2105 }
2106 function takeRecords(node) {
2107 node = window.wrap(node);
2108 if (!node) {
2109 node = window.wrap(document);
2110 }
2111 while (node.parentNode) {
2112 node = node.parentNode;
2113 }
2114 var observer = node.__observer;
2115 if (observer) {
2116 handler(node, observer.takeRecords());
2117 takeMutations();
2118 }
2119 }
2120 var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
2121 function observe(inRoot) {
2122 if (inRoot.__observer) {
2123 return;
2124 }
2125 var observer = new MutationObserver(handler.bind(this, inRoot));
2126 observer.observe(inRoot, {
2127 childList: true,
2128 subtree: true
2129 });
2130 inRoot.__observer = observer;
2131 }
2132 function upgradeDocument(doc) {
2133 doc = window.wrap(doc);
2134 flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
2135 var isMainDocument = doc === window.wrap(document);
2136 addedNode(doc, isMainDocument);
2137 observe(doc);
2138 flags.dom && console.groupEnd();
2139 }
2140 function upgradeDocumentTree(doc) {
2141 forDocumentTree(doc, upgradeDocument);
2142 }
2143 var originalCreateShadowRoot = Element.prototype.createShadowRoot;
2144 if (originalCreateShadowRoot) {
2145 Element.prototype.createShadowRoot = function() {
2146 var root = originalCreateShadowRoot.call(this);
2147 window.CustomElements.watchShadow(this);
2148 return root;
2149 };
2150 }
2151 scope.watchShadow = watchShadow;
2152 scope.upgradeDocumentTree = upgradeDocumentTree;
2153 scope.upgradeDocument = upgradeDocument;
2154 scope.upgradeSubtree = addedSubtree;
2155 scope.upgradeAll = addedNode;
2156 scope.attached = attached;
2157 scope.takeRecords = takeRecords;
2158 });
2159
2160 window.CustomElements.addModule(function(scope) {
2161 var flags = scope.flags;
2162 function upgrade(node, isAttached) {
2163 if (node.localName === "template") {
2164 if (window.HTMLTemplateElement && HTMLTemplateElement.decorate) {
2165 HTMLTemplateElement.decorate(node);
2166 }
2167 }
2168 if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
2169 var is = node.getAttribute("is");
2170 var definition = scope.getRegisteredDefinition(node.localName) || scope.getRegisteredDefinition(is);
2171 if (definition) {
2172 if (is && definition.tag == node.localName || !is && !definition.extends) {
2173 return upgradeWithDefinition(node, definition, isAttached);
2174 }
2175 }
2176 }
2177 }
2178 function upgradeWithDefinition(element, definition, isAttached) {
2179 flags.upgrade && console.group("upgrade:", element.localName);
2180 if (definition.is) {
2181 element.setAttribute("is", definition.is);
2182 }
2183 implementPrototype(element, definition);
2184 element.__upgraded__ = true;
2185 created(element);
2186 if (isAttached) {
2187 scope.attached(element);
2188 }
2189 scope.upgradeSubtree(element, isAttached);
2190 flags.upgrade && console.groupEnd();
2191 return element;
2192 }
2193 function implementPrototype(element, definition) {
2194 if (Object.__proto__) {
2195 element.__proto__ = definition.prototype;
2196 } else {
2197 customMixin(element, definition.prototype, definition.native);
2198 element.__proto__ = definition.prototype;
2199 }
2200 }
2201 function customMixin(inTarget, inSrc, inNative) {
2202 var used = {};
2203 var p = inSrc;
2204 while (p !== inNative && p !== HTMLElement.prototype) {
2205 var keys = Object.getOwnPropertyNames(p);
2206 for (var i = 0, k; k = keys[i]; i++) {
2207 if (!used[k]) {
2208 Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
2209 used[k] = 1;
2210 }
2211 }
2212 p = Object.getPrototypeOf(p);
2213 }
2214 }
2215 function created(element) {
2216 if (element.createdCallback) {
2217 element.createdCallback();
2218 }
2219 }
2220 scope.upgrade = upgrade;
2221 scope.upgradeWithDefinition = upgradeWithDefinition;
2222 scope.implementPrototype = implementPrototype;
2223 });
2224
2225 window.CustomElements.addModule(function(scope) {
2226 var isIE = scope.isIE;
2227 var upgradeDocumentTree = scope.upgradeDocumentTree;
2228 var upgradeAll = scope.upgradeAll;
2229 var upgradeWithDefinition = scope.upgradeWithDefinition;
2230 var implementPrototype = scope.implementPrototype;
2231 var useNative = scope.useNative;
2232 function register(name, options) {
2233 var definition = options || {};
2234 if (!name) {
2235 throw new Error("document.registerElement: first argument `name` must not be empty");
2236 }
2237 if (name.indexOf("-") < 0) {
2238 throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
2239 }
2240 if (isReservedTag(name)) {
2241 throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
2242 }
2243 if (getRegisteredDefinition(name)) {
2244 throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
2245 }
2246 if (!definition.prototype) {
2247 definition.prototype = Object.create(HTMLElement.prototype);
2248 }
2249 definition.__name = name.toLowerCase();
2250 if (definition.extends) {
2251 definition.extends = definition.extends.toLowerCase();
2252 }
2253 definition.lifecycle = definition.lifecycle || {};
2254 definition.ancestry = ancestry(definition.extends);
2255 resolveTagName(definition);
2256 resolvePrototypeChain(definition);
2257 overrideAttributeApi(definition.prototype);
2258 registerDefinition(definition.__name, definition);
2259 definition.ctor = generateConstructor(definition);
2260 definition.ctor.prototype = definition.prototype;
2261 definition.prototype.constructor = definition.ctor;
2262 if (scope.ready) {
2263 upgradeDocumentTree(document);
2264 }
2265 return definition.ctor;
2266 }
2267 function overrideAttributeApi(prototype) {
2268 if (prototype.setAttribute._polyfilled) {
2269 return;
2270 }
2271 var setAttribute = prototype.setAttribute;
2272 prototype.setAttribute = function(name, value) {
2273 changeAttribute.call(this, name, value, setAttribute);
2274 };
2275 var removeAttribute = prototype.removeAttribute;
2276 prototype.removeAttribute = function(name) {
2277 changeAttribute.call(this, name, null, removeAttribute);
2278 };
2279 prototype.setAttribute._polyfilled = true;
2280 }
2281 function changeAttribute(name, value, operation) {
2282 name = name.toLowerCase();
2283 var oldValue = this.getAttribute(name);
2284 operation.apply(this, arguments);
2285 var newValue = this.getAttribute(name);
2286 if (this.attributeChangedCallback && newValue !== oldValue) {
2287 this.attributeChangedCallback(name, oldValue, newValue);
2288 }
2289 }
2290 function isReservedTag(name) {
2291 for (var i = 0; i < reservedTagList.length; i++) {
2292 if (name === reservedTagList[i]) {
2293 return true;
2294 }
2295 }
2296 }
2297 var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
2298 function ancestry(extnds) {
2299 var extendee = getRegisteredDefinition(extnds);
2300 if (extendee) {
2301 return ancestry(extendee.extends).concat([ extendee ]);
2302 }
2303 return [];
2304 }
2305 function resolveTagName(definition) {
2306 var baseTag = definition.extends;
2307 for (var i = 0, a; a = definition.ancestry[i]; i++) {
2308 baseTag = a.is && a.tag;
2309 }
2310 definition.tag = baseTag || definition.__name;
2311 if (baseTag) {
2312 definition.is = definition.__name;
2313 }
2314 }
2315 function resolvePrototypeChain(definition) {
2316 if (!Object.__proto__) {
2317 var nativePrototype = HTMLElement.prototype;
2318 if (definition.is) {
2319 var inst = document.createElement(definition.tag);
2320 nativePrototype = Object.getPrototypeOf(inst);
2321 }
2322 var proto = definition.prototype, ancestor;
2323 var foundPrototype = false;
2324 while (proto) {
2325 if (proto == nativePrototype) {
2326 foundPrototype = true;
2327 }
2328 ancestor = Object.getPrototypeOf(proto);
2329 if (ancestor) {
2330 proto.__proto__ = ancestor;
2331 }
2332 proto = ancestor;
2333 }
2334 if (!foundPrototype) {
2335 console.warn(definition.tag + " prototype not found in prototype chain for " + definition.is);
2336 }
2337 definition.native = nativePrototype;
2338 }
2339 }
2340 function instantiate(definition) {
2341 return upgradeWithDefinition(domCreateElement(definition.tag), definition);
2342 }
2343 var registry = {};
2344 function getRegisteredDefinition(name) {
2345 if (name) {
2346 return registry[name.toLowerCase()];
2347 }
2348 }
2349 function registerDefinition(name, definition) {
2350 registry[name] = definition;
2351 }
2352 function generateConstructor(definition) {
2353 return function() {
2354 return instantiate(definition);
2355 };
2356 }
2357 var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
2358 function createElementNS(namespace, tag, typeExtension) {
2359 if (namespace === HTML_NAMESPACE) {
2360 return createElement(tag, typeExtension);
2361 } else {
2362 return domCreateElementNS(namespace, tag);
2363 }
2364 }
2365 function createElement(tag, typeExtension) {
2366 if (tag) {
2367 tag = tag.toLowerCase();
2368 }
2369 if (typeExtension) {
2370 typeExtension = typeExtension.toLowerCase();
2371 }
2372 var definition = getRegisteredDefinition(typeExtension || tag);
2373 if (definition) {
2374 if (tag == definition.tag && typeExtension == definition.is) {
2375 return new definition.ctor();
2376 }
2377 if (!typeExtension && !definition.is) {
2378 return new definition.ctor();
2379 }
2380 }
2381 var element;
2382 if (typeExtension) {
2383 element = createElement(tag);
2384 element.setAttribute("is", typeExtension);
2385 return element;
2386 }
2387 element = domCreateElement(tag);
2388 if (tag.indexOf("-") >= 0) {
2389 implementPrototype(element, HTMLElement);
2390 }
2391 return element;
2392 }
2393 var domCreateElement = document.createElement.bind(document);
2394 var domCreateElementNS = document.createElementNS.bind(document);
2395 var isInstance;
2396 if (!Object.__proto__ && !useNative) {
2397 isInstance = function(obj, ctor) {
2398 if (obj instanceof ctor) {
2399 return true;
2400 }
2401 var p = obj;
2402 while (p) {
2403 if (p === ctor.prototype) {
2404 return true;
2405 }
2406 p = p.__proto__;
2407 }
2408 return false;
2409 };
2410 } else {
2411 isInstance = function(obj, base) {
2412 return obj instanceof base;
2413 };
2414 }
2415 function wrapDomMethodToForceUpgrade(obj, methodName) {
2416 var orig = obj[methodName];
2417 obj[methodName] = function() {
2418 var n = orig.apply(this, arguments);
2419 upgradeAll(n);
2420 return n;
2421 };
2422 }
2423 wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode");
2424 wrapDomMethodToForceUpgrade(document, "importNode");
2425 document.registerElement = register;
2426 document.createElement = createElement;
2427 document.createElementNS = createElementNS;
2428 scope.registry = registry;
2429 scope.instanceof = isInstance;
2430 scope.reservedTagList = reservedTagList;
2431 scope.getRegisteredDefinition = getRegisteredDefinition;
2432 document.register = document.registerElement;
2433 });
2434
2435 (function(scope) {
2436 var useNative = scope.useNative;
2437 var initializeModules = scope.initializeModules;
2438 var isIE = scope.isIE;
2439 if (useNative) {
2440 var nop = function() {};
2441 scope.watchShadow = nop;
2442 scope.upgrade = nop;
2443 scope.upgradeAll = nop;
2444 scope.upgradeDocumentTree = nop;
2445 scope.upgradeSubtree = nop;
2446 scope.takeRecords = nop;
2447 scope.instanceof = function(obj, base) {
2448 return obj instanceof base;
2449 };
2450 } else {
2451 initializeModules();
2452 }
2453 var upgradeDocumentTree = scope.upgradeDocumentTree;
2454 var upgradeDocument = scope.upgradeDocument;
2455 if (!window.wrap) {
2456 if (window.ShadowDOMPolyfill) {
2457 window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded;
2458 window.unwrap = window.ShadowDOMPolyfill.unwrapIfNeeded;
2459 } else {
2460 window.wrap = window.unwrap = function(node) {
2461 return node;
2462 };
2463 }
2464 }
2465 if (window.HTMLImports) {
2466 window.HTMLImports.__importsParsingHook = function(elt) {
2467 if (elt.import) {
2468 upgradeDocument(wrap(elt.import));
2469 }
2470 };
2471 }
2472 function bootstrap() {
2473 upgradeDocumentTree(window.wrap(document));
2474 window.CustomElements.ready = true;
2475 var requestAnimationFrame = window.requestAnimationFrame || function(f) {
2476 setTimeout(f, 16);
2477 };
2478 requestAnimationFrame(function() {
2479 setTimeout(function() {
2480 window.CustomElements.readyTime = Date.now();
2481 if (window.HTMLImports) {
2482 window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime;
2483 }
2484 document.dispatchEvent(new CustomEvent("WebComponentsReady", {
2485 bubbles: true
2486 }));
2487 });
2488 });
2489 }
2490 if (document.readyState === "complete" || scope.flags.eager) {
2491 bootstrap();
2492 } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
2493 bootstrap();
2494 } else {
2495 var loadEvent = window.HTMLImports && !window.HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
2496 window.addEventListener(loadEvent, bootstrap);
2497 }
2498 })(window.CustomElements);
2499
2500 (function(scope) {
2501 var style = document.createElement("style");
2502 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; position: relative;" + " } \n";
2503 var head = document.querySelector("head");
2504 head.insertBefore(style, head.firstChild);
2505 })(window.WebComponents); No newline at end of file
@@ -0,0 +1,12 b''
1 /**
2 * @license
3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 * Code distributed by Google as part of the polymer project is also
8 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 */
10 // @version 0.7.22
11 !function(){window.WebComponents=window.WebComponents||{flags:{}};var e="webcomponents-lite.js",t=document.querySelector('script[src*="'+e+'"]'),n={};if(!n.noOpts){if(location.search.slice(1).split("&").forEach(function(e){var t,o=e.split("=");o[0]&&(t=o[0].match(/wc-(.+)/))&&(n[t[1]]=o[1]||!0)}),t)for(var o,r=0;o=t.attributes[r];r++)"src"!==o.name&&(n[o.name]=o.value||!0);if(n.log&&n.log.split){var i=n.log.split(",");n.log={},i.forEach(function(e){n.log[e]=!0})}else n.log={}}n.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=n.register),WebComponents.flags=n}(),function(e){"use strict";function t(e){return void 0!==h[e]}function n(){s.call(this),this._isInvalid=!0}function o(e){return""==e&&n.call(this),e.toLowerCase()}function r(e){var t=e.charCodeAt(0);return t>32&&127>t&&-1==[34,35,60,62,63,96].indexOf(t)?e:encodeURIComponent(e)}function i(e){var t=e.charCodeAt(0);return t>32&&127>t&&-1==[34,35,60,62,96].indexOf(t)?e:encodeURIComponent(e)}function a(e,a,s){function c(e){g.push(e)}var d=a||"scheme start",l=0,u="",w=!1,_=!1,g=[];e:for(;(e[l-1]!=p||0==l)&&!this._isInvalid;){var b=e[l];switch(d){case"scheme start":if(!b||!m.test(b)){if(a){c("Invalid scheme.");break e}u="",d="no scheme";continue}u+=b.toLowerCase(),d="scheme";break;case"scheme":if(b&&v.test(b))u+=b.toLowerCase();else{if(":"!=b){if(a){if(p==b)break e;c("Code point not allowed in scheme: "+b);break e}u="",l=0,d="no scheme";continue}if(this._scheme=u,u="",a)break e;t(this._scheme)&&(this._isRelative=!0),d="file"==this._scheme?"relative":this._isRelative&&s&&s._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==b?(this._query="?",d="query"):"#"==b?(this._fragment="#",d="fragment"):p!=b&&" "!=b&&"\n"!=b&&"\r"!=b&&(this._schemeData+=r(b));break;case"no scheme":if(s&&t(s._scheme)){d="relative";continue}c("Missing scheme."),n.call(this);break;case"relative or authority":if("/"!=b||"/"!=e[l+1]){c("Expected /, got: "+b),d="relative";continue}d="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=s._scheme),p==b){this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query=s._query,this._username=s._username,this._password=s._password;break e}if("/"==b||"\\"==b)"\\"==b&&c("\\ is an invalid code point."),d="relative slash";else if("?"==b)this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query="?",this._username=s._username,this._password=s._password,d="query";else{if("#"!=b){var y=e[l+1],E=e[l+2];("file"!=this._scheme||!m.test(b)||":"!=y&&"|"!=y||p!=E&&"/"!=E&&"\\"!=E&&"?"!=E&&"#"!=E)&&(this._host=s._host,this._port=s._port,this._username=s._username,this._password=s._password,this._path=s._path.slice(),this._path.pop()),d="relative path";continue}this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query=s._query,this._fragment="#",this._username=s._username,this._password=s._password,d="fragment"}break;case"relative slash":if("/"!=b&&"\\"!=b){"file"!=this._scheme&&(this._host=s._host,this._port=s._port,this._username=s._username,this._password=s._password),d="relative path";continue}"\\"==b&&c("\\ is an invalid code point."),d="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=b){c("Expected '/', got: "+b),d="authority ignore slashes";continue}d="authority second slash";break;case"authority second slash":if(d="authority ignore slashes","/"!=b){c("Expected '/', got: "+b);continue}break;case"authority ignore slashes":if("/"!=b&&"\\"!=b){d="authority";continue}c("Expected authority, got: "+b);break;case"authority":if("@"==b){w&&(c("@ already seen."),u+="%40"),w=!0;for(var L=0;L<u.length;L++){var N=u[L];if(" "!=N&&"\n"!=N&&"\r"!=N)if(":"!=N||null!==this._password){var M=r(N);null!==this._password?this._password+=M:this._username+=M}else this._password="";else c("Invalid whitespace in authority.")}u=""}else{if(p==b||"/"==b||"\\"==b||"?"==b||"#"==b){l-=u.length,u="",d="host";continue}u+=b}break;case"file host":if(p==b||"/"==b||"\\"==b||"?"==b||"#"==b){2!=u.length||!m.test(u[0])||":"!=u[1]&&"|"!=u[1]?0==u.length?d="relative path start":(this._host=o.call(this,u),u="",d="relative path start"):d="relative path";continue}" "==b||"\n"==b||"\r"==b?c("Invalid whitespace in file host."):u+=b;break;case"host":case"hostname":if(":"!=b||_){if(p==b||"/"==b||"\\"==b||"?"==b||"#"==b){if(this._host=o.call(this,u),u="",d="relative path start",a)break e;continue}" "!=b&&"\n"!=b&&"\r"!=b?("["==b?_=!0:"]"==b&&(_=!1),u+=b):c("Invalid code point in host/hostname: "+b)}else if(this._host=o.call(this,u),u="",d="port","hostname"==a)break e;break;case"port":if(/[0-9]/.test(b))u+=b;else{if(p==b||"/"==b||"\\"==b||"?"==b||"#"==b||a){if(""!=u){var T=parseInt(u,10);T!=h[this._scheme]&&(this._port=T+""),u=""}if(a)break e;d="relative path start";continue}" "==b||"\n"==b||"\r"==b?c("Invalid code point in port: "+b):n.call(this)}break;case"relative path start":if("\\"==b&&c("'\\' not allowed in path."),d="relative path","/"!=b&&"\\"!=b)continue;break;case"relative path":if(p!=b&&"/"!=b&&"\\"!=b&&(a||"?"!=b&&"#"!=b))" "!=b&&"\n"!=b&&"\r"!=b&&(u+=r(b));else{"\\"==b&&c("\\ not allowed in relative path.");var O;(O=f[u.toLowerCase()])&&(u=O),".."==u?(this._path.pop(),"/"!=b&&"\\"!=b&&this._path.push("")):"."==u&&"/"!=b&&"\\"!=b?this._path.push(""):"."!=u&&("file"==this._scheme&&0==this._path.length&&2==u.length&&m.test(u[0])&&"|"==u[1]&&(u=u[0]+":"),this._path.push(u)),u="","?"==b?(this._query="?",d="query"):"#"==b&&(this._fragment="#",d="fragment")}break;case"query":a||"#"!=b?p!=b&&" "!=b&&"\n"!=b&&"\r"!=b&&(this._query+=i(b)):(this._fragment="#",d="fragment");break;case"fragment":p!=b&&" "!=b&&"\n"!=b&&"\r"!=b&&(this._fragment+=b)}l++}}function s(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function c(e,t){void 0===t||t instanceof c||(t=new c(String(t))),this._url=e,s.call(this);var n=e.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");a.call(this,n,null,t)}var d=!1;if(!e.forceJURL)try{var l=new URL("b","http://a");l.pathname="c%20d",d="http://a/c%20d"===l.href}catch(u){}if(!d){var h=Object.create(null);h.ftp=21,h.file=0,h.gopher=70,h.http=80,h.https=443,h.ws=80,h.wss=443;var f=Object.create(null);f["%2e"]=".",f[".%2e"]="..",f["%2e."]="..",f["%2e%2e"]="..";var p=void 0,m=/[a-zA-Z]/,v=/[a-zA-Z0-9\+\-\.]/;c.prototype={toString:function(){return this.href},get href(){if(this._isInvalid)return this._url;var e="";return""==this._username&&null==this._password||(e=this._username+(null!=this._password?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+e+this.host:"")+this.pathname+this._query+this._fragment},set href(e){s.call(this),a.call(this,e)},get protocol(){return this._scheme+":"},set protocol(e){this._isInvalid||a.call(this,e+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(e){!this._isInvalid&&this._isRelative&&a.call(this,e,"host")},get hostname(){return this._host},set hostname(e){!this._isInvalid&&this._isRelative&&a.call(this,e,"hostname")},get port(){return this._port},set port(e){!this._isInvalid&&this._isRelative&&a.call(this,e,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(e){!this._isInvalid&&this._isRelative&&(this._path=[],a.call(this,e,"relative path start"))},get search(){return this._isInvalid||!this._query||"?"==this._query?"":this._query},set search(e){!this._isInvalid&&this._isRelative&&(this._query="?","?"==e[0]&&(e=e.slice(1)),a.call(this,e,"query"))},get hash(){return this._isInvalid||!this._fragment||"#"==this._fragment?"":this._fragment},set hash(e){this._isInvalid||(this._fragment="#","#"==e[0]&&(e=e.slice(1)),a.call(this,e,"fragment"))},get origin(){var e;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null"}return e=this.host,e?this._scheme+"://"+e:""}};var w=e.URL;w&&(c.createObjectURL=function(e){return w.createObjectURL.apply(w,arguments)},c.revokeObjectURL=function(e){w.revokeObjectURL(e)}),e.URL=c}}(self),"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var o=t[this.name];return o&&o[0]===t?o[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),function(e){function t(e){b.push(e),g||(g=!0,m(o))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function o(){g=!1;var e=b;b=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();r(e),n.length&&(e.callback_(n,e),t=!0)}),t&&o()}function r(e){e.nodes_.forEach(function(t){var n=v.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var o=v.get(n);if(o)for(var r=0;r<o.length;r++){var i=o[r],a=i.options;if(n===e||a.subtree){var s=t(a);s&&i.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++y}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function c(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function d(e,t){return E=new s(e,t)}function l(e){return L?L:(L=c(E),L.oldValue=e,L)}function u(){E=L=void 0}function h(e){return e===L||e===E}function f(e,t){return e===t?e:L&&h(e)?L:null}function p(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}if(!e.JsMutationObserver){var m,v=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))m=setTimeout;else if(window.setImmediate)m=window.setImmediate;else{var w=[],_=String(Math.random());window.addEventListener("message",function(e){if(e.data===_){var t=w;w=[],t.forEach(function(e){e()})}}),m=function(e){w.push(e),window.postMessage(_,"*")}}var g=!1,b=[],y=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var o=v.get(e);o||v.set(e,o=[]);for(var r,i=0;i<o.length;i++)if(o[i].observer===this){r=o[i],r.removeListeners(),r.options=t;break}r||(r=new p(this,e,t),o.push(r),this.nodes_.push(e)),r.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=v.get(e),n=0;n<t.length;n++){var o=t[n];if(o.observer===this){o.removeListeners(),t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var E,L;p.prototype={enqueue:function(e){var n=this.observer.records_,o=n.length;if(n.length>0){var r=n[o-1],i=f(r,e);if(i)return void(n[o-1]=i)}else t(this.observer);n[o]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;n<t.length;n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e.relatedNode.namespaceURI,o=e.target,r=new d("attributes",o);r.attributeName=t,r.attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(o,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0:e.attributeOldValue?l(a):r});break;case"DOMCharacterDataModified":var o=e.target,r=d("characterData",o),a=e.prevValue;i(o,function(e){return e.characterData?e.characterDataOldValue?l(a):r:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,c,h=e.target;"DOMNodeInserted"===e.type?(s=[h],c=[]):(s=[],c=[h]);var f=h.previousSibling,p=h.nextSibling,r=d("childList",e.target.parentNode);r.addedNodes=s,r.removedNodes=c,r.previousSibling=f,r.nextSibling=p,i(e.relatedNode,function(e){return e.childList?r:void 0})}u()}},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a,a._isPolyfilled=!0)}}(self),function(){function e(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case" ":return"&nbsp;"}}function t(t){return t.replace(u,e)}var n="undefined"==typeof HTMLTemplateElement;/Trident/.test(navigator.userAgent)&&!function(){var e=document.importNode;document.importNode=function(){var t=e.apply(document,arguments);if(t.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var n=document.createDocumentFragment();return n.appendChild(t),n}return t}}();var o=function(){if(!n){var e=document.createElement("template"),t=document.createElement("template");t.content.appendChild(document.createElement("div")),e.content.appendChild(t);var o=e.cloneNode(!0);return 0===o.content.childNodes.length||0===o.content.firstChild.content.childNodes.length}}(),r="template",i=function(){};if(n){var a=document.implementation.createHTMLDocument("template"),s=!0,c=document.createElement("style");c.textContent=r+"{display:none;}";var d=document.head;d.insertBefore(c,d.firstElementChild),i.prototype=Object.create(HTMLElement.prototype),i.decorate=function(e){if(!e.content){e.content=a.createDocumentFragment();for(var n;n=e.firstChild;)e.content.appendChild(n);if(e.cloneNode=function(e){return i.cloneNode(this,e)},s)try{Object.defineProperty(e,"innerHTML",{get:function(){for(var e="",n=this.content.firstChild;n;n=n.nextSibling)e+=n.outerHTML||t(n.data);return e},set:function(e){for(a.body.innerHTML=e,i.bootstrap(a);this.content.firstChild;)this.content.removeChild(this.content.firstChild);for(;a.body.firstChild;)this.content.appendChild(a.body.firstChild)},configurable:!0})}catch(o){s=!1}i.bootstrap(e.content)}},i.bootstrap=function(e){for(var t,n=e.querySelectorAll(r),o=0,a=n.length;a>o&&(t=n[o]);o++)i.decorate(t)},document.addEventListener("DOMContentLoaded",function(){i.bootstrap(document)});var l=document.createElement;document.createElement=function(){"use strict";var e=l.apply(document,arguments);return"template"===e.localName&&i.decorate(e),e};var u=/[&\u00A0<>]/g}if(n||o){var h=Node.prototype.cloneNode;i.cloneNode=function(e,t){var n=h.call(e,!1);return this.decorate&&this.decorate(n),t&&(n.content.appendChild(h.call(e.content,!0)),this.fixClonedDom(n.content,e.content)),n},i.fixClonedDom=function(e,t){if(t.querySelectorAll)for(var n,o,i=t.querySelectorAll(r),a=e.querySelectorAll(r),s=0,c=a.length;c>s;s++)o=i[s],n=a[s],this.decorate&&this.decorate(o),n.parentNode.replaceChild(o.cloneNode(!0),n)};var f=document.importNode;Node.prototype.cloneNode=function(e){var t=h.call(this,e);return e&&i.fixClonedDom(t,this),t},document.importNode=function(e,t){if(e.localName===r)return i.cloneNode(e,t);var n=f.call(document,e,t);return t&&i.fixClonedDom(n,e),n},o&&(HTMLTemplateElement.prototype.cloneNode=function(e){return i.cloneNode(this,e)})}n&&(window.HTMLTemplateElement=i)}(),function(e){"use strict";if(!window.performance){var t=Date.now();window.performance={now:function(){return Date.now()-t}}}window.requestAnimationFrame||(window.requestAnimationFrame=function(){var e=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;return e?function(t){return e(function(){t(performance.now())})}:function(e){return window.setTimeout(e,1e3/60)}}()),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(){return window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}}());var n=function(){var e=document.createEvent("Event");return e.initEvent("foo",!0,!0),e.preventDefault(),e.defaultPrevented}();if(!n){var o=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(o.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}var r=/Trident/.test(navigator.userAgent);if((!window.CustomEvent||r&&"function"!=typeof window.CustomEvent)&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),!window.Event||r&&"function"!=typeof window.Event){var i=window.Event;window.Event=function(e,t){t=t||{};var n=document.createEvent("Event");return n.initEvent(e,Boolean(t.bubbles),Boolean(t.cancelable)),n},window.Event.prototype=i.prototype}}(window.WebComponents),window.HTMLImports=window.HTMLImports||{flags:{}},function(e){function t(e,t){t=t||p,o(function(){i(e,t)},t)}function n(e){return"complete"===e.readyState||e.readyState===w}function o(e,t){if(n(t))e&&e();else{var r=function(){"complete"!==t.readyState&&t.readyState!==w||(t.removeEventListener(_,r),o(e,t))};t.addEventListener(_,r)}}function r(e){e.target.__loaded=!0}function i(e,t){function n(){c==d&&e&&e({allImports:s,loadedImports:l,errorImports:u})}function o(e){r(e),l.push(this),c++,n()}function i(e){u.push(this),c++,n()}var s=t.querySelectorAll("link[rel=import]"),c=0,d=s.length,l=[],u=[];if(d)for(var h,f=0;d>f&&(h=s[f]);f++)a(h)?(l.push(this),c++,n()):(h.addEventListener("load",o),h.addEventListener("error",i));else n()}function a(e){return u?e.__loaded||e["import"]&&"loading"!==e["import"].readyState:e.__importParsed}function s(e){for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)c(t)&&d(t)}function c(e){return"link"===e.localName&&"import"===e.rel}function d(e){var t=e["import"];t?r({target:e}):(e.addEventListener("load",r),e.addEventListener("error",r))}var l="import",u=Boolean(l in document.createElement("link")),h=Boolean(window.ShadowDOMPolyfill),f=function(e){return h?window.ShadowDOMPolyfill.wrapIfNeeded(e):e},p=f(document),m={get:function(){var e=window.HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return f(e)},configurable:!0};Object.defineProperty(document,"_currentScript",m),Object.defineProperty(p,"_currentScript",m);var v=/Trident/.test(navigator.userAgent),w=v?"complete":"interactive",_="readystatechange";u&&(new MutationObserver(function(e){for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),n=0,o=t.length;o>n&&(e=t[n]);n++)d(e)}()),t(function(e){window.HTMLImports.ready=!0,window.HTMLImports.readyTime=(new Date).getTime();var t=p.createEvent("CustomEvent");t.initCustomEvent("HTMLImportsLoaded",!0,!0,e),p.dispatchEvent(t)}),e.IMPORT_LINK_TYPE=l,e.useNative=u,e.rootDocument=p,e.whenReady=t,e.isIE=v}(window.HTMLImports),function(e){var t=[],n=function(e){t.push(e)},o=function(){t.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=o}(window.HTMLImports),window.HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,n=/(@import[\s]+(?!url\())([^;]*)(;)/g,o={resolveUrlsInStyle:function(e,t){var n=e.ownerDocument,o=n.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,t,o),e},resolveUrlsInCssText:function(e,o,r){var i=this.replaceUrls(e,r,o,t);return i=this.replaceUrls(i,r,o,n)},replaceUrls:function(e,t,n,o){return e.replace(o,function(e,o,r,i){var a=r.replace(/["']/g,"");return n&&(a=new URL(a,n).href),t.href=a,a=t.href,o+"'"+a+"'"+i})}};e.path=o}),window.HTMLImports.addModule(function(e){var t={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(n,o,r){var i=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(n+="?"+Math.random()),i.open("GET",n,t.async),i.addEventListener("readystatechange",function(e){if(4===i.readyState){var n=null;try{var a=i.getResponseHeader("Location");a&&(n="/"===a.substr(0,1)?location.origin+a:a)}catch(e){console.error(e.message)}o.call(r,!t.ok(i)&&i,i.response||i.responseText,n)}}),i.send(),i},loadDocument:function(e,t,n){this.load(e,t,n).responseType="document"}};e.xhr=t}),window.HTMLImports.addModule(function(e){var t=e.xhr,n=e.flags,o=function(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};o.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,o){if(n.load&&console.log("fetch",e,o),e)if(e.match(/^data:/)){var r=e.split(","),i=r[0],a=r[1];a=i.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,o,null,a)}.bind(this),0)}else{var s=function(t,n,r){this.receive(e,o,t,n,r)}.bind(this);t.load(e,s)}else setTimeout(function(){this.receive(e,o,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,n,o,r){this.cache[e]=o;for(var i,a=this.pending[e],s=0,c=a.length;c>s&&(i=a[s]);s++)this.onload(e,i,o,n,r),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=o}),window.HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),window.HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===l}function n(e){var t=o(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function o(e){return e.textContent+r(e)}function r(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var n=e.ownerDocument.baseURI,o=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+n+o+".js\n"}function i(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,c=e.flags,d=e.isIE,l=e.IMPORT_LINK_TYPE,u="link[rel="+l+"]",h={documentSelectors:u,importsSelectors:[u,"link[rel=stylesheet]:not([type])","style:not([type])","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(c.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){c.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,c.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(e["import"]=e.__doc,window.HTMLImports.__importsParsingHook&&window.HTMLImports.__importsParsingHook(e),e["import"]&&(e["import"].__importParsed=!0),this.markParsingComplete(e),e.__resource&&!e.__error?e.dispatchEvent(new CustomEvent("load",{bubbles:!1})):e.dispatchEvent(new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=i(e),t.__appliedElement=e,e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(e,t){var n=this,o=function(r){e.removeEventListener("load",o),e.removeEventListener("error",o),t&&t(r),n.markParsingComplete(e),n.parseNext()};if(e.addEventListener("load",o),e.addEventListener("error",o),d&&"style"===e.localName){var r=!1;if(-1==e.textContent.indexOf("@import"))r=!0;else if(e.sheet){r=!0;for(var i,a=e.sheet.cssRules,s=a?a.length:0,c=0;s>c&&(i=a[c]);c++)i.type===CSSRule.IMPORT_RULE&&(r=r&&Boolean(i.styleSheet))}r&&setTimeout(function(){e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(t){var o=document.createElement("script");o.__importElement=t,o.src=t.src?t.src:n(t),e.currentScript=t,this.trackElement(o,function(t){o.parentNode&&o.parentNode.removeChild(o),e.currentScript=null}),this.addElementToDocument(o)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,n){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var o,r=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,a=r.length;a>i&&(o=r[i]);i++)if(!this.isParsed(o))return this.hasResource(o)?t(o)?this.nextToParseInDoc(o.__doc,o):o:void 0}return n},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return!t(e)||void 0!==e.__doc}};e.parser=h,e.IMPORT_SELECTOR=u}),window.HTMLImports.addModule(function(e){function t(e){return n(e,a)}function n(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function o(e){return!!Object.getOwnPropertyDescriptor(e,"baseURI")}function r(e,t){var n=document.implementation.createHTMLDocument(a);n._URL=t;var r=n.createElement("base");r.setAttribute("href",t),n.baseURI||o(n)||Object.defineProperty(n,"baseURI",{value:t});var i=n.createElement("meta");return i.setAttribute("charset","utf-8"),n.head.appendChild(i),n.head.appendChild(r),n.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}var i=e.flags,a=e.IMPORT_LINK_TYPE,s=e.IMPORT_SELECTOR,c=e.rootDocument,d=e.Loader,l=e.Observer,u=e.parser,h={documents:{},documentPreloadSelectors:s,importsPreloadSelectors:[s].join(","),loadNode:function(e){f.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);f.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===c?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,n,o,a,s){if(i.load&&console.log("loaded",e,n),n.__resource=o,n.__error=a,t(n)){var c=this.documents[e];void 0===c&&(c=a?null:r(o,s||e),c&&(c.__importLink=n,this.bootDocument(c)),this.documents[e]=c),n.__doc=c}u.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),u.parseNext()},loadedAll:function(){u.parseNext()}},f=new d(h.loaded.bind(h),h.loadedAll.bind(h));if(h.observer=new l,!document.baseURI){var p={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",p),Object.defineProperty(c,"baseURI",p)}e.importer=h,e.importLoader=f}),window.HTMLImports.addModule(function(e){var t=e.parser,n=e.importer,o={added:function(e){for(var o,r,i,a,s=0,c=e.length;c>s&&(a=e[s]);s++)o||(o=a.ownerDocument,r=t.isParsed(o)),i=this.shouldLoadNode(a),i&&n.loadNode(a),this.shouldParseNode(a)&&r&&t.parseDynamic(a,i)},shouldLoadNode:function(e){return 1===e.nodeType&&r.call(e,n.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&r.call(e,t.parseSelectorsForNode(e))}};n.observer.addCallback=o.added.bind(o);var r=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){window.HTMLImports.importer.bootDocument(o)}var n=e.initializeModules;e.isIE;if(!e.useNative){n();var o=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(window.HTMLImports),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[],o=function(e){n.push(e)},r=function(){n.forEach(function(t){t(e)})};e.addModule=o,e.initializeModules=r,e.hasNative=Boolean(document.registerElement),e.isIE=/Trident/.test(navigator.userAgent),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(e){function t(e,t){n(e,function(e){return t(e)?!0:void o(e,t)}),o(e,t)}function n(e,t,o){var r=e.firstElementChild;if(!r)for(r=e.firstChild;r&&r.nodeType!==Node.ELEMENT_NODE;)r=r.nextSibling;for(;r;)t(r,o)!==!0&&n(r,t,o),r=r.nextElementSibling;return null}function o(e,n){for(var o=e.shadowRoot;o;)t(o,n),o=o.olderShadowRoot}function r(e,t){i(e,t,[])}function i(e,t,n){if(e=window.wrap(e),!(n.indexOf(e)>=0)){n.push(e);for(var o,r=e.querySelectorAll("link[rel="+a+"]"),s=0,c=r.length;c>s&&(o=r[s]);s++)o["import"]&&i(o["import"],t,n);t(e)}}var a=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=r,e.forSubtree=t}),window.CustomElements.addModule(function(e){function t(e,t){return n(e,t)||o(e,t)}function n(t,n){return e.upgrade(t,n)?!0:void(n&&a(t))}function o(e,t){g(e,function(e){return n(e,t)?!0:void 0})}function r(e){L.push(e),E||(E=!0,setTimeout(i))}function i(){E=!1;for(var e,t=L,n=0,o=t.length;o>n&&(e=t[n]);n++)e();L=[]}function a(e){y?r(function(){s(e)}):s(e)}function s(e){
12 e.__upgraded__&&!e.__attached&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function c(e){d(e),g(e,function(e){d(e)})}function d(e){y?r(function(){l(e)}):l(e)}function l(e){e.__upgraded__&&e.__attached&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function u(e){for(var t=e,n=window.wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host}}function h(e){if(e.shadowRoot&&!e.shadowRoot.__watched){_.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)m(t),t=t.olderShadowRoot}}function f(e,n){if(_.dom){var o=n[0];if(o&&"childList"===o.type&&o.addedNodes&&o.addedNodes){for(var r=o.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var i=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";i=i.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,i||"")}var a=u(e);n.forEach(function(e){"childList"===e.type&&(N(e.addedNodes,function(e){e.localName&&t(e,a)}),N(e.removedNodes,function(e){e.localName&&c(e)}))}),_.dom&&console.groupEnd()}function p(e){for(e=window.wrap(e),e||(e=window.wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(f(e,t.takeRecords()),i())}function m(e){if(!e.__observer){var t=new MutationObserver(f.bind(this,e));t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function v(e){e=window.wrap(e),_.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop());var n=e===window.wrap(document);t(e,n),m(e),_.dom&&console.groupEnd()}function w(e){b(e,v)}var _=e.flags,g=e.forSubtree,b=e.forDocumentTree,y=window.MutationObserver._isPolyfilled&&_["throttle-attached"];e.hasPolyfillMutations=y,e.hasThrottledAttached=y;var E=!1,L=[],N=Array.prototype.forEach.call.bind(Array.prototype.forEach),M=Element.prototype.createShadowRoot;M&&(Element.prototype.createShadowRoot=function(){var e=M.call(this);return window.CustomElements.watchShadow(this),e}),e.watchShadow=h,e.upgradeDocumentTree=w,e.upgradeDocument=v,e.upgradeSubtree=o,e.upgradeAll=t,e.attached=a,e.takeRecords=p}),window.CustomElements.addModule(function(e){function t(t,o){if("template"===t.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(t),!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var r=t.getAttribute("is"),i=e.getRegisteredDefinition(t.localName)||e.getRegisteredDefinition(r);if(i&&(r&&i.tag==t.localName||!r&&!i["extends"]))return n(t,i,o)}}function n(t,n,r){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAttribute("is",n.is),o(t,n),t.__upgraded__=!0,i(t),r&&e.attached(t),e.upgradeSubtree(t,r),a.upgrade&&console.groupEnd(),t}function o(e,t){Object.__proto__?e.__proto__=t.prototype:(r(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function r(e,t,n){for(var o={},r=t;r!==n&&r!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(r),s=0;i=a[s];s++)o[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i)),o[i]=1);r=Object.getPrototypeOf(r)}}function i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=n,e.implementPrototype=o}),window.CustomElements.addModule(function(e){function t(t,o){var c=o||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(r(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(d(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return c.prototype||(c.prototype=Object.create(HTMLElement.prototype)),c.__name=t.toLowerCase(),c["extends"]&&(c["extends"]=c["extends"].toLowerCase()),c.lifecycle=c.lifecycle||{},c.ancestry=i(c["extends"]),a(c),s(c),n(c.prototype),l(c.__name,c),c.ctor=u(c),c.ctor.prototype=c.prototype,c.prototype.constructor=c.ctor,e.ready&&v(document),c.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){o.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){o.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function o(e,t,n){e=e.toLowerCase();var o=this.getAttribute(e);n.apply(this,arguments);var r=this.getAttribute(e);this.attributeChangedCallback&&r!==o&&this.attributeChangedCallback(e,o,r)}function r(e){for(var t=0;t<y.length;t++)if(e===y[t])return!0}function i(e){var t=d(e);return t?i(t["extends"]).concat([t]):[]}function a(e){for(var t,n=e["extends"],o=0;t=e.ancestry[o];o++)n=t.is&&t.tag;e.tag=n||e.__name,n&&(e.is=e.__name)}function s(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag);t=Object.getPrototypeOf(n)}for(var o,r=e.prototype,i=!1;r;)r==t&&(i=!0),o=Object.getPrototypeOf(r),o&&(r.__proto__=o),r=o;i||console.warn(e.tag+" prototype not found in prototype chain for "+e.is),e["native"]=t}}function c(e){return _(N(e.tag),e)}function d(e){return e?E[e.toLowerCase()]:void 0}function l(e,t){E[e]=t}function u(e){return function(){return c(e)}}function h(e,t,n){return e===L?f(t,n):M(e,t)}function f(e,t){e&&(e=e.toLowerCase()),t&&(t=t.toLowerCase());var n=d(t||e);if(n){if(e==n.tag&&t==n.is)return new n.ctor;if(!t&&!n.is)return new n.ctor}var o;return t?(o=f(e),o.setAttribute("is",t),o):(o=N(e),e.indexOf("-")>=0&&g(o,HTMLElement),o)}function p(e,t){var n=e[t];e[t]=function(){var e=n.apply(this,arguments);return w(e),e}}var m,v=(e.isIE,e.upgradeDocumentTree),w=e.upgradeAll,_=e.upgradeWithDefinition,g=e.implementPrototype,b=e.useNative,y=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],E={},L="http://www.w3.org/1999/xhtml",N=document.createElement.bind(document),M=document.createElementNS.bind(document);m=Object.__proto__||b?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},p(Node.prototype,"cloneNode"),p(document,"importNode"),document.registerElement=t,document.createElement=f,document.createElementNS=h,e.registry=E,e["instanceof"]=m,e.reservedTagList=y,e.getRegisteredDefinition=d,document.register=document.registerElement}),function(e){function t(){i(window.wrap(document)),window.CustomElements.ready=!0;var e=window.requestAnimationFrame||function(e){setTimeout(e,16)};e(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var n=e.useNative,o=e.initializeModules;e.isIE;if(n){var r=function(){};e.watchShadow=r,e.upgrade=r,e.upgradeAll=r,e.upgradeDocumentTree=r,e.upgradeSubtree=r,e.takeRecords=r,e["instanceof"]=function(e,t){return e instanceof t}}else o();var i=e.upgradeDocumentTree,a=e.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(e){e["import"]&&a(wrap(e["import"]))}),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var s=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(s,t)}else t()}(window.CustomElements),function(e){var t=document.createElement("style");t.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var n=document.querySelector("head");n.insertBefore(t,n.firstChild)}(window.WebComponents); No newline at end of file
@@ -0,0 +1,14 b''
1 /**
2 * @license
3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 * Code distributed by Google as part of the polymer project is also
8 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 */
10 // @version 0.7.22
11 !function(){window.WebComponents=window.WebComponents||{flags:{}};var e="webcomponents.js",t=document.querySelector('script[src*="'+e+'"]'),n={};if(!n.noOpts){if(location.search.slice(1).split("&").forEach(function(e){var t,r=e.split("=");r[0]&&(t=r[0].match(/wc-(.+)/))&&(n[t[1]]=r[1]||!0)}),t)for(var r,o=0;r=t.attributes[o];o++)"src"!==r.name&&(n[r.name]=r.value||!0);if(n.log&&n.log.split){var i=n.log.split(",");n.log={},i.forEach(function(e){n.log[e]=!0})}else n.log={}}n.shadow=n.shadow||n.shadowdom||n.polyfill,"native"===n.shadow?n.shadow=!1:n.shadow=n.shadow||!HTMLElement.prototype.createShadowRoot,n.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=n.register),WebComponents.flags=n}(),WebComponents.flags.shadow&&("undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];return r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),window.ShadowDOMPolyfill={},function(e){"use strict";function t(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;if(navigator.getDeviceStorage)return!1;try{var e=new Function("return true;");return e()}catch(t){return!1}}function n(e){if(!e)throw new Error("Assertion failed")}function r(e,t){for(var n=W(t),r=0;r<n.length;r++){var o=n[r];A(e,o,F(t,o))}return e}function o(e,t){for(var n=W(t),r=0;r<n.length;r++){var o=n[r];switch(o){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":continue}A(e,o,F(t,o))}return e}function i(e,t){for(var n=0;n<t.length;n++)if(t[n]in e)return t[n]}function a(e,t,n){U.value=n,A(e,t,U)}function s(e,t){var n=e.__proto__||Object.getPrototypeOf(e);if(q)try{W(n)}catch(r){n=n.__proto__}var o=R.get(n);if(o)return o;var i=s(n),a=E(i);return g(n,a,t),a}function c(e,t){w(e,t,!0)}function l(e,t){w(t,e,!1)}function u(e){return/^on[a-z]+$/.test(e)}function d(e){return/^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(e)}function p(e){return k&&d(e)?new Function("return this.__impl4cf1e782hg__."+e):function(){return this.__impl4cf1e782hg__[e]}}function h(e){return k&&d(e)?new Function("v","this.__impl4cf1e782hg__."+e+" = v"):function(t){this.__impl4cf1e782hg__[e]=t}}function f(e){return k&&d(e)?new Function("return this.__impl4cf1e782hg__."+e+".apply(this.__impl4cf1e782hg__, arguments)"):function(){return this.__impl4cf1e782hg__[e].apply(this.__impl4cf1e782hg__,arguments)}}function m(e,t){try{return Object.getOwnPropertyDescriptor(e,t)}catch(n){return B}}function w(t,n,r,o){for(var i=W(t),a=0;a<i.length;a++){var s=i[a];if("polymerBlackList_"!==s&&!(s in n||t.polymerBlackList_&&t.polymerBlackList_[s])){q&&t.__lookupGetter__(s);var c,l,d=m(t,s);if("function"!=typeof d.value){var w=u(s);c=w?e.getEventHandlerGetter(s):p(s),(d.writable||d.set||V)&&(l=w?e.getEventHandlerSetter(s):h(s));var v=V||d.configurable;A(n,s,{get:c,set:l,configurable:v,enumerable:d.enumerable})}else r&&(n[s]=f(s))}}}function v(e,t,n){if(null!=e){var r=e.prototype;g(r,t,n),o(t,e)}}function g(e,t,r){var o=t.prototype;n(void 0===R.get(e)),R.set(e,t),I.set(o,e),c(e,o),r&&l(o,r),a(o,"constructor",t),t.prototype=o}function b(e,t){return R.get(t.prototype)===e}function y(e){var t=Object.getPrototypeOf(e),n=s(t),r=E(n);return g(t,r,e),r}function E(e){function t(t){e.call(this,t)}var n=Object.create(e.prototype);return n.constructor=t,t.prototype=n,t}function _(e){return e&&e.__impl4cf1e782hg__}function S(e){return!_(e)}function T(e){if(null===e)return null;n(S(e));var t=e.__wrapper8e3dd93a60__;return null!=t?t:e.__wrapper8e3dd93a60__=new(s(e,e))(e)}function M(e){return null===e?null:(n(_(e)),e.__impl4cf1e782hg__)}function O(e){return e.__impl4cf1e782hg__}function L(e,t){t.__impl4cf1e782hg__=e,e.__wrapper8e3dd93a60__=t}function N(e){return e&&_(e)?M(e):e}function C(e){return e&&!_(e)?T(e):e}function j(e,t){null!==t&&(n(S(e)),n(void 0===t||_(t)),e.__wrapper8e3dd93a60__=t)}function D(e,t,n){G.get=n,A(e.prototype,t,G)}function H(e,t){D(e,t,function(){return T(this.__impl4cf1e782hg__[t])})}function x(e,t){e.forEach(function(e){t.forEach(function(t){e.prototype[t]=function(){var e=C(this);return e[t].apply(e,arguments)}})})}var R=new WeakMap,I=new WeakMap,P=Object.create(null),k=t(),A=Object.defineProperty,W=Object.getOwnPropertyNames,F=Object.getOwnPropertyDescriptor,U={value:void 0,configurable:!0,enumerable:!1,writable:!0};W(window);var q=/Firefox/.test(navigator.userAgent),B={get:function(){},set:function(e){},configurable:!0,enumerable:!0},V=function(){var e=Object.getOwnPropertyDescriptor(Node.prototype,"nodeType");return e&&!e.get&&!e.set}(),G={get:void 0,configurable:!0,enumerable:!0};e.addForwardingProperties=c,e.assert=n,e.constructorTable=R,e.defineGetter=D,e.defineWrapGetter=H,e.forwardMethodsToWrapper=x,e.isIdentifierName=d,e.isWrapper=_,e.isWrapperFor=b,e.mixin=r,e.nativePrototypeTable=I,e.oneOf=i,e.registerObject=y,e.registerWrapper=v,e.rewrap=j,e.setWrapper=L,e.unsafeUnwrap=O,e.unwrap=M,e.unwrapIfNeeded=N,e.wrap=T,e.wrapIfNeeded=C,e.wrappers=P}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t,n){return{index:e,removed:t,addedCount:n}}function n(){}var r=0,o=1,i=2,a=3;n.prototype={calcEditDistances:function(e,t,n,r,o,i){for(var a=i-o+1,s=n-t+1,c=new Array(a),l=0;a>l;l++)c[l]=new Array(s),c[l][0]=l;for(var u=0;s>u;u++)c[0][u]=u;for(var l=1;a>l;l++)for(var u=1;s>u;u++)if(this.equals(e[t+u-1],r[o+l-1]))c[l][u]=c[l-1][u-1];else{var d=c[l-1][u]+1,p=c[l][u-1]+1;c[l][u]=p>d?d:p}return c},spliceOperationsFromEditDistances:function(e){for(var t=e.length-1,n=e[0].length-1,s=e[t][n],c=[];t>0||n>0;)if(0!=t)if(0!=n){var l,u=e[t-1][n-1],d=e[t-1][n],p=e[t][n-1];l=p>d?u>d?d:u:u>p?p:u,l==u?(u==s?c.push(r):(c.push(o),s=u),t--,n--):l==d?(c.push(a),t--,s=d):(c.push(i),n--,s=p)}else c.push(a),t--;else c.push(i),n--;return c.reverse(),c},calcSplices:function(e,n,s,c,l,u){var d=0,p=0,h=Math.min(s-n,u-l);if(0==n&&0==l&&(d=this.sharedPrefix(e,c,h)),s==e.length&&u==c.length&&(p=this.sharedSuffix(e,c,h-d)),n+=d,l+=d,s-=p,u-=p,s-n==0&&u-l==0)return[];if(n==s){for(var f=t(n,[],0);u>l;)f.removed.push(c[l++]);return[f]}if(l==u)return[t(n,[],s-n)];for(var m=this.spliceOperationsFromEditDistances(this.calcEditDistances(e,n,s,c,l,u)),f=void 0,w=[],v=n,g=l,b=0;b<m.length;b++)switch(m[b]){case r:f&&(w.push(f),f=void 0),v++,g++;break;case o:f||(f=t(v,[],0)),f.addedCount++,v++,f.removed.push(c[g]),g++;break;case i:f||(f=t(v,[],0)),f.addedCount++,v++;break;case a:f||(f=t(v,[],0)),f.removed.push(c[g]),g++}return f&&w.push(f),w},sharedPrefix:function(e,t,n){for(var r=0;n>r;r++)if(!this.equals(e[r],t[r]))return r;return n},sharedSuffix:function(e,t,n){for(var r=e.length,o=t.length,i=0;n>i&&this.equals(e[--r],t[--o]);)i++;return i},calculateSplices:function(e,t){return this.calcSplices(e,0,e.length,t,0,t.length)},equals:function(e,t){return e===t}},e.ArraySplice=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(){a=!1;var e=i.slice(0);i=[];for(var t=0;t<e.length;t++)(0,e[t])()}function n(e){i.push(e),a||(a=!0,r(t,0))}var r,o=window.MutationObserver,i=[],a=!1;if(o){var s=1,c=new o(t),l=document.createTextNode(s);c.observe(l,{characterData:!0}),r=function(){s=(s+1)%2,l.data=s}}else r=window.setTimeout;e.setEndOfMicrotask=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.scheduled_||(e.scheduled_=!0,f.push(e),m||(u(n),m=!0))}function n(){for(m=!1;f.length;){var e=f;f=[],e.sort(function(e,t){return e.uid_-t.uid_});for(var t=0;t<e.length;t++){var n=e[t];n.scheduled_=!1;var r=n.takeRecords();i(n),r.length&&n.callback_(r,n)}}}function r(e,t){this.type=e,this.target=t,this.addedNodes=new p.NodeList,this.removedNodes=new p.NodeList,this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function o(e,t){for(;e;e=e.parentNode){var n=h.get(e);if(n)for(var r=0;r<n.length;r++){var o=n[r];o.options.subtree&&o.addTransientObserver(t)}}}function i(e){for(var t=0;t<e.nodes_.length;t++){var n=e.nodes_[t],r=h.get(n);if(!r)return;for(var o=0;o<r.length;o++){var i=r[o];i.observer===e&&i.removeTransientObservers()}}}function a(e,n,o){for(var i=Object.create(null),a=Object.create(null),s=e;s;s=s.parentNode){var c=h.get(s);if(c)for(var l=0;l<c.length;l++){var u=c[l],d=u.options;if((s===e||d.subtree)&&("attributes"!==n||d.attributes)&&("attributes"!==n||!d.attributeFilter||null===o.namespace&&-1!==d.attributeFilter.indexOf(o.name))&&("characterData"!==n||d.characterData)&&("childList"!==n||d.childList)){var p=u.observer;i[p.uid_]=p,("attributes"===n&&d.attributeOldValue||"characterData"===n&&d.characterDataOldValue)&&(a[p.uid_]=o.oldValue)}}}for(var f in i){var p=i[f],m=new r(n,e);"name"in o&&"namespace"in o&&(m.attributeName=o.name,m.attributeNamespace=o.namespace),o.addedNodes&&(m.addedNodes=o.addedNodes),o.removedNodes&&(m.removedNodes=o.removedNodes),o.previousSibling&&(m.previousSibling=o.previousSibling),o.nextSibling&&(m.nextSibling=o.nextSibling),void 0!==a[f]&&(m.oldValue=a[f]),t(p),p.records_.push(m)}}function s(e){if(this.childList=!!e.childList,this.subtree=!!e.subtree,"attributes"in e||!("attributeOldValue"in e||"attributeFilter"in e)?this.attributes=!!e.attributes:this.attributes=!0,"characterDataOldValue"in e&&!("characterData"in e)?this.characterData=!0:this.characterData=!!e.characterData,!this.attributes&&(e.attributeOldValue||"attributeFilter"in e)||!this.characterData&&e.characterDataOldValue)throw new TypeError;if(this.characterData=!!e.characterData,this.attributeOldValue=!!e.attributeOldValue,this.characterDataOldValue=!!e.characterDataOldValue,"attributeFilter"in e){if(null==e.attributeFilter||"object"!=typeof e.attributeFilter)throw new TypeError;this.attributeFilter=w.call(e.attributeFilter)}else this.attributeFilter=null}function c(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++v,this.scheduled_=!1}function l(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}var u=e.setEndOfMicrotask,d=e.wrapIfNeeded,p=e.wrappers,h=new WeakMap,f=[],m=!1,w=Array.prototype.slice,v=0;c.prototype={constructor:c,observe:function(e,t){e=d(e);var n,r=new s(t),o=h.get(e);o||h.set(e,o=[]);for(var i=0;i<o.length;i++)o[i].observer===this&&(n=o[i],n.removeTransientObservers(),n.options=r);n||(n=new l(this,e,r),o.push(n),this.nodes_.push(e))},disconnect:function(){this.nodes_.forEach(function(e){for(var t=h.get(e),n=0;n<t.length;n++){var r=t[n];if(r.observer===this){t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}},l.prototype={addTransientObserver:function(e){if(e!==this.target){t(this.observer),this.transientObservedNodes.push(e);var n=h.get(e);n||h.set(e,n=[]),n.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[];for(var t=0;t<e.length;t++)for(var n=e[t],r=h.get(n),o=0;o<r.length;o++)if(r[o]===this){r.splice(o,1);break}}},e.enqueueMutation=a,e.registerTransientObservers=o,e.wrappers.MutationObserver=c,e.wrappers.MutationRecord=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){this.root=e,this.parent=t}function n(e,t){if(e.treeScope_!==t){e.treeScope_=t;for(var r=e.shadowRoot;r;r=r.olderShadowRoot)r.treeScope_.parent=t;for(var o=e.firstChild;o;o=o.nextSibling)n(o,t)}}function r(n){if(n instanceof e.wrappers.Window,n.treeScope_)return n.treeScope_;var o,i=n.parentNode;return o=i?r(i):new t(n,null),n.treeScope_=o}t.prototype={get renderer(){return this.root instanceof e.wrappers.ShadowRoot?e.getRendererForHost(this.root.host):null},contains:function(e){for(;e;e=e.parent)if(e===this)return!0;return!1}},e.TreeScope=t,e.getTreeScope=r,e.setTreeScope=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e instanceof G.ShadowRoot}function n(e){return A(e).root}function r(e,r){var s=[],c=e;for(s.push(c);c;){var l=a(c);if(l&&l.length>0){for(var u=0;u<l.length;u++){var p=l[u];if(i(p)){var h=n(p),f=h.olderShadowRoot;f&&s.push(f)}s.push(p)}c=l[l.length-1]}else if(t(c)){if(d(e,c)&&o(r))break;c=c.host,s.push(c)}else c=c.parentNode,c&&s.push(c)}return s}function o(e){if(!e)return!1;switch(e.type){case"abort":case"error":case"select":case"change":case"load":case"reset":case"resize":case"scroll":case"selectstart":return!0}return!1}function i(e){return e instanceof HTMLShadowElement}function a(t){return e.getDestinationInsertionPoints(t)}function s(e,t){if(0===e.length)return t;t instanceof G.Window&&(t=t.document);for(var n=A(t),r=e[0],o=A(r),i=l(n,o),a=0;a<e.length;a++){var s=e[a];if(A(s)===i)return s}return e[e.length-1]}function c(e){for(var t=[];e;e=e.parent)t.push(e);return t}function l(e,t){for(var n=c(e),r=c(t),o=null;n.length>0&&r.length>0;){var i=n.pop(),a=r.pop();if(i!==a)break;o=i}return o}function u(e,t,n){t instanceof G.Window&&(t=t.document);var o,i=A(t),a=A(n),s=r(n,e),o=l(i,a);o||(o=a.root);for(var c=o;c;c=c.parent)for(var u=0;u<s.length;u++){var d=s[u];if(A(d)===c)return d}return null}function d(e,t){return A(e)===A(t)}function p(e){if(!K.get(e)&&(K.set(e,!0),f(V(e),V(e.target)),P)){var t=P;throw P=null,t}}function h(e){switch(e.type){case"load":case"beforeunload":case"unload":return!0}return!1}function f(t,n){if($.get(t))throw new Error("InvalidStateError");$.set(t,!0),e.renderAllPending();var o,i,a;if(h(t)&&!t.bubbles){var s=n;s instanceof G.Document&&(a=s.defaultView)&&(i=s,o=[])}if(!o)if(n instanceof G.Window)a=n,o=[];else if(o=r(n,t),!h(t)){var s=o[o.length-1];s instanceof G.Document&&(a=s.defaultView)}return ne.set(t,o),m(t,o,a,i)&&w(t,o,a,i)&&v(t,o,a,i),J.set(t,re),Y["delete"](t,null),$["delete"](t),t.defaultPrevented}function m(e,t,n,r){var o=oe;if(n&&!g(n,e,o,t,r))return!1;for(var i=t.length-1;i>0;i--)if(!g(t[i],e,o,t,r))return!1;return!0}function w(e,t,n,r){var o=ie,i=t[0]||n;return g(i,e,o,t,r)}function v(e,t,n,r){for(var o=ae,i=1;i<t.length;i++)if(!g(t[i],e,o,t,r))return;n&&t.length>0&&g(n,e,o,t,r)}function g(e,t,n,r,o){var i=z.get(e);if(!i)return!0;var a=o||s(r,e);if(a===e){if(n===oe)return!0;n===ae&&(n=ie)}else if(n===ae&&!t.bubbles)return!0;if("relatedTarget"in t){var c=B(t),l=c.relatedTarget;if(l){if(l instanceof Object&&l.addEventListener){var d=V(l),p=u(t,e,d);if(p===a)return!0}else p=null;Z.set(t,p)}}J.set(t,n);var h=t.type,f=!1;X.set(t,a),Y.set(t,e),i.depth++;for(var m=0,w=i.length;w>m;m++){var v=i[m];if(v.removed)f=!0;else if(!(v.type!==h||!v.capture&&n===oe||v.capture&&n===ae))try{if("function"==typeof v.handler?v.handler.call(e,t):v.handler.handleEvent(t),ee.get(t))return!1}catch(g){P||(P=g)}}if(i.depth--,f&&0===i.depth){var b=i.slice();i.length=0;for(var m=0;m<b.length;m++)b[m].removed||i.push(b[m])}return!Q.get(t)}function b(e,t,n){this.type=e,this.handler=t,this.capture=Boolean(n)}function y(e,t){if(!(e instanceof se))return V(T(se,"Event",e,t));var n=e;return be||"beforeunload"!==n.type||this instanceof M?void U(n,this):new M(n)}function E(e){return e&&e.relatedTarget?Object.create(e,{relatedTarget:{value:B(e.relatedTarget)}}):e}function _(e,t,n){var r=window[e],o=function(t,n){return t instanceof r?void U(t,this):V(T(r,e,t,n))};if(o.prototype=Object.create(t.prototype),n&&W(o.prototype,n),r)try{F(r,o,new r("temp"))}catch(i){F(r,o,document.createEvent(e))}return o}function S(e,t){return function(){arguments[t]=B(arguments[t]);var n=B(this);n[e].apply(n,arguments)}}function T(e,t,n,r){if(ve)return new e(n,E(r));var o=B(document.createEvent(t)),i=we[t],a=[n];return Object.keys(i).forEach(function(e){var t=null!=r&&e in r?r[e]:i[e];"relatedTarget"===e&&(t=B(t)),a.push(t)}),o["init"+t].apply(o,a),o}function M(e){y.call(this,e)}function O(e){return"function"==typeof e?!0:e&&e.handleEvent}function L(e){switch(e){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function N(e){U(e,this)}function C(e){return e instanceof G.ShadowRoot&&(e=e.host),B(e)}function j(e,t){var n=z.get(e);if(n)for(var r=0;r<n.length;r++)if(!n[r].removed&&n[r].type===t)return!0;return!1}function D(e,t){for(var n=B(e);n;n=n.parentNode)if(j(V(n),t))return!0;return!1}function H(e){k(e,Ee)}function x(t,n,o,i){e.renderAllPending();var a=V(_e.call(q(n),o,i));if(!a)return null;var c=r(a,null),l=c.lastIndexOf(t);return-1==l?null:(c=c.slice(0,l),s(c,t))}function R(e){return function(){var t=te.get(this);return t&&t[e]&&t[e].value||null}}function I(e){var t=e.slice(2);return function(n){var r=te.get(this);r||(r=Object.create(null),te.set(this,r));var o=r[e];if(o&&this.removeEventListener(t,o.wrapped,!1),"function"==typeof n){var i=function(t){var r=n.call(this,t);r===!1?t.preventDefault():"onbeforeunload"===e&&"string"==typeof r&&(t.returnValue=r)};this.addEventListener(t,i,!1),r[e]={value:n,wrapped:i}}}}var P,k=e.forwardMethodsToWrapper,A=e.getTreeScope,W=e.mixin,F=e.registerWrapper,U=e.setWrapper,q=e.unsafeUnwrap,B=e.unwrap,V=e.wrap,G=e.wrappers,z=(new WeakMap,new WeakMap),K=new WeakMap,$=new WeakMap,X=new WeakMap,Y=new WeakMap,Z=new WeakMap,J=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,ne=new WeakMap,re=0,oe=1,ie=2,ae=3;b.prototype={equals:function(e){return this.handler===e.handler&&this.type===e.type&&this.capture===e.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var se=window.Event;se.prototype.polymerBlackList_={returnValue:!0,keyLocation:!0},y.prototype={get target(){return X.get(this)},get currentTarget(){return Y.get(this)},get eventPhase(){return J.get(this)},get path(){var e=ne.get(this);return e?e.slice():[]},stopPropagation:function(){Q.set(this,!0)},stopImmediatePropagation:function(){Q.set(this,!0),ee.set(this,!0)}};var ce=function(){var e=document.createEvent("Event");return e.initEvent("test",!0,!0),e.preventDefault(),e.defaultPrevented}();ce||(y.prototype.preventDefault=function(){this.cancelable&&(q(this).preventDefault(),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}),F(se,y,document.createEvent("Event"));var le=_("UIEvent",y),ue=_("CustomEvent",y),de={get relatedTarget(){var e=Z.get(this);return void 0!==e?e:V(B(this).relatedTarget)}},pe=W({initMouseEvent:S("initMouseEvent",14)},de),he=W({initFocusEvent:S("initFocusEvent",5)},de),fe=_("MouseEvent",le,pe),me=_("FocusEvent",le,he),we=Object.create(null),ve=function(){try{new window.FocusEvent("focus")}catch(e){return!1}return!0}();if(!ve){var ge=function(e,t,n){if(n){var r=we[n];t=W(W({},r),t)}we[e]=t};ge("Event",{bubbles:!1,cancelable:!1}),ge("CustomEvent",{detail:null},"Event"),ge("UIEvent",{view:null,detail:0},"Event"),ge("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),ge("FocusEvent",{relatedTarget:null},"UIEvent")}var be=window.BeforeUnloadEvent;M.prototype=Object.create(y.prototype),W(M.prototype,{get returnValue(){return q(this).returnValue},set returnValue(e){q(this).returnValue=e}}),be&&F(be,M);var ye=window.EventTarget,Ee=["addEventListener","removeEventListener","dispatchEvent"];[Node,Window].forEach(function(e){var t=e.prototype;Ee.forEach(function(e){Object.defineProperty(t,e+"_",{value:t[e]})})}),N.prototype={addEventListener:function(e,t,n){if(O(t)&&!L(e)){var r=new b(e,t,n),o=z.get(this);if(o){for(var i=0;i<o.length;i++)if(r.equals(o[i]))return}else o=[],o.depth=0,z.set(this,o);o.push(r);var a=C(this);a.addEventListener_(e,p,!0)}},removeEventListener:function(e,t,n){n=Boolean(n);var r=z.get(this);if(r){for(var o=0,i=!1,a=0;a<r.length;a++)r[a].type===e&&r[a].capture===n&&(o++,r[a].handler===t&&(i=!0,r[a].remove()));if(i&&1===o){var s=C(this);s.removeEventListener_(e,p,!0)}}},dispatchEvent:function(t){var n=B(t),r=n.type;K.set(n,!1),e.renderAllPending();var o;D(this,r)||(o=function(){},this.addEventListener(r,o,!0));try{return B(this).dispatchEvent_(n)}finally{o&&this.removeEventListener(r,o,!0)}}},ye&&F(ye,N);var _e=document.elementFromPoint;e.elementFromPoint=x,e.getEventHandlerGetter=R,e.getEventHandlerSetter=I,e.wrapEventTargetMethods=H,e.wrappers.BeforeUnloadEvent=M,e.wrappers.CustomEvent=ue,e.wrappers.Event=y,e.wrappers.EventTarget=N,e.wrappers.FocusEvent=me,e.wrappers.MouseEvent=fe,e.wrappers.UIEvent=le}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,m)}function n(e){l(e,this)}function r(){this.length=0,t(this,"length")}function o(e){for(var t=new r,o=0;o<e.length;o++)t[o]=new n(e[o]);return t.length=o,t}function i(e){a.call(this,e)}var a=e.wrappers.UIEvent,s=e.mixin,c=e.registerWrapper,l=e.setWrapper,u=e.unsafeUnwrap,d=e.wrap,p=window.TouchEvent;if(p){var h;try{h=document.createEvent("TouchEvent")}catch(f){return}var m={enumerable:!1};n.prototype={get target(){return d(u(this).target)}};var w={configurable:!0,enumerable:!0,get:null};["clientX","clientY","screenX","screenY","pageX","pageY","identifier","webkitRadiusX","webkitRadiusY","webkitRotationAngle","webkitForce"].forEach(function(e){w.get=function(){return u(this)[e]},Object.defineProperty(n.prototype,e,w)}),r.prototype={item:function(e){return this[e]}},i.prototype=Object.create(a.prototype),s(i.prototype,{get touches(){return o(u(this).touches)},get targetTouches(){return o(u(this).targetTouches)},get changedTouches(){return o(u(this).changedTouches)},initTouchEvent:function(){throw new Error("Not implemented")}}),c(p,i,h),e.wrappers.Touch=n,e.wrappers.TouchEvent=i,e.wrappers.TouchList=r}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,s)}function n(){this.length=0,t(this,"length")}function r(e){if(null==e)return e;for(var t=new n,r=0,o=e.length;o>r;r++)t[r]=a(e[r]);return t.length=o,t}function o(e,t){e.prototype[t]=function(){return r(i(this)[t].apply(i(this),arguments))}}var i=e.unsafeUnwrap,a=e.wrap,s={enumerable:!1};n.prototype={item:function(e){return this[e]}},t(n.prototype,"item"),e.wrappers.NodeList=n,e.addWrapNodeListMethod=o,e.wrapNodeList=r}(window.ShadowDOMPolyfill),function(e){"use strict";e.wrapHTMLCollection=e.wrapNodeList,e.wrappers.HTMLCollection=e.wrappers.NodeList}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){O(e instanceof _)}function n(e){var t=new T;return t[0]=e,t.length=1,t}function r(e,t,n){N(t,"childList",{removedNodes:n,previousSibling:e.previousSibling,nextSibling:e.nextSibling})}function o(e,t){N(e,"childList",{removedNodes:t})}function i(e,t,r,o){if(e instanceof DocumentFragment){var i=s(e);U=!0;for(var a=i.length-1;a>=0;a--)e.removeChild(i[a]),i[a].parentNode_=t;U=!1;for(var a=0;a<i.length;a++)i[a].previousSibling_=i[a-1]||r,i[a].nextSibling_=i[a+1]||o;return r&&(r.nextSibling_=i[0]),o&&(o.previousSibling_=i[i.length-1]),i}var i=n(e),c=e.parentNode;return c&&c.removeChild(e),e.parentNode_=t,e.previousSibling_=r,e.nextSibling_=o,r&&(r.nextSibling_=e),o&&(o.previousSibling_=e),i}function a(e){if(e instanceof DocumentFragment)return s(e);var t=n(e),o=e.parentNode;return o&&r(e,o,t),t}function s(e){for(var t=new T,n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t.length=n,o(e,t),t}function c(e){return e}function l(e,t){R(e,t),e.nodeIsInserted_()}function u(e,t){for(var n=C(t),r=0;r<e.length;r++)l(e[r],n)}function d(e){R(e,new M(e,null))}function p(e){for(var t=0;t<e.length;t++)d(e[t])}function h(e,t){var n=e.nodeType===_.DOCUMENT_NODE?e:e.ownerDocument;n!==t.ownerDocument&&n.adoptNode(t)}function f(t,n){if(n.length){var r=t.ownerDocument;if(r!==n[0].ownerDocument)for(var o=0;o<n.length;o++)e.adoptNodeNoRemove(n[o],r)}}function m(e,t){f(e,t);var n=t.length;if(1===n)return P(t[0]);for(var r=P(e.ownerDocument.createDocumentFragment()),o=0;n>o;o++)r.appendChild(P(t[o]));return r}function w(e){if(void 0!==e.firstChild_)for(var t=e.firstChild_;t;){var n=t;t=t.nextSibling_,n.parentNode_=n.previousSibling_=n.nextSibling_=void 0}e.firstChild_=e.lastChild_=void 0}function v(e){if(e.invalidateShadowRenderer()){for(var t=e.firstChild;t;){O(t.parentNode===e);var n=t.nextSibling,r=P(t),o=r.parentNode;o&&X.call(o,r),t.previousSibling_=t.nextSibling_=t.parentNode_=null,t=n}e.firstChild_=e.lastChild_=null}else for(var n,i=P(e),a=i.firstChild;a;)n=a.nextSibling,X.call(i,a),a=n}function g(e){var t=e.parentNode;return t&&t.invalidateShadowRenderer()}function b(e){for(var t,n=0;n<e.length;n++)t=e[n],t.parentNode.removeChild(t)}function y(e,t,n){var r;if(r=A(n?q.call(n,I(e),!1):B.call(I(e),!1)),t){for(var o=e.firstChild;o;o=o.nextSibling)r.appendChild(y(o,!0,n));if(e instanceof F.HTMLTemplateElement)for(var i=r.content,o=e.content.firstChild;o;o=o.nextSibling)i.appendChild(y(o,!0,n))}return r}function E(e,t){if(!t||C(e)!==C(t))return!1;for(var n=t;n;n=n.parentNode)if(n===e)return!0;return!1}function _(e){O(e instanceof V),S.call(this,e),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0,this.treeScope_=void 0}var S=e.wrappers.EventTarget,T=e.wrappers.NodeList,M=e.TreeScope,O=e.assert,L=e.defineWrapGetter,N=e.enqueueMutation,C=e.getTreeScope,j=e.isWrapper,D=e.mixin,H=e.registerTransientObservers,x=e.registerWrapper,R=e.setTreeScope,I=e.unsafeUnwrap,P=e.unwrap,k=e.unwrapIfNeeded,A=e.wrap,W=e.wrapIfNeeded,F=e.wrappers,U=!1,q=document.importNode,B=window.Node.prototype.cloneNode,V=window.Node,G=window.DocumentFragment,z=(V.prototype.appendChild,V.prototype.compareDocumentPosition),K=V.prototype.isEqualNode,$=V.prototype.insertBefore,X=V.prototype.removeChild,Y=V.prototype.replaceChild,Z=/Trident|Edge/.test(navigator.userAgent),J=Z?function(e,t){try{X.call(e,t)}catch(n){if(!(e instanceof G))throw n}}:function(e,t){X.call(e,t)};_.prototype=Object.create(S.prototype),D(_.prototype,{appendChild:function(e){return this.insertBefore(e,null)},insertBefore:function(e,n){t(e);var r;n?j(n)?r=P(n):(r=n,n=A(r)):(n=null,r=null),n&&O(n.parentNode===this);var o,s=n?n.previousSibling:this.lastChild,c=!this.invalidateShadowRenderer()&&!g(e);if(o=c?a(e):i(e,this,s,n),c)h(this,e),w(this),$.call(I(this),P(e),r);else{s||(this.firstChild_=o[0]),n||(this.lastChild_=o[o.length-1],void 0===this.firstChild_&&(this.firstChild_=this.firstChild));var l=r?r.parentNode:I(this);l?$.call(l,m(this,o),r):f(this,o)}return N(this,"childList",{addedNodes:o,nextSibling:n,previousSibling:s}),u(o,this),e},removeChild:function(e){if(t(e),e.parentNode!==this){for(var r=!1,o=(this.childNodes,this.firstChild);o;o=o.nextSibling)if(o===e){r=!0;break}if(!r)throw new Error("NotFoundError")}var i=P(e),a=e.nextSibling,s=e.previousSibling;if(this.invalidateShadowRenderer()){var c=this.firstChild,l=this.lastChild,u=i.parentNode;u&&J(u,i),c===e&&(this.firstChild_=a),l===e&&(this.lastChild_=s),s&&(s.nextSibling_=a),a&&(a.previousSibling_=s),e.previousSibling_=e.nextSibling_=e.parentNode_=void 0}else w(this),J(I(this),i);return U||N(this,"childList",{removedNodes:n(e),nextSibling:a,previousSibling:s}),H(this,e),e},replaceChild:function(e,r){t(e);var o;if(j(r)?o=P(r):(o=r,r=A(o)),r.parentNode!==this)throw new Error("NotFoundError");var s,c=r.nextSibling,l=r.previousSibling,p=!this.invalidateShadowRenderer()&&!g(e);return p?s=a(e):(c===e&&(c=e.nextSibling),s=i(e,this,l,c)),p?(h(this,e),w(this),Y.call(I(this),P(e),o)):(this.firstChild===r&&(this.firstChild_=s[0]),this.lastChild===r&&(this.lastChild_=s[s.length-1]),r.previousSibling_=r.nextSibling_=r.parentNode_=void 0,o.parentNode&&Y.call(o.parentNode,m(this,s),o)),N(this,"childList",{addedNodes:s,removedNodes:n(r),nextSibling:c,previousSibling:l}),d(r),u(s,this),r},nodeIsInserted_:function(){for(var e=this.firstChild;e;e=e.nextSibling)e.nodeIsInserted_()},hasChildNodes:function(){return null!==this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:A(I(this).parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:A(I(this).firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:A(I(this).lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:A(I(this).nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:A(I(this).previousSibling)},get parentElement(){for(var e=this.parentNode;e&&e.nodeType!==_.ELEMENT_NODE;)e=e.parentNode;return e},get textContent(){for(var e="",t=this.firstChild;t;t=t.nextSibling)t.nodeType!=_.COMMENT_NODE&&(e+=t.textContent);return e},set textContent(e){null==e&&(e="");var t=c(this.childNodes);if(this.invalidateShadowRenderer()){if(v(this),""!==e){var n=I(this).ownerDocument.createTextNode(e);this.appendChild(n)}}else w(this),I(this).textContent=e;var r=c(this.childNodes);N(this,"childList",{addedNodes:r,removedNodes:t}),p(t),u(r,this)},get childNodes(){for(var e=new T,t=0,n=this.firstChild;n;n=n.nextSibling)e[t++]=n;return e.length=t,e},cloneNode:function(e){return y(this,e)},contains:function(e){return E(this,W(e))},compareDocumentPosition:function(e){return z.call(I(this),k(e))},isEqualNode:function(e){return K.call(I(this),k(e))},normalize:function(){for(var e,t,n=c(this.childNodes),r=[],o="",i=0;i<n.length;i++)t=n[i],t.nodeType===_.TEXT_NODE?e||t.data.length?e?(o+=t.data,r.push(t)):e=t:this.removeChild(t):(e&&r.length&&(e.data+=o,b(r)),r=[],o="",e=null,t.childNodes.length&&t.normalize());e&&r.length&&(e.data+=o,b(r))}}),L(_,"ownerDocument"),x(V,_,document.createDocumentFragment()),delete _.prototype.querySelector,delete _.prototype.querySelectorAll,_.prototype=D(Object.create(S.prototype),_.prototype),e.cloneNode=y,e.nodeWasAdded=l,e.nodeWasRemoved=d,e.nodesWereAdded=u,e.nodesWereRemoved=p,e.originalInsertBefore=$,e.originalRemoveChild=X,e.snapshotNodeList=c,e.wrappers.Node=_}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t,n,r,o){for(var i=null,a=null,s=0,c=t.length;c>s;s++)i=b(t[s]),!o&&(a=v(i).root)&&a instanceof e.wrappers.ShadowRoot||(r[n++]=i);return n}function n(e){return String(e).replace(/\/deep\/|::shadow|>>>/g," ")}function r(e){return String(e).replace(/:host\(([^\s]+)\)/g,"$1").replace(/([^\s]):host/g,"$1").replace(":host","*").replace(/\^|\/shadow\/|\/shadow-deep\/|::shadow|\/deep\/|::content|>>>/g," ")}function o(e,t){for(var n,r=e.firstElementChild;r;){if(r.matches(t))return r;if(n=o(r,t))return n;r=r.nextElementSibling}return null}function i(e,t){return e.matches(t)}function a(e,t,n){var r=e.localName;return r===t||r===n&&e.namespaceURI===j}function s(){return!0}function c(e,t,n){return e.localName===n}function l(e,t){return e.namespaceURI===t}function u(e,t,n){return e.namespaceURI===t&&e.localName===n}function d(e,t,n,r,o,i){for(var a=e.firstElementChild;a;)r(a,o,i)&&(n[t++]=a),t=d(a,t,n,r,o,i),a=a.nextElementSibling;return t}function p(n,r,o,i,a){var s,c=g(this),l=v(this).root;if(l instanceof e.wrappers.ShadowRoot)return d(this,r,o,n,i,null);if(c instanceof N)s=S.call(c,i);else{if(!(c instanceof C))return d(this,r,o,n,i,null);s=_.call(c,i)}return t(s,r,o,a)}function h(n,r,o,i,a){var s,c=g(this),l=v(this).root;if(l instanceof e.wrappers.ShadowRoot)return d(this,r,o,n,i,a);if(c instanceof N)s=M.call(c,i,a);else{if(!(c instanceof C))return d(this,r,o,n,i,a);s=T.call(c,i,a)}return t(s,r,o,!1)}function f(n,r,o,i,a){var s,c=g(this),l=v(this).root;if(l instanceof e.wrappers.ShadowRoot)return d(this,r,o,n,i,a);if(c instanceof N)s=L.call(c,i,a);else{if(!(c instanceof C))return d(this,r,o,n,i,a);s=O.call(c,i,a)}return t(s,r,o,!1)}var m=e.wrappers.HTMLCollection,w=e.wrappers.NodeList,v=e.getTreeScope,g=e.unsafeUnwrap,b=e.wrap,y=document.querySelector,E=document.documentElement.querySelector,_=document.querySelectorAll,S=document.documentElement.querySelectorAll,T=document.getElementsByTagName,M=document.documentElement.getElementsByTagName,O=document.getElementsByTagNameNS,L=document.documentElement.getElementsByTagNameNS,N=window.Element,C=window.HTMLDocument||window.Document,j="http://www.w3.org/1999/xhtml",D={
12 querySelector:function(t){var r=n(t),i=r!==t;t=r;var a,s=g(this),c=v(this).root;if(c instanceof e.wrappers.ShadowRoot)return o(this,t);if(s instanceof N)a=b(E.call(s,t));else{if(!(s instanceof C))return o(this,t);a=b(y.call(s,t))}return a&&!i&&(c=v(a).root)&&c instanceof e.wrappers.ShadowRoot?o(this,t):a},querySelectorAll:function(e){var t=n(e),r=t!==e;e=t;var o=new w;return o.length=p.call(this,i,0,o,e,r),o}},H={matches:function(t){return t=r(t),e.originalMatches.call(g(this),t)}},x={getElementsByTagName:function(e){var t=new m,n="*"===e?s:a;return t.length=h.call(this,n,0,t,e,e.toLowerCase()),t},getElementsByClassName:function(e){return this.querySelectorAll("."+e)},getElementsByTagNameNS:function(e,t){var n=new m,r=null;return r="*"===e?"*"===t?s:c:"*"===t?l:u,n.length=f.call(this,r,0,n,e||null,t),n}};e.GetElementsByInterface=x,e.SelectorsInterface=D,e.MatchesInterface=H}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;return e}function n(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.previousSibling;return e}var r=e.wrappers.NodeList,o={get firstElementChild(){return t(this.firstChild)},get lastElementChild(){return n(this.lastChild)},get childElementCount(){for(var e=0,t=this.firstElementChild;t;t=t.nextElementSibling)e++;return e},get children(){for(var e=new r,t=0,n=this.firstElementChild;n;n=n.nextElementSibling)e[t++]=n;return e.length=t,e},remove:function(){var e=this.parentNode;e&&e.removeChild(this)}},i={get nextElementSibling(){return t(this.nextSibling)},get previousElementSibling(){return n(this.previousSibling)}},a={getElementById:function(e){return/[ \t\n\r\f]/.test(e)?null:this.querySelector('[id="'+e+'"]')}};e.ChildNodeInterface=i,e.NonElementParentNodeInterface=a,e.ParentNodeInterface=o}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}var n=e.ChildNodeInterface,r=e.wrappers.Node,o=e.enqueueMutation,i=e.mixin,a=e.registerWrapper,s=e.unsafeUnwrap,c=window.CharacterData;t.prototype=Object.create(r.prototype),i(t.prototype,{get nodeValue(){return this.data},set nodeValue(e){this.data=e},get textContent(){return this.data},set textContent(e){this.data=e},get data(){return s(this).data},set data(e){var t=s(this).data;o(this,"characterData",{oldValue:t}),s(this).data=e}}),i(t.prototype,n),a(c,t,document.createTextNode("")),e.wrappers.CharacterData=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e>>>0}function n(e){r.call(this,e)}var r=e.wrappers.CharacterData,o=(e.enqueueMutation,e.mixin),i=e.registerWrapper,a=window.Text;n.prototype=Object.create(r.prototype),o(n.prototype,{splitText:function(e){e=t(e);var n=this.data;if(e>n.length)throw new Error("IndexSizeError");var r=n.slice(0,e),o=n.slice(e);this.data=r;var i=this.ownerDocument.createTextNode(o);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}}),i(a,n,document.createTextNode("")),e.wrappers.Text=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return i(e).getAttribute("class")}function n(e,t){a(e,"attributes",{name:"class",namespace:null,oldValue:t})}function r(t){e.invalidateRendererBasedOnAttribute(t,"class")}function o(e,o,i){var a=e.ownerElement_;if(null==a)return o.apply(e,i);var s=t(a),c=o.apply(e,i);return t(a)!==s&&(n(a,s),r(a)),c}if(!window.DOMTokenList)return void console.warn("Missing DOMTokenList prototype, please include a compatible classList polyfill such as http://goo.gl/uTcepH.");var i=e.unsafeUnwrap,a=e.enqueueMutation,s=DOMTokenList.prototype.add;DOMTokenList.prototype.add=function(){o(this,s,arguments)};var c=DOMTokenList.prototype.remove;DOMTokenList.prototype.remove=function(){o(this,c,arguments)};var l=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(){return o(this,l,arguments)}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t,n){var r=t.parentNode;if(r&&r.shadowRoot){var o=e.getRendererForHost(r);o.dependsOnAttribute(n)&&o.invalidate()}}function n(e,t,n){u(e,"attributes",{name:t,namespace:null,oldValue:n})}function r(e){a.call(this,e)}var o=e.ChildNodeInterface,i=e.GetElementsByInterface,a=e.wrappers.Node,s=e.ParentNodeInterface,c=e.SelectorsInterface,l=e.MatchesInterface,u=(e.addWrapNodeListMethod,e.enqueueMutation),d=e.mixin,p=(e.oneOf,e.registerWrapper),h=e.unsafeUnwrap,f=e.wrappers,m=window.Element,w=["matches","mozMatchesSelector","msMatchesSelector","webkitMatchesSelector"].filter(function(e){return m.prototype[e]}),v=w[0],g=m.prototype[v],b=new WeakMap;r.prototype=Object.create(a.prototype),d(r.prototype,{createShadowRoot:function(){var t=new f.ShadowRoot(this);h(this).polymerShadowRoot_=t;var n=e.getRendererForHost(this);return n.invalidate(),t},get shadowRoot(){return h(this).polymerShadowRoot_||null},setAttribute:function(e,r){var o=h(this).getAttribute(e);h(this).setAttribute(e,r),n(this,e,o),t(this,e)},removeAttribute:function(e){var r=h(this).getAttribute(e);h(this).removeAttribute(e),n(this,e,r),t(this,e)},get classList(){var e=b.get(this);if(!e){if(e=h(this).classList,!e)return;e.ownerElement_=this,b.set(this,e)}return e},get className(){return h(this).className},set className(e){this.setAttribute("class",e)},get id(){return h(this).id},set id(e){this.setAttribute("id",e)}}),w.forEach(function(e){"matches"!==e&&(r.prototype[e]=function(e){return this.matches(e)})}),m.prototype.webkitCreateShadowRoot&&(r.prototype.webkitCreateShadowRoot=r.prototype.createShadowRoot),d(r.prototype,o),d(r.prototype,i),d(r.prototype,s),d(r.prototype,c),d(r.prototype,l),p(m,r,document.createElementNS(null,"x")),e.invalidateRendererBasedOnAttribute=t,e.matchesNames=w,e.originalMatches=g,e.wrappers.Element=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case" ":return"&nbsp;"}}function n(e){return e.replace(L,t)}function r(e){return e.replace(N,t)}function o(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;return t}function i(e){if(e.namespaceURI!==D)return!0;var t=e.ownerDocument.doctype;return t&&t.publicId&&t.systemId}function a(e,t){switch(e.nodeType){case Node.ELEMENT_NODE:for(var o,a=e.tagName.toLowerCase(),c="<"+a,l=e.attributes,u=0;o=l[u];u++)c+=" "+o.name+'="'+n(o.value)+'"';return C[a]?(i(e)&&(c+="/"),c+">"):c+">"+s(e)+"</"+a+">";case Node.TEXT_NODE:var d=e.data;return t&&j[t.localName]?d:r(d);case Node.COMMENT_NODE:return"<!--"+e.data+"-->";default:throw console.error(e),new Error("not implemented")}}function s(e){e instanceof O.HTMLTemplateElement&&(e=e.content);for(var t="",n=e.firstChild;n;n=n.nextSibling)t+=a(n,e);return t}function c(e,t,n){var r=n||"div";e.textContent="";var o=T(e.ownerDocument.createElement(r));o.innerHTML=t;for(var i;i=o.firstChild;)e.appendChild(M(i))}function l(e){m.call(this,e)}function u(e,t){var n=T(e.cloneNode(!1));n.innerHTML=t;for(var r,o=T(document.createDocumentFragment());r=n.firstChild;)o.appendChild(r);return M(o)}function d(t){return function(){return e.renderAllPending(),S(this)[t]}}function p(e){w(l,e,d(e))}function h(t){Object.defineProperty(l.prototype,t,{get:d(t),set:function(n){e.renderAllPending(),S(this)[t]=n},configurable:!0,enumerable:!0})}function f(t){Object.defineProperty(l.prototype,t,{value:function(){return e.renderAllPending(),S(this)[t].apply(S(this),arguments)},configurable:!0,enumerable:!0})}var m=e.wrappers.Element,w=e.defineGetter,v=e.enqueueMutation,g=e.mixin,b=e.nodesWereAdded,y=e.nodesWereRemoved,E=e.registerWrapper,_=e.snapshotNodeList,S=e.unsafeUnwrap,T=e.unwrap,M=e.wrap,O=e.wrappers,L=/[&\u00A0"]/g,N=/[&\u00A0<>]/g,C=o(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),j=o(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]),D="http://www.w3.org/1999/xhtml",H=/MSIE/.test(navigator.userAgent),x=window.HTMLElement,R=window.HTMLTemplateElement;l.prototype=Object.create(m.prototype),g(l.prototype,{get innerHTML(){return s(this)},set innerHTML(e){if(H&&j[this.localName])return void(this.textContent=e);var t=_(this.childNodes);this.invalidateShadowRenderer()?this instanceof O.HTMLTemplateElement?c(this.content,e):c(this,e,this.tagName):!R&&this instanceof O.HTMLTemplateElement?c(this.content,e):S(this).innerHTML=e;var n=_(this.childNodes);v(this,"childList",{addedNodes:n,removedNodes:t}),y(t),b(n,this)},get outerHTML(){return a(this,this.parentNode)},set outerHTML(e){var t=this.parentNode;if(t){t.invalidateShadowRenderer();var n=u(t,e);t.replaceChild(n,this)}},insertAdjacentHTML:function(e,t){var n,r;switch(String(e).toLowerCase()){case"beforebegin":n=this.parentNode,r=this;break;case"afterend":n=this.parentNode,r=this.nextSibling;break;case"afterbegin":n=this,r=this.firstChild;break;case"beforeend":n=this,r=null;break;default:return}var o=u(n,t);n.insertBefore(o,r)},get hidden(){return this.hasAttribute("hidden")},set hidden(e){e?this.setAttribute("hidden",""):this.removeAttribute("hidden")}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollWidth"].forEach(p),["scrollLeft","scrollTop"].forEach(h),["focus","getBoundingClientRect","getClientRects","scrollIntoView"].forEach(f),E(x,l,document.createElement("b")),e.wrappers.HTMLElement=l,e.getInnerHTML=s,e.setInnerHTML=c}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unsafeUnwrap,a=e.wrap,s=window.HTMLCanvasElement;t.prototype=Object.create(n.prototype),r(t.prototype,{getContext:function(){var e=i(this).getContext.apply(i(this),arguments);return e&&a(e)}}),o(s,t,document.createElement("canvas")),e.wrappers.HTMLCanvasElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=window.HTMLContentElement;t.prototype=Object.create(n.prototype),r(t.prototype,{constructor:t,get select(){return this.getAttribute("select")},set select(e){this.setAttribute("select",e)},setAttribute:function(e,t){n.prototype.setAttribute.call(this,e,t),"select"===String(e).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),i&&o(i,t),e.wrappers.HTMLContentElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=window.HTMLFormElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get elements(){return i(a(this).elements)}}),o(s,t,document.createElement("form")),e.wrappers.HTMLFormElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}function n(e,t){if(!(this instanceof n))throw new TypeError("DOM object constructor cannot be called as a function.");var o=i(document.createElement("img"));r.call(this,o),a(o,this),void 0!==e&&(o.width=e),void 0!==t&&(o.height=t)}var r=e.wrappers.HTMLElement,o=e.registerWrapper,i=e.unwrap,a=e.rewrap,s=window.HTMLImageElement;t.prototype=Object.create(r.prototype),o(s,t,document.createElement("img")),n.prototype=t.prototype,e.wrappers.HTMLImageElement=t,e.wrappers.Image=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=(e.mixin,e.wrappers.NodeList,e.registerWrapper),o=window.HTMLShadowElement;t.prototype=Object.create(n.prototype),t.prototype.constructor=t,o&&r(o,t),e.wrappers.HTMLShadowElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){if(!e.defaultView)return e;var t=d.get(e);if(!t){for(t=e.implementation.createHTMLDocument("");t.lastChild;)t.removeChild(t.lastChild);d.set(e,t)}return t}function n(e){for(var n,r=t(e.ownerDocument),o=c(r.createDocumentFragment());n=e.firstChild;)o.appendChild(n);return o}function r(e){if(o.call(this,e),!p){var t=n(e);u.set(this,l(t))}}var o=e.wrappers.HTMLElement,i=e.mixin,a=e.registerWrapper,s=e.unsafeUnwrap,c=e.unwrap,l=e.wrap,u=new WeakMap,d=new WeakMap,p=window.HTMLTemplateElement;r.prototype=Object.create(o.prototype),i(r.prototype,{constructor:r,get content(){return p?l(s(this).content):u.get(this)}}),p&&a(p,r),e.wrappers.HTMLTemplateElement=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.registerWrapper,o=window.HTMLMediaElement;o&&(t.prototype=Object.create(n.prototype),r(o,t,document.createElement("audio")),e.wrappers.HTMLMediaElement=t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}function n(e){if(!(this instanceof n))throw new TypeError("DOM object constructor cannot be called as a function.");var t=i(document.createElement("audio"));r.call(this,t),a(t,this),t.setAttribute("preload","auto"),void 0!==e&&t.setAttribute("src",e)}var r=e.wrappers.HTMLMediaElement,o=e.registerWrapper,i=e.unwrap,a=e.rewrap,s=window.HTMLAudioElement;s&&(t.prototype=Object.create(r.prototype),o(s,t,document.createElement("audio")),n.prototype=t.prototype,e.wrappers.HTMLAudioElement=t,e.wrappers.Audio=n)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e.replace(/\s+/g," ").trim()}function n(e){o.call(this,e)}function r(e,t,n,i){if(!(this instanceof r))throw new TypeError("DOM object constructor cannot be called as a function.");var a=c(document.createElement("option"));o.call(this,a),s(a,this),void 0!==e&&(a.text=e),void 0!==t&&a.setAttribute("value",t),n===!0&&a.setAttribute("selected",""),a.selected=i===!0}var o=e.wrappers.HTMLElement,i=e.mixin,a=e.registerWrapper,s=e.rewrap,c=e.unwrap,l=e.wrap,u=window.HTMLOptionElement;n.prototype=Object.create(o.prototype),i(n.prototype,{get text(){return t(this.textContent)},set text(e){this.textContent=t(String(e))},get form(){return l(c(this).form)}}),a(u,n,document.createElement("option")),r.prototype=n.prototype,e.wrappers.HTMLOptionElement=n,e.wrappers.Option=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unwrap,a=e.wrap,s=window.HTMLSelectElement;t.prototype=Object.create(n.prototype),r(t.prototype,{add:function(e,t){"object"==typeof t&&(t=i(t)),i(this).add(i(e),t)},remove:function(e){return void 0===e?void n.prototype.remove.call(this):("object"==typeof e&&(e=i(e)),void i(this).remove(e))},get form(){return a(i(this).form)}}),o(s,t,document.createElement("select")),e.wrappers.HTMLSelectElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unwrap,a=e.wrap,s=e.wrapHTMLCollection,c=window.HTMLTableElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get caption(){return a(i(this).caption)},createCaption:function(){return a(i(this).createCaption())},get tHead(){return a(i(this).tHead)},createTHead:function(){return a(i(this).createTHead())},createTFoot:function(){return a(i(this).createTFoot())},get tFoot(){return a(i(this).tFoot)},get tBodies(){return s(i(this).tBodies)},createTBody:function(){return a(i(this).createTBody())},get rows(){return s(i(this).rows)},insertRow:function(e){return a(i(this).insertRow(e))}}),o(c,t,document.createElement("table")),e.wrappers.HTMLTableElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=e.wrap,c=window.HTMLTableSectionElement;t.prototype=Object.create(n.prototype),r(t.prototype,{constructor:t,get rows(){return i(a(this).rows)},insertRow:function(e){return s(a(this).insertRow(e))}}),o(c,t,document.createElement("thead")),e.wrappers.HTMLTableSectionElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=e.wrap,c=window.HTMLTableRowElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get cells(){return i(a(this).cells)},insertCell:function(e){return s(a(this).insertCell(e))}}),o(c,t,document.createElement("tr")),e.wrappers.HTMLTableRowElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e.localName){case"content":return new n(e);case"shadow":return new o(e);case"template":return new i(e)}r.call(this,e)}var n=e.wrappers.HTMLContentElement,r=e.wrappers.HTMLElement,o=e.wrappers.HTMLShadowElement,i=e.wrappers.HTMLTemplateElement,a=(e.mixin,e.registerWrapper),s=window.HTMLUnknownElement;t.prototype=Object.create(r.prototype),a(s,t),e.wrappers.HTMLUnknownElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.Element,r=e.wrappers.HTMLElement,o=e.registerWrapper,i=(e.defineWrapGetter,e.unsafeUnwrap),a=e.wrap,s=e.mixin,c="http://www.w3.org/2000/svg",l=window.SVGElement,u=document.createElementNS(c,"title");if(!("classList"in u)){var d=Object.getOwnPropertyDescriptor(n.prototype,"classList");Object.defineProperty(r.prototype,"classList",d),delete n.prototype.classList}t.prototype=Object.create(n.prototype),s(t.prototype,{get ownerSVGElement(){return a(i(this).ownerSVGElement)}}),o(l,t,document.createElementNS(c,"title")),e.wrappers.SVGElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){p.call(this,e)}var n=e.mixin,r=e.registerWrapper,o=e.unwrap,i=e.wrap,a=window.SVGUseElement,s="http://www.w3.org/2000/svg",c=i(document.createElementNS(s,"g")),l=document.createElementNS(s,"use"),u=c.constructor,d=Object.getPrototypeOf(u.prototype),p=d.constructor;t.prototype=Object.create(d),"instanceRoot"in l&&n(t.prototype,{get instanceRoot(){return i(o(this).instanceRoot)},get animatedInstanceRoot(){return i(o(this).animatedInstanceRoot)}}),r(a,t,l),e.wrappers.SVGUseElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.mixin,o=e.registerWrapper,i=e.unsafeUnwrap,a=e.wrap,s=window.SVGElementInstance;s&&(t.prototype=Object.create(n.prototype),r(t.prototype,{get correspondingElement(){return a(i(this).correspondingElement)},get correspondingUseElement(){return a(i(this).correspondingUseElement)},get parentNode(){return a(i(this).parentNode)},get childNodes(){throw new Error("Not implemented")},get firstChild(){return a(i(this).firstChild)},get lastChild(){return a(i(this).lastChild)},get previousSibling(){return a(i(this).previousSibling)},get nextSibling(){return a(i(this).nextSibling)}}),o(s,t),e.wrappers.SVGElementInstance=t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){o(e,this)}var n=e.mixin,r=e.registerWrapper,o=e.setWrapper,i=e.unsafeUnwrap,a=e.unwrap,s=e.unwrapIfNeeded,c=e.wrap,l=window.CanvasRenderingContext2D;n(t.prototype,{get canvas(){return c(i(this).canvas)},drawImage:function(){arguments[0]=s(arguments[0]),i(this).drawImage.apply(i(this),arguments)},createPattern:function(){return arguments[0]=a(arguments[0]),i(this).createPattern.apply(i(this),arguments)}}),r(l,t,document.createElement("canvas").getContext("2d")),e.wrappers.CanvasRenderingContext2D=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){i(e,this)}var n=e.addForwardingProperties,r=e.mixin,o=e.registerWrapper,i=e.setWrapper,a=e.unsafeUnwrap,s=e.unwrapIfNeeded,c=e.wrap,l=window.WebGLRenderingContext;if(l){r(t.prototype,{get canvas(){return c(a(this).canvas)},texImage2D:function(){arguments[5]=s(arguments[5]),a(this).texImage2D.apply(a(this),arguments)},texSubImage2D:function(){arguments[6]=s(arguments[6]),a(this).texSubImage2D.apply(a(this),arguments)}});var u=Object.getPrototypeOf(l.prototype);u!==Object.prototype&&n(u,t.prototype);var d=/WebKit/.test(navigator.userAgent)?{drawingBufferHeight:null,drawingBufferWidth:null}:{};o(l,t,d),e.wrappers.WebGLRenderingContext=t}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.Node,r=e.GetElementsByInterface,o=e.NonElementParentNodeInterface,i=e.ParentNodeInterface,a=e.SelectorsInterface,s=e.mixin,c=e.registerObject,l=e.registerWrapper,u=window.DocumentFragment;t.prototype=Object.create(n.prototype),s(t.prototype,i),s(t.prototype,a),s(t.prototype,r),s(t.prototype,o),l(u,t,document.createDocumentFragment()),e.wrappers.DocumentFragment=t;var d=c(document.createComment(""));e.wrappers.Comment=d}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=d(u(e).ownerDocument.createDocumentFragment());n.call(this,t),c(t,this);var o=e.shadowRoot;f.set(this,o),this.treeScope_=new r(this,a(o||e)),h.set(this,e)}var n=e.wrappers.DocumentFragment,r=e.TreeScope,o=e.elementFromPoint,i=e.getInnerHTML,a=e.getTreeScope,s=e.mixin,c=e.rewrap,l=e.setInnerHTML,u=e.unsafeUnwrap,d=e.unwrap,p=e.wrap,h=new WeakMap,f=new WeakMap;t.prototype=Object.create(n.prototype),s(t.prototype,{constructor:t,get innerHTML(){return i(this)},set innerHTML(e){l(this,e),this.invalidateShadowRenderer()},get olderShadowRoot(){return f.get(this)||null},get host(){return h.get(this)||null},invalidateShadowRenderer:function(){return h.get(this).invalidateShadowRenderer()},elementFromPoint:function(e,t){return o(this,this.ownerDocument,e,t)},getSelection:function(){return document.getSelection()},get activeElement(){var e=d(this).ownerDocument.activeElement;if(!e||!e.nodeType)return null;for(var t=p(e);!this.contains(t);){for(;t.parentNode;)t=t.parentNode;if(!t.host)return null;t=t.host}return t}}),e.wrappers.ShadowRoot=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=d(e).root;return t instanceof h?t.host:null}function n(t,n){if(t.shadowRoot){n=Math.min(t.childNodes.length-1,n);var r=t.childNodes[n];if(r){var o=e.getDestinationInsertionPoints(r);if(o.length>0){var i=o[0].parentNode;i.nodeType==Node.ELEMENT_NODE&&(t=i)}}}return t}function r(e){return e=u(e),t(e)||e}function o(e){a(e,this)}var i=e.registerWrapper,a=e.setWrapper,s=e.unsafeUnwrap,c=e.unwrap,l=e.unwrapIfNeeded,u=e.wrap,d=e.getTreeScope,p=window.Range,h=e.wrappers.ShadowRoot;o.prototype={get startContainer(){return r(s(this).startContainer)},get endContainer(){return r(s(this).endContainer)},get commonAncestorContainer(){return r(s(this).commonAncestorContainer)},setStart:function(e,t){e=n(e,t),s(this).setStart(l(e),t)},setEnd:function(e,t){e=n(e,t),s(this).setEnd(l(e),t)},setStartBefore:function(e){s(this).setStartBefore(l(e))},setStartAfter:function(e){s(this).setStartAfter(l(e))},setEndBefore:function(e){s(this).setEndBefore(l(e))},setEndAfter:function(e){s(this).setEndAfter(l(e))},selectNode:function(e){s(this).selectNode(l(e))},selectNodeContents:function(e){s(this).selectNodeContents(l(e))},compareBoundaryPoints:function(e,t){return s(this).compareBoundaryPoints(e,c(t))},extractContents:function(){return u(s(this).extractContents())},cloneContents:function(){return u(s(this).cloneContents())},insertNode:function(e){s(this).insertNode(l(e))},surroundContents:function(e){s(this).surroundContents(l(e))},cloneRange:function(){return u(s(this).cloneRange())},isPointInRange:function(e,t){return s(this).isPointInRange(l(e),t)},comparePoint:function(e,t){return s(this).comparePoint(l(e),t)},intersectsNode:function(e){return s(this).intersectsNode(l(e))},toString:function(){return s(this).toString()}},p.prototype.createContextualFragment&&(o.prototype.createContextualFragment=function(e){return u(s(this).createContextualFragment(e))}),i(window.Range,o,document.createRange()),e.wrappers.Range=o}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.previousSibling_=e.previousSibling,e.nextSibling_=e.nextSibling,e.parentNode_=e.parentNode}function n(n,o,i){var a=x(n),s=x(o),c=i?x(i):null;if(r(o),t(o),i)n.firstChild===i&&(n.firstChild_=i),i.previousSibling_=i.previousSibling;else{n.lastChild_=n.lastChild,n.lastChild===n.firstChild&&(n.firstChild_=n.firstChild);var l=R(a.lastChild);l&&(l.nextSibling_=l.nextSibling)}e.originalInsertBefore.call(a,s,c)}function r(n){var r=x(n),o=r.parentNode;if(o){var i=R(o);t(n),n.previousSibling&&(n.previousSibling.nextSibling_=n),n.nextSibling&&(n.nextSibling.previousSibling_=n),i.lastChild===n&&(i.lastChild_=n),i.firstChild===n&&(i.firstChild_=n),e.originalRemoveChild.call(o,r)}}function o(e){P.set(e,[])}function i(e){var t=P.get(e);return t||P.set(e,t=[]),t}function a(e){for(var t=[],n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t}function s(){for(var e=0;e<F.length;e++){var t=F[e],n=t.parentRenderer;n&&n.dirty||t.render()}F=[]}function c(){T=null,s()}function l(e){var t=A.get(e);return t||(t=new h(e),A.set(e,t)),t}function u(e){var t=j(e).root;return t instanceof C?t:null}function d(e){return l(e.host)}function p(e){this.skip=!1,this.node=e,this.childNodes=[]}function h(e){this.host=e,this.dirty=!1,this.invalidateAttributes(),this.associateNode(e)}function f(e){for(var t=[],n=e.firstChild;n;n=n.nextSibling)E(n)?t.push.apply(t,i(n)):t.push(n);return t}function m(e){if(e instanceof L)return e;if(e instanceof O)return null;for(var t=e.firstChild;t;t=t.nextSibling){var n=m(t);if(n)return n}return null}function w(e,t){i(t).push(e);var n=k.get(e);n?n.push(t):k.set(e,[t])}function v(e){return k.get(e)}function g(e){k.set(e,void 0)}function b(e,t){var n=t.getAttribute("select");if(!n)return!0;if(n=n.trim(),!n)return!0;if(!(e instanceof M))return!1;if(!q.test(n))return!1;try{return e.matches(n)}catch(r){return!1}}function y(e,t){var n=v(t);return n&&n[n.length-1]===e}function E(e){return e instanceof O||e instanceof L}function _(e){return e.shadowRoot}function S(e){for(var t=[],n=e.shadowRoot;n;n=n.olderShadowRoot)t.push(n);return t}var T,M=e.wrappers.Element,O=e.wrappers.HTMLContentElement,L=e.wrappers.HTMLShadowElement,N=e.wrappers.Node,C=e.wrappers.ShadowRoot,j=(e.assert,e.getTreeScope),D=(e.mixin,e.oneOf),H=e.unsafeUnwrap,x=e.unwrap,R=e.wrap,I=e.ArraySplice,P=new WeakMap,k=new WeakMap,A=new WeakMap,W=D(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),F=[],U=new I;U.equals=function(e,t){return x(e.node)===t},p.prototype={append:function(e){var t=new p(e);return this.childNodes.push(t),t},sync:function(e){if(!this.skip){for(var t=this.node,o=this.childNodes,i=a(x(t)),s=e||new WeakMap,c=U.calculateSplices(o,i),l=0,u=0,d=0,p=0;p<c.length;p++){for(var h=c[p];d<h.index;d++)u++,o[l++].sync(s);for(var f=h.removed.length,m=0;f>m;m++){var w=R(i[u++]);s.get(w)||r(w)}for(var v=h.addedCount,g=i[u]&&R(i[u]),m=0;v>m;m++){var b=o[l++],y=b.node;n(t,y,g),s.set(y,!0),b.sync(s)}d+=v}for(var p=d;p<o.length;p++)o[p].sync(s)}}},h.prototype={render:function(e){if(this.dirty){this.invalidateAttributes();var t=this.host;this.distribution(t);var n=e||new p(t);this.buildRenderTree(n,t);var r=!e;r&&n.sync(),this.dirty=!1}},get parentRenderer(){return j(this.host).renderer},invalidate:function(){if(!this.dirty){this.dirty=!0;var e=this.parentRenderer;if(e&&e.invalidate(),F.push(this),T)return;T=window[W](c,0)}},distribution:function(e){this.resetAllSubtrees(e),this.distributionResolution(e)},resetAll:function(e){E(e)?o(e):g(e),this.resetAllSubtrees(e)},resetAllSubtrees:function(e){for(var t=e.firstChild;t;t=t.nextSibling)this.resetAll(t);e.shadowRoot&&this.resetAll(e.shadowRoot),e.olderShadowRoot&&this.resetAll(e.olderShadowRoot)},distributionResolution:function(e){if(_(e)){for(var t=e,n=f(t),r=S(t),o=0;o<r.length;o++)this.poolDistribution(r[o],n);for(var o=r.length-1;o>=0;o--){var i=r[o],a=m(i);if(a){var s=i.olderShadowRoot;s&&(n=f(s));for(var c=0;c<n.length;c++)w(n[c],a)}this.distributionResolution(i)}}for(var l=e.firstChild;l;l=l.nextSibling)this.distributionResolution(l)},poolDistribution:function(e,t){if(!(e instanceof L))if(e instanceof O){var n=e;this.updateDependentAttributes(n.getAttribute("select"));for(var r=!1,o=0;o<t.length;o++){var e=t[o];e&&b(e,n)&&(w(e,n),t[o]=void 0,r=!0)}if(!r)for(var i=n.firstChild;i;i=i.nextSibling)w(i,n)}else for(var i=e.firstChild;i;i=i.nextSibling)this.poolDistribution(i,t)},buildRenderTree:function(e,t){for(var n=this.compose(t),r=0;r<n.length;r++){var o=n[r],i=e.append(o);this.buildRenderTree(i,o)}if(_(t)){var a=l(t);a.dirty=!1}},compose:function(e){for(var t=[],n=e.shadowRoot||e,r=n.firstChild;r;r=r.nextSibling)if(E(r)){this.associateNode(n);for(var o=i(r),a=0;a<o.length;a++){var s=o[a];y(r,s)&&t.push(s)}}else t.push(r);return t},invalidateAttributes:function(){this.attributes=Object.create(null)},updateDependentAttributes:function(e){if(e){var t=this.attributes;/\.\w+/.test(e)&&(t["class"]=!0),/#\w+/.test(e)&&(t.id=!0),e.replace(/\[\s*([^\s=\|~\]]+)/g,function(e,n){t[n]=!0})}},dependsOnAttribute:function(e){return this.attributes[e]},associateNode:function(e){H(e).polymerShadowRenderer_=this}};var q=/^(:not\()?[*.#[a-zA-Z_|]/;N.prototype.invalidateShadowRenderer=function(e){var t=H(this).polymerShadowRenderer_;return t?(t.invalidate(),!0):!1},O.prototype.getDistributedNodes=L.prototype.getDistributedNodes=function(){return s(),i(this)},M.prototype.getDestinationInsertionPoints=function(){return s(),v(this)||[]},O.prototype.nodeIsInserted_=L.prototype.nodeIsInserted_=function(){this.invalidateShadowRenderer();var e,t=u(this);t&&(e=d(t)),H(this).polymerShadowRenderer_=e,e&&e.invalidate()},e.getRendererForHost=l,e.getShadowTrees=S,e.renderAllPending=s,e.getDestinationInsertionPoints=v,e.visual={insertBefore:n,remove:r}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t){if(window[t]){r(!e.wrappers[t]);var c=function(e){n.call(this,e)};c.prototype=Object.create(n.prototype),o(c.prototype,{get form(){return s(a(this).form)}}),i(window[t],c,document.createElement(t.slice(4,-7))),e.wrappers[t]=c}}var n=e.wrappers.HTMLElement,r=e.assert,o=e.mixin,i=e.registerWrapper,a=e.unwrap,s=e.wrap,c=["HTMLButtonElement","HTMLFieldSetElement","HTMLInputElement","HTMLKeygenElement","HTMLLabelElement","HTMLLegendElement","HTMLObjectElement","HTMLOutputElement","HTMLTextAreaElement"];c.forEach(t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r(e,this)}var n=e.registerWrapper,r=e.setWrapper,o=e.unsafeUnwrap,i=e.unwrap,a=e.unwrapIfNeeded,s=e.wrap,c=window.Selection;t.prototype={get anchorNode(){return s(o(this).anchorNode)},get focusNode(){return s(o(this).focusNode)},addRange:function(e){o(this).addRange(a(e))},collapse:function(e,t){o(this).collapse(a(e),t)},containsNode:function(e,t){return o(this).containsNode(a(e),t)},getRangeAt:function(e){return s(o(this).getRangeAt(e))},removeRange:function(e){o(this).removeRange(i(e))},selectAllChildren:function(e){o(this).selectAllChildren(e instanceof ShadowRoot?o(e.host):a(e))},toString:function(){return o(this).toString()}},c.prototype.extend&&(t.prototype.extend=function(e,t){o(this).extend(a(e),t)}),n(window.Selection,t,window.getSelection()),e.wrappers.Selection=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r(e,this)}var n=e.registerWrapper,r=e.setWrapper,o=e.unsafeUnwrap,i=e.unwrapIfNeeded,a=e.wrap,s=window.TreeWalker;t.prototype={get root(){return a(o(this).root)},get currentNode(){return a(o(this).currentNode)},set currentNode(e){o(this).currentNode=i(e)},get filter(){return o(this).filter},parentNode:function(){return a(o(this).parentNode())},firstChild:function(){return a(o(this).firstChild())},lastChild:function(){return a(o(this).lastChild())},previousSibling:function(){return a(o(this).previousSibling())},previousNode:function(){return a(o(this).previousNode())},nextNode:function(){return a(o(this).nextNode())}},n(s,t),e.wrappers.TreeWalker=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){u.call(this,e),this.treeScope_=new w(this,null)}function n(e){var n=document[e];t.prototype[e]=function(){return j(n.apply(N(this),arguments))}}function r(e,t){x.call(N(t),C(e)),o(e,t)}function o(e,t){e.shadowRoot&&t.adoptNode(e.shadowRoot),e instanceof m&&i(e,t);for(var n=e.firstChild;n;n=n.nextSibling)o(n,t)}function i(e,t){var n=e.olderShadowRoot;n&&t.adoptNode(n)}function a(e){L(e,this)}function s(e,t){var n=document.implementation[t];e.prototype[t]=function(){
13 return j(n.apply(N(this),arguments))}}function c(e,t){var n=document.implementation[t];e.prototype[t]=function(){return n.apply(N(this),arguments)}}var l=e.GetElementsByInterface,u=e.wrappers.Node,d=e.ParentNodeInterface,p=e.NonElementParentNodeInterface,h=e.wrappers.Selection,f=e.SelectorsInterface,m=e.wrappers.ShadowRoot,w=e.TreeScope,v=e.cloneNode,g=e.defineGetter,b=e.defineWrapGetter,y=e.elementFromPoint,E=e.forwardMethodsToWrapper,_=e.matchesNames,S=e.mixin,T=e.registerWrapper,M=e.renderAllPending,O=e.rewrap,L=e.setWrapper,N=e.unsafeUnwrap,C=e.unwrap,j=e.wrap,D=e.wrapEventTargetMethods,H=(e.wrapNodeList,new WeakMap);t.prototype=Object.create(u.prototype),b(t,"documentElement"),b(t,"body"),b(t,"head"),g(t,"activeElement",function(){var e=C(this).activeElement;if(!e||!e.nodeType)return null;for(var t=j(e);!this.contains(t);){for(;t.parentNode;)t=t.parentNode;if(!t.host)return null;t=t.host}return t}),["createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode"].forEach(n);var x=document.adoptNode,R=document.getSelection;S(t.prototype,{adoptNode:function(e){return e.parentNode&&e.parentNode.removeChild(e),r(e,this),e},elementFromPoint:function(e,t){return y(this,this,e,t)},importNode:function(e,t){return v(e,t,N(this))},getSelection:function(){return M(),new h(R.call(C(this)))},getElementsByName:function(e){return f.querySelectorAll.call(this,"[name="+JSON.stringify(String(e))+"]")}});var I=document.createTreeWalker,P=e.wrappers.TreeWalker;if(t.prototype.createTreeWalker=function(e,t,n,r){var o=null;return n&&(n.acceptNode&&"function"==typeof n.acceptNode?o={acceptNode:function(e){return n.acceptNode(j(e))}}:"function"==typeof n&&(o=function(e){return n(j(e))})),new P(I.call(C(this),C(e),t,o,r))},document.registerElement){var k=document.registerElement;t.prototype.registerElement=function(t,n){function r(e){return e?void L(e,this):i?document.createElement(i,t):document.createElement(t)}var o,i;if(void 0!==n&&(o=n.prototype,i=n["extends"]),o||(o=Object.create(HTMLElement.prototype)),e.nativePrototypeTable.get(o))throw new Error("NotSupportedError");for(var a,s=Object.getPrototypeOf(o),c=[];s&&!(a=e.nativePrototypeTable.get(s));)c.push(s),s=Object.getPrototypeOf(s);if(!a)throw new Error("NotSupportedError");for(var l=Object.create(a),u=c.length-1;u>=0;u--)l=Object.create(l);["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"].forEach(function(e){var t=o[e];t&&(l[e]=function(){j(this)instanceof r||O(this),t.apply(j(this),arguments)})});var d={prototype:l};i&&(d["extends"]=i),r.prototype=o,r.prototype.constructor=r,e.constructorTable.set(l,r),e.nativePrototypeTable.set(o,l);k.call(C(this),t,d);return r},E([window.HTMLDocument||window.Document],["registerElement"])}E([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement,window.HTMLHtmlElement],["appendChild","compareDocumentPosition","contains","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),E([window.HTMLBodyElement,window.HTMLHeadElement,window.HTMLHtmlElement],_),E([window.HTMLDocument||window.Document],["adoptNode","importNode","contains","createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode","createTreeWalker","elementFromPoint","getElementById","getElementsByName","getSelection"]),S(t.prototype,l),S(t.prototype,d),S(t.prototype,f),S(t.prototype,p),S(t.prototype,{get implementation(){var e=H.get(this);return e?e:(e=new a(C(this).implementation),H.set(this,e),e)},get defaultView(){return j(C(this).defaultView)}}),T(window.Document,t,document.implementation.createHTMLDocument("")),window.HTMLDocument&&T(window.HTMLDocument,t),D([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]);var A=document.implementation.createDocument;a.prototype.createDocument=function(){return arguments[2]=C(arguments[2]),j(A.apply(N(this),arguments))},s(a,"createDocumentType"),s(a,"createHTMLDocument"),c(a,"hasFeature"),T(window.DOMImplementation,a),E([window.DOMImplementation],["createDocument","createDocumentType","createHTMLDocument","hasFeature"]),e.adoptNodeNoRemove=r,e.wrappers.DOMImplementation=a,e.wrappers.Document=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.wrappers.Selection,o=e.mixin,i=e.registerWrapper,a=e.renderAllPending,s=e.unwrap,c=e.unwrapIfNeeded,l=e.wrap,u=window.Window,d=window.getComputedStyle,p=window.getDefaultComputedStyle,h=window.getSelection;t.prototype=Object.create(n.prototype),u.prototype.getComputedStyle=function(e,t){return l(this||window).getComputedStyle(c(e),t)},p&&(u.prototype.getDefaultComputedStyle=function(e,t){return l(this||window).getDefaultComputedStyle(c(e),t)}),u.prototype.getSelection=function(){return l(this||window).getSelection()},delete window.getComputedStyle,delete window.getDefaultComputedStyle,delete window.getSelection,["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){u.prototype[e]=function(){var t=l(this||window);return t[e].apply(t,arguments)},delete window[e]}),o(t.prototype,{getComputedStyle:function(e,t){return a(),d.call(s(this),c(e),t)},getSelection:function(){return a(),new r(h.call(s(this)))},get document(){return l(s(this).document)}}),p&&(t.prototype.getDefaultComputedStyle=function(e,t){return a(),p.call(s(this),c(e),t)}),i(u,t,window),e.wrappers.Window=t}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.unwrap,n=window.DataTransfer||window.Clipboard,r=n.prototype.setDragImage;r&&(n.prototype.setDragImage=function(e,n,o){r.call(this,t(e),n,o)})}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t;t=e instanceof i?e:new i(e&&o(e)),r(t,this)}var n=e.registerWrapper,r=e.setWrapper,o=e.unwrap,i=window.FormData;i&&(n(i,t,new i),e.wrappers.FormData=t)}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.unwrapIfNeeded,n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(e){return n.call(this,t(e))}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=n[e],r=window[t];if(r){var o=document.createElement(e),i=o.constructor;window[t]=i}}var n=(e.isWrapperFor,{a:"HTMLAnchorElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",base:"HTMLBaseElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",content:"HTMLContentElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",del:"HTMLModElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",head:"HTMLHeadElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",keygen:"HTMLKeygenElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",map:"HTMLMapElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",shadow:"HTMLShadowElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",ul:"HTMLUListElement",video:"HTMLVideoElement"});Object.keys(n).forEach(t),Object.getOwnPropertyNames(e.wrappers).forEach(function(t){window[t]=e.wrappers[t]})}(window.ShadowDOMPolyfill),function(e){function t(e,t){var n="";return Array.prototype.forEach.call(e,function(e){n+=e.textContent+"\n\n"}),t||(n=n.replace(d,"")),n}function n(e){var t=document.createElement("style");return t.textContent=e,t}function r(e){var t=n(e);document.head.appendChild(t);var r=[];if(t.sheet)try{r=t.sheet.cssRules}catch(o){}else console.warn("sheet not found",t);return t.parentNode.removeChild(t),r}function o(){C.initialized=!0,document.body.appendChild(C);var e=C.contentDocument,t=e.createElement("base");t.href=document.baseURI,e.head.appendChild(t)}function i(e){C.initialized||o(),document.body.appendChild(C),e(C.contentDocument),document.body.removeChild(C)}function a(e,t){if(t){var o;if(e.match("@import")&&D){var a=n(e);i(function(e){e.head.appendChild(a.impl),o=Array.prototype.slice.call(a.sheet.cssRules,0),t(o)})}else o=r(e),t(o)}}function s(e){e&&l().appendChild(document.createTextNode(e))}function c(e,t){var r=n(e);r.setAttribute(t,""),r.setAttribute(x,""),document.head.appendChild(r)}function l(){return j||(j=document.createElement("style"),j.setAttribute(x,""),j[x]=!0),j}var u={strictStyling:!1,registry:{},shimStyling:function(e,n,r){var o=this.prepareRoot(e,n,r),i=this.isTypeExtension(r),a=this.makeScopeSelector(n,i),s=t(o,!0);s=this.scopeCssText(s,a),e&&(e.shimmedStyle=s),this.addCssToDocument(s,n)},shimStyle:function(e,t){return this.shimCssText(e.textContent,t)},shimCssText:function(e,t){return e=this.insertDirectives(e),this.scopeCssText(e,t)},makeScopeSelector:function(e,t){return e?t?"[is="+e+"]":e:""},isTypeExtension:function(e){return e&&e.indexOf("-")<0},prepareRoot:function(e,t,n){var r=this.registerRoot(e,t,n);return this.replaceTextInStyles(r.rootStyles,this.insertDirectives),this.removeStyles(e,r.rootStyles),this.strictStyling&&this.applyScopeToContent(e,t),r.scopeStyles},removeStyles:function(e,t){for(var n,r=0,o=t.length;o>r&&(n=t[r]);r++)n.parentNode.removeChild(n)},registerRoot:function(e,t,n){var r=this.registry[t]={root:e,name:t,extendsName:n},o=this.findStyles(e);r.rootStyles=o,r.scopeStyles=r.rootStyles;var i=this.registry[r.extendsName];return i&&(r.scopeStyles=i.scopeStyles.concat(r.scopeStyles)),r},findStyles:function(e){if(!e)return[];var t=e.querySelectorAll("style");return Array.prototype.filter.call(t,function(e){return!e.hasAttribute(R)})},applyScopeToContent:function(e,t){e&&(Array.prototype.forEach.call(e.querySelectorAll("*"),function(e){e.setAttribute(t,"")}),Array.prototype.forEach.call(e.querySelectorAll("template"),function(e){this.applyScopeToContent(e.content,t)},this))},insertDirectives:function(e){return e=this.insertPolyfillDirectivesInCssText(e),this.insertPolyfillRulesInCssText(e)},insertPolyfillDirectivesInCssText:function(e){return e=e.replace(p,function(e,t){return t.slice(0,-2)+"{"}),e.replace(h,function(e,t){return t+" {"})},insertPolyfillRulesInCssText:function(e){return e=e.replace(f,function(e,t){return t.slice(0,-1)}),e.replace(m,function(e,t,n,r){var o=e.replace(t,"").replace(n,"");return r+o})},scopeCssText:function(e,t){var n=this.extractUnscopedRulesFromCssText(e);if(e=this.insertPolyfillHostInCssText(e),e=this.convertColonHost(e),e=this.convertColonHostContext(e),e=this.convertShadowDOMSelectors(e),t){var e,r=this;a(e,function(n){e=r.scopeRules(n,t)})}return e=e+"\n"+n,e.trim()},extractUnscopedRulesFromCssText:function(e){for(var t,n="";t=w.exec(e);)n+=t[1].slice(0,-1)+"\n\n";for(;t=v.exec(e);)n+=t[0].replace(t[2],"").replace(t[1],t[3])+"\n\n";return n},convertColonHost:function(e){return this.convertColonRule(e,E,this.colonHostPartReplacer)},convertColonHostContext:function(e){return this.convertColonRule(e,_,this.colonHostContextPartReplacer)},convertColonRule:function(e,t,n){return e.replace(t,function(e,t,r,o){if(t=O,r){for(var i,a=r.split(","),s=[],c=0,l=a.length;l>c&&(i=a[c]);c++)i=i.trim(),s.push(n(t,i,o));return s.join(",")}return t+o})},colonHostContextPartReplacer:function(e,t,n){return t.match(g)?this.colonHostPartReplacer(e,t,n):e+t+n+", "+t+" "+e+n},colonHostPartReplacer:function(e,t,n){return e+t.replace(g,"")+n},convertShadowDOMSelectors:function(e){for(var t=0;t<N.length;t++)e=e.replace(N[t]," ");return e},scopeRules:function(e,t){var n="";return e&&Array.prototype.forEach.call(e,function(e){if(e.selectorText&&e.style&&void 0!==e.style.cssText)n+=this.scopeSelector(e.selectorText,t,this.strictStyling)+" {\n ",n+=this.propertiesFromRule(e)+"\n}\n\n";else if(e.type===CSSRule.MEDIA_RULE)n+="@media "+e.media.mediaText+" {\n",n+=this.scopeRules(e.cssRules,t),n+="\n}\n\n";else try{e.cssText&&(n+=e.cssText+"\n\n")}catch(r){e.type===CSSRule.KEYFRAMES_RULE&&e.cssRules&&(n+=this.ieSafeCssTextFromKeyFrameRule(e))}},this),n},ieSafeCssTextFromKeyFrameRule:function(e){var t="@keyframes "+e.name+" {";return Array.prototype.forEach.call(e.cssRules,function(e){t+=" "+e.keyText+" {"+e.style.cssText+"}"}),t+=" }"},scopeSelector:function(e,t,n){var r=[],o=e.split(",");return o.forEach(function(e){e=e.trim(),this.selectorNeedsScoping(e,t)&&(e=n&&!e.match(O)?this.applyStrictSelectorScope(e,t):this.applySelectorScope(e,t)),r.push(e)},this),r.join(", ")},selectorNeedsScoping:function(e,t){if(Array.isArray(t))return!0;var n=this.makeScopeMatcher(t);return!e.match(n)},makeScopeMatcher:function(e){return e=e.replace(/\[/g,"\\[").replace(/\]/g,"\\]"),new RegExp("^("+e+")"+S,"m")},applySelectorScope:function(e,t){return Array.isArray(t)?this.applySelectorScopeList(e,t):this.applySimpleSelectorScope(e,t)},applySelectorScopeList:function(e,t){for(var n,r=[],o=0;n=t[o];o++)r.push(this.applySimpleSelectorScope(e,n));return r.join(", ")},applySimpleSelectorScope:function(e,t){return e.match(L)?(e=e.replace(O,t),e.replace(L,t+" ")):t+" "+e},applyStrictSelectorScope:function(e,t){t=t.replace(/\[is=([^\]]*)\]/g,"$1");var n=[" ",">","+","~"],r=e,o="["+t+"]";return n.forEach(function(e){var t=r.split(e);r=t.map(function(e){var t=e.trim().replace(L,"");return t&&n.indexOf(t)<0&&t.indexOf(o)<0&&(e=t.replace(/([^:]*)(:*)(.*)/,"$1"+o+"$2$3")),e}).join(e)}),r},insertPolyfillHostInCssText:function(e){return e.replace(M,b).replace(T,g)},propertiesFromRule:function(e){var t=e.style.cssText;e.style.content&&!e.style.content.match(/['"]+|attr/)&&(t=t.replace(/content:[^;]*;/g,"content: '"+e.style.content+"';"));var n=e.style;for(var r in n)"initial"===n[r]&&(t+=r+": initial; ");return t},replaceTextInStyles:function(e,t){e&&t&&(e instanceof Array||(e=[e]),Array.prototype.forEach.call(e,function(e){e.textContent=t.call(this,e.textContent)},this))},addCssToDocument:function(e,t){e.match("@import")?c(e,t):s(e)}},d=/\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,p=/\/\*\s*@polyfill ([^*]*\*+([^\/*][^*]*\*+)*\/)([^{]*?){/gim,h=/polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,f=/\/\*\s@polyfill-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim,m=/(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,w=/\/\*\s@polyfill-unscoped-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim,v=/(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,g="-shadowcsshost",b="-shadowcsscontext",y=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",E=new RegExp("("+g+y,"gim"),_=new RegExp("("+b+y,"gim"),S="([>\\s~+[.,{:][\\s\\S]*)?$",T=/\:host/gim,M=/\:host-context/gim,O=g+"-no-combinator",L=new RegExp(g,"gim"),N=(new RegExp(b,"gim"),[/>>>/g,/::shadow/g,/::content/g,/\/deep\//g,/\/shadow\//g,/\/shadow-deep\//g,/\^\^/g,/\^/g]),C=document.createElement("iframe");C.style.display="none";var j,D=navigator.userAgent.match("Chrome"),H="shim-shadowdom",x="shim-shadowdom-css",R="no-shim";if(window.ShadowDOMPolyfill){s("style { display: none !important; }\n");var I=ShadowDOMPolyfill.wrap(document),P=I.querySelector("head");P.insertBefore(l(),P.childNodes[0]),document.addEventListener("DOMContentLoaded",function(){e.urlResolver;if(window.HTMLImports&&!HTMLImports.useNative){var t="link[rel=stylesheet]["+H+"]",n="style["+H+"]";HTMLImports.importer.documentPreloadSelectors+=","+t,HTMLImports.importer.importsPreloadSelectors+=","+t,HTMLImports.parser.documentSelectors=[HTMLImports.parser.documentSelectors,t,n].join(",");var r=HTMLImports.parser.parseGeneric;HTMLImports.parser.parseGeneric=function(e){if(!e[x]){var t=e.__importElement||e;if(!t.hasAttribute(H))return void r.call(this,e);e.__resource&&(t=e.ownerDocument.createElement("style"),t.textContent=e.__resource),HTMLImports.path.resolveUrlsInStyle(t,e.href),t.textContent=u.shimStyle(t),t.removeAttribute(H,""),t.setAttribute(x,""),t[x]=!0,t.parentNode!==P&&(e.parentNode===P?P.replaceChild(t,e):this.addElementToDocument(t)),t.__importParsed=!0,this.markParsingComplete(e),this.parseNext()}};var o=HTMLImports.parser.hasResource;HTMLImports.parser.hasResource=function(e){return"link"===e.localName&&"stylesheet"===e.rel&&e.hasAttribute(H)?e.__resource:o.call(this,e)}}})}e.ShadowCSS=u}(window.WebComponents)),function(e){window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}}(window.WebComponents),function(e){"use strict";function t(e){return void 0!==p[e]}function n(){s.call(this),this._isInvalid=!0}function r(e){return""==e&&n.call(this),e.toLowerCase()}function o(e){var t=e.charCodeAt(0);return t>32&&127>t&&-1==[34,35,60,62,63,96].indexOf(t)?e:encodeURIComponent(e)}function i(e){var t=e.charCodeAt(0);return t>32&&127>t&&-1==[34,35,60,62,96].indexOf(t)?e:encodeURIComponent(e)}function a(e,a,s){function c(e){b.push(e)}var l=a||"scheme start",u=0,d="",v=!1,g=!1,b=[];e:for(;(e[u-1]!=f||0==u)&&!this._isInvalid;){var y=e[u];switch(l){case"scheme start":if(!y||!m.test(y)){if(a){c("Invalid scheme.");break e}d="",l="no scheme";continue}d+=y.toLowerCase(),l="scheme";break;case"scheme":if(y&&w.test(y))d+=y.toLowerCase();else{if(":"!=y){if(a){if(f==y)break e;c("Code point not allowed in scheme: "+y);break e}d="",u=0,l="no scheme";continue}if(this._scheme=d,d="",a)break e;t(this._scheme)&&(this._isRelative=!0),l="file"==this._scheme?"relative":this._isRelative&&s&&s._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==y?(this._query="?",l="query"):"#"==y?(this._fragment="#",l="fragment"):f!=y&&" "!=y&&"\n"!=y&&"\r"!=y&&(this._schemeData+=o(y));break;case"no scheme":if(s&&t(s._scheme)){l="relative";continue}c("Missing scheme."),n.call(this);break;case"relative or authority":if("/"!=y||"/"!=e[u+1]){c("Expected /, got: "+y),l="relative";continue}l="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=s._scheme),f==y){this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query=s._query,this._username=s._username,this._password=s._password;break e}if("/"==y||"\\"==y)"\\"==y&&c("\\ is an invalid code point."),l="relative slash";else if("?"==y)this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query="?",this._username=s._username,this._password=s._password,l="query";else{if("#"!=y){var E=e[u+1],_=e[u+2];("file"!=this._scheme||!m.test(y)||":"!=E&&"|"!=E||f!=_&&"/"!=_&&"\\"!=_&&"?"!=_&&"#"!=_)&&(this._host=s._host,this._port=s._port,this._username=s._username,this._password=s._password,this._path=s._path.slice(),this._path.pop()),l="relative path";continue}this._host=s._host,this._port=s._port,this._path=s._path.slice(),this._query=s._query,this._fragment="#",this._username=s._username,this._password=s._password,l="fragment"}break;case"relative slash":if("/"!=y&&"\\"!=y){"file"!=this._scheme&&(this._host=s._host,this._port=s._port,this._username=s._username,this._password=s._password),l="relative path";continue}"\\"==y&&c("\\ is an invalid code point."),l="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=y){c("Expected '/', got: "+y),l="authority ignore slashes";continue}l="authority second slash";break;case"authority second slash":if(l="authority ignore slashes","/"!=y){c("Expected '/', got: "+y);continue}break;case"authority ignore slashes":if("/"!=y&&"\\"!=y){l="authority";continue}c("Expected authority, got: "+y);break;case"authority":if("@"==y){v&&(c("@ already seen."),d+="%40"),v=!0;for(var S=0;S<d.length;S++){var T=d[S];if(" "!=T&&"\n"!=T&&"\r"!=T)if(":"!=T||null!==this._password){var M=o(T);null!==this._password?this._password+=M:this._username+=M}else this._password="";else c("Invalid whitespace in authority.")}d=""}else{if(f==y||"/"==y||"\\"==y||"?"==y||"#"==y){u-=d.length,d="",l="host";continue}d+=y}break;case"file host":if(f==y||"/"==y||"\\"==y||"?"==y||"#"==y){2!=d.length||!m.test(d[0])||":"!=d[1]&&"|"!=d[1]?0==d.length?l="relative path start":(this._host=r.call(this,d),d="",l="relative path start"):l="relative path";continue}" "==y||"\n"==y||"\r"==y?c("Invalid whitespace in file host."):d+=y;break;case"host":case"hostname":if(":"!=y||g){if(f==y||"/"==y||"\\"==y||"?"==y||"#"==y){if(this._host=r.call(this,d),d="",l="relative path start",a)break e;continue}" "!=y&&"\n"!=y&&"\r"!=y?("["==y?g=!0:"]"==y&&(g=!1),d+=y):c("Invalid code point in host/hostname: "+y)}else if(this._host=r.call(this,d),d="",l="port","hostname"==a)break e;break;case"port":if(/[0-9]/.test(y))d+=y;else{if(f==y||"/"==y||"\\"==y||"?"==y||"#"==y||a){if(""!=d){var O=parseInt(d,10);O!=p[this._scheme]&&(this._port=O+""),d=""}if(a)break e;l="relative path start";continue}" "==y||"\n"==y||"\r"==y?c("Invalid code point in port: "+y):n.call(this)}break;case"relative path start":if("\\"==y&&c("'\\' not allowed in path."),l="relative path","/"!=y&&"\\"!=y)continue;break;case"relative path":if(f!=y&&"/"!=y&&"\\"!=y&&(a||"?"!=y&&"#"!=y))" "!=y&&"\n"!=y&&"\r"!=y&&(d+=o(y));else{"\\"==y&&c("\\ not allowed in relative path.");var L;(L=h[d.toLowerCase()])&&(d=L),".."==d?(this._path.pop(),"/"!=y&&"\\"!=y&&this._path.push("")):"."==d&&"/"!=y&&"\\"!=y?this._path.push(""):"."!=d&&("file"==this._scheme&&0==this._path.length&&2==d.length&&m.test(d[0])&&"|"==d[1]&&(d=d[0]+":"),this._path.push(d)),d="","?"==y?(this._query="?",l="query"):"#"==y&&(this._fragment="#",l="fragment")}break;case"query":a||"#"!=y?f!=y&&" "!=y&&"\n"!=y&&"\r"!=y&&(this._query+=i(y)):(this._fragment="#",l="fragment");break;case"fragment":f!=y&&" "!=y&&"\n"!=y&&"\r"!=y&&(this._fragment+=y)}u++}}function s(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function c(e,t){void 0===t||t instanceof c||(t=new c(String(t))),this._url=e,s.call(this);var n=e.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");a.call(this,n,null,t)}var l=!1;if(!e.forceJURL)try{var u=new URL("b","http://a");u.pathname="c%20d",l="http://a/c%20d"===u.href}catch(d){}if(!l){var p=Object.create(null);p.ftp=21,p.file=0,p.gopher=70,p.http=80,p.https=443,p.ws=80,p.wss=443;var h=Object.create(null);h["%2e"]=".",h[".%2e"]="..",h["%2e."]="..",h["%2e%2e"]="..";var f=void 0,m=/[a-zA-Z]/,w=/[a-zA-Z0-9\+\-\.]/;c.prototype={toString:function(){return this.href},get href(){if(this._isInvalid)return this._url;var e="";return""==this._username&&null==this._password||(e=this._username+(null!=this._password?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+e+this.host:"")+this.pathname+this._query+this._fragment},set href(e){s.call(this),a.call(this,e)},get protocol(){return this._scheme+":"},set protocol(e){this._isInvalid||a.call(this,e+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(e){!this._isInvalid&&this._isRelative&&a.call(this,e,"host")},get hostname(){return this._host},set hostname(e){!this._isInvalid&&this._isRelative&&a.call(this,e,"hostname")},get port(){return this._port},set port(e){!this._isInvalid&&this._isRelative&&a.call(this,e,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(e){!this._isInvalid&&this._isRelative&&(this._path=[],a.call(this,e,"relative path start"))},get search(){return this._isInvalid||!this._query||"?"==this._query?"":this._query},set search(e){!this._isInvalid&&this._isRelative&&(this._query="?","?"==e[0]&&(e=e.slice(1)),a.call(this,e,"query"))},get hash(){return this._isInvalid||!this._fragment||"#"==this._fragment?"":this._fragment},set hash(e){this._isInvalid||(this._fragment="#","#"==e[0]&&(e=e.slice(1)),a.call(this,e,"fragment"))},get origin(){var e;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null"}return e=this.host,e?this._scheme+"://"+e:""}};var v=e.URL;v&&(c.createObjectURL=function(e){return v.createObjectURL.apply(v,arguments)},c.revokeObjectURL=function(e){v.revokeObjectURL(e)}),e.URL=c}}(self),function(e){function t(e){y.push(e),b||(b=!0,m(r))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function r(){b=!1;var e=y;y=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();o(e),n.length&&(e.callback_(n,e),t=!0)}),t&&r()}function o(e){e.nodes_.forEach(function(t){var n=w.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var r=w.get(n);if(r)for(var o=0;o<r.length;o++){var i=r[o],a=i.options;if(n===e||a.subtree){var s=t(a);s&&i.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++E}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function c(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function l(e,t){return _=new s(e,t)}function u(e){return S?S:(S=c(_),S.oldValue=e,S)}function d(){_=S=void 0}function p(e){return e===S||e===_}function h(e,t){return e===t?e:S&&p(e)?S:null}function f(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}if(!e.JsMutationObserver){var m,w=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))m=setTimeout;else if(window.setImmediate)m=window.setImmediate;else{var v=[],g=String(Math.random());window.addEventListener("message",function(e){if(e.data===g){var t=v;v=[],t.forEach(function(e){e()})}}),m=function(e){v.push(e),window.postMessage(g,"*")}}var b=!1,y=[],E=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var r=w.get(e);r||w.set(e,r=[]);for(var o,i=0;i<r.length;i++)if(r[i].observer===this){o=r[i],o.removeListeners(),o.options=t;break}o||(o=new f(this,e,t),r.push(o),this.nodes_.push(e)),o.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=w.get(e),n=0;n<t.length;n++){var r=t[n];if(r.observer===this){r.removeListeners(),t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var _,S;f.prototype={enqueue:function(e){var n=this.observer.records_,r=n.length;if(n.length>0){var o=n[r-1],i=h(o,e);if(i)return void(n[r-1]=i)}else t(this.observer);n[r]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=w.get(e);t||w.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=w.get(e),n=0;n<t.length;n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e.relatedNode.namespaceURI,r=e.target,o=new l("attributes",r);o.attributeName=t,o.attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(r,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0:e.attributeOldValue?u(a):o});break;case"DOMCharacterDataModified":var r=e.target,o=l("characterData",r),a=e.prevValue;i(r,function(e){return e.characterData?e.characterDataOldValue?u(a):o:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,c,p=e.target;"DOMNodeInserted"===e.type?(s=[p],c=[]):(s=[],c=[p]);var h=p.previousSibling,f=p.nextSibling,o=l("childList",e.target.parentNode);o.addedNodes=s,o.removedNodes=c,o.previousSibling=h,o.nextSibling=f,i(e.relatedNode,function(e){return e.childList?o:void 0})}d()}},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a,a._isPolyfilled=!0)}}(self),function(e){"use strict";if(!window.performance){var t=Date.now();window.performance={now:function(){return Date.now()-t}}}window.requestAnimationFrame||(window.requestAnimationFrame=function(){var e=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;return e?function(t){return e(function(){t(performance.now())})}:function(e){return window.setTimeout(e,1e3/60)}}()),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(){return window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}}());var n=function(){var e=document.createEvent("Event");return e.initEvent("foo",!0,!0),e.preventDefault(),e.defaultPrevented}();if(!n){var r=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(r.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}var o=/Trident/.test(navigator.userAgent);if((!window.CustomEvent||o&&"function"!=typeof window.CustomEvent)&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),!window.Event||o&&"function"!=typeof window.Event){var i=window.Event;window.Event=function(e,t){t=t||{};var n=document.createEvent("Event");return n.initEvent(e,Boolean(t.bubbles),Boolean(t.cancelable)),n},window.Event.prototype=i.prototype}}(window.WebComponents),window.HTMLImports=window.HTMLImports||{flags:{}},function(e){function t(e,t){t=t||f,r(function(){i(e,t)},t)}function n(e){return"complete"===e.readyState||e.readyState===v}function r(e,t){if(n(t))e&&e();else{var o=function(){"complete"!==t.readyState&&t.readyState!==v||(t.removeEventListener(g,o),r(e,t))};t.addEventListener(g,o)}}function o(e){e.target.__loaded=!0}function i(e,t){function n(){c==l&&e&&e({allImports:s,loadedImports:u,errorImports:d})}function r(e){o(e),u.push(this),c++,n()}function i(e){d.push(this),c++,n()}var s=t.querySelectorAll("link[rel=import]"),c=0,l=s.length,u=[],d=[];
14 if(l)for(var p,h=0;l>h&&(p=s[h]);h++)a(p)?(u.push(this),c++,n()):(p.addEventListener("load",r),p.addEventListener("error",i));else n()}function a(e){return d?e.__loaded||e["import"]&&"loading"!==e["import"].readyState:e.__importParsed}function s(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)c(t)&&l(t)}function c(e){return"link"===e.localName&&"import"===e.rel}function l(e){var t=e["import"];t?o({target:e}):(e.addEventListener("load",o),e.addEventListener("error",o))}var u="import",d=Boolean(u in document.createElement("link")),p=Boolean(window.ShadowDOMPolyfill),h=function(e){return p?window.ShadowDOMPolyfill.wrapIfNeeded(e):e},f=h(document),m={get:function(){var e=window.HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return h(e)},configurable:!0};Object.defineProperty(document,"_currentScript",m),Object.defineProperty(f,"_currentScript",m);var w=/Trident/.test(navigator.userAgent),v=w?"complete":"interactive",g="readystatechange";d&&(new MutationObserver(function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),n=0,r=t.length;r>n&&(e=t[n]);n++)l(e)}()),t(function(e){window.HTMLImports.ready=!0,window.HTMLImports.readyTime=(new Date).getTime();var t=f.createEvent("CustomEvent");t.initCustomEvent("HTMLImportsLoaded",!0,!0,e),f.dispatchEvent(t)}),e.IMPORT_LINK_TYPE=u,e.useNative=d,e.rootDocument=f,e.whenReady=t,e.isIE=w}(window.HTMLImports),function(e){var t=[],n=function(e){t.push(e)},r=function(){t.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=r}(window.HTMLImports),window.HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,n=/(@import[\s]+(?!url\())([^;]*)(;)/g,r={resolveUrlsInStyle:function(e,t){var n=e.ownerDocument,r=n.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,t,r),e},resolveUrlsInCssText:function(e,r,o){var i=this.replaceUrls(e,o,r,t);return i=this.replaceUrls(i,o,r,n)},replaceUrls:function(e,t,n,r){return e.replace(r,function(e,r,o,i){var a=o.replace(/["']/g,"");return n&&(a=new URL(a,n).href),t.href=a,a=t.href,r+"'"+a+"'"+i})}};e.path=r}),window.HTMLImports.addModule(function(e){var t={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(n,r,o){var i=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(n+="?"+Math.random()),i.open("GET",n,t.async),i.addEventListener("readystatechange",function(e){if(4===i.readyState){var n=null;try{var a=i.getResponseHeader("Location");a&&(n="/"===a.substr(0,1)?location.origin+a:a)}catch(e){console.error(e.message)}r.call(o,!t.ok(i)&&i,i.response||i.responseText,n)}}),i.send(),i},loadDocument:function(e,t,n){this.load(e,t,n).responseType="document"}};e.xhr=t}),window.HTMLImports.addModule(function(e){var t=e.xhr,n=e.flags,r=function(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};r.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,r){if(n.load&&console.log("fetch",e,r),e)if(e.match(/^data:/)){var o=e.split(","),i=o[0],a=o[1];a=i.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,r,null,a)}.bind(this),0)}else{var s=function(t,n,o){this.receive(e,r,t,n,o)}.bind(this);t.load(e,s)}else setTimeout(function(){this.receive(e,r,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,n,r,o){this.cache[e]=r;for(var i,a=this.pending[e],s=0,c=a.length;c>s&&(i=a[s]);s++)this.onload(e,i,r,n,o),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=r}),window.HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),window.HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===u}function n(e){var t=r(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function r(e){return e.textContent+o(e)}function o(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var n=e.ownerDocument.baseURI,r=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+n+r+".js\n"}function i(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,c=e.flags,l=e.isIE,u=e.IMPORT_LINK_TYPE,d="link[rel="+u+"]",p={documentSelectors:d,importsSelectors:[d,"link[rel=stylesheet]:not([type])","style:not([type])","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(c.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){c.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,c.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(e["import"]=e.__doc,window.HTMLImports.__importsParsingHook&&window.HTMLImports.__importsParsingHook(e),e["import"]&&(e["import"].__importParsed=!0),this.markParsingComplete(e),e.__resource&&!e.__error?e.dispatchEvent(new CustomEvent("load",{bubbles:!1})):e.dispatchEvent(new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=i(e),t.__appliedElement=e,e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(e,t){var n=this,r=function(o){e.removeEventListener("load",r),e.removeEventListener("error",r),t&&t(o),n.markParsingComplete(e),n.parseNext()};if(e.addEventListener("load",r),e.addEventListener("error",r),l&&"style"===e.localName){var o=!1;if(-1==e.textContent.indexOf("@import"))o=!0;else if(e.sheet){o=!0;for(var i,a=e.sheet.cssRules,s=a?a.length:0,c=0;s>c&&(i=a[c]);c++)i.type===CSSRule.IMPORT_RULE&&(o=o&&Boolean(i.styleSheet))}o&&setTimeout(function(){e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(t){var r=document.createElement("script");r.__importElement=t,r.src=t.src?t.src:n(t),e.currentScript=t,this.trackElement(r,function(t){r.parentNode&&r.parentNode.removeChild(r),e.currentScript=null}),this.addElementToDocument(r)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,n){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var r,o=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,a=o.length;a>i&&(r=o[i]);i++)if(!this.isParsed(r))return this.hasResource(r)?t(r)?this.nextToParseInDoc(r.__doc,r):r:void 0}return n},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return!t(e)||void 0!==e.__doc}};e.parser=p,e.IMPORT_SELECTOR=d}),window.HTMLImports.addModule(function(e){function t(e){return n(e,a)}function n(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function r(e){return!!Object.getOwnPropertyDescriptor(e,"baseURI")}function o(e,t){var n=document.implementation.createHTMLDocument(a);n._URL=t;var o=n.createElement("base");o.setAttribute("href",t),n.baseURI||r(n)||Object.defineProperty(n,"baseURI",{value:t});var i=n.createElement("meta");return i.setAttribute("charset","utf-8"),n.head.appendChild(i),n.head.appendChild(o),n.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}var i=e.flags,a=e.IMPORT_LINK_TYPE,s=e.IMPORT_SELECTOR,c=e.rootDocument,l=e.Loader,u=e.Observer,d=e.parser,p={documents:{},documentPreloadSelectors:s,importsPreloadSelectors:[s].join(","),loadNode:function(e){h.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);h.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===c?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,n,r,a,s){if(i.load&&console.log("loaded",e,n),n.__resource=r,n.__error=a,t(n)){var c=this.documents[e];void 0===c&&(c=a?null:o(r,s||e),c&&(c.__importLink=n,this.bootDocument(c)),this.documents[e]=c),n.__doc=c}d.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),d.parseNext()},loadedAll:function(){d.parseNext()}},h=new l(p.loaded.bind(p),p.loadedAll.bind(p));if(p.observer=new u,!document.baseURI){var f={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",f),Object.defineProperty(c,"baseURI",f)}e.importer=p,e.importLoader=h}),window.HTMLImports.addModule(function(e){var t=e.parser,n=e.importer,r={added:function(e){for(var r,o,i,a,s=0,c=e.length;c>s&&(a=e[s]);s++)r||(r=a.ownerDocument,o=t.isParsed(r)),i=this.shouldLoadNode(a),i&&n.loadNode(a),this.shouldParseNode(a)&&o&&t.parseDynamic(a,i)},shouldLoadNode:function(e){return 1===e.nodeType&&o.call(e,n.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&o.call(e,t.parseSelectorsForNode(e))}};n.observer.addCallback=r.added.bind(r);var o=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){window.HTMLImports.importer.bootDocument(r)}var n=e.initializeModules;e.isIE;if(!e.useNative){n();var r=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(window.HTMLImports),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[],r=function(e){n.push(e)},o=function(){n.forEach(function(t){t(e)})};e.addModule=r,e.initializeModules=o,e.hasNative=Boolean(document.registerElement),e.isIE=/Trident/.test(navigator.userAgent),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative)}(window.CustomElements),window.CustomElements.addModule(function(e){function t(e,t){n(e,function(e){return t(e)?!0:void r(e,t)}),r(e,t)}function n(e,t,r){var o=e.firstElementChild;if(!o)for(o=e.firstChild;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.nextSibling;for(;o;)t(o,r)!==!0&&n(o,t,r),o=o.nextElementSibling;return null}function r(e,n){for(var r=e.shadowRoot;r;)t(r,n),r=r.olderShadowRoot}function o(e,t){i(e,t,[])}function i(e,t,n){if(e=window.wrap(e),!(n.indexOf(e)>=0)){n.push(e);for(var r,o=e.querySelectorAll("link[rel="+a+"]"),s=0,c=o.length;c>s&&(r=o[s]);s++)r["import"]&&i(r["import"],t,n);t(e)}}var a=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=o,e.forSubtree=t}),window.CustomElements.addModule(function(e){function t(e,t){return n(e,t)||r(e,t)}function n(t,n){return e.upgrade(t,n)?!0:void(n&&a(t))}function r(e,t){b(e,function(e){return n(e,t)?!0:void 0})}function o(e){S.push(e),_||(_=!0,setTimeout(i))}function i(){_=!1;for(var e,t=S,n=0,r=t.length;r>n&&(e=t[n]);n++)e();S=[]}function a(e){E?o(function(){s(e)}):s(e)}function s(e){e.__upgraded__&&!e.__attached&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function c(e){l(e),b(e,function(e){l(e)})}function l(e){E?o(function(){u(e)}):u(e)}function u(e){e.__upgraded__&&e.__attached&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function d(e){for(var t=e,n=window.wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host}}function p(e){if(e.shadowRoot&&!e.shadowRoot.__watched){g.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)m(t),t=t.olderShadowRoot}}function h(e,n){if(g.dom){var r=n[0];if(r&&"childList"===r.type&&r.addedNodes&&r.addedNodes){for(var o=r.addedNodes[0];o&&o!==document&&!o.host;)o=o.parentNode;var i=o&&(o.URL||o._URL||o.host&&o.host.localName)||"";i=i.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,i||"")}var a=d(e);n.forEach(function(e){"childList"===e.type&&(T(e.addedNodes,function(e){e.localName&&t(e,a)}),T(e.removedNodes,function(e){e.localName&&c(e)}))}),g.dom&&console.groupEnd()}function f(e){for(e=window.wrap(e),e||(e=window.wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(h(e,t.takeRecords()),i())}function m(e){if(!e.__observer){var t=new MutationObserver(h.bind(this,e));t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function w(e){e=window.wrap(e),g.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop());var n=e===window.wrap(document);t(e,n),m(e),g.dom&&console.groupEnd()}function v(e){y(e,w)}var g=e.flags,b=e.forSubtree,y=e.forDocumentTree,E=window.MutationObserver._isPolyfilled&&g["throttle-attached"];e.hasPolyfillMutations=E,e.hasThrottledAttached=E;var _=!1,S=[],T=Array.prototype.forEach.call.bind(Array.prototype.forEach),M=Element.prototype.createShadowRoot;M&&(Element.prototype.createShadowRoot=function(){var e=M.call(this);return window.CustomElements.watchShadow(this),e}),e.watchShadow=p,e.upgradeDocumentTree=v,e.upgradeDocument=w,e.upgradeSubtree=r,e.upgradeAll=t,e.attached=a,e.takeRecords=f}),window.CustomElements.addModule(function(e){function t(t,r){if("template"===t.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(t),!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var o=t.getAttribute("is"),i=e.getRegisteredDefinition(t.localName)||e.getRegisteredDefinition(o);if(i&&(o&&i.tag==t.localName||!o&&!i["extends"]))return n(t,i,r)}}function n(t,n,o){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAttribute("is",n.is),r(t,n),t.__upgraded__=!0,i(t),o&&e.attached(t),e.upgradeSubtree(t,o),a.upgrade&&console.groupEnd(),t}function r(e,t){Object.__proto__?e.__proto__=t.prototype:(o(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function o(e,t,n){for(var r={},o=t;o!==n&&o!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(o),s=0;i=a[s];s++)r[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(o,i)),r[i]=1);o=Object.getPrototypeOf(o)}}function i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=n,e.implementPrototype=r}),window.CustomElements.addModule(function(e){function t(t,r){var c=r||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(o(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(l(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return c.prototype||(c.prototype=Object.create(HTMLElement.prototype)),c.__name=t.toLowerCase(),c["extends"]&&(c["extends"]=c["extends"].toLowerCase()),c.lifecycle=c.lifecycle||{},c.ancestry=i(c["extends"]),a(c),s(c),n(c.prototype),u(c.__name,c),c.ctor=d(c),c.ctor.prototype=c.prototype,c.prototype.constructor=c.ctor,e.ready&&w(document),c.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){r.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){r.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function r(e,t,n){e=e.toLowerCase();var r=this.getAttribute(e);n.apply(this,arguments);var o=this.getAttribute(e);this.attributeChangedCallback&&o!==r&&this.attributeChangedCallback(e,r,o)}function o(e){for(var t=0;t<E.length;t++)if(e===E[t])return!0}function i(e){var t=l(e);return t?i(t["extends"]).concat([t]):[]}function a(e){for(var t,n=e["extends"],r=0;t=e.ancestry[r];r++)n=t.is&&t.tag;e.tag=n||e.__name,n&&(e.is=e.__name)}function s(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag);t=Object.getPrototypeOf(n)}for(var r,o=e.prototype,i=!1;o;)o==t&&(i=!0),r=Object.getPrototypeOf(o),r&&(o.__proto__=r),o=r;i||console.warn(e.tag+" prototype not found in prototype chain for "+e.is),e["native"]=t}}function c(e){return g(T(e.tag),e)}function l(e){return e?_[e.toLowerCase()]:void 0}function u(e,t){_[e]=t}function d(e){return function(){return c(e)}}function p(e,t,n){return e===S?h(t,n):M(e,t)}function h(e,t){e&&(e=e.toLowerCase()),t&&(t=t.toLowerCase());var n=l(t||e);if(n){if(e==n.tag&&t==n.is)return new n.ctor;if(!t&&!n.is)return new n.ctor}var r;return t?(r=h(e),r.setAttribute("is",t),r):(r=T(e),e.indexOf("-")>=0&&b(r,HTMLElement),r)}function f(e,t){var n=e[t];e[t]=function(){var e=n.apply(this,arguments);return v(e),e}}var m,w=(e.isIE,e.upgradeDocumentTree),v=e.upgradeAll,g=e.upgradeWithDefinition,b=e.implementPrototype,y=e.useNative,E=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],_={},S="http://www.w3.org/1999/xhtml",T=document.createElement.bind(document),M=document.createElementNS.bind(document);m=Object.__proto__||y?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},f(Node.prototype,"cloneNode"),f(document,"importNode"),document.registerElement=t,document.createElement=h,document.createElementNS=p,e.registry=_,e["instanceof"]=m,e.reservedTagList=E,e.getRegisteredDefinition=l,document.register=document.registerElement}),function(e){function t(){i(window.wrap(document)),window.CustomElements.ready=!0;var e=window.requestAnimationFrame||function(e){setTimeout(e,16)};e(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var n=e.useNative,r=e.initializeModules;e.isIE;if(n){var o=function(){};e.watchShadow=o,e.upgrade=o,e.upgradeAll=o,e.upgradeDocumentTree=o,e.upgradeSubtree=o,e.takeRecords=o,e["instanceof"]=function(e,t){return e instanceof t}}else r();var i=e.upgradeDocumentTree,a=e.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(e){e["import"]&&a(wrap(e["import"]))}),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var s=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(s,t)}else t()}(window.CustomElements),function(e){Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice.call(arguments,1);return function(){var r=n.slice();return r.push.apply(r,arguments),t.apply(e,r)}})}(window.WebComponents),function(e){var t=document.createElement("style");t.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var n=document.querySelector("head");n.insertBefore(t,n.firstChild)}(window.WebComponents),function(e){window.Platform=e}(window.WebComponents); No newline at end of file
@@ -0,0 +1,66 b''
1 ## -*- coding: utf-8 -*-
2 <%inherit file="base.html"/>
3 <%namespace name="widgets" file="/widgets.html"/>
4
5 <%def name="breadcrumbs_links()">
6 %if c.repo:
7 ${h.link_to('Settings',h.url('edit_repo', repo_name=c.repo.repo_name))}
8 &raquo;
9 ${h.link_to(_('Integrations'),request.route_url(route_name='repo_integrations_home', repo_name=c.repo.repo_name))}
10 %elif c.repo_group:
11 ${h.link_to(_('Admin'),h.url('admin_home'))}
12 &raquo;
13 ${h.link_to(_('Repository Groups'),h.url('repo_groups'))}
14 &raquo;
15 ${h.link_to(c.repo_group.group_name,h.url('edit_repo_group', group_name=c.repo_group.group_name))}
16 &raquo;
17 ${h.link_to(_('Integrations'),request.route_url(route_name='repo_group_integrations_home', repo_group_name=c.repo_group.group_name))}
18 %else:
19 ${h.link_to(_('Admin'),h.url('admin_home'))}
20 &raquo;
21 ${h.link_to(_('Settings'),h.url('admin_settings'))}
22 &raquo;
23 ${h.link_to(_('Integrations'),request.route_url(route_name='global_integrations_home'))}
24 %endif
25 &raquo;
26 ${_('Create new integration')}
27 </%def>
28 <%widgets:panel class_='integrations'>
29 <%def name="title()">
30 %if c.repo:
31 ${_('Create New Integration for repository: {repo_name}').format(repo_name=c.repo.repo_name)}
32 %elif c.repo_group:
33 ${_('Create New Integration for repository group: {repo_group_name}').format(repo_group_name=c.repo_group.group_name)}
34 %else:
35 ${_('Create New Global Integration')}
36 %endif
37 </%def>
38
39 %for integration, IntegrationType in available_integrations.items():
40 <%
41 if c.repo:
42 create_url = request.route_path('repo_integrations_create',
43 repo_name=c.repo.repo_name,
44 integration=integration)
45 elif c.repo_group:
46 create_url = request.route_path('repo_group_integrations_create',
47 repo_group_name=c.repo_group.group_name,
48 integration=integration)
49 else:
50 create_url = request.route_path('global_integrations_create',
51 integration=integration)
52 %>
53 <a href="${create_url}" class="integration-box">
54 <%widgets:panel>
55 <h2>
56 <div class="integration-icon">
57 ${IntegrationType.icon|n}
58 </div>
59 ${IntegrationType.display_name}
60 </h2>
61 ${IntegrationType.description or _('No description available')}
62 </%widgets:panel>
63 </a>
64 %endfor
65 <div style="clear:both"></div>
66 </%widgets:panel>
@@ -0,0 +1,28 b''
1 <div i18n:domain="deform" tal:omit-tag=""
2 tal:define="oid oid|field.oid;
3 name name|field.name;
4 css_class css_class|field.widget.css_class;
5 style style|field.widget.style">
6 ${field.start_mapping()}
7 <div class="form-group">
8 <input type="password"
9 name="${name}"
10 value="${field.widget.redisplay and cstruct or ''}"
11 tal:attributes="class string: form-control ${css_class or ''};
12 style style;"
13 id="${oid}"
14 i18n:attributes="placeholder"
15 placeholder="Password"/>
16 </div>
17 <div class="form-group">
18 <input type="password"
19 name="${name}-confirm"
20 value="${field.widget.redisplay and confirm or ''}"
21 tal:attributes="class string: form-control ${css_class or ''};
22 style style;"
23 id="${oid}-confirm"
24 i18n:attributes="placeholder"
25 placeholder="Confirm Password"/>
26 </div>
27 ${field.end_mapping()}
28 </div> No newline at end of file
@@ -0,0 +1,4 b''
1 <div class="form-control readonly"
2 id="${oid|field.oid}">
3 ${cstruct}
4 </div>
@@ -0,0 +1,18 b''
1 <%def name="panel(title='', category='default', class_='')">
2 <div class="panel panel-${category} ${class_}">
3 %if title or hasattr(caller, 'title'):
4 <div class="panel-heading">
5 <h3 class="panel-title">
6 %if title:
7 ${title}
8 %else:
9 ${caller.title()}
10 %endif
11 </h3>
12 </div>
13 %endif
14 <div class="panel-body">
15 ${caller.body()}
16 </div>
17 </div>
18 </%def>
@@ -0,0 +1,264 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import mock
22 import pytest
23 from webob.exc import HTTPNotFound
24
25 import rhodecode
26 from rhodecode.model.db import Integration
27 from rhodecode.model.meta import Session
28 from rhodecode.tests import assert_session_flash, url, TEST_USER_ADMIN_LOGIN
29 from rhodecode.tests.utils import AssertResponse
30 from rhodecode.integrations import integration_type_registry
31 from rhodecode.config.routing import ADMIN_PREFIX
32
33
34 @pytest.mark.usefixtures('app', 'autologin_user')
35 class TestIntegrationsView(object):
36 pass
37
38
39 class TestGlobalIntegrationsView(TestIntegrationsView):
40 def test_index_no_integrations(self, app):
41 url = ADMIN_PREFIX + '/integrations'
42 response = app.get(url)
43
44 assert response.status_code == 200
45 assert 'exist yet' in response.body
46
47 def test_index_with_integrations(self, app, global_integration_stub):
48 url = ADMIN_PREFIX + '/integrations'
49 response = app.get(url)
50
51 assert response.status_code == 200
52 assert 'exist yet' not in response.body
53 assert global_integration_stub.name in response.body
54
55 def test_new_integration_page(self, app):
56 url = ADMIN_PREFIX + '/integrations/new'
57
58 response = app.get(url)
59
60 assert response.status_code == 200
61
62 for integration_key in integration_type_registry:
63 nurl = (ADMIN_PREFIX + '/integrations/{integration}/new').format(
64 integration=integration_key)
65 assert nurl in response.body
66
67 @pytest.mark.parametrize(
68 'IntegrationType', integration_type_registry.values())
69 def test_get_create_integration_page(self, app, IntegrationType):
70 url = ADMIN_PREFIX + '/integrations/{integration_key}/new'.format(
71 integration_key=IntegrationType.key)
72
73 response = app.get(url)
74
75 assert response.status_code == 200
76 assert IntegrationType.display_name in response.body
77
78 def test_post_integration_page(self, app, StubIntegrationType, csrf_token,
79 test_repo_group, backend_random):
80 url = ADMIN_PREFIX + '/integrations/{integration_key}/new'.format(
81 integration_key=StubIntegrationType.key)
82
83 _post_integration_test_helper(app, url, csrf_token, admin_view=True,
84 repo=backend_random.repo, repo_group=test_repo_group)
85
86
87 class TestRepoGroupIntegrationsView(TestIntegrationsView):
88 def test_index_no_integrations(self, app, test_repo_group):
89 url = '/{repo_group_name}/settings/integrations'.format(
90 repo_group_name=test_repo_group.group_name)
91 response = app.get(url)
92
93 assert response.status_code == 200
94 assert 'exist yet' in response.body
95
96 def test_index_with_integrations(self, app, test_repo_group,
97 repogroup_integration_stub):
98 url = '/{repo_group_name}/settings/integrations'.format(
99 repo_group_name=test_repo_group.group_name)
100
101 stub_name = repogroup_integration_stub.name
102 response = app.get(url)
103
104 assert response.status_code == 200
105 assert 'exist yet' not in response.body
106 assert stub_name in response.body
107
108 def test_new_integration_page(self, app, test_repo_group):
109 repo_group_name = test_repo_group.group_name
110 url = '/{repo_group_name}/settings/integrations/new'.format(
111 repo_group_name=test_repo_group.group_name)
112
113 response = app.get(url)
114
115 assert response.status_code == 200
116
117 for integration_key in integration_type_registry:
118 nurl = ('/{repo_group_name}/settings/integrations'
119 '/{integration}/new').format(
120 repo_group_name=repo_group_name,
121 integration=integration_key)
122
123 assert nurl in response.body
124
125 @pytest.mark.parametrize(
126 'IntegrationType', integration_type_registry.values())
127 def test_get_create_integration_page(self, app, test_repo_group,
128 IntegrationType):
129 repo_group_name = test_repo_group.group_name
130 url = ('/{repo_group_name}/settings/integrations/{integration_key}/new'
131 ).format(repo_group_name=repo_group_name,
132 integration_key=IntegrationType.key)
133
134 response = app.get(url)
135
136 assert response.status_code == 200
137 assert IntegrationType.display_name in response.body
138
139 def test_post_integration_page(self, app, test_repo_group, backend_random,
140 StubIntegrationType, csrf_token):
141 repo_group_name = test_repo_group.group_name
142 url = ('/{repo_group_name}/settings/integrations/{integration_key}/new'
143 ).format(repo_group_name=repo_group_name,
144 integration_key=StubIntegrationType.key)
145
146 _post_integration_test_helper(app, url, csrf_token, admin_view=False,
147 repo=backend_random.repo, repo_group=test_repo_group)
148
149
150 class TestRepoIntegrationsView(TestIntegrationsView):
151 def test_index_no_integrations(self, app, backend_random):
152 url = '/{repo_name}/settings/integrations'.format(
153 repo_name=backend_random.repo.repo_name)
154 response = app.get(url)
155
156 assert response.status_code == 200
157 assert 'exist yet' in response.body
158
159 def test_index_with_integrations(self, app, repo_integration_stub):
160 url = '/{repo_name}/settings/integrations'.format(
161 repo_name=repo_integration_stub.repo.repo_name)
162 stub_name = repo_integration_stub.name
163
164 response = app.get(url)
165
166 assert response.status_code == 200
167 assert stub_name in response.body
168 assert 'exist yet' not in response.body
169
170 def test_new_integration_page(self, app, backend_random):
171 repo_name = backend_random.repo.repo_name
172 url = '/{repo_name}/settings/integrations/new'.format(
173 repo_name=repo_name)
174
175 response = app.get(url)
176
177 assert response.status_code == 200
178
179 for integration_key in integration_type_registry:
180 nurl = ('/{repo_name}/settings/integrations'
181 '/{integration}/new').format(
182 repo_name=repo_name,
183 integration=integration_key)
184
185 assert nurl in response.body
186
187 @pytest.mark.parametrize(
188 'IntegrationType', integration_type_registry.values())
189 def test_get_create_integration_page(self, app, backend_random,
190 IntegrationType):
191 repo_name = backend_random.repo.repo_name
192 url = '/{repo_name}/settings/integrations/{integration_key}/new'.format(
193 repo_name=repo_name, integration_key=IntegrationType.key)
194
195 response = app.get(url)
196
197 assert response.status_code == 200
198 assert IntegrationType.display_name in response.body
199
200 def test_post_integration_page(self, app, backend_random, test_repo_group,
201 StubIntegrationType, csrf_token):
202 repo_name = backend_random.repo.repo_name
203 url = '/{repo_name}/settings/integrations/{integration_key}/new'.format(
204 repo_name=repo_name, integration_key=StubIntegrationType.key)
205
206 _post_integration_test_helper(app, url, csrf_token, admin_view=False,
207 repo=backend_random.repo, repo_group=test_repo_group)
208
209
210 def _post_integration_test_helper(app, url, csrf_token, repo, repo_group,
211 admin_view):
212 """
213 Posts form data to create integration at the url given then deletes it and
214 checks if the redirect url is correct.
215 """
216
217 app.post(url, params={}, status=403) # missing csrf check
218 response = app.post(url, params={'csrf_token': csrf_token})
219 assert response.status_code == 200
220 assert 'Errors exist' in response.body
221
222 scopes_destinations = [
223 ('global',
224 ADMIN_PREFIX + '/integrations'),
225 ('root-repos',
226 ADMIN_PREFIX + '/integrations'),
227 ('repo:%s' % repo.repo_name,
228 '/%s/settings/integrations' % repo.repo_name),
229 ('repogroup:%s' % repo_group.group_name,
230 '/%s/settings/integrations' % repo_group.group_name),
231 ('repogroup-recursive:%s' % repo_group.group_name,
232 '/%s/settings/integrations' % repo_group.group_name),
233 ]
234
235 for scope, destination in scopes_destinations:
236 if admin_view:
237 destination = ADMIN_PREFIX + '/integrations'
238
239 form_data = [
240 ('csrf_token', csrf_token),
241 ('__start__', 'options:mapping'),
242 ('name', 'test integration'),
243 ('scope', scope),
244 ('enabled', 'true'),
245 ('__end__', 'options:mapping'),
246 ('__start__', 'settings:mapping'),
247 ('test_int_field', '34'),
248 ('test_string_field', ''), # empty value on purpose as it's required
249 ('__end__', 'settings:mapping'),
250 ]
251 errors_response = app.post(url, form_data)
252 assert 'Errors exist' in errors_response.body
253
254 form_data[-2] = ('test_string_field', 'data!')
255 assert Session().query(Integration).count() == 0
256 created_response = app.post(url, form_data)
257 assert Session().query(Integration).count() == 1
258
259 delete_response = app.post(
260 created_response.location,
261 params={'csrf_token': csrf_token, 'delete': 'delete'})
262
263 assert Session().query(Integration).count() == 0
264 assert delete_response.location.endswith(destination)
@@ -0,0 +1,47 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import mock
22 import pytest
23 import rhodecode
24 import rhodecode.lib.vcs.client as client
25
26 @pytest.mark.usefixtures('autologin_user', 'app')
27 def test_vcs_available_returns_summary_page(app, backend):
28 url = '/{repo_name}'.format(repo_name=backend.repo.repo_name)
29 response = app.get(url)
30 assert response.status_code == 200
31 assert 'Summary' in response.body
32
33
34 @pytest.mark.usefixtures('autologin_user', 'app')
35 def test_vcs_unavailable_returns_vcs_error_page(app, backend):
36 url = '/{repo_name}'.format(repo_name=backend.repo.repo_name)
37
38 try:
39 rhodecode.disable_error_handler = False
40 with mock.patch.object(client, '_get_proxy_method') as p:
41 p.side_effect = client.exceptions.PyroVCSCommunicationError()
42 response = app.get(url, expect_errors=True)
43 finally:
44 rhodecode.disable_error_handler = True
45
46 assert response.status_code == 502
47 assert 'Could not connect to VCS Server' in response.body
@@ -0,0 +1,171 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2016-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import colander
22 import pytest
23
24 from rhodecode.model import validation_schema
25
26 from rhodecode.integrations import integration_type_registry
27 from rhodecode.integrations.types.base import IntegrationTypeBase
28 from rhodecode.model.validation_schema.schemas.integration_schema import (
29 make_integration_schema
30 )
31
32
33 @pytest.mark.usefixtures('app', 'autologin_user')
34 class TestIntegrationSchema(object):
35
36 def test_deserialize_integration_schema_perms(self, backend_random,
37 test_repo_group,
38 StubIntegrationType):
39
40 repo = backend_random.repo
41 repo_group = test_repo_group
42
43
44 empty_perms_dict = {
45 'global': [],
46 'repositories': {},
47 'repositories_groups': {},
48 }
49
50 perms_tests = [
51 (
52 'repo:%s' % repo.repo_name,
53 {
54 'child_repos_only': None,
55 'repo_group': None,
56 'repo': repo,
57 },
58 [
59 ({}, False),
60 ({'global': ['hg.admin']}, True),
61 ({'global': []}, False),
62 ({'repositories': {repo.repo_name: 'repository.admin'}}, True),
63 ({'repositories': {repo.repo_name: 'repository.read'}}, False),
64 ({'repositories': {repo.repo_name: 'repository.write'}}, False),
65 ({'repositories': {repo.repo_name: 'repository.none'}}, False),
66 ]
67 ),
68 (
69 'repogroup:%s' % repo_group.group_name,
70 {
71 'repo': None,
72 'repo_group': repo_group,
73 'child_repos_only': True,
74 },
75 [
76 ({}, False),
77 ({'global': ['hg.admin']}, True),
78 ({'global': []}, False),
79 ({'repositories_groups':
80 {repo_group.group_name: 'group.admin'}}, True),
81 ({'repositories_groups':
82 {repo_group.group_name: 'group.read'}}, False),
83 ({'repositories_groups':
84 {repo_group.group_name: 'group.write'}}, False),
85 ({'repositories_groups':
86 {repo_group.group_name: 'group.none'}}, False),
87 ]
88 ),
89 (
90 'repogroup-recursive:%s' % repo_group.group_name,
91 {
92 'repo': None,
93 'repo_group': repo_group,
94 'child_repos_only': False,
95 },
96 [
97 ({}, False),
98 ({'global': ['hg.admin']}, True),
99 ({'global': []}, False),
100 ({'repositories_groups':
101 {repo_group.group_name: 'group.admin'}}, True),
102 ({'repositories_groups':
103 {repo_group.group_name: 'group.read'}}, False),
104 ({'repositories_groups':
105 {repo_group.group_name: 'group.write'}}, False),
106 ({'repositories_groups':
107 {repo_group.group_name: 'group.none'}}, False),
108 ]
109 ),
110 (
111 'global',
112 {
113 'repo': None,
114 'repo_group': None,
115 'child_repos_only': False,
116 }, [
117 ({}, False),
118 ({'global': ['hg.admin']}, True),
119 ({'global': []}, False),
120 ]
121 ),
122 (
123 'root-repos',
124 {
125 'repo': None,
126 'repo_group': None,
127 'child_repos_only': True,
128 }, [
129 ({}, False),
130 ({'global': ['hg.admin']}, True),
131 ({'global': []}, False),
132 ]
133 ),
134 ]
135
136 for scope_input, scope_output, perms_allowed in perms_tests:
137 for perms_update, allowed in perms_allowed:
138 perms = dict(empty_perms_dict, **perms_update)
139
140 schema = make_integration_schema(
141 IntegrationType=StubIntegrationType
142 ).bind(permissions=perms)
143
144 input_data = {
145 'options': {
146 'enabled': 'true',
147 'scope': scope_input,
148 'name': 'test integration',
149 },
150 'settings': {
151 'test_string_field': 'stringy',
152 'test_int_field': '100',
153 }
154 }
155
156 if not allowed:
157 with pytest.raises(colander.Invalid):
158 schema.deserialize(input_data)
159 else:
160 assert schema.deserialize(input_data) == {
161 'options': {
162 'enabled': True,
163 'scope': scope_output,
164 'name': 'test integration',
165 },
166 'settings': {
167 'test_string_field': 'stringy',
168 'test_int_field': 100,
169 }
170 }
171
@@ -0,0 +1,72 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2016-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import colander
22 import pytest
23
24 from rhodecode.model import validation_schema
25 from rhodecode.model.validation_schema.schemas import user_schema
26
27
28 class TestChangePasswordSchema(object):
29 original_password = 'm092d903fnio0m'
30
31 def test_deserialize_bad_data(self, user_regular):
32 schema = user_schema.ChangePasswordSchema().bind(
33 username=user_regular.username)
34
35 with pytest.raises(validation_schema.Invalid) as exc_info:
36 schema.deserialize('err')
37 err = exc_info.value.asdict()
38 assert err[''] == '"err" is not a mapping type: ' \
39 'Does not implement dict-like functionality.'
40
41 def test_validate_valid_change_password_data(self, user_util):
42 user = user_util.create_user(password=self.original_password)
43 schema = user_schema.ChangePasswordSchema().bind(
44 username=user.username)
45
46 schema.deserialize({
47 'current_password': self.original_password,
48 'new_password': '23jf04rm04imr'
49 })
50
51 @pytest.mark.parametrize(
52 'current_password,new_password,key,message', [
53 ('', 'abcdef123', 'current_password', 'required'),
54 ('wrong_pw', 'abcdef123', 'current_password', 'incorrect'),
55 (original_password, original_password, 'new_password', 'different'),
56 (original_password, '', 'new_password', 'Required'),
57 (original_password, 'short', 'new_password', 'minimum'),
58 ])
59 def test_validate_invalid_change_password_data(self, current_password,
60 new_password, key, message,
61 user_util):
62 user = user_util.create_user(password=self.original_password)
63 schema = user_schema.ChangePasswordSchema().bind(
64 username=user.username)
65
66 with pytest.raises(validation_schema.Invalid) as exc_info:
67 schema.deserialize({
68 'current_password': current_password,
69 'new_password': new_password
70 })
71 err = exc_info.value.asdict()
72 assert message.lower() in err[key].lower()
@@ -0,0 +1,141 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2016-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import colander
22 import pytest
23
24 from rhodecode.model import validation_schema
25 from rhodecode.model.db import Session
26 from rhodecode.model.user import UserModel
27 from rhodecode.model.user_group import UserGroupModel
28 from rhodecode.model.validation_schema.types import (
29 UserOrUserGroupType, UserType, UserGroupType
30 )
31
32
33 class TestUserAndUserGroupSchemaType(object):
34
35 class Schema(colander.Schema):
36 user_or_usergroup = colander.SchemaNode(UserOrUserGroupType())
37
38 def test_serialize(self, user_regular, test_user_group):
39 schema = self.Schema()
40
41 assert schema.serialize({'user_or_usergroup': user_regular}) == (
42 {'user_or_usergroup': 'user:' + user_regular.username})
43 assert schema.serialize({'user_or_usergroup': test_user_group}) == (
44 {'user_or_usergroup': 'usergroup:' + test_user_group.users_group_name})
45
46 with pytest.raises(colander.Invalid):
47 schema.serialize({'user_or_usergroup': 'invalidusername'})
48
49 def test_deserialize(self, test_user_group, user_regular):
50 schema = self.Schema()
51
52 assert schema.deserialize(
53 {'user_or_usergroup': test_user_group.users_group_name}
54 ) == {'user_or_usergroup': test_user_group}
55
56 assert schema.deserialize(
57 {'user_or_usergroup': user_regular.username}
58 ) == {'user_or_usergroup': user_regular}
59
60 def test_deserialize_user_user_group_with_same_name(self):
61 schema = self.Schema()
62 try:
63 user = UserModel().create_or_update(
64 'test_user_usergroup', 'nopass', 'test_user_usergroup')
65 usergroup = UserGroupModel().create(
66 'test_user_usergroup', 'test usergroup', user)
67
68 with pytest.raises(colander.Invalid) as exc_info:
69 schema.deserialize(
70 {'user_or_usergroup': user.username}
71 ) == {'user_or_usergroup': user}
72
73 err = exc_info.value.asdict()
74 assert 'is both a user and usergroup' in err['user_or_usergroup']
75 finally:
76 UserGroupModel().delete(usergroup)
77 Session().commit()
78 UserModel().delete(user)
79
80
81 class TestUserType(object):
82
83 class Schema(colander.Schema):
84 user = colander.SchemaNode(UserType())
85
86 def test_serialize(self, user_regular, test_user_group):
87 schema = self.Schema()
88
89 assert schema.serialize({'user': user_regular}) == (
90 {'user': user_regular.username})
91
92 with pytest.raises(colander.Invalid):
93 schema.serialize({'user': test_user_group})
94
95 with pytest.raises(colander.Invalid):
96 schema.serialize({'user': 'invaliduser'})
97
98 def test_deserialize(self, user_regular, test_user_group):
99 schema = self.Schema()
100
101 assert schema.deserialize(
102 {'user': user_regular.username}) == {'user': user_regular}
103
104 with pytest.raises(colander.Invalid):
105 schema.deserialize({'user': test_user_group.users_group_name})
106
107 with pytest.raises(colander.Invalid):
108 schema.deserialize({'user': 'invaliduser'})
109
110
111 class TestUserGroupType(object):
112
113 class Schema(colander.Schema):
114 usergroup = colander.SchemaNode(
115 UserGroupType()
116 )
117
118 def test_serialize(self, user_regular, test_user_group):
119 schema = self.Schema()
120
121 assert schema.serialize({'usergroup': test_user_group}) == (
122 {'usergroup': test_user_group.users_group_name})
123
124 with pytest.raises(colander.Invalid):
125 schema.serialize({'usergroup': user_regular})
126
127 with pytest.raises(colander.Invalid):
128 schema.serialize({'usergroup': 'invalidusergroup'})
129
130 def test_deserialize(self, user_regular, test_user_group):
131 schema = self.Schema()
132
133 assert schema.deserialize({
134 'usergroup': test_user_group.users_group_name
135 }) == {'usergroup': test_user_group}
136
137 with pytest.raises(colander.Invalid):
138 schema.deserialize({'usergroup': user_regular.username})
139
140 with pytest.raises(colander.Invalid):
141 schema.deserialize({'usergroup': 'invaliduser'})
@@ -0,0 +1,106 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import pytest
22
23 from rhodecode.lib.vcs import nodes
24 from rhodecode.model.repo import ReadmeFinder
25
26
27 @pytest.fixture
28 def commit_util(vcsbackend_stub):
29 """
30 Provide a commit which has certain files in it's tree.
31
32 This is based on the fixture "vcsbackend" and will automatically be
33 parametrized for all vcs backends.
34 """
35 return CommitUtility(vcsbackend_stub)
36
37
38 class CommitUtility:
39
40 def __init__(self, vcsbackend):
41 self.vcsbackend = vcsbackend
42
43 def commit_with_files(self, filenames):
44 commits = [
45 {'message': 'Adding all requested files',
46 'added': [
47 nodes.FileNode(filename, content='')
48 for filename in filenames
49 ]}]
50 repo = self.vcsbackend.create_repo(commits=commits)
51 return repo.get_commit()
52
53
54 def test_no_matching_file_returns_none(commit_util):
55 commit = commit_util.commit_with_files(['LIESMICH'])
56 finder = ReadmeFinder(default_renderer='rst')
57 filenode = finder.search(commit)
58 assert filenode is None
59
60
61 def test_matching_file_returns_the_file_name(commit_util):
62 commit = commit_util.commit_with_files(['README'])
63 finder = ReadmeFinder(default_renderer='rst')
64 filenode = finder.search(commit)
65 assert filenode.path == 'README'
66
67
68 def test_matching_file_with_extension(commit_util):
69 commit = commit_util.commit_with_files(['README.rst'])
70 finder = ReadmeFinder(default_renderer='rst')
71 filenode = finder.search(commit)
72 assert filenode.path == 'README.rst'
73
74
75 def test_prefers_readme_without_extension(commit_util):
76 commit = commit_util.commit_with_files(['README.rst', 'Readme'])
77 finder = ReadmeFinder()
78 filenode = finder.search(commit)
79 assert filenode.path == 'Readme'
80
81
82 @pytest.mark.parametrize('renderer, expected', [
83 ('rst', 'readme.rst'),
84 ('markdown', 'readme.md'),
85 ])
86 def test_prefers_renderer_extensions(commit_util, renderer, expected):
87 commit = commit_util.commit_with_files(
88 ['readme.rst', 'readme.md', 'readme.txt'])
89 finder = ReadmeFinder(default_renderer=renderer)
90 filenode = finder.search(commit)
91 assert filenode.path == expected
92
93
94 def test_finds_readme_in_subdirectory(commit_util):
95 commit = commit_util.commit_with_files(['doc/README.rst', 'LIESMICH'])
96 finder = ReadmeFinder()
97 filenode = finder.search(commit)
98 assert filenode.path == 'doc/README.rst'
99
100
101 def test_prefers_subdirectory_with_priority(commit_util):
102 commit = commit_util.commit_with_files(
103 ['Doc/Readme.rst', 'Docs/Readme.rst'])
104 finder = ReadmeFinder()
105 filenode = finder.search(commit)
106 assert filenode.path == 'Doc/Readme.rst'
@@ -1,5 +1,5 b''
1 [bumpversion]
1 [bumpversion]
2 current_version = 4.3.1
2 current_version = 4.4.0
3 message = release: Bump version {current_version} to {new_version}
3 message = release: Bump version {current_version} to {new_version}
4
4
5 [bumpversion:file:rhodecode/VERSION]
5 [bumpversion:file:rhodecode/VERSION]
@@ -8,6 +8,7 b' syntax: glob'
8 *.swp
8 *.swp
9 *.tox
9 *.tox
10 *.DS_Store*
10 *.DS_Store*
11 rhodecode/public/js/src/components/**/*.css
11
12
12 syntax: regexp
13 syntax: regexp
13
14
@@ -23,6 +24,7 b' syntax: regexp'
23 ^_dev
24 ^_dev
24 ^._dev
25 ^._dev
25 ^build/
26 ^build/
27 ^bower_components/
26 ^coverage\.xml$
28 ^coverage\.xml$
27 ^data$
29 ^data$
28 ^\.eggs/
30 ^\.eggs/
@@ -38,7 +40,11 b' syntax: regexp'
38 ^rcextensions/
40 ^rcextensions/
39 ^result$
41 ^result$
40 ^rhodecode/public/css/style.css$
42 ^rhodecode/public/css/style.css$
43 ^rhodecode/public/css/style-polymer.css$
44 ^rhodecode/public/js/rhodecode-components.html$
41 ^rhodecode/public/js/scripts.js$
45 ^rhodecode/public/js/scripts.js$
46 ^rhodecode/public/js/src/components/root-styles.gen.html$
47 ^rhodecode/public/js/vendors/webcomponentsjs/
42 ^rhodecode\.db$
48 ^rhodecode\.db$
43 ^rhodecode\.log$
49 ^rhodecode\.log$
44 ^rhodecode_dev\.log$
50 ^rhodecode_dev\.log$
@@ -4,26 +4,21 b' done = false'
4 [task:bump_version]
4 [task:bump_version]
5 done = true
5 done = true
6
6
7 [task:rc_tools_pinned]
8 done = true
9
10 [task:fixes_on_stable]
7 [task:fixes_on_stable]
11 done = true
12
8
13 [task:pip2nix_generated]
9 [task:pip2nix_generated]
14 done = true
15
10
16 [task:changelog_updated]
11 [task:changelog_updated]
17 done = true
18
12
19 [task:generate_api_docs]
13 [task:generate_api_docs]
20 done = true
14
15 [task:updated_translation]
21
16
22 [release]
17 [release]
23 state = prepared
18 state = in_progress
24 version = 4.3.1
19 version = 4.4.0
25
20
26 [task:updated_translation]
21 [task:rc_tools_pinned]
27
22
28 [task:generate_js_routes]
23 [task:generate_js_routes]
29
24
@@ -1,144 +1,15 b''
1 module.exports = function(grunt) {
1 var gruntConfig = require('./grunt_config.json');
2 grunt.initConfig({
3
4 dirs: {
5 css: "rhodecode/public/css",
6 js: {
7 "src": "rhodecode/public/js/src",
8 "dest": "rhodecode/public/js"
9 }
10 },
11
12 concat: {
13 dist: {
14 src: [
15 // Base libraries
16 '<%= dirs.js.src %>/jquery-1.11.1.min.js',
17 '<%= dirs.js.src %>/logging.js',
18 '<%= dirs.js.src %>/bootstrap.js',
19 '<%= dirs.js.src %>/mousetrap.js',
20 '<%= dirs.js.src %>/moment.js',
21 '<%= dirs.js.src %>/appenlight-client-0.4.1.min.js',
22 '<%= dirs.js.src %>/i18n_utils.js',
23 '<%= dirs.js.src %>/deform.js',
24
25 // Plugins
26 '<%= dirs.js.src %>/plugins/jquery.pjax.js',
27 '<%= dirs.js.src %>/plugins/jquery.dataTables.js',
28 '<%= dirs.js.src %>/plugins/flavoured_checkbox.js',
29 '<%= dirs.js.src %>/plugins/jquery.auto-grow-input.js',
30 '<%= dirs.js.src %>/plugins/jquery.autocomplete.js',
31 '<%= dirs.js.src %>/plugins/jquery.debounce.js',
32 '<%= dirs.js.src %>/plugins/jquery.mark.js',
33 '<%= dirs.js.src %>/plugins/jquery.timeago.js',
34 '<%= dirs.js.src %>/plugins/jquery.timeago-extension.js',
35 '<%= dirs.js.src %>/plugins/toastr.js',
36
37 // Select2
38 '<%= dirs.js.src %>/select2/select2.js',
39
40 // Code-mirror
41 '<%= dirs.js.src %>/codemirror/codemirror.js',
42 '<%= dirs.js.src %>/codemirror/codemirror_loadmode.js',
43 '<%= dirs.js.src %>/codemirror/codemirror_hint.js',
44 '<%= dirs.js.src %>/codemirror/codemirror_overlay.js',
45 '<%= dirs.js.src %>/codemirror/codemirror_placeholder.js',
46 // TODO: mikhail: this is an exception. Since the code mirror modes
47 // are loaded "on the fly", we need to keep them in a public folder
48 '<%= dirs.js.dest %>/mode/meta.js',
49 '<%= dirs.js.dest %>/mode/meta_ext.js',
50 '<%= dirs.js.dest %>/rhodecode/i18n/select2/translations.js',
51
52 // Rhodecode utilities
53 '<%= dirs.js.src %>/rhodecode/utils/array.js',
54 '<%= dirs.js.src %>/rhodecode/utils/string.js',
55 '<%= dirs.js.src %>/rhodecode/utils/pyroutes.js',
56 '<%= dirs.js.src %>/rhodecode/utils/ajax.js',
57 '<%= dirs.js.src %>/rhodecode/utils/autocomplete.js',
58 '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js',
59 '<%= dirs.js.src %>/rhodecode/utils/ie.js',
60 '<%= dirs.js.src %>/rhodecode/utils/os.js',
61 '<%= dirs.js.src %>/rhodecode/utils/topics.js',
62
63 // Rhodecode widgets
64 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
65
2
66 // Rhodecode components
3 module.exports = function(grunt) {
67 '<%= dirs.js.src %>/rhodecode/init.js',
4 grunt.initConfig(gruntConfig);
68 '<%= dirs.js.src %>/rhodecode/connection_controller.js',
69 '<%= dirs.js.src %>/rhodecode/codemirror.js',
70 '<%= dirs.js.src %>/rhodecode/comments.js',
71 '<%= dirs.js.src %>/rhodecode/constants.js',
72 '<%= dirs.js.src %>/rhodecode/files.js',
73 '<%= dirs.js.src %>/rhodecode/followers.js',
74 '<%= dirs.js.src %>/rhodecode/menus.js',
75 '<%= dirs.js.src %>/rhodecode/notifications.js',
76 '<%= dirs.js.src %>/rhodecode/permissions.js',
77 '<%= dirs.js.src %>/rhodecode/pjax.js',
78 '<%= dirs.js.src %>/rhodecode/pullrequests.js',
79 '<%= dirs.js.src %>/rhodecode/settings.js',
80 '<%= dirs.js.src %>/rhodecode/select2_widgets.js',
81 '<%= dirs.js.src %>/rhodecode/tooltips.js',
82 '<%= dirs.js.src %>/rhodecode/users.js',
83 '<%= dirs.js.src %>/rhodecode/utils/notifications.js',
84 '<%= dirs.js.src %>/rhodecode/appenlight.js',
85
86 // Rhodecode main module
87 '<%= dirs.js.src %>/rhodecode.js'
88 ],
89 dest: '<%= dirs.js.dest %>/scripts.js',
90 nonull: true
91 }
92 },
93
94 less: {
95 development: {
96 options: {
97 compress: false,
98 yuicompress: false,
99 optimization: 0
100 },
101 files: {
102 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
103 }
104 },
105 production: {
106 options: {
107 compress: true,
108 yuicompress: true,
109 optimization: 2
110 },
111 files: {
112 "<%= dirs.css %>/style.css": "<%= dirs.css %>/main.less"
113 }
114 }
115 },
116
117 watch: {
118 less: {
119 files: ["<%= dirs.css %>/*.less"],
120 tasks: ["less:production"]
121 },
122 js: {
123 files: ["<%= dirs.js.src %>/**/*.js"],
124 tasks: ["concat:dist"]
125 }
126 },
127
128 jshint: {
129 rhodecode: {
130 src: '<%= dirs.js.src %>/rhodecode/**/*.js',
131 options: {
132 jshintrc: '.jshintrc'
133 }
134 }
135 }
136 });
137
5
138 grunt.loadNpmTasks('grunt-contrib-less');
6 grunt.loadNpmTasks('grunt-contrib-less');
139 grunt.loadNpmTasks('grunt-contrib-concat');
7 grunt.loadNpmTasks('grunt-contrib-concat');
140 grunt.loadNpmTasks('grunt-contrib-watch');
8 grunt.loadNpmTasks('grunt-contrib-watch');
141 grunt.loadNpmTasks('grunt-contrib-jshint');
9 grunt.loadNpmTasks('grunt-contrib-jshint');
10 grunt.loadNpmTasks('grunt-vulcanize');
11 grunt.loadNpmTasks('grunt-crisper');
12 grunt.loadNpmTasks('grunt-contrib-copy');
142
13
143 grunt.registerTask('default', ['less:production', 'concat:dist']);
14 grunt.registerTask('default', ['less:production', 'less:components', 'concat:polymercss', 'copy','vulcanize', 'crisper', 'concat:dist']);
144 };
15 };
@@ -29,6 +29,9 b' recursive-include rhodecode *.mako'
29 # 502 page
29 # 502 page
30 include rhodecode/public/502.html
30 include rhodecode/public/502.html
31
31
32 # 502 page
33 include rhodecode/public/502.html
34
32 # images, css
35 # images, css
33 include rhodecode/public/css/*.css
36 include rhodecode/public/css/*.css
34 include rhodecode/public/images/*.*
37 include rhodecode/public/images/*.*
@@ -414,7 +414,7 b' search.location = %(here)s/data/index'
414 ## channelstream enables persistent connections and live notification
414 ## channelstream enables persistent connections and live notification
415 ## in the system. It's also used by the chat system
415 ## in the system. It's also used by the chat system
416
416
417 channelstream.enabled = true
417 channelstream.enabled = false
418 ## location of channelstream server on the backend
418 ## location of channelstream server on the backend
419 channelstream.server = 127.0.0.1:9800
419 channelstream.server = 127.0.0.1:9800
420 ## location of the channelstream server from outside world
420 ## location of the channelstream server from outside world
@@ -388,7 +388,7 b' search.location = %(here)s/data/index'
388 ## channelstream enables persistent connections and live notification
388 ## channelstream enables persistent connections and live notification
389 ## in the system. It's also used by the chat system
389 ## in the system. It's also used by the chat system
390
390
391 channelstream.enabled = true
391 channelstream.enabled = false
392 ## location of channelstream server on the backend
392 ## location of channelstream server on the backend
393 channelstream.server = 127.0.0.1:9800
393 channelstream.server = 127.0.0.1:9800
394 ## location of the channelstream server from outside world
394 ## location of the channelstream server from outside world
@@ -30,6 +30,10 b' let'
30 then pythonPackages
30 then pythonPackages
31 else getAttr pythonPackages pkgs;
31 else getAttr pythonPackages pkgs;
32
32
33 buildBowerComponents =
34 pkgs.buildBowerComponents or
35 (import ./pkgs/backport-16.03-build-bower-components.nix { inherit pkgs; });
36
33 elem = builtins.elem;
37 elem = builtins.elem;
34 basename = path: with pkgs.lib; last (splitString "/" path);
38 basename = path: with pkgs.lib; last (splitString "/" path);
35 startsWith = prefix: full: let
39 startsWith = prefix: full: let
@@ -41,31 +45,28 b' let'
41 ext = last (splitString "." path);
45 ext = last (splitString "." path);
42 in
46 in
43 !elem (basename path) [
47 !elem (basename path) [
44 ".git" ".hg" "__pycache__" ".eggs" "node_modules"
48 ".git" ".hg" "__pycache__" ".eggs"
45 "build" "data" "tmp"] &&
49 "bower_components" "node_modules"
50 "build" "data" "result" "tmp"] &&
46 !elem ext ["egg-info" "pyc"] &&
51 !elem ext ["egg-info" "pyc"] &&
52 # TODO: johbo: This check is wrong, since "path" contains an absolute path,
53 # it would still be good to restore it since we want to ignore "result-*".
47 !startsWith "result" path;
54 !startsWith "result" path;
48
55
49 sources = pkgs.config.rc.sources or {};
56 sources = pkgs.config.rc.sources or {};
57 version = builtins.readFile ./rhodecode/VERSION;
50 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
58 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
51
59
52 # Load the generated node packages
60 nodeEnv = import ./pkgs/node-default.nix {
53 nodePackages = pkgs.callPackage "${pkgs.path}/pkgs/top-level/node-packages.nix" rec {
61 inherit pkgs;
54 self = nodePackages;
55 generated = pkgs.callPackage ./pkgs/node-packages.nix { inherit self; };
56 };
62 };
63 nodeDependencies = nodeEnv.shell.nodeDependencies;
57
64
58 # TODO: Should be taken automatically out of the generates packages.
65 bowerComponents = buildBowerComponents {
59 # apps.nix has one solution for this, although I'd prefer to have the deps
66 name = "enterprise-ce-${version}";
60 # from package.json mapped in here.
67 generated = ./pkgs/bower-packages.nix;
61 nodeDependencies = with nodePackages; [
68 src = rhodecode-enterprise-ce-src;
62 grunt
69 };
63 grunt-contrib-concat
64 grunt-contrib-jshint
65 grunt-contrib-less
66 grunt-contrib-watch
67 jshint
68 ];
69
70
70 pythonGeneratedPackages = self: basePythonPackages.override (a: {
71 pythonGeneratedPackages = self: basePythonPackages.override (a: {
71 inherit self;
72 inherit self;
@@ -86,16 +87,25 b' let'
86 pythonLocalOverrides = self: super: {
87 pythonLocalOverrides = self: super: {
87 rhodecode-enterprise-ce =
88 rhodecode-enterprise-ce =
88 let
89 let
89 version = builtins.readFile ./rhodecode/VERSION;
90 linkNodeAndBowerPackages = ''
90 linkNodeModules = ''
91 echo "Export RhodeCode CE path"
92 export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src}
91 echo "Link node packages"
93 echo "Link node packages"
92 # TODO: check if this adds stuff as a dependency, closure size
93 rm -fr node_modules
94 rm -fr node_modules
94 mkdir -p node_modules
95 mkdir node_modules
95 ${pkgs.lib.concatMapStrings (dep: ''
96 # johbo: Linking individual packages allows us to run "npm install"
96 ln -sfv ${dep}/lib/node_modules/${dep.pkgName} node_modules/
97 # inside of a shell to try things out. Re-entering the shell will
97 '') nodeDependencies}
98 # restore a clean environment.
99 ln -s ${nodeDependencies}/lib/node_modules/* node_modules/
100
98 echo "DONE: Link node packages"
101 echo "DONE: Link node packages"
102
103 echo "Link bower packages"
104 rm -fr bower_components
105 mkdir bower_components
106
107 ln -s ${bowerComponents}/bower_components/* bower_components/
108 echo "DONE: Link bower packages"
99 '';
109 '';
100 in super.rhodecode-enterprise-ce.override (attrs: {
110 in super.rhodecode-enterprise-ce.override (attrs: {
101
111
@@ -109,6 +119,7 b' let'
109 buildInputs =
119 buildInputs =
110 attrs.buildInputs ++
120 attrs.buildInputs ++
111 (with self; [
121 (with self; [
122 pkgs.nodePackages.bower
112 pkgs.nodePackages.grunt-cli
123 pkgs.nodePackages.grunt-cli
113 pkgs.subversion
124 pkgs.subversion
114 pytest-catchlog
125 pytest-catchlog
@@ -123,7 +134,8 b' let'
123 # pkgs/default.nix?
134 # pkgs/default.nix?
124 passthru = {
135 passthru = {
125 inherit
136 inherit
126 linkNodeModules
137 bowerComponents
138 linkNodeAndBowerPackages
127 myPythonPackagesUnfix
139 myPythonPackagesUnfix
128 pythonLocalOverrides;
140 pythonLocalOverrides;
129 pythonPackages = self;
141 pythonPackages = self;
@@ -145,7 +157,7 b' let'
145 export PYTHONPATH="$tmp_path/${self.python.sitePackages}:$PYTHONPATH"
157 export PYTHONPATH="$tmp_path/${self.python.sitePackages}:$PYTHONPATH"
146 mkdir -p $tmp_path/${self.python.sitePackages}
158 mkdir -p $tmp_path/${self.python.sitePackages}
147 python setup.py develop --prefix $tmp_path --allow-hosts ""
159 python setup.py develop --prefix $tmp_path --allow-hosts ""
148 '' + linkNodeModules;
160 '' + linkNodeAndBowerPackages;
149
161
150 preCheck = ''
162 preCheck = ''
151 export PATH="$out/bin:$PATH"
163 export PATH="$out/bin:$PATH"
@@ -156,7 +168,7 b' let'
156 rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
168 rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
157 '';
169 '';
158
170
159 preBuild = linkNodeModules + ''
171 preBuild = linkNodeAndBowerPackages + ''
160 grunt
172 grunt
161 rm -fr node_modules
173 rm -fr node_modules
162 '';
174 '';
@@ -29,13 +29,3 b' 4. You will see the labs setting on the'
29 :menuselection:`Admin --> Settings --> labs` page.
29 :menuselection:`Admin --> Settings --> labs` page.
30
30
31 .. image:: ../images/lab-setting.png
31 .. image:: ../images/lab-setting.png
32
33 Available Lab Extras
34 --------------------
35
36 Once lab settings are enabled, the following features are available.
37
38 .. toctree::
39 :maxdepth: 1
40
41 svn-http
@@ -26,6 +26,7 b' For more information, see the following '
26 * :ref:`vcs-server-versions`
26 * :ref:`vcs-server-versions`
27 * :ref:`vcs-server-maintain`
27 * :ref:`vcs-server-maintain`
28 * :ref:`vcs-server-config-file`
28 * :ref:`vcs-server-config-file`
29 * :ref:`svn-http`
29
30
30 .. _install-vcs:
31 .. _install-vcs:
31
32
@@ -297,5 +298,133 b' For a more detailed explanation of the l'
297 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
298 format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
298 datefmt = %Y-%m-%d %H:%M:%S
299 datefmt = %Y-%m-%d %H:%M:%S
299
300
301 .. _svn-http:
300
302
301 .. _Ask Ubuntu: http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue
303 |svn| With Write Over HTTP
304 ^^^^^^^^^^^^^^^^^^^^^^^^^^
305
306 To use |svn| with read/write support over the |svn| HTTP protocol, you have to
307 configure the HTTP |svn| backend.
308
309 Prerequisites
310 =============
311
312 - Enable HTTP support inside the admin VCS settings on your |RCE| instance
313 - You need to install the following tools on the machine that is running an
314 instance of |RCE|:
315 ``Apache HTTP Server`` and
316 ``mod_dav_svn``.
317
318
319 Using Ubuntu Distribution as an example you can run:
320
321 .. code-block:: bash
322
323 $ sudo apt-get install apache2 libapache2-mod-svn
324
325 Once installed you need to enable ``dav_svn``:
326
327 .. code-block:: bash
328
329 $ sudo a2enmod dav_svn
330
331 Configuring Apache Setup
332 ========================
333
334 .. tip::
335
336 It is recommended to run Apache on a port other than 80, due to possible
337 conflicts with other HTTP servers like nginx. To do this, set the
338 ``Listen`` parameter in the ``/etc/apache2/ports.conf`` file, for example
339 ``Listen 8090``.
340
341
342 .. warning::
343
344 Make sure your Apache instance which runs the mod_dav_svn module is
345 only accessible by RhodeCode. Otherwise everyone is able to browse
346 the repositories or run subversion operations (checkout/commit/etc.).
347
348 It is also recommended to run apache as the same user as |RCE|, otherwise
349 permission issues could occur. To do this edit the ``/etc/apache2/envvars``
350
351 .. code-block:: apache
352
353 export APACHE_RUN_USER=rhodecode
354 export APACHE_RUN_GROUP=rhodecode
355
356 1. To configure Apache, create and edit a virtual hosts file, for example
357 :file:`/etc/apache2/sites-available/default.conf`. Below is an example
358 how to use one with auto-generated config ```mod_dav_svn.conf```
359 from configured |RCE| instance.
360
361 .. code-block:: apache
362
363 <VirtualHost *:8080>
364 ServerAdmin rhodecode-admin@localhost
365 DocumentRoot /var/www/html
366 ErrorLog ${'${APACHE_LOG_DIR}'}/error.log
367 CustomLog ${'${APACHE_LOG_DIR}'}/access.log combined
368 Include /home/user/.rccontrol/enterprise-1/mod_dav_svn.conf
369 </VirtualHost>
370
371
372 2. Go to the :menuselection:`Admin --> Settings --> VCS` page, and
373 enable :guilabel:`Proxy Subversion HTTP requests`, and specify the
374 :guilabel:`Subversion HTTP Server URL`.
375
376 3. Open the |RCE| configuration file,
377 :file:`/home/{user}/.rccontrol/{instance-id}/rhodecode.ini`
378
379 4. Add the following configuration option in the ``[app:main]``
380 section if you don't have it yet.
381
382 This enables mapping of the created |RCE| repo groups into special |svn| paths.
383 Each time a new repository group is created, the system will update
384 the template file and create new mapping. Apache web server needs to be
385 reloaded to pick up the changes on this file.
386 It's recommended to add reload into a crontab so the changes can be picked
387 automatically once someone creates a repository group inside RhodeCode.
388
389
390 .. code-block:: ini
391
392 ##############################################
393 ### Subversion proxy support (mod_dav_svn) ###
394 ##############################################
395 ## Enable or disable the config file generation.
396 svn.proxy.generate_config = true
397 ## Generate config file with `SVNListParentPath` set to `On`.
398 svn.proxy.list_parent_path = true
399 ## Set location and file name of generated config file.
400 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
401 ## File system path to the directory containing the repositories served by
402 ## RhodeCode.
403 svn.proxy.parent_path_root = /path/to/repo_store
404 ## Used as a prefix to the <Location> block in the generated config file. In
405 ## most cases it should be set to `/`.
406 svn.proxy.location_root = /
407
408
409 This would create a special template file called ```mod_dav_svn.conf```. We
410 used that file path in the apache config above inside the Include statement.
411
412
413 Using |svn|
414 ===========
415
416 Once |svn| has been enabled on your instance, you can use it with the
417 following examples. For more |svn| information, see the `Subversion Red Book`_
418
419 .. code-block:: bash
420
421 # To clone a repository
422 svn checkout http://my-svn-server.example.com/my-svn-repo
423
424 # svn commit
425 svn commit
426
427 .. _Subversion Red Book: http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.ref.svn
428
429
430 .. _Ask Ubuntu: http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue No newline at end of file
@@ -18,3 +18,4 b' Welcome to the contribution guides and d'
18 db-schema
18 db-schema
19 dev-settings
19 dev-settings
20 api
20 api
21 dependencies
@@ -111,15 +111,18 b' time operation::'
111 Compile CSS and JavaScript
111 Compile CSS and JavaScript
112 ^^^^^^^^^^^^^^^^^^^^^^^^^^
112 ^^^^^^^^^^^^^^^^^^^^^^^^^^
113
113
114 To use the application's frontend, you will need to compile the CSS and
114 To use the application's frontend and prepare it for production deployment,
115 JavaScript with Grunt. This is easily done from within the nix-shell using the
115 you will need to compile the CSS and JavaScript with Grunt.
116 following command::
116 This is easily done from within the nix-shell using the following command::
117
118 grunt
117
119
118 make web-build
120 When developing new features you will need to recompile following any
121 changes made to the CSS or JavaScript files when developing the code::
119
122
120 You will need to recompile following any changes made to the CSS or JavaScript
123 grunt watch
121 files.
122
124
125 This prepares the development (with comments/whitespace) versions of files.
123
126
124 Start the Development Server
127 Start the Development Server
125 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,6 +45,11 b' JavaScript'
45 ----------
45 ----------
46 This currently remains undefined. Suggestions welcome!
46 This currently remains undefined. Suggestions welcome!
47
47
48 However, we have decided to go forward with W3C standards and picked
49 WebComponents as the foundation of user interface. New functionality should
50 be implemented as components using the
51 `Polymer Project` <https://www.polymer-project.org>`_ library
52 and should avoid external dependencies like `jquery`.
48
53
49 HTML
54 HTML
50 ----
55 ----
@@ -14,9 +14,6 b' py.test based test suite'
14 The test suite is in the folder :file:`rhodecode/tests/` and should be run with
14 The test suite is in the folder :file:`rhodecode/tests/` and should be run with
15 the test runner `py.test` inside of your `nix-shell` environment::
15 the test runner `py.test` inside of your `nix-shell` environment::
16
16
17 # In case you need the cythonized version
18 CYTHONIZE=1 python setup.py develop --prefix=$tmp_path
19
20 py.test rhodecode
17 py.test rhodecode
21
18
22
19
@@ -26,20 +23,28 b' py.test integration'
26
23
27 The integration with the test runner is based on the following three parts:
24 The integration with the test runner is based on the following three parts:
28
25
29 - `pytest_pylons` is a py.test plugin which does the integration with the
26 - :file:`rhodecode/tests/pylons_plugin.py` is a py.test plugin which does the
30 Pylons web framework. It sets up the Pylons environment based on the given ini
27 integration with the Pylons web framework. It sets up the Pylons environment
31 file.
28 based on the given ini file.
32
29
33 Tests which depend on the Pylons environment to be set up must request the
30 Tests which depend on the Pylons environment to be set up must request the
34 fixture `pylonsapp`.
31 fixture `pylonsapp`.
35
32
36 - :file:`rhodecode/tests/plugin.py` contains the integration of py.test with
33 - :file:`rhodecode/tests/plugin.py` contains the integration of py.test with
37 RhodeCode Enterprise itself.
34 RhodeCode Enterprise itself and it takes care of setting up the needed parts
35 of the Pyramid framework.
38
36
39 - :file:`conftest.py` plugins are used to provide a special integration for
37 - :file:`conftest.py` plugins are used to provide a special integration for
40 certain groups of tests based on the directory location.
38 certain groups of tests based on the directory location.
41
39
42
40
41 .. note::
42
43 We are migrating from Pylons to its successor Pyramid. Eventually the role of
44 the file `pylons_plugin.py` will change to provide only a Pyramid
45 integration.
46
47
43
48
44 VCS backend selection
49 VCS backend selection
45 ---------------------
50 ---------------------
@@ -19,8 +19,7 b' Quick Start Installation Guide'
19
19
20 To get |RCE| up and running, run through the below steps:
20 To get |RCE| up and running, run through the below steps:
21
21
22 1. Download the latest |RCC| installer from your `rhodecode.com`_ profile
22 1. Download the latest |RCC| installer from `rhodecode.com/download`_.
23 or main page.
24 If you don't have an account, sign up at `rhodecode.com/register`_.
23 If you don't have an account, sign up at `rhodecode.com/register`_.
25
24
26 2. Run the |RCC| installer and accept the End User Licence using the
25 2. Run the |RCC| installer and accept the End User Licence using the
@@ -107,3 +106,5 b' 5. Check the status of your installation'
107 .. _rhodecode.com/download/: https://rhodecode.com/download/
106 .. _rhodecode.com/download/: https://rhodecode.com/download/
108 .. _rhodecode.com: https://rhodecode.com/
107 .. _rhodecode.com: https://rhodecode.com/
109 .. _rhodecode.com/register: https://rhodecode.com/register/
108 .. _rhodecode.com/register: https://rhodecode.com/register/
109 .. _rhodecode.com/download: https://rhodecode.com/download/
110
@@ -3,20 +3,20 b''
3 PostgreSQL
3 PostgreSQL
4 ----------
4 ----------
5
5
6 To use a PostgreSQL database you should install and configurevthe database
6 To use a PostgreSQL database, you should install and configure the database
7 before installing |RCV|. This is becausevduring |RCV| installation you will
7 before installing |RCV|. This is because during |RCV| installation you will
8 setup a connection to your PostgreSQL database. To work with PostgreSQL,
8 setup the connection to your PostgreSQL database. To work with PostgreSQL,
9 use the following steps:
9 use the following steps:
10
10
11 1. Depending on your |os|, install avPostgreSQL database following the
11 1. Depending on your |os|, install a PostgreSQL database following the
12 appropriate instructions from the `PostgreSQL website`_.
12 appropriate instructions from the `PostgreSQL website`_.
13 2. Configure the database with a username and password which you will use
13 2. Configure the database with a username and password, which you will use
14 with |RCV|.
14 with |RCV|.
15 3. Install |RCV|, and during installation select PostgreSQL as your database.
15 3. Install |RCV|, and during installation select PostgreSQL as your database.
16 4. Enter the following information to during the database setup:
16 4. Enter the following information during the database setup:
17
17
18 * Your network IP Address
18 * Your network IP Address
19 * The port number for MySQL access. The default MySQL port is ``5434``
19 * The port number for PostgreSQL access; the default port is ``5434``
20 * Your database username
20 * Your database username
21 * Your database password
21 * Your database password
22 * A new database name
22 * A new database name
@@ -9,6 +9,7 b' Release Notes'
9 .. toctree::
9 .. toctree::
10 :maxdepth: 1
10 :maxdepth: 1
11
11
12 release-notes-4.4.0.rst
12 release-notes-4.3.1.rst
13 release-notes-4.3.1.rst
13 release-notes-4.3.0.rst
14 release-notes-4.3.0.rst
14 release-notes-4.2.1.rst
15 release-notes-4.2.1.rst
@@ -3,10 +3,16 b''
3 "version": "0.0.1",
3 "version": "0.0.1",
4 "devDependencies": {
4 "devDependencies": {
5 "grunt": "^0.4.5",
5 "grunt": "^0.4.5",
6 "grunt-contrib-copy": "^1.0.0",
6 "grunt-contrib-concat": "^0.5.1",
7 "grunt-contrib-concat": "^0.5.1",
7 "grunt-contrib-jshint": "^0.12.0",
8 "grunt-contrib-jshint": "^0.12.0",
8 "grunt-contrib-less": "^1.1.0",
9 "grunt-contrib-less": "^1.1.0",
9 "grunt-contrib-watch": "^0.6.1",
10 "grunt-contrib-watch": "^0.6.1",
10 "jshint": "^2.9.1-rc3"
11 "crisper": "^2.0.2",
12 "vulcanize": "^1.14.8",
13 "grunt-crisper": "^1.0.1",
14 "grunt-vulcanize": "^1.0.0",
15 "jshint": "^2.9.1-rc3",
16 "bower": "^1.7.9"
11 }
17 }
12 }
18 }
This diff has been collapsed as it changes many lines, (5566 lines changed) Show them Hide them
@@ -1,3341 +1,2337 b''
1 { self, fetchurl, fetchgit ? null, lib }:
1 # This file has been generated by node2nix 1.0.0. Do not edit!
2
3 {nodeEnv, fetchurl, fetchgit}:
2
4
3 {
5 let
4 by-spec."abbrev"."1" =
6 sources = {
5 self.by-version."abbrev"."1.0.7";
7 "grunt-0.4.5" = {
6 by-version."abbrev"."1.0.7" = lib.makeOverridable self.buildNodePackage {
8 name = "grunt";
7 name = "abbrev-1.0.7";
9 packageName = "grunt";
8 bin = false;
10 version = "0.4.5";
9 src = [
11 src = fetchurl {
10 (fetchurl {
12 url = "https://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz";
11 url = "http://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz";
13 sha1 = "56937cd5194324adff6d207631832a9d6ba4e7f0";
12 name = "abbrev-1.0.7.tgz";
14 };
13 sha1 = "5b6035b2ee9d4fb5cf859f08a9be81b208491843";
15 };
14 })
16 "grunt-contrib-copy-1.0.0" = {
15 ];
17 name = "grunt-contrib-copy";
16 buildInputs =
18 packageName = "grunt-contrib-copy";
17 (self.nativeDeps."abbrev" or []);
19 version = "1.0.0";
18 deps = {
20 src = fetchurl {
19 };
21 url = "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-1.0.0.tgz";
20 peerDependencies = [
22 sha1 = "7060c6581e904b8ab0d00f076e0a8f6e3e7c3573";
21 ];
23 };
22 passthru.names = [ "abbrev" ];
24 };
23 };
25 "grunt-contrib-concat-0.5.1" = {
24 by-spec."amdefine".">=0.0.4" =
26 name = "grunt-contrib-concat";
25 self.by-version."amdefine"."1.0.0";
27 packageName = "grunt-contrib-concat";
26 by-version."amdefine"."1.0.0" = lib.makeOverridable self.buildNodePackage {
28 version = "0.5.1";
27 name = "amdefine-1.0.0";
29 src = fetchurl {
28 bin = false;
30 url = "https://registry.npmjs.org/grunt-contrib-concat/-/grunt-contrib-concat-0.5.1.tgz";
29 src = [
31 sha1 = "953c6efdfdfd2c107ab9c85077f2d4b24d31cd49";
30 (fetchurl {
32 };
31 url = "http://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz";
33 };
32 name = "amdefine-1.0.0.tgz";
34 "grunt-contrib-jshint-0.12.0" = {
33 sha1 = "fd17474700cb5cc9c2b709f0be9d23ce3c198c33";
35 name = "grunt-contrib-jshint";
34 })
36 packageName = "grunt-contrib-jshint";
35 ];
37 version = "0.12.0";
36 buildInputs =
38 src = fetchurl {
37 (self.nativeDeps."amdefine" or []);
39 url = "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-0.12.0.tgz";
38 deps = {
40 sha1 = "f6b2f06fc715264837a7ab6c69a1ce1a689c2c29";
39 };
41 };
40 peerDependencies = [
42 };
41 ];
43 "grunt-contrib-less-1.4.0" = {
42 passthru.names = [ "amdefine" ];
44 name = "grunt-contrib-less";
43 };
45 packageName = "grunt-contrib-less";
44 by-spec."ansi-regex"."^0.2.0" =
46 version = "1.4.0";
45 self.by-version."ansi-regex"."0.2.1";
47 src = fetchurl {
46 by-version."ansi-regex"."0.2.1" = lib.makeOverridable self.buildNodePackage {
48 url = "https://registry.npmjs.org/grunt-contrib-less/-/grunt-contrib-less-1.4.0.tgz";
47 name = "ansi-regex-0.2.1";
49 sha1 = "17ee79cad21c9720ee07b3a991fab5103b513514";
48 bin = false;
50 };
49 src = [
51 };
50 (fetchurl {
52 "grunt-contrib-watch-0.6.1" = {
51 url = "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz";
53 name = "grunt-contrib-watch";
52 name = "ansi-regex-0.2.1.tgz";
54 packageName = "grunt-contrib-watch";
53 sha1 = "0d8e946967a3d8143f93e24e298525fc1b2235f9";
55 version = "0.6.1";
54 })
56 src = fetchurl {
55 ];
57 url = "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-0.6.1.tgz";
56 buildInputs =
58 sha1 = "64fdcba25a635f5b4da1b6ce6f90da0aeb6e3f15";
57 (self.nativeDeps."ansi-regex" or []);
59 };
58 deps = {
60 };
59 };
61 "crisper-2.0.2" = {
60 peerDependencies = [
62 name = "crisper";
61 ];
63 packageName = "crisper";
62 passthru.names = [ "ansi-regex" ];
64 version = "2.0.2";
63 };
65 src = fetchurl {
64 by-spec."ansi-regex"."^0.2.1" =
66 url = "https://registry.npmjs.org/crisper/-/crisper-2.0.2.tgz";
65 self.by-version."ansi-regex"."0.2.1";
67 sha1 = "188a7da3d00dcf0c64eff7f253d23dacffba7197";
66 by-spec."ansi-regex"."^2.0.0" =
68 };
67 self.by-version."ansi-regex"."2.0.0";
69 };
68 by-version."ansi-regex"."2.0.0" = lib.makeOverridable self.buildNodePackage {
70 "vulcanize-1.14.8" = {
69 name = "ansi-regex-2.0.0";
71 name = "vulcanize";
70 bin = false;
72 packageName = "vulcanize";
71 src = [
73 version = "1.14.8";
72 (fetchurl {
74 src = fetchurl {
73 url = "http://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz";
75 url = "https://registry.npmjs.org/vulcanize/-/vulcanize-1.14.8.tgz";
74 name = "ansi-regex-2.0.0.tgz";
76 sha1 = "3cdd6f81d9baf2c5796ddd6d2d289e45975086f7";
75 sha1 = "c5061b6e0ef8a81775e50f5d66151bf6bf371107";
77 };
76 })
78 };
77 ];
79 "grunt-crisper-1.0.1" = {
78 buildInputs =
80 name = "grunt-crisper";
79 (self.nativeDeps."ansi-regex" or []);
81 packageName = "grunt-crisper";
80 deps = {
82 version = "1.0.1";
81 };
83 src = fetchurl {
82 peerDependencies = [
84 url = "https://registry.npmjs.org/grunt-crisper/-/grunt-crisper-1.0.1.tgz";
83 ];
85 sha1 = "e7c091dcaff10deb0091e3035ca7e54008991fe7";
84 passthru.names = [ "ansi-regex" ];
86 };
85 };
87 };
86 by-spec."ansi-styles"."^1.1.0" =
88 "grunt-vulcanize-1.0.0" = {
87 self.by-version."ansi-styles"."1.1.0";
89 name = "grunt-vulcanize";
88 by-version."ansi-styles"."1.1.0" = lib.makeOverridable self.buildNodePackage {
90 packageName = "grunt-vulcanize";
89 name = "ansi-styles-1.1.0";
91 version = "1.0.0";
90 bin = false;
92 src = fetchurl {
91 src = [
93 url = "https://registry.npmjs.org/grunt-vulcanize/-/grunt-vulcanize-1.0.0.tgz";
92 (fetchurl {
94 sha1 = "f4d6cfef274f8216c06f6c290e7dbb3b9e9e3b0f";
93 url = "http://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz";
95 };
94 name = "ansi-styles-1.1.0.tgz";
96 };
95 sha1 = "eaecbf66cd706882760b2f4691582b8f55d7a7de";
97 "jshint-2.9.3" = {
96 })
98 name = "jshint";
97 ];
99 packageName = "jshint";
98 buildInputs =
100 version = "2.9.3";
99 (self.nativeDeps."ansi-styles" or []);
101 src = fetchurl {
100 deps = {
102 url = "https://registry.npmjs.org/jshint/-/jshint-2.9.3.tgz";
101 };
103 sha1 = "a2e14ff85c2d6bf8c8080e5aa55129ebc6a2d320";
102 peerDependencies = [
104 };
103 ];
105 };
104 passthru.names = [ "ansi-styles" ];
106 "async-0.1.22" = {
105 };
107 name = "async";
106 by-spec."ansi-styles"."^2.1.0" =
108 packageName = "async";
107 self.by-version."ansi-styles"."2.1.0";
109 version = "0.1.22";
108 by-version."ansi-styles"."2.1.0" = lib.makeOverridable self.buildNodePackage {
110 src = fetchurl {
109 name = "ansi-styles-2.1.0";
111 url = "https://registry.npmjs.org/async/-/async-0.1.22.tgz";
110 bin = false;
112 sha1 = "0fc1aaa088a0e3ef0ebe2d8831bab0dcf8845061";
111 src = [
113 };
112 (fetchurl {
114 };
113 url = "http://registry.npmjs.org/ansi-styles/-/ansi-styles-2.1.0.tgz";
115 "coffee-script-1.3.3" = {
114 name = "ansi-styles-2.1.0.tgz";
116 name = "coffee-script";
115 sha1 = "990f747146927b559a932bf92959163d60c0d0e2";
117 packageName = "coffee-script";
116 })
118 version = "1.3.3";
117 ];
119 src = fetchurl {
118 buildInputs =
120 url = "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz";
119 (self.nativeDeps."ansi-styles" or []);
121 sha1 = "150d6b4cb522894369efed6a2101c20bc7f4a4f4";
120 deps = {
122 };
121 };
123 };
122 peerDependencies = [
124 "colors-0.6.2" = {
123 ];
125 name = "colors";
124 passthru.names = [ "ansi-styles" ];
126 packageName = "colors";
125 };
127 version = "0.6.2";
126 by-spec."argparse"."~ 0.1.11" =
128 src = fetchurl {
127 self.by-version."argparse"."0.1.16";
129 url = "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz";
128 by-version."argparse"."0.1.16" = lib.makeOverridable self.buildNodePackage {
130 sha1 = "2423fe6678ac0c5dae8852e5d0e5be08c997abcc";
129 name = "argparse-0.1.16";
131 };
130 bin = false;
132 };
131 src = [
133 "dateformat-1.0.2-1.2.3" = {
132 (fetchurl {
134 name = "dateformat";
133 url = "http://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz";
135 packageName = "dateformat";
134 name = "argparse-0.1.16.tgz";
136 version = "1.0.2-1.2.3";
137 src = fetchurl {
138 url = "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz";
139 sha1 = "b0220c02de98617433b72851cf47de3df2cdbee9";
140 };
141 };
142 "eventemitter2-0.4.14" = {
143 name = "eventemitter2";
144 packageName = "eventemitter2";
145 version = "0.4.14";
146 src = fetchurl {
147 url = "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz";
148 sha1 = "8f61b75cde012b2e9eb284d4545583b5643b61ab";
149 };
150 };
151 "findup-sync-0.1.3" = {
152 name = "findup-sync";
153 packageName = "findup-sync";
154 version = "0.1.3";
155 src = fetchurl {
156 url = "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz";
157 sha1 = "7f3e7a97b82392c653bf06589bd85190e93c3683";
158 };
159 };
160 "glob-3.1.21" = {
161 name = "glob";
162 packageName = "glob";
163 version = "3.1.21";
164 src = fetchurl {
165 url = "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz";
166 sha1 = "d29e0a055dea5138f4d07ed40e8982e83c2066cd";
167 };
168 };
169 "hooker-0.2.3" = {
170 name = "hooker";
171 packageName = "hooker";
172 version = "0.2.3";
173 src = fetchurl {
174 url = "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz";
175 sha1 = "b834f723cc4a242aa65963459df6d984c5d3d959";
176 };
177 };
178 "iconv-lite-0.2.11" = {
179 name = "iconv-lite";
180 packageName = "iconv-lite";
181 version = "0.2.11";
182 src = fetchurl {
183 url = "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz";
184 sha1 = "1ce60a3a57864a292d1321ff4609ca4bb965adc8";
185 };
186 };
187 "minimatch-0.2.14" = {
188 name = "minimatch";
189 packageName = "minimatch";
190 version = "0.2.14";
191 src = fetchurl {
192 url = "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz";
193 sha1 = "c74e780574f63c6f9a090e90efbe6ef53a6a756a";
194 };
195 };
196 "nopt-1.0.10" = {
197 name = "nopt";
198 packageName = "nopt";
199 version = "1.0.10";
200 src = fetchurl {
201 url = "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz";
202 sha1 = "6ddd21bd2a31417b92727dd585f8a6f37608ebee";
203 };
204 };
205 "rimraf-2.2.8" = {
206 name = "rimraf";
207 packageName = "rimraf";
208 version = "2.2.8";
209 src = fetchurl {
210 url = "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz";
211 sha1 = "e439be2aaee327321952730f99a8929e4fc50582";
212 };
213 };
214 "lodash-0.9.2" = {
215 name = "lodash";
216 packageName = "lodash";
217 version = "0.9.2";
218 src = fetchurl {
219 url = "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz";
220 sha1 = "8f3499c5245d346d682e5b0d3b40767e09f1a92c";
221 };
222 };
223 "underscore.string-2.2.1" = {
224 name = "underscore.string";
225 packageName = "underscore.string";
226 version = "2.2.1";
227 src = fetchurl {
228 url = "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz";
229 sha1 = "d7c0fa2af5d5a1a67f4253daee98132e733f0f19";
230 };
231 };
232 "which-1.0.9" = {
233 name = "which";
234 packageName = "which";
235 version = "1.0.9";
236 src = fetchurl {
237 url = "https://registry.npmjs.org/which/-/which-1.0.9.tgz";
238 sha1 = "460c1da0f810103d0321a9b633af9e575e64486f";
239 };
240 };
241 "js-yaml-2.0.5" = {
242 name = "js-yaml";
243 packageName = "js-yaml";
244 version = "2.0.5";
245 src = fetchurl {
246 url = "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz";
247 sha1 = "a25ae6509999e97df278c6719da11bd0687743a8";
248 };
249 };
250 "exit-0.1.2" = {
251 name = "exit";
252 packageName = "exit";
253 version = "0.1.2";
254 src = fetchurl {
255 url = "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz";
256 sha1 = "0632638f8d877cc82107d30a0fff1a17cba1cd0c";
257 };
258 };
259 "getobject-0.1.0" = {
260 name = "getobject";
261 packageName = "getobject";
262 version = "0.1.0";
263 src = fetchurl {
264 url = "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz";
265 sha1 = "047a449789fa160d018f5486ed91320b6ec7885c";
266 };
267 };
268 "grunt-legacy-util-0.2.0" = {
269 name = "grunt-legacy-util";
270 packageName = "grunt-legacy-util";
271 version = "0.2.0";
272 src = fetchurl {
273 url = "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz";
274 sha1 = "93324884dbf7e37a9ff7c026dff451d94a9e554b";
275 };
276 };
277 "grunt-legacy-log-0.1.3" = {
278 name = "grunt-legacy-log";
279 packageName = "grunt-legacy-log";
280 version = "0.1.3";
281 src = fetchurl {
282 url = "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz";
283 sha1 = "ec29426e803021af59029f87d2f9cd7335a05531";
284 };
285 };
286 "glob-3.2.11" = {
287 name = "glob";
288 packageName = "glob";
289 version = "3.2.11";
290 src = fetchurl {
291 url = "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz";
292 sha1 = "4a973f635b9190f715d10987d5c00fd2815ebe3d";
293 };
294 };
295 "lodash-2.4.2" = {
296 name = "lodash";
297 packageName = "lodash";
298 version = "2.4.2";
299 src = fetchurl {
300 url = "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz";
301 sha1 = "fadd834b9683073da179b3eae6d9c0d15053f73e";
302 };
303 };
304 "inherits-2.0.1" = {
305 name = "inherits";
306 packageName = "inherits";
307 version = "2.0.1";
308 src = fetchurl {
309 url = "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz";
310 sha1 = "b17d08d326b4423e568eff719f91b0b1cbdf69f1";
311 };
312 };
313 "minimatch-0.3.0" = {
314 name = "minimatch";
315 packageName = "minimatch";
316 version = "0.3.0";
317 src = fetchurl {
318 url = "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz";
319 sha1 = "275d8edaac4f1bb3326472089e7949c8394699dd";
320 };
321 };
322 "lru-cache-2.7.3" = {
323 name = "lru-cache";
324 packageName = "lru-cache";
325 version = "2.7.3";
326 src = fetchurl {
327 url = "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz";
328 sha1 = "6d4524e8b955f95d4f5b58851ce21dd72fb4e952";
329 };
330 };
331 "sigmund-1.0.1" = {
332 name = "sigmund";
333 packageName = "sigmund";
334 version = "1.0.1";
335 src = fetchurl {
336 url = "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz";
337 sha1 = "3ff21f198cad2175f9f3b781853fd94d0d19b590";
338 };
339 };
340 "graceful-fs-1.2.3" = {
341 name = "graceful-fs";
342 packageName = "graceful-fs";
343 version = "1.2.3";
344 src = fetchurl {
345 url = "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz";
346 sha1 = "15a4806a57547cb2d2dbf27f42e89a8c3451b364";
347 };
348 };
349 "inherits-1.0.2" = {
350 name = "inherits";
351 packageName = "inherits";
352 version = "1.0.2";
353 src = fetchurl {
354 url = "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz";
355 sha1 = "ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b";
356 };
357 };
358 "abbrev-1.0.9" = {
359 name = "abbrev";
360 packageName = "abbrev";
361 version = "1.0.9";
362 src = fetchurl {
363 url = "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz";
364 sha1 = "91b4792588a7738c25f35dd6f63752a2f8776135";
365 };
366 };
367 "argparse-0.1.16" = {
368 name = "argparse";
369 packageName = "argparse";
370 version = "0.1.16";
371 src = fetchurl {
372 url = "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz";
135 sha1 = "cfd01e0fbba3d6caed049fbd758d40f65196f57c";
373 sha1 = "cfd01e0fbba3d6caed049fbd758d40f65196f57c";
136 })
374 };
137 ];
375 };
138 buildInputs =
376 "esprima-1.0.4" = {
139 (self.nativeDeps."argparse" or []);
377 name = "esprima";
140 deps = {
378 packageName = "esprima";
141 "underscore-1.7.0" = self.by-version."underscore"."1.7.0";
379 version = "1.0.4";
142 "underscore.string-2.4.0" = self.by-version."underscore.string"."2.4.0";
380 src = fetchurl {
143 };
381 url = "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz";
144 peerDependencies = [
382 sha1 = "9f557e08fc3b4d26ece9dd34f8fbf476b62585ad";
145 ];
383 };
146 passthru.names = [ "argparse" ];
384 };
147 };
385 "underscore-1.7.0" = {
148 by-spec."asap"."~1.0.0" =
386 name = "underscore";
149 self.by-version."asap"."1.0.0";
387 packageName = "underscore";
150 by-version."asap"."1.0.0" = lib.makeOverridable self.buildNodePackage {
388 version = "1.7.0";
151 name = "asap-1.0.0";
389 src = fetchurl {
152 bin = false;
390 url = "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz";
153 src = [
391 sha1 = "6bbaf0877500d36be34ecaa584e0db9fef035209";
154 (fetchurl {
392 };
155 url = "http://registry.npmjs.org/asap/-/asap-1.0.0.tgz";
393 };
156 name = "asap-1.0.0.tgz";
394 "underscore.string-2.4.0" = {
157 sha1 = "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d";
395 name = "underscore.string";
158 })
396 packageName = "underscore.string";
159 ];
397 version = "2.4.0";
160 buildInputs =
398 src = fetchurl {
161 (self.nativeDeps."asap" or []);
399 url = "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz";
162 deps = {
400 sha1 = "8cdd8fbac4e2d2ea1e7e2e8097c42f442280f85b";
163 };
401 };
164 peerDependencies = [
402 };
165 ];
403 "grunt-legacy-log-utils-0.1.1" = {
166 passthru.names = [ "asap" ];
404 name = "grunt-legacy-log-utils";
167 };
405 packageName = "grunt-legacy-log-utils";
168 by-spec."asn1".">=0.2.3 <0.3.0" =
406 version = "0.1.1";
169 self.by-version."asn1"."0.2.3";
407 src = fetchurl {
170 by-version."asn1"."0.2.3" = lib.makeOverridable self.buildNodePackage {
408 url = "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz";
171 name = "asn1-0.2.3";
409 sha1 = "c0706b9dd9064e116f36f23fe4e6b048672c0f7e";
172 bin = false;
410 };
173 src = [
411 };
174 (fetchurl {
412 "underscore.string-2.3.3" = {
175 url = "http://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz";
413 name = "underscore.string";
176 name = "asn1-0.2.3.tgz";
414 packageName = "underscore.string";
177 sha1 = "dac8787713c9966849fc8180777ebe9c1ddf3b86";
415 version = "2.3.3";
178 })
416 src = fetchurl {
179 ];
417 url = "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz";
180 buildInputs =
418 sha1 = "71c08bf6b428b1133f37e78fa3a21c82f7329b0d";
181 (self.nativeDeps."asn1" or []);
419 };
182 deps = {
420 };
183 };
421 "chalk-1.1.3" = {
184 peerDependencies = [
422 name = "chalk";
185 ];
423 packageName = "chalk";
186 passthru.names = [ "asn1" ];
424 version = "1.1.3";
187 };
425 src = fetchurl {
188 by-spec."assert-plus".">=0.2.0 <0.3.0" =
426 url = "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz";
189 self.by-version."assert-plus"."0.2.0";
427 sha1 = "a8115c55e4a702fe4d150abd3872822a7e09fc98";
190 by-version."assert-plus"."0.2.0" = lib.makeOverridable self.buildNodePackage {
428 };
191 name = "assert-plus-0.2.0";
429 };
192 bin = false;
430 "file-sync-cmp-0.1.1" = {
193 src = [
431 name = "file-sync-cmp";
194 (fetchurl {
432 packageName = "file-sync-cmp";
195 url = "http://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz";
433 version = "0.1.1";
196 name = "assert-plus-0.2.0.tgz";
434 src = fetchurl {
197 sha1 = "d74e1b87e7affc0db8aadb7021f3fe48101ab234";
435 url = "https://registry.npmjs.org/file-sync-cmp/-/file-sync-cmp-0.1.1.tgz";
198 })
436 sha1 = "a5e7a8ffbfa493b43b923bbd4ca89a53b63b612b";
199 ];
437 };
200 buildInputs =
438 };
201 (self.nativeDeps."assert-plus" or []);
439 "ansi-styles-2.2.1" = {
202 deps = {
440 name = "ansi-styles";
203 };
441 packageName = "ansi-styles";
204 peerDependencies = [
442 version = "2.2.1";
205 ];
443 src = fetchurl {
206 passthru.names = [ "assert-plus" ];
444 url = "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz";
207 };
445 sha1 = "b432dd3358b634cf75e1e4664368240533c1ddbe";
208 by-spec."assert-plus"."^0.1.5" =
446 };
209 self.by-version."assert-plus"."0.1.5";
447 };
210 by-version."assert-plus"."0.1.5" = lib.makeOverridable self.buildNodePackage {
448 "escape-string-regexp-1.0.5" = {
211 name = "assert-plus-0.1.5";
449 name = "escape-string-regexp";
212 bin = false;
450 packageName = "escape-string-regexp";
213 src = [
451 version = "1.0.5";
214 (fetchurl {
452 src = fetchurl {
215 url = "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz";
453 url = "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz";
216 name = "assert-plus-0.1.5.tgz";
454 sha1 = "1b61c0562190a8dff6ae3bb2cf0200ca130b86d4";
217 sha1 = "ee74009413002d84cec7219c6ac811812e723160";
455 };
218 })
456 };
219 ];
457 "has-ansi-2.0.0" = {
220 buildInputs =
458 name = "has-ansi";
221 (self.nativeDeps."assert-plus" or []);
459 packageName = "has-ansi";
222 deps = {
460 version = "2.0.0";
223 };
461 src = fetchurl {
224 peerDependencies = [
462 url = "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz";
225 ];
463 sha1 = "34f5049ce1ecdf2b0649af3ef24e45ed35416d91";
226 passthru.names = [ "assert-plus" ];
464 };
227 };
465 };
228 by-spec."assert-plus"."^0.2.0" =
466 "strip-ansi-3.0.1" = {
229 self.by-version."assert-plus"."0.2.0";
467 name = "strip-ansi";
230 by-spec."async"."^0.9.0" =
468 packageName = "strip-ansi";
231 self.by-version."async"."0.9.2";
469 version = "3.0.1";
232 by-version."async"."0.9.2" = lib.makeOverridable self.buildNodePackage {
470 src = fetchurl {
233 name = "async-0.9.2";
471 url = "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz";
234 bin = false;
472 sha1 = "6a385fb8853d952d5ff05d0e8aaf94278dc63dcf";
235 src = [
473 };
236 (fetchurl {
474 };
237 url = "http://registry.npmjs.org/async/-/async-0.9.2.tgz";
475 "supports-color-2.0.0" = {
238 name = "async-0.9.2.tgz";
476 name = "supports-color";
239 sha1 = "aea74d5e61c1f899613bf64bda66d4c78f2fd17d";
477 packageName = "supports-color";
240 })
478 version = "2.0.0";
241 ];
479 src = fetchurl {
242 buildInputs =
480 url = "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz";
243 (self.nativeDeps."async" or []);
481 sha1 = "535d045ce6b6363fa40117084629995e9df324c7";
244 deps = {
482 };
245 };
483 };
246 peerDependencies = [
484 "ansi-regex-2.0.0" = {
247 ];
485 name = "ansi-regex";
248 passthru.names = [ "async" ];
486 packageName = "ansi-regex";
249 };
487 version = "2.0.0";
250 by-spec."async"."^1.4.0" =
488 src = fetchurl {
251 self.by-version."async"."1.5.2";
489 url = "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz";
252 by-version."async"."1.5.2" = lib.makeOverridable self.buildNodePackage {
490 sha1 = "c5061b6e0ef8a81775e50f5d66151bf6bf371107";
253 name = "async-1.5.2";
491 };
254 bin = false;
492 };
255 src = [
493 "chalk-0.5.1" = {
256 (fetchurl {
494 name = "chalk";
257 url = "http://registry.npmjs.org/async/-/async-1.5.2.tgz";
495 packageName = "chalk";
258 name = "async-1.5.2.tgz";
496 version = "0.5.1";
259 sha1 = "ec6a61ae56480c0c3cb241c95618e20892f9672a";
497 src = fetchurl {
260 })
498 url = "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz";
261 ];
499 sha1 = "663b3a648b68b55d04690d49167aa837858f2174";
262 buildInputs =
500 };
263 (self.nativeDeps."async" or []);
501 };
264 deps = {
502 "source-map-0.3.0" = {
265 };
503 name = "source-map";
266 peerDependencies = [
504 packageName = "source-map";
267 ];
505 version = "0.3.0";
268 passthru.names = [ "async" ];
506 src = fetchurl {
269 };
507 url = "https://registry.npmjs.org/source-map/-/source-map-0.3.0.tgz";
270 by-spec."async"."~0.1.22" =
508 sha1 = "8586fb9a5a005e5b501e21cd18b6f21b457ad1f9";
271 self.by-version."async"."0.1.22";
509 };
272 by-version."async"."0.1.22" = lib.makeOverridable self.buildNodePackage {
510 };
273 name = "async-0.1.22";
511 "ansi-styles-1.1.0" = {
274 bin = false;
512 name = "ansi-styles";
275 src = [
513 packageName = "ansi-styles";
276 (fetchurl {
514 version = "1.1.0";
277 url = "http://registry.npmjs.org/async/-/async-0.1.22.tgz";
515 src = fetchurl {
278 name = "async-0.1.22.tgz";
516 url = "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz";
279 sha1 = "0fc1aaa088a0e3ef0ebe2d8831bab0dcf8845061";
517 sha1 = "eaecbf66cd706882760b2f4691582b8f55d7a7de";
280 })
518 };
281 ];
519 };
282 buildInputs =
520 "has-ansi-0.1.0" = {
283 (self.nativeDeps."async" or []);
521 name = "has-ansi";
284 deps = {
522 packageName = "has-ansi";
285 };
523 version = "0.1.0";
286 peerDependencies = [
524 src = fetchurl {
287 ];
525 url = "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz";
288 passthru.names = [ "async" ];
526 sha1 = "84f265aae8c0e6a88a12d7022894b7568894c62e";
289 };
527 };
290 by-spec."async"."~0.2.9" =
528 };
291 self.by-version."async"."0.2.10";
529 "strip-ansi-0.3.0" = {
292 by-version."async"."0.2.10" = lib.makeOverridable self.buildNodePackage {
530 name = "strip-ansi";
293 name = "async-0.2.10";
531 packageName = "strip-ansi";
294 bin = false;
532 version = "0.3.0";
295 src = [
533 src = fetchurl {
296 (fetchurl {
534 url = "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz";
297 url = "http://registry.npmjs.org/async/-/async-0.2.10.tgz";
535 sha1 = "25f48ea22ca79187f3174a4db8759347bb126220";
298 name = "async-0.2.10.tgz";
536 };
537 };
538 "supports-color-0.2.0" = {
539 name = "supports-color";
540 packageName = "supports-color";
541 version = "0.2.0";
542 src = fetchurl {
543 url = "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz";
544 sha1 = "d92de2694eb3f67323973d7ae3d8b55b4c22190a";
545 };
546 };
547 "ansi-regex-0.2.1" = {
548 name = "ansi-regex";
549 packageName = "ansi-regex";
550 version = "0.2.1";
551 src = fetchurl {
552 url = "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz";
553 sha1 = "0d8e946967a3d8143f93e24e298525fc1b2235f9";
554 };
555 };
556 "amdefine-1.0.0" = {
557 name = "amdefine";
558 packageName = "amdefine";
559 version = "1.0.0";
560 src = fetchurl {
561 url = "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz";
562 sha1 = "fd17474700cb5cc9c2b709f0be9d23ce3c198c33";
563 };
564 };
565 "async-2.0.1" = {
566 name = "async";
567 packageName = "async";
568 version = "2.0.1";
569 src = fetchurl {
570 url = "https://registry.npmjs.org/async/-/async-2.0.1.tgz";
571 sha1 = "b709cc0280a9c36f09f4536be823c838a9049e25";
572 };
573 };
574 "less-2.7.1" = {
575 name = "less";
576 packageName = "less";
577 version = "2.7.1";
578 src = fetchurl {
579 url = "https://registry.npmjs.org/less/-/less-2.7.1.tgz";
580 sha1 = "6cbfea22b3b830304e9a5fb371d54fa480c9d7cf";
581 };
582 };
583 "lodash-4.15.0" = {
584 name = "lodash";
585 packageName = "lodash";
586 version = "4.15.0";
587 src = fetchurl {
588 url = "https://registry.npmjs.org/lodash/-/lodash-4.15.0.tgz";
589 sha1 = "3162391d8f0140aa22cf8f6b3c34d6b7f63d3aa9";
590 };
591 };
592 "errno-0.1.4" = {
593 name = "errno";
594 packageName = "errno";
595 version = "0.1.4";
596 src = fetchurl {
597 url = "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz";
598 sha1 = "b896e23a9e5e8ba33871fc996abd3635fc9a1c7d";
599 };
600 };
601 "graceful-fs-4.1.6" = {
602 name = "graceful-fs";
603 packageName = "graceful-fs";
604 version = "4.1.6";
605 src = fetchurl {
606 url = "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.6.tgz";
607 sha1 = "514c38772b31bee2e08bedc21a0aeb3abf54c19e";
608 };
609 };
610 "image-size-0.5.0" = {
611 name = "image-size";
612 packageName = "image-size";
613 version = "0.5.0";
614 src = fetchurl {
615 url = "https://registry.npmjs.org/image-size/-/image-size-0.5.0.tgz";
616 sha1 = "be7aed1c37b5ac3d9ba1d66a24b4c47ff8397651";
617 };
618 };
619 "mime-1.3.4" = {
620 name = "mime";
621 packageName = "mime";
622 version = "1.3.4";
623 src = fetchurl {
624 url = "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz";
625 sha1 = "115f9e3b6b3daf2959983cb38f149a2d40eb5d53";
626 };
627 };
628 "mkdirp-0.5.1" = {
629 name = "mkdirp";
630 packageName = "mkdirp";
631 version = "0.5.1";
632 src = fetchurl {
633 url = "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz";
634 sha1 = "30057438eac6cf7f8c4767f38648d6697d75c903";
635 };
636 };
637 "promise-7.1.1" = {
638 name = "promise";
639 packageName = "promise";
640 version = "7.1.1";
641 src = fetchurl {
642 url = "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz";
643 sha1 = "489654c692616b8aa55b0724fa809bb7db49c5bf";
644 };
645 };
646 "source-map-0.5.6" = {
647 name = "source-map";
648 packageName = "source-map";
649 version = "0.5.6";
650 src = fetchurl {
651 url = "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz";
652 sha1 = "75ce38f52bf0733c5a7f0c118d81334a2bb5f412";
653 };
654 };
655 "prr-0.0.0" = {
656 name = "prr";
657 packageName = "prr";
658 version = "0.0.0";
659 src = fetchurl {
660 url = "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz";
661 sha1 = "1a84b85908325501411853d0081ee3fa86e2926a";
662 };
663 };
664 "minimist-0.0.8" = {
665 name = "minimist";
666 packageName = "minimist";
667 version = "0.0.8";
668 src = fetchurl {
669 url = "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz";
670 sha1 = "857fcabfc3397d2625b8228262e86aa7a011b05d";
671 };
672 };
673 "asap-2.0.4" = {
674 name = "asap";
675 packageName = "asap";
676 version = "2.0.4";
677 src = fetchurl {
678 url = "https://registry.npmjs.org/asap/-/asap-2.0.4.tgz";
679 sha1 = "b391bf7f6bfbc65706022fec8f49c4b07fecf589";
680 };
681 };
682 "gaze-0.5.2" = {
683 name = "gaze";
684 packageName = "gaze";
685 version = "0.5.2";
686 src = fetchurl {
687 url = "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz";
688 sha1 = "40b709537d24d1d45767db5a908689dfe69ac44f";
689 };
690 };
691 "tiny-lr-fork-0.0.5" = {
692 name = "tiny-lr-fork";
693 packageName = "tiny-lr-fork";
694 version = "0.0.5";
695 src = fetchurl {
696 url = "https://registry.npmjs.org/tiny-lr-fork/-/tiny-lr-fork-0.0.5.tgz";
697 sha1 = "1e99e1e2a8469b736ab97d97eefa98c71f76ed0a";
698 };
699 };
700 "async-0.2.10" = {
701 name = "async";
702 packageName = "async";
703 version = "0.2.10";
704 src = fetchurl {
705 url = "https://registry.npmjs.org/async/-/async-0.2.10.tgz";
299 sha1 = "b6bbe0b0674b9d719708ca38de8c237cb526c3d1";
706 sha1 = "b6bbe0b0674b9d719708ca38de8c237cb526c3d1";
300 })
707 };
301 ];
708 };
302 buildInputs =
709 "globule-0.1.0" = {
303 (self.nativeDeps."async" or []);
710 name = "globule";
304 deps = {
711 packageName = "globule";
305 };
712 version = "0.1.0";
306 peerDependencies = [
713 src = fetchurl {
307 ];
714 url = "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz";
308 passthru.names = [ "async" ];
715 sha1 = "d9c8edde1da79d125a151b79533b978676346ae5";
309 };
716 };
310 by-spec."aws-sign2"."~0.6.0" =
717 };
311 self.by-version."aws-sign2"."0.6.0";
718 "lodash-1.0.2" = {
312 by-version."aws-sign2"."0.6.0" = lib.makeOverridable self.buildNodePackage {
719 name = "lodash";
313 name = "aws-sign2-0.6.0";
720 packageName = "lodash";
314 bin = false;
721 version = "1.0.2";
315 src = [
722 src = fetchurl {
316 (fetchurl {
723 url = "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz";
317 url = "http://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz";
724 sha1 = "8f57560c83b59fc270bd3d561b690043430e2551";
318 name = "aws-sign2-0.6.0.tgz";
725 };
319 sha1 = "14342dd38dbcc94d0e5b87d763cd63612c0e794f";
726 };
320 })
727 "qs-0.5.6" = {
321 ];
728 name = "qs";
322 buildInputs =
729 packageName = "qs";
323 (self.nativeDeps."aws-sign2" or []);
730 version = "0.5.6";
324 deps = {
731 src = fetchurl {
325 };
732 url = "https://registry.npmjs.org/qs/-/qs-0.5.6.tgz";
326 peerDependencies = [
733 sha1 = "31b1ad058567651c526921506b9a8793911a0384";
327 ];
734 };
328 passthru.names = [ "aws-sign2" ];
735 };
329 };
736 "faye-websocket-0.4.4" = {
330 by-spec."balanced-match"."^0.3.0" =
737 name = "faye-websocket";
331 self.by-version."balanced-match"."0.3.0";
738 packageName = "faye-websocket";
332 by-version."balanced-match"."0.3.0" = lib.makeOverridable self.buildNodePackage {
739 version = "0.4.4";
333 name = "balanced-match-0.3.0";
740 src = fetchurl {
334 bin = false;
741 url = "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.4.4.tgz";
335 src = [
742 sha1 = "c14c5b3bf14d7417ffbfd990c0a7495cd9f337bc";
336 (fetchurl {
743 };
337 url = "http://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz";
744 };
338 name = "balanced-match-0.3.0.tgz";
745 "noptify-0.0.3" = {
339 sha1 = "a91cdd1ebef1a86659e70ff4def01625fc2d6756";
746 name = "noptify";
340 })
747 packageName = "noptify";
341 ];
748 version = "0.0.3";
342 buildInputs =
749 src = fetchurl {
343 (self.nativeDeps."balanced-match" or []);
750 url = "https://registry.npmjs.org/noptify/-/noptify-0.0.3.tgz";
344 deps = {
751 sha1 = "58f654a73d9753df0c51d9686dc92104a67f4bbb";
345 };
752 };
346 peerDependencies = [
753 };
347 ];
754 "debug-0.7.4" = {
348 passthru.names = [ "balanced-match" ];
755 name = "debug";
349 };
756 packageName = "debug";
350 by-spec."bl"."~1.0.0" =
757 version = "0.7.4";
351 self.by-version."bl"."1.0.1";
758 src = fetchurl {
352 by-version."bl"."1.0.1" = lib.makeOverridable self.buildNodePackage {
759 url = "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz";
353 name = "bl-1.0.1";
760 sha1 = "06e1ea8082c2cb14e39806e22e2f6f757f92af39";
354 bin = false;
761 };
355 src = [
762 };
356 (fetchurl {
763 "nopt-2.0.0" = {
357 url = "http://registry.npmjs.org/bl/-/bl-1.0.1.tgz";
764 name = "nopt";
358 name = "bl-1.0.1.tgz";
765 packageName = "nopt";
359 sha1 = "0e6df7330308c46515751676cafa7334dc9852fd";
766 version = "2.0.0";
360 })
767 src = fetchurl {
361 ];
768 url = "https://registry.npmjs.org/nopt/-/nopt-2.0.0.tgz";
362 buildInputs =
769 sha1 = "ca7416f20a5e3f9c3b86180f96295fa3d0b52e0d";
363 (self.nativeDeps."bl" or []);
770 };
364 deps = {
771 };
365 "readable-stream-2.0.5" = self.by-version."readable-stream"."2.0.5";
772 "command-line-args-2.1.6" = {
366 };
773 name = "command-line-args";
367 peerDependencies = [
774 packageName = "command-line-args";
368 ];
775 version = "2.1.6";
369 passthru.names = [ "bl" ];
776 src = fetchurl {
370 };
777 url = "https://registry.npmjs.org/command-line-args/-/command-line-args-2.1.6.tgz";
371 by-spec."boom"."2.x.x" =
778 sha1 = "f197d6eaff34c9085577484b2864375b294f5697";
372 self.by-version."boom"."2.10.1";
779 };
373 by-version."boom"."2.10.1" = lib.makeOverridable self.buildNodePackage {
780 };
374 name = "boom-2.10.1";
781 "dom5-1.3.3" = {
375 bin = false;
782 name = "dom5";
376 src = [
783 packageName = "dom5";
377 (fetchurl {
784 version = "1.3.3";
378 url = "http://registry.npmjs.org/boom/-/boom-2.10.1.tgz";
785 src = fetchurl {
379 name = "boom-2.10.1.tgz";
786 url = "https://registry.npmjs.org/dom5/-/dom5-1.3.3.tgz";
380 sha1 = "39c8918ceff5799f83f9492a848f625add0c766f";
787 sha1 = "07e514522c245c7aa8512aa3f9118e8bcab9f909";
381 })
788 };
382 ];
789 };
383 buildInputs =
790 "array-back-1.0.3" = {
384 (self.nativeDeps."boom" or []);
791 name = "array-back";
385 deps = {
792 packageName = "array-back";
386 "hoek-2.16.3" = self.by-version."hoek"."2.16.3";
793 version = "1.0.3";
387 };
794 src = fetchurl {
388 peerDependencies = [
795 url = "https://registry.npmjs.org/array-back/-/array-back-1.0.3.tgz";
389 ];
796 sha1 = "f1128a5cf1b91c80bed4a218f8c5b635c8b10663";
390 passthru.names = [ "boom" ];
797 };
391 };
798 };
392 by-spec."brace-expansion"."^1.0.0" =
799 "command-line-usage-2.0.5" = {
393 self.by-version."brace-expansion"."1.1.2";
800 name = "command-line-usage";
394 by-version."brace-expansion"."1.1.2" = lib.makeOverridable self.buildNodePackage {
801 packageName = "command-line-usage";
395 name = "brace-expansion-1.1.2";
802 version = "2.0.5";
396 bin = false;
803 src = fetchurl {
397 src = [
804 url = "https://registry.npmjs.org/command-line-usage/-/command-line-usage-2.0.5.tgz";
398 (fetchurl {
805 sha1 = "f80c35ca5e8624841923ea3be3b9bfbf4f7be27b";
399 url = "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz";
806 };
400 name = "brace-expansion-1.1.2.tgz";
807 };
401 sha1 = "f21445d0488b658e2771efd870eff51df29f04ef";
808 "core-js-2.4.1" = {
402 })
809 name = "core-js";
403 ];
810 packageName = "core-js";
404 buildInputs =
811 version = "2.4.1";
405 (self.nativeDeps."brace-expansion" or []);
812 src = fetchurl {
406 deps = {
813 url = "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz";
407 "balanced-match-0.3.0" = self.by-version."balanced-match"."0.3.0";
814 sha1 = "4de911e667b0eae9124e34254b53aea6fc618d3e";
408 "concat-map-0.0.1" = self.by-version."concat-map"."0.0.1";
815 };
409 };
816 };
410 peerDependencies = [
817 "feature-detect-es6-1.3.1" = {
411 ];
818 name = "feature-detect-es6";
412 passthru.names = [ "brace-expansion" ];
819 packageName = "feature-detect-es6";
413 };
820 version = "1.3.1";
414 by-spec."caseless"."~0.11.0" =
821 src = fetchurl {
415 self.by-version."caseless"."0.11.0";
822 url = "https://registry.npmjs.org/feature-detect-es6/-/feature-detect-es6-1.3.1.tgz";
416 by-version."caseless"."0.11.0" = lib.makeOverridable self.buildNodePackage {
823 sha1 = "f888736af9cb0c91f55663bfa4762eb96ee7047f";
417 name = "caseless-0.11.0";
824 };
418 bin = false;
825 };
419 src = [
826 "find-replace-1.0.2" = {
420 (fetchurl {
827 name = "find-replace";
421 url = "http://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz";
828 packageName = "find-replace";
422 name = "caseless-0.11.0.tgz";
829 version = "1.0.2";
423 sha1 = "715b96ea9841593cc33067923f5ec60ebda4f7d7";
830 src = fetchurl {
424 })
831 url = "https://registry.npmjs.org/find-replace/-/find-replace-1.0.2.tgz";
425 ];
832 sha1 = "a2d6ce740d15f0d92b1b26763e2ce9c0e361fd98";
426 buildInputs =
833 };
427 (self.nativeDeps."caseless" or []);
834 };
428 deps = {
835 "typical-2.5.0" = {
429 };
836 name = "typical";
430 peerDependencies = [
837 packageName = "typical";
431 ];
838 version = "2.5.0";
432 passthru.names = [ "caseless" ];
839 src = fetchurl {
433 };
840 url = "https://registry.npmjs.org/typical/-/typical-2.5.0.tgz";
434 by-spec."chalk"."^0.5.1" =
841 sha1 = "81244918aa28180c9e602aa457173404be0604f1";
435 self.by-version."chalk"."0.5.1";
842 };
436 by-version."chalk"."0.5.1" = lib.makeOverridable self.buildNodePackage {
843 };
437 name = "chalk-0.5.1";
844 "ansi-escape-sequences-2.2.2" = {
438 bin = false;
845 name = "ansi-escape-sequences";
439 src = [
846 packageName = "ansi-escape-sequences";
440 (fetchurl {
847 version = "2.2.2";
441 url = "http://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz";
848 src = fetchurl {
442 name = "chalk-0.5.1.tgz";
849 url = "https://registry.npmjs.org/ansi-escape-sequences/-/ansi-escape-sequences-2.2.2.tgz";
443 sha1 = "663b3a648b68b55d04690d49167aa837858f2174";
850 sha1 = "174c78d6f8b7de75f8957ae81c7f72210c701635";
444 })
851 };
445 ];
852 };
446 buildInputs =
853 "column-layout-2.1.4" = {
447 (self.nativeDeps."chalk" or []);
854 name = "column-layout";
448 deps = {
855 packageName = "column-layout";
449 "ansi-styles-1.1.0" = self.by-version."ansi-styles"."1.1.0";
856 version = "2.1.4";
450 "escape-string-regexp-1.0.4" = self.by-version."escape-string-regexp"."1.0.4";
857 src = fetchurl {
451 "has-ansi-0.1.0" = self.by-version."has-ansi"."0.1.0";
858 url = "https://registry.npmjs.org/column-layout/-/column-layout-2.1.4.tgz";
452 "strip-ansi-0.3.0" = self.by-version."strip-ansi"."0.3.0";
859 sha1 = "ed2857092ccf8338026fe538379d9672d70b3641";
453 "supports-color-0.2.0" = self.by-version."supports-color"."0.2.0";
860 };
454 };
861 };
455 peerDependencies = [
862 "wordwrapjs-1.2.1" = {
456 ];
863 name = "wordwrapjs";
457 passthru.names = [ "chalk" ];
864 packageName = "wordwrapjs";
458 };
865 version = "1.2.1";
459 by-spec."chalk"."^1.0.0" =
866 src = fetchurl {
460 self.by-version."chalk"."1.1.1";
867 url = "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-1.2.1.tgz";
461 by-version."chalk"."1.1.1" = lib.makeOverridable self.buildNodePackage {
868 sha1 = "754a5ea0664cfbff50540dc32d67bda3289fc34b";
462 name = "chalk-1.1.1";
869 };
463 bin = false;
870 };
464 src = [
871 "collect-all-0.2.1" = {
465 (fetchurl {
872 name = "collect-all";
466 url = "http://registry.npmjs.org/chalk/-/chalk-1.1.1.tgz";
873 packageName = "collect-all";
467 name = "chalk-1.1.1.tgz";
874 version = "0.2.1";
468 sha1 = "509afb67066e7499f7eb3535c77445772ae2d019";
875 src = fetchurl {
469 })
876 url = "https://registry.npmjs.org/collect-all/-/collect-all-0.2.1.tgz";
470 ];
877 sha1 = "7225fb4585c22d4ffac886f0abaf5abc563a1a6a";
471 buildInputs =
878 };
472 (self.nativeDeps."chalk" or []);
879 };
473 deps = {
880 "stream-connect-1.0.2" = {
474 "ansi-styles-2.1.0" = self.by-version."ansi-styles"."2.1.0";
881 name = "stream-connect";
475 "escape-string-regexp-1.0.4" = self.by-version."escape-string-regexp"."1.0.4";
882 packageName = "stream-connect";
476 "has-ansi-2.0.0" = self.by-version."has-ansi"."2.0.0";
883 version = "1.0.2";
477 "strip-ansi-3.0.0" = self.by-version."strip-ansi"."3.0.0";
884 src = fetchurl {
478 "supports-color-2.0.0" = self.by-version."supports-color"."2.0.0";
885 url = "https://registry.npmjs.org/stream-connect/-/stream-connect-1.0.2.tgz";
479 };
886 sha1 = "18bc81f2edb35b8b5d9a8009200a985314428a97";
480 peerDependencies = [
887 };
481 ];
888 };
482 passthru.names = [ "chalk" ];
889 "stream-via-0.1.1" = {
483 };
890 name = "stream-via";
484 by-spec."chalk"."^1.1.1" =
891 packageName = "stream-via";
485 self.by-version."chalk"."1.1.1";
892 version = "0.1.1";
486 by-spec."cli"."0.6.x" =
893 src = fetchurl {
487 self.by-version."cli"."0.6.6";
894 url = "https://registry.npmjs.org/stream-via/-/stream-via-0.1.1.tgz";
488 by-version."cli"."0.6.6" = lib.makeOverridable self.buildNodePackage {
895 sha1 = "0cee5df9c959fb1d3f4eda4819f289d5f9205afc";
489 name = "cli-0.6.6";
896 };
490 bin = false;
897 };
491 src = [
898 "collect-json-1.0.8" = {
492 (fetchurl {
899 name = "collect-json";
493 url = "http://registry.npmjs.org/cli/-/cli-0.6.6.tgz";
900 packageName = "collect-json";
494 name = "cli-0.6.6.tgz";
901 version = "1.0.8";
495 sha1 = "02ad44a380abf27adac5e6f0cdd7b043d74c53e3";
902 src = fetchurl {
496 })
903 url = "https://registry.npmjs.org/collect-json/-/collect-json-1.0.8.tgz";
497 ];
904 sha1 = "aa2fa52b4d1d9444ce690f07a1e3617ab74bb827";
498 buildInputs =
905 };
499 (self.nativeDeps."cli" or []);
906 };
500 deps = {
907 "deep-extend-0.4.1" = {
501 "glob-3.2.11" = self.by-version."glob"."3.2.11";
908 name = "deep-extend";
502 "exit-0.1.2" = self.by-version."exit"."0.1.2";
909 packageName = "deep-extend";
503 };
910 version = "0.4.1";
504 peerDependencies = [
911 src = fetchurl {
505 ];
912 url = "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.1.tgz";
506 passthru.names = [ "cli" ];
913 sha1 = "efe4113d08085f4e6f9687759810f807469e2253";
507 };
914 };
508 by-spec."coffee-script"."~1.3.3" =
915 };
509 self.by-version."coffee-script"."1.3.3";
916 "object-tools-2.0.6" = {
510 by-version."coffee-script"."1.3.3" = lib.makeOverridable self.buildNodePackage {
917 name = "object-tools";
511 name = "coffee-script-1.3.3";
918 packageName = "object-tools";
512 bin = true;
919 version = "2.0.6";
513 src = [
920 src = fetchurl {
514 (fetchurl {
921 url = "https://registry.npmjs.org/object-tools/-/object-tools-2.0.6.tgz";
515 url = "http://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz";
922 sha1 = "f3fe1c350cda4a6f5d99d9646dc4892a02476ddd";
516 name = "coffee-script-1.3.3.tgz";
923 };
517 sha1 = "150d6b4cb522894369efed6a2101c20bc7f4a4f4";
924 };
518 })
925 "collect-all-1.0.2" = {
519 ];
926 name = "collect-all";
520 buildInputs =
927 packageName = "collect-all";
521 (self.nativeDeps."coffee-script" or []);
928 version = "1.0.2";
522 deps = {
929 src = fetchurl {
523 };
930 url = "https://registry.npmjs.org/collect-all/-/collect-all-1.0.2.tgz";
524 peerDependencies = [
931 sha1 = "39450f1e7aa6086570a006bce93ccf1218a77ea1";
525 ];
932 };
526 passthru.names = [ "coffee-script" ];
933 };
527 };
934 "stream-via-1.0.3" = {
528 by-spec."colors"."~0.6.2" =
935 name = "stream-via";
529 self.by-version."colors"."0.6.2";
936 packageName = "stream-via";
530 by-version."colors"."0.6.2" = lib.makeOverridable self.buildNodePackage {
937 version = "1.0.3";
531 name = "colors-0.6.2";
938 src = fetchurl {
532 bin = false;
939 url = "https://registry.npmjs.org/stream-via/-/stream-via-1.0.3.tgz";
533 src = [
940 sha1 = "cebd32a5a59d74b3b68e3404942e867184ad4ac9";
534 (fetchurl {
941 };
535 url = "http://registry.npmjs.org/colors/-/colors-0.6.2.tgz";
942 };
536 name = "colors-0.6.2.tgz";
943 "object-get-2.1.0" = {
537 sha1 = "2423fe6678ac0c5dae8852e5d0e5be08c997abcc";
944 name = "object-get";
538 })
945 packageName = "object-get";
539 ];
946 version = "2.1.0";
540 buildInputs =
947 src = fetchurl {
541 (self.nativeDeps."colors" or []);
948 url = "https://registry.npmjs.org/object-get/-/object-get-2.1.0.tgz";
542 deps = {
949 sha1 = "722bbdb60039efa47cad3c6dc2ce51a85c02c5ae";
543 };
950 };
544 peerDependencies = [
951 };
545 ];
952 "test-value-1.1.0" = {
546 passthru.names = [ "colors" ];
953 name = "test-value";
547 };
954 packageName = "test-value";
548 by-spec."combined-stream"."^1.0.5" =
955 version = "1.1.0";
549 self.by-version."combined-stream"."1.0.5";
956 src = fetchurl {
550 by-version."combined-stream"."1.0.5" = lib.makeOverridable self.buildNodePackage {
957 url = "https://registry.npmjs.org/test-value/-/test-value-1.1.0.tgz";
551 name = "combined-stream-1.0.5";
958 sha1 = "a09136f72ec043d27c893707c2b159bfad7de93f";
552 bin = false;
959 };
553 src = [
960 };
554 (fetchurl {
961 "test-value-2.0.0" = {
555 url = "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz";
962 name = "test-value";
556 name = "combined-stream-1.0.5.tgz";
963 packageName = "test-value";
557 sha1 = "938370a57b4a51dea2c77c15d5c5fdf895164009";
964 version = "2.0.0";
558 })
965 src = fetchurl {
559 ];
966 url = "https://registry.npmjs.org/test-value/-/test-value-2.0.0.tgz";
560 buildInputs =
967 sha1 = "0d65c45ee0b48a757c4507a5e98ec2680a9db137";
561 (self.nativeDeps."combined-stream" or []);
968 };
562 deps = {
969 };
563 "delayed-stream-1.0.0" = self.by-version."delayed-stream"."1.0.0";
970 "@types/clone-0.1.29" = {
564 };
971 name = "@types/clone";
565 peerDependencies = [
972 packageName = "@types/clone";
566 ];
973 version = "0.1.29";
567 passthru.names = [ "combined-stream" ];
974 src = fetchurl {
568 };
975 url = "https://registry.npmjs.org/@types/clone/-/clone-0.1.29.tgz";
569 by-spec."combined-stream"."~1.0.5" =
976 sha1 = "65a0be88189ffddcd373e450aa6b68c9c83218b7";
570 self.by-version."combined-stream"."1.0.5";
977 };
571 by-spec."commander"."^2.9.0" =
978 };
572 self.by-version."commander"."2.9.0";
979 "@types/node-4.0.30" = {
573 by-version."commander"."2.9.0" = lib.makeOverridable self.buildNodePackage {
980 name = "@types/node";
574 name = "commander-2.9.0";
981 packageName = "@types/node";
575 bin = false;
982 version = "4.0.30";
576 src = [
983 src = fetchurl {
577 (fetchurl {
984 url = "https://registry.npmjs.org/@types/node/-/node-4.0.30.tgz";
578 url = "http://registry.npmjs.org/commander/-/commander-2.9.0.tgz";
985 sha1 = "553f490ed3030311620f88003e7abfc0edcb301e";
579 name = "commander-2.9.0.tgz";
986 };
580 sha1 = "9c99094176e12240cb22d6c5146098400fe0f7d4";
987 };
581 })
988 "@types/parse5-0.0.28" = {
582 ];
989 name = "@types/parse5";
583 buildInputs =
990 packageName = "@types/parse5";
584 (self.nativeDeps."commander" or []);
991 version = "0.0.28";
585 deps = {
992 src = fetchurl {
586 "graceful-readlink-1.0.1" = self.by-version."graceful-readlink"."1.0.1";
993 url = "https://registry.npmjs.org/@types/parse5/-/parse5-0.0.28.tgz";
587 };
994 sha1 = "2a38cb7145bb157688d4ad2c46944c6dffae3cc6";
588 peerDependencies = [
995 };
589 ];
996 };
590 passthru.names = [ "commander" ];
997 "clone-1.0.2" = {
591 };
998 name = "clone";
592 by-spec."concat-map"."0.0.1" =
999 packageName = "clone";
593 self.by-version."concat-map"."0.0.1";
1000 version = "1.0.2";
594 by-version."concat-map"."0.0.1" = lib.makeOverridable self.buildNodePackage {
1001 src = fetchurl {
595 name = "concat-map-0.0.1";
1002 url = "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz";
596 bin = false;
1003 sha1 = "260b7a99ebb1edfe247538175f783243cb19d149";
597 src = [
1004 };
598 (fetchurl {
1005 };
599 url = "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz";
1006 "parse5-1.5.1" = {
600 name = "concat-map-0.0.1.tgz";
1007 name = "parse5";
1008 packageName = "parse5";
1009 version = "1.5.1";
1010 src = fetchurl {
1011 url = "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz";
1012 sha1 = "9b7f3b0de32be78dc2401b17573ccaf0f6f59d94";
1013 };
1014 };
1015 "@types/node-6.0.37" = {
1016 name = "@types/node";
1017 packageName = "@types/node";
1018 version = "6.0.37";
1019 src = fetchurl {
1020 url = "https://registry.npmjs.org/@types/node/-/node-6.0.37.tgz";
1021 sha1 = "a1e081f2ec60074113d3a1fbf11f35d304f30e39";
1022 };
1023 };
1024 "es6-promise-2.3.0" = {
1025 name = "es6-promise";
1026 packageName = "es6-promise";
1027 version = "2.3.0";
1028 src = fetchurl {
1029 url = "https://registry.npmjs.org/es6-promise/-/es6-promise-2.3.0.tgz";
1030 sha1 = "96edb9f2fdb01995822b263dd8aadab6748181bc";
1031 };
1032 };
1033 "hydrolysis-1.24.1" = {
1034 name = "hydrolysis";
1035 packageName = "hydrolysis";
1036 version = "1.24.1";
1037 src = fetchurl {
1038 url = "https://registry.npmjs.org/hydrolysis/-/hydrolysis-1.24.1.tgz";
1039 sha1 = "0f94f055d1065ac0d81ff40b762d143fef07eff4";
1040 };
1041 };
1042 "nopt-3.0.6" = {
1043 name = "nopt";
1044 packageName = "nopt";
1045 version = "3.0.6";
1046 src = fetchurl {
1047 url = "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz";
1048 sha1 = "c6465dbf08abcd4db359317f79ac68a646b28ff9";
1049 };
1050 };
1051 "path-posix-1.0.0" = {
1052 name = "path-posix";
1053 packageName = "path-posix";
1054 version = "1.0.0";
1055 src = fetchurl {
1056 url = "https://registry.npmjs.org/path-posix/-/path-posix-1.0.0.tgz";
1057 sha1 = "06b26113f56beab042545a23bfa88003ccac260f";
1058 };
1059 };
1060 "update-notifier-0.6.3" = {
1061 name = "update-notifier";
1062 packageName = "update-notifier";
1063 version = "0.6.3";
1064 src = fetchurl {
1065 url = "https://registry.npmjs.org/update-notifier/-/update-notifier-0.6.3.tgz";
1066 sha1 = "776dec8daa13e962a341e8a1d98354306b67ae08";
1067 };
1068 };
1069 "babel-polyfill-6.13.0" = {
1070 name = "babel-polyfill";
1071 packageName = "babel-polyfill";
1072 version = "6.13.0";
1073 src = fetchurl {
1074 url = "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.13.0.tgz";
1075 sha1 = "5978215c25d49a697eb78afc54e63c9d3a73d5ec";
1076 };
1077 };
1078 "doctrine-0.7.2" = {
1079 name = "doctrine";
1080 packageName = "doctrine";
1081 version = "0.7.2";
1082 src = fetchurl {
1083 url = "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz";
1084 sha1 = "7cb860359ba3be90e040b26b729ce4bfa654c523";
1085 };
1086 };
1087 "escodegen-1.8.1" = {
1088 name = "escodegen";
1089 packageName = "escodegen";
1090 version = "1.8.1";
1091 src = fetchurl {
1092 url = "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz";
1093 sha1 = "5a5b53af4693110bebb0867aa3430dd3b70a1018";
1094 };
1095 };
1096 "espree-3.1.7" = {
1097 name = "espree";
1098 packageName = "espree";
1099 version = "3.1.7";
1100 src = fetchurl {
1101 url = "https://registry.npmjs.org/espree/-/espree-3.1.7.tgz";
1102 sha1 = "fd5deec76a97a5120a9cd3a7cb1177a0923b11d2";
1103 };
1104 };
1105 "estraverse-3.1.0" = {
1106 name = "estraverse";
1107 packageName = "estraverse";
1108 version = "3.1.0";
1109 src = fetchurl {
1110 url = "https://registry.npmjs.org/estraverse/-/estraverse-3.1.0.tgz";
1111 sha1 = "15e28a446b8b82bc700ccc8b96c78af4da0d6cba";
1112 };
1113 };
1114 "path-is-absolute-1.0.0" = {
1115 name = "path-is-absolute";
1116 packageName = "path-is-absolute";
1117 version = "1.0.0";
1118 src = fetchurl {
1119 url = "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz";
1120 sha1 = "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912";
1121 };
1122 };
1123 "babel-runtime-6.11.6" = {
1124 name = "babel-runtime";
1125 packageName = "babel-runtime";
1126 version = "6.11.6";
1127 src = fetchurl {
1128 url = "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.11.6.tgz";
1129 sha1 = "6db707fef2d49c49bfa3cb64efdb436b518b8222";
1130 };
1131 };
1132 "regenerator-runtime-0.9.5" = {
1133 name = "regenerator-runtime";
1134 packageName = "regenerator-runtime";
1135 version = "0.9.5";
1136 src = fetchurl {
1137 url = "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.9.5.tgz";
1138 sha1 = "403d6d40a4bdff9c330dd9392dcbb2d9a8bba1fc";
1139 };
1140 };
1141 "esutils-1.1.6" = {
1142 name = "esutils";
1143 packageName = "esutils";
1144 version = "1.1.6";
1145 src = fetchurl {
1146 url = "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz";
1147 sha1 = "c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375";
1148 };
1149 };
1150 "isarray-0.0.1" = {
1151 name = "isarray";
1152 packageName = "isarray";
1153 version = "0.0.1";
1154 src = fetchurl {
1155 url = "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz";
1156 sha1 = "8a18acfca9a8f4177e09abfc6038939b05d1eedf";
1157 };
1158 };
1159 "estraverse-1.9.3" = {
1160 name = "estraverse";
1161 packageName = "estraverse";
1162 version = "1.9.3";
1163 src = fetchurl {
1164 url = "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz";
1165 sha1 = "af67f2dc922582415950926091a4005d29c9bb44";
1166 };
1167 };
1168 "esutils-2.0.2" = {
1169 name = "esutils";
1170 packageName = "esutils";
1171 version = "2.0.2";
1172 src = fetchurl {
1173 url = "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz";
1174 sha1 = "0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b";
1175 };
1176 };
1177 "esprima-2.7.3" = {
1178 name = "esprima";
1179 packageName = "esprima";
1180 version = "2.7.3";
1181 src = fetchurl {
1182 url = "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz";
1183 sha1 = "96e3b70d5779f6ad49cd032673d1c312767ba581";
1184 };
1185 };
1186 "optionator-0.8.1" = {
1187 name = "optionator";
1188 packageName = "optionator";
1189 version = "0.8.1";
1190 src = fetchurl {
1191 url = "https://registry.npmjs.org/optionator/-/optionator-0.8.1.tgz";
1192 sha1 = "e31b4932cdd5fb862a8b0d10bc63d3ee1ec7d78b";
1193 };
1194 };
1195 "source-map-0.2.0" = {
1196 name = "source-map";
1197 packageName = "source-map";
1198 version = "0.2.0";
1199 src = fetchurl {
1200 url = "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz";
1201 sha1 = "dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d";
1202 };
1203 };
1204 "prelude-ls-1.1.2" = {
1205 name = "prelude-ls";
1206 packageName = "prelude-ls";
1207 version = "1.1.2";
1208 src = fetchurl {
1209 url = "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz";
1210 sha1 = "21932a549f5e52ffd9a827f570e04be62a97da54";
1211 };
1212 };
1213 "deep-is-0.1.3" = {
1214 name = "deep-is";
1215 packageName = "deep-is";
1216 version = "0.1.3";
1217 src = fetchurl {
1218 url = "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz";
1219 sha1 = "b369d6fb5dbc13eecf524f91b070feedc357cf34";
1220 };
1221 };
1222 "wordwrap-1.0.0" = {
1223 name = "wordwrap";
1224 packageName = "wordwrap";
1225 version = "1.0.0";
1226 src = fetchurl {
1227 url = "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz";
1228 sha1 = "27584810891456a4171c8d0226441ade90cbcaeb";
1229 };
1230 };
1231 "type-check-0.3.2" = {
1232 name = "type-check";
1233 packageName = "type-check";
1234 version = "0.3.2";
1235 src = fetchurl {
1236 url = "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz";
1237 sha1 = "5884cab512cf1d355e3fb784f30804b2b520db72";
1238 };
1239 };
1240 "levn-0.3.0" = {
1241 name = "levn";
1242 packageName = "levn";
1243 version = "0.3.0";
1244 src = fetchurl {
1245 url = "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz";
1246 sha1 = "3b09924edf9f083c0490fdd4c0bc4421e04764ee";
1247 };
1248 };
1249 "fast-levenshtein-1.1.4" = {
1250 name = "fast-levenshtein";
1251 packageName = "fast-levenshtein";
1252 version = "1.1.4";
1253 src = fetchurl {
1254 url = "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.1.4.tgz";
1255 sha1 = "e6a754cc8f15e58987aa9cbd27af66fd6f4e5af9";
1256 };
1257 };
1258 "acorn-3.3.0" = {
1259 name = "acorn";
1260 packageName = "acorn";
1261 version = "3.3.0";
1262 src = fetchurl {
1263 url = "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz";
1264 sha1 = "45e37fb39e8da3f25baee3ff5369e2bb5f22017a";
1265 };
1266 };
1267 "acorn-jsx-3.0.1" = {
1268 name = "acorn-jsx";
1269 packageName = "acorn-jsx";
1270 version = "3.0.1";
1271 src = fetchurl {
1272 url = "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz";
1273 sha1 = "afdf9488fb1ecefc8348f6fb22f464e32a58b36b";
1274 };
1275 };
1276 "boxen-0.3.1" = {
1277 name = "boxen";
1278 packageName = "boxen";
1279 version = "0.3.1";
1280 src = fetchurl {
1281 url = "https://registry.npmjs.org/boxen/-/boxen-0.3.1.tgz";
1282 sha1 = "a7d898243ae622f7abb6bb604d740a76c6a5461b";
1283 };
1284 };
1285 "configstore-2.0.0" = {
1286 name = "configstore";
1287 packageName = "configstore";
1288 version = "2.0.0";
1289 src = fetchurl {
1290 url = "https://registry.npmjs.org/configstore/-/configstore-2.0.0.tgz";
1291 sha1 = "8d81e9cdfa73ebd0e06bc985147856b2f1c4e764";
1292 };
1293 };
1294 "is-npm-1.0.0" = {
1295 name = "is-npm";
1296 packageName = "is-npm";
1297 version = "1.0.0";
1298 src = fetchurl {
1299 url = "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz";
1300 sha1 = "f2fb63a65e4905b406c86072765a1a4dc793b9f4";
1301 };
1302 };
1303 "latest-version-2.0.0" = {
1304 name = "latest-version";
1305 packageName = "latest-version";
1306 version = "2.0.0";
1307 src = fetchurl {
1308 url = "https://registry.npmjs.org/latest-version/-/latest-version-2.0.0.tgz";
1309 sha1 = "56f8d6139620847b8017f8f1f4d78e211324168b";
1310 };
1311 };
1312 "semver-diff-2.1.0" = {
1313 name = "semver-diff";
1314 packageName = "semver-diff";
1315 version = "2.1.0";
1316 src = fetchurl {
1317 url = "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz";
1318 sha1 = "4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36";
1319 };
1320 };
1321 "filled-array-1.1.0" = {
1322 name = "filled-array";
1323 packageName = "filled-array";
1324 version = "1.1.0";
1325 src = fetchurl {
1326 url = "https://registry.npmjs.org/filled-array/-/filled-array-1.1.0.tgz";
1327 sha1 = "c3c4f6c663b923459a9aa29912d2d031f1507f84";
1328 };
1329 };
1330 "object-assign-4.1.0" = {
1331 name = "object-assign";
1332 packageName = "object-assign";
1333 version = "4.1.0";
1334 src = fetchurl {
1335 url = "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz";
1336 sha1 = "7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0";
1337 };
1338 };
1339 "repeating-2.0.1" = {
1340 name = "repeating";
1341 packageName = "repeating";
1342 version = "2.0.1";
1343 src = fetchurl {
1344 url = "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz";
1345 sha1 = "5214c53a926d3552707527fbab415dbc08d06dda";
1346 };
1347 };
1348 "string-width-1.0.2" = {
1349 name = "string-width";
1350 packageName = "string-width";
1351 version = "1.0.2";
1352 src = fetchurl {
1353 url = "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz";
1354 sha1 = "118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3";
1355 };
1356 };
1357 "widest-line-1.0.0" = {
1358 name = "widest-line";
1359 packageName = "widest-line";
1360 version = "1.0.0";
1361 src = fetchurl {
1362 url = "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz";
1363 sha1 = "0c09c85c2a94683d0d7eaf8ee097d564bf0e105c";
1364 };
1365 };
1366 "is-finite-1.0.1" = {
1367 name = "is-finite";
1368 packageName = "is-finite";
1369 version = "1.0.1";
1370 src = fetchurl {
1371 url = "https://registry.npmjs.org/is-finite/-/is-finite-1.0.1.tgz";
1372 sha1 = "6438603eaebe2793948ff4a4262ec8db3d62597b";
1373 };
1374 };
1375 "number-is-nan-1.0.0" = {
1376 name = "number-is-nan";
1377 packageName = "number-is-nan";
1378 version = "1.0.0";
1379 src = fetchurl {
1380 url = "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.0.tgz";
1381 sha1 = "c020f529c5282adfdd233d91d4b181c3d686dc4b";
1382 };
1383 };
1384 "code-point-at-1.0.0" = {
1385 name = "code-point-at";
1386 packageName = "code-point-at";
1387 version = "1.0.0";
1388 src = fetchurl {
1389 url = "https://registry.npmjs.org/code-point-at/-/code-point-at-1.0.0.tgz";
1390 sha1 = "f69b192d3f7d91e382e4b71bddb77878619ab0c6";
1391 };
1392 };
1393 "is-fullwidth-code-point-1.0.0" = {
1394 name = "is-fullwidth-code-point";
1395 packageName = "is-fullwidth-code-point";
1396 version = "1.0.0";
1397 src = fetchurl {
1398 url = "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz";
1399 sha1 = "ef9e31386f031a7f0d643af82fde50c457ef00cb";
1400 };
1401 };
1402 "dot-prop-2.4.0" = {
1403 name = "dot-prop";
1404 packageName = "dot-prop";
1405 version = "2.4.0";
1406 src = fetchurl {
1407 url = "https://registry.npmjs.org/dot-prop/-/dot-prop-2.4.0.tgz";
1408 sha1 = "848e28f7f1d50740c6747ab3cb07670462b6f89c";
1409 };
1410 };
1411 "os-tmpdir-1.0.1" = {
1412 name = "os-tmpdir";
1413 packageName = "os-tmpdir";
1414 version = "1.0.1";
1415 src = fetchurl {
1416 url = "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz";
1417 sha1 = "e9b423a1edaf479882562e92ed71d7743a071b6e";
1418 };
1419 };
1420 "osenv-0.1.3" = {
1421 name = "osenv";
1422 packageName = "osenv";
1423 version = "0.1.3";
1424 src = fetchurl {
1425 url = "https://registry.npmjs.org/osenv/-/osenv-0.1.3.tgz";
1426 sha1 = "83cf05c6d6458fc4d5ac6362ea325d92f2754217";
1427 };
1428 };
1429 "uuid-2.0.2" = {
1430 name = "uuid";
1431 packageName = "uuid";
1432 version = "2.0.2";
1433 src = fetchurl {
1434 url = "https://registry.npmjs.org/uuid/-/uuid-2.0.2.tgz";
1435 sha1 = "48bd5698f0677e3c7901a1c46ef15b1643794726";
1436 };
1437 };
1438 "write-file-atomic-1.2.0" = {
1439 name = "write-file-atomic";
1440 packageName = "write-file-atomic";
1441 version = "1.2.0";
1442 src = fetchurl {
1443 url = "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.2.0.tgz";
1444 sha1 = "14c66d4e4cb3ca0565c28cf3b7a6f3e4d5938fab";
1445 };
1446 };
1447 "xdg-basedir-2.0.0" = {
1448 name = "xdg-basedir";
1449 packageName = "xdg-basedir";
1450 version = "2.0.0";
1451 src = fetchurl {
1452 url = "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-2.0.0.tgz";
1453 sha1 = "edbc903cc385fc04523d966a335504b5504d1bd2";
1454 };
1455 };
1456 "is-obj-1.0.1" = {
1457 name = "is-obj";
1458 packageName = "is-obj";
1459 version = "1.0.1";
1460 src = fetchurl {
1461 url = "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz";
1462 sha1 = "3e4729ac1f5fde025cd7d83a896dab9f4f67db0f";
1463 };
1464 };
1465 "os-homedir-1.0.1" = {
1466 name = "os-homedir";
1467 packageName = "os-homedir";
1468 version = "1.0.1";
1469 src = fetchurl {
1470 url = "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.1.tgz";
1471 sha1 = "0d62bdf44b916fd3bbdcf2cab191948fb094f007";
1472 };
1473 };
1474 "imurmurhash-0.1.4" = {
1475 name = "imurmurhash";
1476 packageName = "imurmurhash";
1477 version = "0.1.4";
1478 src = fetchurl {
1479 url = "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz";
1480 sha1 = "9218b9b2b928a238b13dc4fb6b6d576f231453ea";
1481 };
1482 };
1483 "slide-1.1.6" = {
1484 name = "slide";
1485 packageName = "slide";
1486 version = "1.1.6";
1487 src = fetchurl {
1488 url = "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz";
1489 sha1 = "56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707";
1490 };
1491 };
1492 "package-json-2.3.3" = {
1493 name = "package-json";
1494 packageName = "package-json";
1495 version = "2.3.3";
1496 src = fetchurl {
1497 url = "https://registry.npmjs.org/package-json/-/package-json-2.3.3.tgz";
1498 sha1 = "14895311a963d18edf8801e06b67ea87795d15b9";
1499 };
1500 };
1501 "got-5.6.0" = {
1502 name = "got";
1503 packageName = "got";
1504 version = "5.6.0";
1505 src = fetchurl {
1506 url = "https://registry.npmjs.org/got/-/got-5.6.0.tgz";
1507 sha1 = "bb1d7ee163b78082bbc8eb836f3f395004ea6fbf";
1508 };
1509 };
1510 "rc-1.1.6" = {
1511 name = "rc";
1512 packageName = "rc";
1513 version = "1.1.6";
1514 src = fetchurl {
1515 url = "https://registry.npmjs.org/rc/-/rc-1.1.6.tgz";
1516 sha1 = "43651b76b6ae53b5c802f1151fa3fc3b059969c9";
1517 };
1518 };
1519 "registry-url-3.1.0" = {
1520 name = "registry-url";
1521 packageName = "registry-url";
1522 version = "3.1.0";
1523 src = fetchurl {
1524 url = "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz";
1525 sha1 = "3d4ef870f73dde1d77f0cf9a381432444e174942";
1526 };
1527 };
1528 "semver-5.3.0" = {
1529 name = "semver";
1530 packageName = "semver";
1531 version = "5.3.0";
1532 src = fetchurl {
1533 url = "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz";
1534 sha1 = "9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f";
1535 };
1536 };
1537 "create-error-class-3.0.2" = {
1538 name = "create-error-class";
1539 packageName = "create-error-class";
1540 version = "3.0.2";
1541 src = fetchurl {
1542 url = "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz";
1543 sha1 = "06be7abef947a3f14a30fd610671d401bca8b7b6";
1544 };
1545 };
1546 "duplexer2-0.1.4" = {
1547 name = "duplexer2";
1548 packageName = "duplexer2";
1549 version = "0.1.4";
1550 src = fetchurl {
1551 url = "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz";
1552 sha1 = "8b12dab878c0d69e3e7891051662a32fc6bddcc1";
1553 };
1554 };
1555 "is-plain-obj-1.1.0" = {
1556 name = "is-plain-obj";
1557 packageName = "is-plain-obj";
1558 version = "1.1.0";
1559 src = fetchurl {
1560 url = "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz";
1561 sha1 = "71a50c8429dfca773c92a390a4a03b39fcd51d3e";
1562 };
1563 };
1564 "is-redirect-1.0.0" = {
1565 name = "is-redirect";
1566 packageName = "is-redirect";
1567 version = "1.0.0";
1568 src = fetchurl {
1569 url = "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz";
1570 sha1 = "1d03dded53bd8db0f30c26e4f95d36fc7c87dc24";
1571 };
1572 };
1573 "is-retry-allowed-1.1.0" = {
1574 name = "is-retry-allowed";
1575 packageName = "is-retry-allowed";
1576 version = "1.1.0";
1577 src = fetchurl {
1578 url = "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz";
1579 sha1 = "11a060568b67339444033d0125a61a20d564fb34";
1580 };
1581 };
1582 "is-stream-1.1.0" = {
1583 name = "is-stream";
1584 packageName = "is-stream";
1585 version = "1.1.0";
1586 src = fetchurl {
1587 url = "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz";
1588 sha1 = "12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44";
1589 };
1590 };
1591 "lowercase-keys-1.0.0" = {
1592 name = "lowercase-keys";
1593 packageName = "lowercase-keys";
1594 version = "1.0.0";
1595 src = fetchurl {
1596 url = "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz";
1597 sha1 = "4e3366b39e7f5457e35f1324bdf6f88d0bfc7306";
1598 };
1599 };
1600 "node-status-codes-1.0.0" = {
1601 name = "node-status-codes";
1602 packageName = "node-status-codes";
1603 version = "1.0.0";
1604 src = fetchurl {
1605 url = "https://registry.npmjs.org/node-status-codes/-/node-status-codes-1.0.0.tgz";
1606 sha1 = "5ae5541d024645d32a58fcddc9ceecea7ae3ac2f";
1607 };
1608 };
1609 "parse-json-2.2.0" = {
1610 name = "parse-json";
1611 packageName = "parse-json";
1612 version = "2.2.0";
1613 src = fetchurl {
1614 url = "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz";
1615 sha1 = "f480f40434ef80741f8469099f8dea18f55a4dc9";
1616 };
1617 };
1618 "pinkie-promise-2.0.1" = {
1619 name = "pinkie-promise";
1620 packageName = "pinkie-promise";
1621 version = "2.0.1";
1622 src = fetchurl {
1623 url = "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz";
1624 sha1 = "2135d6dfa7a358c069ac9b178776288228450ffa";
1625 };
1626 };
1627 "read-all-stream-3.1.0" = {
1628 name = "read-all-stream";
1629 packageName = "read-all-stream";
1630 version = "3.1.0";
1631 src = fetchurl {
1632 url = "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.1.0.tgz";
1633 sha1 = "35c3e177f2078ef789ee4bfafa4373074eaef4fa";
1634 };
1635 };
1636 "readable-stream-2.1.5" = {
1637 name = "readable-stream";
1638 packageName = "readable-stream";
1639 version = "2.1.5";
1640 src = fetchurl {
1641 url = "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz";
1642 sha1 = "66fa8b720e1438b364681f2ad1a63c618448c9d0";
1643 };
1644 };
1645 "timed-out-2.0.0" = {
1646 name = "timed-out";
1647 packageName = "timed-out";
1648 version = "2.0.0";
1649 src = fetchurl {
1650 url = "https://registry.npmjs.org/timed-out/-/timed-out-2.0.0.tgz";
1651 sha1 = "f38b0ae81d3747d628001f41dafc652ace671c0a";
1652 };
1653 };
1654 "unzip-response-1.0.0" = {
1655 name = "unzip-response";
1656 packageName = "unzip-response";
1657 version = "1.0.0";
1658 src = fetchurl {
1659 url = "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.0.tgz";
1660 sha1 = "bfda54eeec658f00c2df4d4494b9dca0ca00f3e4";
1661 };
1662 };
1663 "url-parse-lax-1.0.0" = {
1664 name = "url-parse-lax";
1665 packageName = "url-parse-lax";
1666 version = "1.0.0";
1667 src = fetchurl {
1668 url = "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz";
1669 sha1 = "7af8f303645e9bd79a272e7a14ac68bc0609da73";
1670 };
1671 };
1672 "capture-stack-trace-1.0.0" = {
1673 name = "capture-stack-trace";
1674 packageName = "capture-stack-trace";
1675 version = "1.0.0";
1676 src = fetchurl {
1677 url = "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz";
1678 sha1 = "4a6fa07399c26bba47f0b2496b4d0fb408c5550d";
1679 };
1680 };
1681 "error-ex-1.3.0" = {
1682 name = "error-ex";
1683 packageName = "error-ex";
1684 version = "1.3.0";
1685 src = fetchurl {
1686 url = "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz";
1687 sha1 = "e67b43f3e82c96ea3a584ffee0b9fc3325d802d9";
1688 };
1689 };
1690 "is-arrayish-0.2.1" = {
1691 name = "is-arrayish";
1692 packageName = "is-arrayish";
1693 version = "0.2.1";
1694 src = fetchurl {
1695 url = "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz";
1696 sha1 = "77c99840527aa8ecb1a8ba697b80645a7a926a9d";
1697 };
1698 };
1699 "pinkie-2.0.4" = {
1700 name = "pinkie";
1701 packageName = "pinkie";
1702 version = "2.0.4";
1703 src = fetchurl {
1704 url = "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz";
1705 sha1 = "72556b80cfa0d48a974e80e77248e80ed4f7f870";
1706 };
1707 };
1708 "buffer-shims-1.0.0" = {
1709 name = "buffer-shims";
1710 packageName = "buffer-shims";
1711 version = "1.0.0";
1712 src = fetchurl {
1713 url = "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz";
1714 sha1 = "9978ce317388c649ad8793028c3477ef044a8b51";
1715 };
1716 };
1717 "core-util-is-1.0.2" = {
1718 name = "core-util-is";
1719 packageName = "core-util-is";
1720 version = "1.0.2";
1721 src = fetchurl {
1722 url = "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz";
1723 sha1 = "b5fd54220aa2bc5ab57aab7140c940754503c1a7";
1724 };
1725 };
1726 "isarray-1.0.0" = {
1727 name = "isarray";
1728 packageName = "isarray";
1729 version = "1.0.0";
1730 src = fetchurl {
1731 url = "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz";
1732 sha1 = "bb935d48582cba168c06834957a54a3e07124f11";
1733 };
1734 };
1735 "process-nextick-args-1.0.7" = {
1736 name = "process-nextick-args";
1737 packageName = "process-nextick-args";
1738 version = "1.0.7";
1739 src = fetchurl {
1740 url = "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz";
1741 sha1 = "150e20b756590ad3f91093f25a4f2ad8bff30ba3";
1742 };
1743 };
1744 "string_decoder-0.10.31" = {
1745 name = "string_decoder";
1746 packageName = "string_decoder";
1747 version = "0.10.31";
1748 src = fetchurl {
1749 url = "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz";
1750 sha1 = "62e203bc41766c6c28c9fc84301dab1c5310fa94";
1751 };
1752 };
1753 "util-deprecate-1.0.2" = {
1754 name = "util-deprecate";
1755 packageName = "util-deprecate";
1756 version = "1.0.2";
1757 src = fetchurl {
1758 url = "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz";
1759 sha1 = "450d4dc9fa70de732762fbd2d4a28981419a0ccf";
1760 };
1761 };
1762 "prepend-http-1.0.4" = {
1763 name = "prepend-http";
1764 packageName = "prepend-http";
1765 version = "1.0.4";
1766 src = fetchurl {
1767 url = "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz";
1768 sha1 = "d4f4562b0ce3696e41ac52d0e002e57a635dc6dc";
1769 };
1770 };
1771 "ini-1.3.4" = {
1772 name = "ini";
1773 packageName = "ini";
1774 version = "1.3.4";
1775 src = fetchurl {
1776 url = "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz";
1777 sha1 = "0537cb79daf59b59a1a517dff706c86ec039162e";
1778 };
1779 };
1780 "minimist-1.2.0" = {
1781 name = "minimist";
1782 packageName = "minimist";
1783 version = "1.2.0";
1784 src = fetchurl {
1785 url = "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz";
1786 sha1 = "a35008b20f41383eec1fb914f4cd5df79a264284";
1787 };
1788 };
1789 "strip-json-comments-1.0.4" = {
1790 name = "strip-json-comments";
1791 packageName = "strip-json-comments";
1792 version = "1.0.4";
1793 src = fetchurl {
1794 url = "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz";
1795 sha1 = "1e15fbcac97d3ee99bf2d73b4c656b082bbafb91";
1796 };
1797 };
1798 "crisper-1.2.0" = {
1799 name = "crisper";
1800 packageName = "crisper";
1801 version = "1.2.0";
1802 src = fetchurl {
1803 url = "https://registry.npmjs.org/crisper/-/crisper-1.2.0.tgz";
1804 sha1 = "9a91f597d71f6110294e076ad44dbb3408568e46";
1805 };
1806 };
1807 "cli-1.0.0" = {
1808 name = "cli";
1809 packageName = "cli";
1810 version = "1.0.0";
1811 src = fetchurl {
1812 url = "https://registry.npmjs.org/cli/-/cli-1.0.0.tgz";
1813 sha1 = "ee07dfc1390e3f2e6a9957cf88e1d4bfa777719d";
1814 };
1815 };
1816 "console-browserify-1.1.0" = {
1817 name = "console-browserify";
1818 packageName = "console-browserify";
1819 version = "1.1.0";
1820 src = fetchurl {
1821 url = "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz";
1822 sha1 = "f0241c45730a9fc6323b206dbf38edc741d0bb10";
1823 };
1824 };
1825 "htmlparser2-3.8.3" = {
1826 name = "htmlparser2";
1827 packageName = "htmlparser2";
1828 version = "3.8.3";
1829 src = fetchurl {
1830 url = "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz";
1831 sha1 = "996c28b191516a8be86501a7d79757e5c70c1068";
1832 };
1833 };
1834 "minimatch-3.0.3" = {
1835 name = "minimatch";
1836 packageName = "minimatch";
1837 version = "3.0.3";
1838 src = fetchurl {
1839 url = "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz";
1840 sha1 = "2a4e4090b96b2db06a9d7df01055a62a77c9b774";
1841 };
1842 };
1843 "shelljs-0.3.0" = {
1844 name = "shelljs";
1845 packageName = "shelljs";
1846 version = "0.3.0";
1847 src = fetchurl {
1848 url = "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz";
1849 sha1 = "3596e6307a781544f591f37da618360f31db57b1";
1850 };
1851 };
1852 "lodash-3.7.0" = {
1853 name = "lodash";
1854 packageName = "lodash";
1855 version = "3.7.0";
1856 src = fetchurl {
1857 url = "https://registry.npmjs.org/lodash/-/lodash-3.7.0.tgz";
1858 sha1 = "3678bd8ab995057c07ade836ed2ef087da811d45";
1859 };
1860 };
1861 "glob-7.0.6" = {
1862 name = "glob";
1863 packageName = "glob";
1864 version = "7.0.6";
1865 src = fetchurl {
1866 url = "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz";
1867 sha1 = "211bafaf49e525b8cd93260d14ab136152b3f57a";
1868 };
1869 };
1870 "fs.realpath-1.0.0" = {
1871 name = "fs.realpath";
1872 packageName = "fs.realpath";
1873 version = "1.0.0";
1874 src = fetchurl {
1875 url = "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz";
1876 sha1 = "1504ad2523158caa40db4a2787cb01411994ea4f";
1877 };
1878 };
1879 "inflight-1.0.5" = {
1880 name = "inflight";
1881 packageName = "inflight";
1882 version = "1.0.5";
1883 src = fetchurl {
1884 url = "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz";
1885 sha1 = "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a";
1886 };
1887 };
1888 "once-1.3.3" = {
1889 name = "once";
1890 packageName = "once";
1891 version = "1.3.3";
1892 src = fetchurl {
1893 url = "https://registry.npmjs.org/once/-/once-1.3.3.tgz";
1894 sha1 = "b2e261557ce4c314ec8304f3fa82663e4297ca20";
1895 };
1896 };
1897 "wrappy-1.0.2" = {
1898 name = "wrappy";
1899 packageName = "wrappy";
1900 version = "1.0.2";
1901 src = fetchurl {
1902 url = "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz";
1903 sha1 = "b5243d8f3ec1aa35f1364605bc0d1036e30ab69f";
1904 };
1905 };
1906 "brace-expansion-1.1.6" = {
1907 name = "brace-expansion";
1908 packageName = "brace-expansion";
1909 version = "1.1.6";
1910 src = fetchurl {
1911 url = "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz";
1912 sha1 = "7197d7eaa9b87e648390ea61fc66c84427420df9";
1913 };
1914 };
1915 "balanced-match-0.4.2" = {
1916 name = "balanced-match";
1917 packageName = "balanced-match";
1918 version = "0.4.2";
1919 src = fetchurl {
1920 url = "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz";
1921 sha1 = "cb3f3e3c732dc0f01ee70b403f302e61d7709838";
1922 };
1923 };
1924 "concat-map-0.0.1" = {
1925 name = "concat-map";
1926 packageName = "concat-map";
1927 version = "0.0.1";
1928 src = fetchurl {
1929 url = "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz";
601 sha1 = "d8a96bd77fd68df7793a73036a3ba0d5405d477b";
1930 sha1 = "d8a96bd77fd68df7793a73036a3ba0d5405d477b";
602 })
1931 };
603 ];
1932 };
604 buildInputs =
1933 "date-now-0.1.4" = {
605 (self.nativeDeps."concat-map" or []);
1934 name = "date-now";
606 deps = {
1935 packageName = "date-now";
607 };
1936 version = "0.1.4";
608 peerDependencies = [
1937 src = fetchurl {
609 ];
1938 url = "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz";
610 passthru.names = [ "concat-map" ];
611 };
612 by-spec."console-browserify"."1.1.x" =
613 self.by-version."console-browserify"."1.1.0";
614 by-version."console-browserify"."1.1.0" = lib.makeOverridable self.buildNodePackage {
615 name = "console-browserify-1.1.0";
616 bin = false;
617 src = [
618 (fetchurl {
619 url = "http://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz";
620 name = "console-browserify-1.1.0.tgz";
621 sha1 = "f0241c45730a9fc6323b206dbf38edc741d0bb10";
622 })
623 ];
624 buildInputs =
625 (self.nativeDeps."console-browserify" or []);
626 deps = {
627 "date-now-0.1.4" = self.by-version."date-now"."0.1.4";
628 };
629 peerDependencies = [
630 ];
631 passthru.names = [ "console-browserify" ];
632 };
633 by-spec."core-util-is"."~1.0.0" =
634 self.by-version."core-util-is"."1.0.2";
635 by-version."core-util-is"."1.0.2" = lib.makeOverridable self.buildNodePackage {
636 name = "core-util-is-1.0.2";
637 bin = false;
638 src = [
639 (fetchurl {
640 url = "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz";
641 name = "core-util-is-1.0.2.tgz";
642 sha1 = "b5fd54220aa2bc5ab57aab7140c940754503c1a7";
643 })
644 ];
645 buildInputs =
646 (self.nativeDeps."core-util-is" or []);
647 deps = {
648 };
649 peerDependencies = [
650 ];
651 passthru.names = [ "core-util-is" ];
652 };
653 by-spec."cryptiles"."2.x.x" =
654 self.by-version."cryptiles"."2.0.5";
655 by-version."cryptiles"."2.0.5" = lib.makeOverridable self.buildNodePackage {
656 name = "cryptiles-2.0.5";
657 bin = false;
658 src = [
659 (fetchurl {
660 url = "http://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz";
661 name = "cryptiles-2.0.5.tgz";
662 sha1 = "3bdfecdc608147c1c67202fa291e7dca59eaa3b8";
663 })
664 ];
665 buildInputs =
666 (self.nativeDeps."cryptiles" or []);
667 deps = {
668 "boom-2.10.1" = self.by-version."boom"."2.10.1";
669 };
670 peerDependencies = [
671 ];
672 passthru.names = [ "cryptiles" ];
673 };
674 by-spec."dashdash".">=1.10.1 <2.0.0" =
675 self.by-version."dashdash"."1.12.2";
676 by-version."dashdash"."1.12.2" = lib.makeOverridable self.buildNodePackage {
677 name = "dashdash-1.12.2";
678 bin = false;
679 src = [
680 (fetchurl {
681 url = "http://registry.npmjs.org/dashdash/-/dashdash-1.12.2.tgz";
682 name = "dashdash-1.12.2.tgz";
683 sha1 = "1c6f70588498d047b8cd5777b32ba85a5e25be36";
684 })
685 ];
686 buildInputs =
687 (self.nativeDeps."dashdash" or []);
688 deps = {
689 "assert-plus-0.2.0" = self.by-version."assert-plus"."0.2.0";
690 };
691 peerDependencies = [
692 ];
693 passthru.names = [ "dashdash" ];
694 };
695 by-spec."date-now"."^0.1.4" =
696 self.by-version."date-now"."0.1.4";
697 by-version."date-now"."0.1.4" = lib.makeOverridable self.buildNodePackage {
698 name = "date-now-0.1.4";
699 bin = false;
700 src = [
701 (fetchurl {
702 url = "http://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz";
703 name = "date-now-0.1.4.tgz";
704 sha1 = "eaf439fd4d4848ad74e5cc7dbef200672b9e345b";
1939 sha1 = "eaf439fd4d4848ad74e5cc7dbef200672b9e345b";
705 })
1940 };
706 ];
1941 };
707 buildInputs =
1942 "domhandler-2.3.0" = {
708 (self.nativeDeps."date-now" or []);
1943 name = "domhandler";
709 deps = {
1944 packageName = "domhandler";
710 };
1945 version = "2.3.0";
711 peerDependencies = [
1946 src = fetchurl {
712 ];
1947 url = "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz";
713 passthru.names = [ "date-now" ];
1948 sha1 = "2de59a0822d5027fabff6f032c2b25a2a8abe738";
714 };
1949 };
715 by-spec."dateformat"."1.0.2-1.2.3" =
1950 };
716 self.by-version."dateformat"."1.0.2-1.2.3";
1951 "domutils-1.5.1" = {
717 by-version."dateformat"."1.0.2-1.2.3" = lib.makeOverridable self.buildNodePackage {
1952 name = "domutils";
718 name = "dateformat-1.0.2-1.2.3";
1953 packageName = "domutils";
719 bin = false;
1954 version = "1.5.1";
720 src = [
1955 src = fetchurl {
721 (fetchurl {
1956 url = "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz";
722 url = "http://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz";
1957 sha1 = "dcd8488a26f563d61079e48c9f7b7e32373682cf";
723 name = "dateformat-1.0.2-1.2.3.tgz";
1958 };
724 sha1 = "b0220c02de98617433b72851cf47de3df2cdbee9";
1959 };
725 })
1960 "domelementtype-1.3.0" = {
726 ];
1961 name = "domelementtype";
727 buildInputs =
1962 packageName = "domelementtype";
728 (self.nativeDeps."dateformat" or []);
1963 version = "1.3.0";
729 deps = {
1964 src = fetchurl {
730 };
1965 url = "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz";
731 peerDependencies = [
1966 sha1 = "b17aed82e8ab59e52dd9c19b1756e0fc187204c2";
732 ];
1967 };
733 passthru.names = [ "dateformat" ];
1968 };
734 };
1969 "readable-stream-1.1.14" = {
735 by-spec."debug"."~0.7.0" =
1970 name = "readable-stream";
736 self.by-version."debug"."0.7.4";
1971 packageName = "readable-stream";
737 by-version."debug"."0.7.4" = lib.makeOverridable self.buildNodePackage {
1972 version = "1.1.14";
738 name = "debug-0.7.4";
1973 src = fetchurl {
739 bin = false;
1974 url = "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz";
740 src = [
1975 sha1 = "7cf4c54ef648e3813084c636dd2079e166c081d9";
741 (fetchurl {
1976 };
742 url = "http://registry.npmjs.org/debug/-/debug-0.7.4.tgz";
1977 };
743 name = "debug-0.7.4.tgz";
1978 "entities-1.0.0" = {
744 sha1 = "06e1ea8082c2cb14e39806e22e2f6f757f92af39";
1979 name = "entities";
745 })
1980 packageName = "entities";
746 ];
1981 version = "1.0.0";
747 buildInputs =
1982 src = fetchurl {
748 (self.nativeDeps."debug" or []);
1983 url = "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz";
749 deps = {
1984 sha1 = "b2987aa3821347fcde642b24fdfc9e4fb712bf26";
750 };
1985 };
751 peerDependencies = [
1986 };
752 ];
1987 "dom-serializer-0.1.0" = {
753 passthru.names = [ "debug" ];
1988 name = "dom-serializer";
754 };
1989 packageName = "dom-serializer";
755 by-spec."delayed-stream"."~1.0.0" =
1990 version = "0.1.0";
756 self.by-version."delayed-stream"."1.0.0";
1991 src = fetchurl {
757 by-version."delayed-stream"."1.0.0" = lib.makeOverridable self.buildNodePackage {
1992 url = "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz";
758 name = "delayed-stream-1.0.0";
759 bin = false;
760 src = [
761 (fetchurl {
762 url = "http://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz";
763 name = "delayed-stream-1.0.0.tgz";
764 sha1 = "df3ae199acadfb7d440aaae0b29e2272b24ec619";
765 })
766 ];
767 buildInputs =
768 (self.nativeDeps."delayed-stream" or []);
769 deps = {
770 };
771 peerDependencies = [
772 ];
773 passthru.names = [ "delayed-stream" ];
774 };
775 by-spec."dom-serializer"."0" =
776 self.by-version."dom-serializer"."0.1.0";
777 by-version."dom-serializer"."0.1.0" = lib.makeOverridable self.buildNodePackage {
778 name = "dom-serializer-0.1.0";
779 bin = false;
780 src = [
781 (fetchurl {
782 url = "http://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz";
783 name = "dom-serializer-0.1.0.tgz";
784 sha1 = "073c697546ce0780ce23be4a28e293e40bc30c82";
1993 sha1 = "073c697546ce0780ce23be4a28e293e40bc30c82";
785 })
1994 };
786 ];
1995 };
787 buildInputs =
1996 "domelementtype-1.1.3" = {
788 (self.nativeDeps."dom-serializer" or []);
1997 name = "domelementtype";
789 deps = {
1998 packageName = "domelementtype";
790 "domelementtype-1.1.3" = self.by-version."domelementtype"."1.1.3";
1999 version = "1.1.3";
791 "entities-1.1.1" = self.by-version."entities"."1.1.1";
2000 src = fetchurl {
792 };
2001 url = "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz";
793 peerDependencies = [
794 ];
795 passthru.names = [ "dom-serializer" ];
796 };
797 by-spec."domelementtype"."1" =
798 self.by-version."domelementtype"."1.3.0";
799 by-version."domelementtype"."1.3.0" = lib.makeOverridable self.buildNodePackage {
800 name = "domelementtype-1.3.0";
801 bin = false;
802 src = [
803 (fetchurl {
804 url = "http://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz";
805 name = "domelementtype-1.3.0.tgz";
806 sha1 = "b17aed82e8ab59e52dd9c19b1756e0fc187204c2";
807 })
808 ];
809 buildInputs =
810 (self.nativeDeps."domelementtype" or []);
811 deps = {
812 };
813 peerDependencies = [
814 ];
815 passthru.names = [ "domelementtype" ];
816 };
817 by-spec."domelementtype"."~1.1.1" =
818 self.by-version."domelementtype"."1.1.3";
819 by-version."domelementtype"."1.1.3" = lib.makeOverridable self.buildNodePackage {
820 name = "domelementtype-1.1.3";
821 bin = false;
822 src = [
823 (fetchurl {
824 url = "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz";
825 name = "domelementtype-1.1.3.tgz";
826 sha1 = "bd28773e2642881aec51544924299c5cd822185b";
2002 sha1 = "bd28773e2642881aec51544924299c5cd822185b";
827 })
2003 };
2004 };
2005 "entities-1.1.1" = {
2006 name = "entities";
2007 packageName = "entities";
2008 version = "1.1.1";
2009 src = fetchurl {
2010 url = "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz";
2011 sha1 = "6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0";
2012 };
2013 };
2014 };
2015 args = {
2016 name = "rhodecode-enterprise";
2017 packageName = "rhodecode-enterprise";
2018 version = "0.0.1";
2019 src = ./.;
2020 dependencies = [
2021 sources."grunt-0.4.5"
2022 sources."grunt-contrib-copy-1.0.0"
2023 (sources."grunt-contrib-concat-0.5.1" // {
2024 dependencies = [
2025 sources."chalk-0.5.1"
2026 sources."ansi-styles-1.1.0"
2027 sources."has-ansi-0.1.0"
2028 sources."strip-ansi-0.3.0"
2029 sources."supports-color-0.2.0"
2030 sources."ansi-regex-0.2.1"
828 ];
2031 ];
829 buildInputs =
830 (self.nativeDeps."domelementtype" or []);
831 deps = {
832 };
833 peerDependencies = [
834 ];
835 passthru.names = [ "domelementtype" ];
836 };
837 by-spec."domhandler"."2.3" =
838 self.by-version."domhandler"."2.3.0";
839 by-version."domhandler"."2.3.0" = lib.makeOverridable self.buildNodePackage {
840 name = "domhandler-2.3.0";
841 bin = false;
842 src = [
843 (fetchurl {
844 url = "http://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz";
845 name = "domhandler-2.3.0.tgz";
846 sha1 = "2de59a0822d5027fabff6f032c2b25a2a8abe738";
847 })
2032 })
2033 sources."grunt-contrib-jshint-0.12.0"
2034 (sources."grunt-contrib-less-1.4.0" // {
2035 dependencies = [
2036 sources."async-2.0.1"
2037 sources."lodash-4.15.0"
848 ];
2038 ];
849 buildInputs =
850 (self.nativeDeps."domhandler" or []);
851 deps = {
852 "domelementtype-1.3.0" = self.by-version."domelementtype"."1.3.0";
853 };
854 peerDependencies = [
855 ];
856 passthru.names = [ "domhandler" ];
857 };
858 by-spec."domutils"."1.5" =
859 self.by-version."domutils"."1.5.1";
860 by-version."domutils"."1.5.1" = lib.makeOverridable self.buildNodePackage {
861 name = "domutils-1.5.1";
862 bin = false;
863 src = [
864 (fetchurl {
865 url = "http://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz";
866 name = "domutils-1.5.1.tgz";
867 sha1 = "dcd8488a26f563d61079e48c9f7b7e32373682cf";
868 })
2039 })
2040 (sources."grunt-contrib-watch-0.6.1" // {
2041 dependencies = [
2042 sources."lodash-2.4.2"
2043 sources."async-0.2.10"
869 ];
2044 ];
870 buildInputs =
871 (self.nativeDeps."domutils" or []);
872 deps = {
873 "dom-serializer-0.1.0" = self.by-version."dom-serializer"."0.1.0";
874 "domelementtype-1.3.0" = self.by-version."domelementtype"."1.3.0";
875 };
876 peerDependencies = [
877 ];
878 passthru.names = [ "domutils" ];
879 };
880 by-spec."ecc-jsbn".">=0.0.1 <1.0.0" =
881 self.by-version."ecc-jsbn"."0.1.1";
882 by-version."ecc-jsbn"."0.1.1" = lib.makeOverridable self.buildNodePackage {
883 name = "ecc-jsbn-0.1.1";
884 bin = false;
885 src = [
886 (fetchurl {
887 url = "http://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz";
888 name = "ecc-jsbn-0.1.1.tgz";
889 sha1 = "0fc73a9ed5f0d53c38193398523ef7e543777505";
890 })
2045 })
2046 sources."crisper-2.0.2"
2047 (sources."vulcanize-1.14.8" // {
2048 dependencies = [
2049 sources."nopt-3.0.6"
891 ];
2050 ];
892 buildInputs =
2051 })
893 (self.nativeDeps."ecc-jsbn" or []);
2052 sources."grunt-crisper-1.0.1"
894 deps = {
2053 (sources."grunt-vulcanize-1.0.0" // {
895 "jsbn-0.1.0" = self.by-version."jsbn"."0.1.0";
2054 dependencies = [
896 };
2055 sources."crisper-1.2.0"
897 peerDependencies = [
2056 sources."nopt-3.0.6"
898 ];
2057 ];
899 passthru.names = [ "ecc-jsbn" ];
900 };
901 by-spec."entities"."1.0" =
902 self.by-version."entities"."1.0.0";
903 by-version."entities"."1.0.0" = lib.makeOverridable self.buildNodePackage {
904 name = "entities-1.0.0";
905 bin = false;
906 src = [
907 (fetchurl {
908 url = "http://registry.npmjs.org/entities/-/entities-1.0.0.tgz";
909 name = "entities-1.0.0.tgz";
910 sha1 = "b2987aa3821347fcde642b24fdfc9e4fb712bf26";
911 })
2058 })
912 ];
2059 (sources."jshint-2.9.3" // {
913 buildInputs =
2060 dependencies = [
914 (self.nativeDeps."entities" or []);
2061 sources."minimatch-3.0.3"
915 deps = {
2062 sources."lodash-3.7.0"
916 };
917 peerDependencies = [
918 ];
2063 ];
919 passthru.names = [ "entities" ];
920 };
921 by-spec."entities"."~1.1.1" =
922 self.by-version."entities"."1.1.1";
923 by-version."entities"."1.1.1" = lib.makeOverridable self.buildNodePackage {
924 name = "entities-1.1.1";
925 bin = false;
926 src = [
927 (fetchurl {
928 url = "http://registry.npmjs.org/entities/-/entities-1.1.1.tgz";
929 name = "entities-1.1.1.tgz";
930 sha1 = "6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0";
931 })
2064 })
932 ];
2065 sources."async-0.1.22"
933 buildInputs =
2066 sources."coffee-script-1.3.3"
934 (self.nativeDeps."entities" or []);
2067 sources."colors-0.6.2"
935 deps = {
2068 sources."dateformat-1.0.2-1.2.3"
936 };
2069 sources."eventemitter2-0.4.14"
937 peerDependencies = [
2070 (sources."findup-sync-0.1.3" // {
2071 dependencies = [
2072 sources."glob-3.2.11"
2073 sources."lodash-2.4.2"
2074 sources."minimatch-0.3.0"
938 ];
2075 ];
939 passthru.names = [ "entities" ];
940 };
941 by-spec."errno"."^0.1.1" =
942 self.by-version."errno"."0.1.4";
943 by-version."errno"."0.1.4" = lib.makeOverridable self.buildNodePackage {
944 name = "errno-0.1.4";
945 bin = true;
946 src = [
947 (fetchurl {
948 url = "http://registry.npmjs.org/errno/-/errno-0.1.4.tgz";
949 name = "errno-0.1.4.tgz";
950 sha1 = "b896e23a9e5e8ba33871fc996abd3635fc9a1c7d";
951 })
2076 })
952 ];
2077 (sources."glob-3.1.21" // {
953 buildInputs =
2078 dependencies = [
954 (self.nativeDeps."errno" or []);
2079 sources."inherits-1.0.2"
955 deps = {
956 "prr-0.0.0" = self.by-version."prr"."0.0.0";
957 };
958 peerDependencies = [
959 ];
2080 ];
960 passthru.names = [ "errno" ];
961 };
962 by-spec."escape-string-regexp"."^1.0.0" =
963 self.by-version."escape-string-regexp"."1.0.4";
964 by-version."escape-string-regexp"."1.0.4" = lib.makeOverridable self.buildNodePackage {
965 name = "escape-string-regexp-1.0.4";
966 bin = false;
967 src = [
968 (fetchurl {
969 url = "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.4.tgz";
970 name = "escape-string-regexp-1.0.4.tgz";
971 sha1 = "b85e679b46f72d03fbbe8a3bf7259d535c21b62f";
972 })
2081 })
973 ];
2082 sources."hooker-0.2.3"
974 buildInputs =
2083 sources."iconv-lite-0.2.11"
975 (self.nativeDeps."escape-string-regexp" or []);
2084 sources."minimatch-0.2.14"
976 deps = {
2085 sources."nopt-1.0.10"
977 };
2086 sources."rimraf-2.2.8"
978 peerDependencies = [
2087 sources."lodash-0.9.2"
979 ];
2088 sources."underscore.string-2.2.1"
980 passthru.names = [ "escape-string-regexp" ];
2089 sources."which-1.0.9"
981 };
2090 sources."js-yaml-2.0.5"
982 by-spec."escape-string-regexp"."^1.0.2" =
2091 sources."exit-0.1.2"
983 self.by-version."escape-string-regexp"."1.0.4";
2092 sources."getobject-0.1.0"
984 by-spec."esprima"."~ 1.0.2" =
2093 sources."grunt-legacy-util-0.2.0"
985 self.by-version."esprima"."1.0.4";
2094 (sources."grunt-legacy-log-0.1.3" // {
986 by-version."esprima"."1.0.4" = lib.makeOverridable self.buildNodePackage {
2095 dependencies = [
987 name = "esprima-1.0.4";
2096 sources."lodash-2.4.2"
988 bin = true;
2097 sources."underscore.string-2.3.3"
989 src = [
990 (fetchurl {
991 url = "http://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz";
992 name = "esprima-1.0.4.tgz";
993 sha1 = "9f557e08fc3b4d26ece9dd34f8fbf476b62585ad";
994 })
995 ];
996 buildInputs =
997 (self.nativeDeps."esprima" or []);
998 deps = {
999 };
1000 peerDependencies = [
1001 ];
1002 passthru.names = [ "esprima" ];
1003 };
1004 by-spec."eventemitter2"."~0.4.13" =
1005 self.by-version."eventemitter2"."0.4.14";
1006 by-version."eventemitter2"."0.4.14" = lib.makeOverridable self.buildNodePackage {
1007 name = "eventemitter2-0.4.14";
1008 bin = false;
1009 src = [
1010 (fetchurl {
1011 url = "http://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz";
1012 name = "eventemitter2-0.4.14.tgz";
1013 sha1 = "8f61b75cde012b2e9eb284d4545583b5643b61ab";
1014 })
1015 ];
1016 buildInputs =
1017 (self.nativeDeps."eventemitter2" or []);
1018 deps = {
1019 };
1020 peerDependencies = [
1021 ];
2098 ];
1022 passthru.names = [ "eventemitter2" ];
1023 };
1024 by-spec."exit"."0.1.2" =
1025 self.by-version."exit"."0.1.2";
1026 by-version."exit"."0.1.2" = lib.makeOverridable self.buildNodePackage {
1027 name = "exit-0.1.2";
1028 bin = false;
1029 src = [
1030 (fetchurl {
1031 url = "http://registry.npmjs.org/exit/-/exit-0.1.2.tgz";
1032 name = "exit-0.1.2.tgz";
1033 sha1 = "0632638f8d877cc82107d30a0fff1a17cba1cd0c";
1034 })
2099 })
1035 ];
2100 sources."inherits-2.0.1"
1036 buildInputs =
2101 sources."lru-cache-2.7.3"
1037 (self.nativeDeps."exit" or []);
2102 sources."sigmund-1.0.1"
1038 deps = {
2103 sources."graceful-fs-1.2.3"
1039 };
2104 sources."abbrev-1.0.9"
1040 peerDependencies = [
2105 (sources."argparse-0.1.16" // {
1041 ];
2106 dependencies = [
1042 passthru.names = [ "exit" ];
2107 sources."underscore.string-2.4.0"
1043 };
1044 by-spec."exit"."0.1.x" =
1045 self.by-version."exit"."0.1.2";
1046 by-spec."exit"."~0.1.1" =
1047 self.by-version."exit"."0.1.2";
1048 by-spec."extend"."~3.0.0" =
1049 self.by-version."extend"."3.0.0";
1050 by-version."extend"."3.0.0" = lib.makeOverridable self.buildNodePackage {
1051 name = "extend-3.0.0";
1052 bin = false;
1053 src = [
1054 (fetchurl {
1055 url = "http://registry.npmjs.org/extend/-/extend-3.0.0.tgz";
1056 name = "extend-3.0.0.tgz";
1057 sha1 = "5a474353b9f3353ddd8176dfd37b91c83a46f1d4";
1058 })
1059 ];
1060 buildInputs =
1061 (self.nativeDeps."extend" or []);
1062 deps = {
1063 };
1064 peerDependencies = [
1065 ];
2108 ];
1066 passthru.names = [ "extend" ];
1067 };
1068 by-spec."extsprintf"."1.0.2" =
1069 self.by-version."extsprintf"."1.0.2";
1070 by-version."extsprintf"."1.0.2" = lib.makeOverridable self.buildNodePackage {
1071 name = "extsprintf-1.0.2";
1072 bin = false;
1073 src = [
1074 (fetchurl {
1075 url = "http://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz";
1076 name = "extsprintf-1.0.2.tgz";
1077 sha1 = "e1080e0658e300b06294990cc70e1502235fd550";
1078 })
2109 })
1079 ];
2110 sources."esprima-1.0.4"
1080 buildInputs =
2111 sources."underscore-1.7.0"
1081 (self.nativeDeps."extsprintf" or []);
2112 (sources."grunt-legacy-log-utils-0.1.1" // {
1082 deps = {
2113 dependencies = [
1083 };
2114 sources."lodash-2.4.2"
1084 peerDependencies = [
2115 sources."underscore.string-2.3.3"
1085 ];
2116 ];
1086 passthru.names = [ "extsprintf" ];
1087 };
1088 by-spec."faye-websocket"."~0.4.3" =
1089 self.by-version."faye-websocket"."0.4.4";
1090 by-version."faye-websocket"."0.4.4" = lib.makeOverridable self.buildNodePackage {
1091 name = "faye-websocket-0.4.4";
1092 bin = false;
1093 src = [
1094 (fetchurl {
1095 url = "http://registry.npmjs.org/faye-websocket/-/faye-websocket-0.4.4.tgz";
1096 name = "faye-websocket-0.4.4.tgz";
1097 sha1 = "c14c5b3bf14d7417ffbfd990c0a7495cd9f337bc";
1098 })
2117 })
1099 ];
2118 sources."chalk-1.1.3"
1100 buildInputs =
2119 sources."file-sync-cmp-0.1.1"
1101 (self.nativeDeps."faye-websocket" or []);
2120 sources."ansi-styles-2.2.1"
1102 deps = {
2121 sources."escape-string-regexp-1.0.5"
1103 };
2122 sources."has-ansi-2.0.0"
1104 peerDependencies = [
2123 sources."strip-ansi-3.0.1"
1105 ];
2124 sources."supports-color-2.0.0"
1106 passthru.names = [ "faye-websocket" ];
2125 sources."ansi-regex-2.0.0"
1107 };
2126 sources."source-map-0.3.0"
1108 by-spec."findup-sync"."~0.1.2" =
2127 sources."amdefine-1.0.0"
1109 self.by-version."findup-sync"."0.1.3";
2128 (sources."less-2.7.1" // {
1110 by-version."findup-sync"."0.1.3" = lib.makeOverridable self.buildNodePackage {
2129 dependencies = [
1111 name = "findup-sync-0.1.3";
2130 sources."graceful-fs-4.1.6"
1112 bin = false;
2131 sources."source-map-0.5.6"
1113 src = [
1114 (fetchurl {
1115 url = "http://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz";
1116 name = "findup-sync-0.1.3.tgz";
1117 sha1 = "7f3e7a97b82392c653bf06589bd85190e93c3683";
1118 })
1119 ];
2132 ];
1120 buildInputs =
1121 (self.nativeDeps."findup-sync" or []);
1122 deps = {
1123 "glob-3.2.11" = self.by-version."glob"."3.2.11";
1124 "lodash-2.4.2" = self.by-version."lodash"."2.4.2";
1125 };
1126 peerDependencies = [
1127 ];
1128 passthru.names = [ "findup-sync" ];
1129 };
1130 by-spec."forever-agent"."~0.6.1" =
1131 self.by-version."forever-agent"."0.6.1";
1132 by-version."forever-agent"."0.6.1" = lib.makeOverridable self.buildNodePackage {
1133 name = "forever-agent-0.6.1";
1134 bin = false;
1135 src = [
1136 (fetchurl {
1137 url = "http://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz";
1138 name = "forever-agent-0.6.1.tgz";
1139 sha1 = "fbc71f0c41adeb37f96c577ad1ed42d8fdacca91";
1140 })
2133 })
1141 ];
2134 sources."errno-0.1.4"
1142 buildInputs =
2135 sources."image-size-0.5.0"
1143 (self.nativeDeps."forever-agent" or []);
2136 sources."mime-1.3.4"
1144 deps = {
2137 sources."mkdirp-0.5.1"
1145 };
2138 sources."promise-7.1.1"
1146 peerDependencies = [
2139 sources."prr-0.0.0"
1147 ];
2140 sources."minimist-0.0.8"
1148 passthru.names = [ "forever-agent" ];
2141 sources."asap-2.0.4"
1149 };
2142 sources."gaze-0.5.2"
1150 by-spec."form-data"."~1.0.0-rc3" =
2143 sources."tiny-lr-fork-0.0.5"
1151 self.by-version."form-data"."1.0.0-rc3";
2144 (sources."globule-0.1.0" // {
1152 by-version."form-data"."1.0.0-rc3" = lib.makeOverridable self.buildNodePackage {
2145 dependencies = [
1153 name = "form-data-1.0.0-rc3";
2146 sources."lodash-1.0.2"
1154 bin = false;
1155 src = [
1156 (fetchurl {
1157 url = "http://registry.npmjs.org/form-data/-/form-data-1.0.0-rc3.tgz";
1158 name = "form-data-1.0.0-rc3.tgz";
1159 sha1 = "d35bc62e7fbc2937ae78f948aaa0d38d90607577";
1160 })
1161 ];
1162 buildInputs =
1163 (self.nativeDeps."form-data" or []);
1164 deps = {
1165 "async-1.5.2" = self.by-version."async"."1.5.2";
1166 "combined-stream-1.0.5" = self.by-version."combined-stream"."1.0.5";
1167 "mime-types-2.1.9" = self.by-version."mime-types"."2.1.9";
1168 };
1169 peerDependencies = [
1170 ];
2147 ];
1171 passthru.names = [ "form-data" ];
1172 };
1173 by-spec."gaze"."~0.5.1" =
1174 self.by-version."gaze"."0.5.2";
1175 by-version."gaze"."0.5.2" = lib.makeOverridable self.buildNodePackage {
1176 name = "gaze-0.5.2";
1177 bin = false;
1178 src = [
1179 (fetchurl {
1180 url = "http://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz";
1181 name = "gaze-0.5.2.tgz";
1182 sha1 = "40b709537d24d1d45767db5a908689dfe69ac44f";
1183 })
2148 })
1184 ];
2149 sources."qs-0.5.6"
1185 buildInputs =
2150 sources."faye-websocket-0.4.4"
1186 (self.nativeDeps."gaze" or []);
2151 (sources."noptify-0.0.3" // {
1187 deps = {
2152 dependencies = [
1188 "globule-0.1.0" = self.by-version."globule"."0.1.0";
2153 sources."nopt-2.0.0"
1189 };
1190 peerDependencies = [
1191 ];
2154 ];
1192 passthru.names = [ "gaze" ];
1193 };
1194 by-spec."generate-function"."^2.0.0" =
1195 self.by-version."generate-function"."2.0.0";
1196 by-version."generate-function"."2.0.0" = lib.makeOverridable self.buildNodePackage {
1197 name = "generate-function-2.0.0";
1198 bin = false;
1199 src = [
1200 (fetchurl {
1201 url = "http://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz";
1202 name = "generate-function-2.0.0.tgz";
1203 sha1 = "6858fe7c0969b7d4e9093337647ac79f60dfbe74";
1204 })
2155 })
1205 ];
2156 sources."debug-0.7.4"
1206 buildInputs =
2157 sources."command-line-args-2.1.6"
1207 (self.nativeDeps."generate-function" or []);
2158 sources."dom5-1.3.3"
1208 deps = {
2159 sources."array-back-1.0.3"
1209 };
2160 sources."command-line-usage-2.0.5"
1210 peerDependencies = [
2161 sources."core-js-2.4.1"
1211 ];
2162 sources."feature-detect-es6-1.3.1"
1212 passthru.names = [ "generate-function" ];
2163 (sources."find-replace-1.0.2" // {
1213 };
2164 dependencies = [
1214 by-spec."generate-object-property"."^1.1.0" =
2165 sources."test-value-2.0.0"
1215 self.by-version."generate-object-property"."1.2.0";
1216 by-version."generate-object-property"."1.2.0" = lib.makeOverridable self.buildNodePackage {
1217 name = "generate-object-property-1.2.0";
1218 bin = false;
1219 src = [
1220 (fetchurl {
1221 url = "http://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz";
1222 name = "generate-object-property-1.2.0.tgz";
1223 sha1 = "9c0e1c40308ce804f4783618b937fa88f99d50d0";
1224 })
1225 ];
1226 buildInputs =
1227 (self.nativeDeps."generate-object-property" or []);
1228 deps = {
1229 "is-property-1.0.2" = self.by-version."is-property"."1.0.2";
1230 };
1231 peerDependencies = [
1232 ];
2166 ];
1233 passthru.names = [ "generate-object-property" ];
1234 };
1235 by-spec."getobject"."~0.1.0" =
1236 self.by-version."getobject"."0.1.0";
1237 by-version."getobject"."0.1.0" = lib.makeOverridable self.buildNodePackage {
1238 name = "getobject-0.1.0";
1239 bin = false;
1240 src = [
1241 (fetchurl {
1242 url = "http://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz";
1243 name = "getobject-0.1.0.tgz";
1244 sha1 = "047a449789fa160d018f5486ed91320b6ec7885c";
1245 })
2167 })
1246 ];
2168 sources."typical-2.5.0"
1247 buildInputs =
2169 sources."ansi-escape-sequences-2.2.2"
1248 (self.nativeDeps."getobject" or []);
2170 sources."column-layout-2.1.4"
1249 deps = {
2171 sources."wordwrapjs-1.2.1"
1250 };
2172 sources."collect-all-0.2.1"
1251 peerDependencies = [
2173 sources."stream-connect-1.0.2"
1252 ];
2174 sources."stream-via-0.1.1"
1253 passthru.names = [ "getobject" ];
2175 (sources."collect-json-1.0.8" // {
1254 };
2176 dependencies = [
1255 by-spec."glob"."~ 3.2.1" =
2177 sources."collect-all-1.0.2"
1256 self.by-version."glob"."3.2.11";
2178 sources."stream-via-1.0.3"
1257 by-version."glob"."3.2.11" = lib.makeOverridable self.buildNodePackage {
1258 name = "glob-3.2.11";
1259 bin = false;
1260 src = [
1261 (fetchurl {
1262 url = "http://registry.npmjs.org/glob/-/glob-3.2.11.tgz";
1263 name = "glob-3.2.11.tgz";
1264 sha1 = "4a973f635b9190f715d10987d5c00fd2815ebe3d";
1265 })
1266 ];
1267 buildInputs =
1268 (self.nativeDeps."glob" or []);
1269 deps = {
1270 "inherits-2.0.1" = self.by-version."inherits"."2.0.1";
1271 "minimatch-0.3.0" = self.by-version."minimatch"."0.3.0";
1272 };
1273 peerDependencies = [
1274 ];
2179 ];
1275 passthru.names = [ "glob" ];
1276 };
1277 by-spec."glob"."~3.1.21" =
1278 self.by-version."glob"."3.1.21";
1279 by-version."glob"."3.1.21" = lib.makeOverridable self.buildNodePackage {
1280 name = "glob-3.1.21";
1281 bin = false;
1282 src = [
1283 (fetchurl {
1284 url = "http://registry.npmjs.org/glob/-/glob-3.1.21.tgz";
1285 name = "glob-3.1.21.tgz";
1286 sha1 = "d29e0a055dea5138f4d07ed40e8982e83c2066cd";
1287 })
2180 })
1288 ];
2181 sources."deep-extend-0.4.1"
1289 buildInputs =
2182 sources."object-tools-2.0.6"
1290 (self.nativeDeps."glob" or []);
2183 sources."object-get-2.1.0"
1291 deps = {
2184 sources."test-value-1.1.0"
1292 "minimatch-0.2.14" = self.by-version."minimatch"."0.2.14";
2185 sources."@types/clone-0.1.29"
1293 "graceful-fs-1.2.3" = self.by-version."graceful-fs"."1.2.3";
2186 sources."@types/node-4.0.30"
1294 "inherits-1.0.2" = self.by-version."inherits"."1.0.2";
2187 (sources."@types/parse5-0.0.28" // {
1295 };
2188 dependencies = [
1296 peerDependencies = [
2189 sources."@types/node-6.0.37"
1297 ];
1298 passthru.names = [ "glob" ];
1299 };
1300 by-spec."glob"."~3.2.9" =
1301 self.by-version."glob"."3.2.11";
1302 by-spec."globule"."~0.1.0" =
1303 self.by-version."globule"."0.1.0";
1304 by-version."globule"."0.1.0" = lib.makeOverridable self.buildNodePackage {
1305 name = "globule-0.1.0";
1306 bin = false;
1307 src = [
1308 (fetchurl {
1309 url = "http://registry.npmjs.org/globule/-/globule-0.1.0.tgz";
1310 name = "globule-0.1.0.tgz";
1311 sha1 = "d9c8edde1da79d125a151b79533b978676346ae5";
1312 })
1313 ];
1314 buildInputs =
1315 (self.nativeDeps."globule" or []);
1316 deps = {
1317 "lodash-1.0.2" = self.by-version."lodash"."1.0.2";
1318 "glob-3.1.21" = self.by-version."glob"."3.1.21";
1319 "minimatch-0.2.14" = self.by-version."minimatch"."0.2.14";
1320 };
1321 peerDependencies = [
1322 ];
1323 passthru.names = [ "globule" ];
1324 };
1325 by-spec."graceful-fs"."^3.0.5" =
1326 self.by-version."graceful-fs"."3.0.8";
1327 by-version."graceful-fs"."3.0.8" = lib.makeOverridable self.buildNodePackage {
1328 name = "graceful-fs-3.0.8";
1329 bin = false;
1330 src = [
1331 (fetchurl {
1332 url = "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.8.tgz";
1333 name = "graceful-fs-3.0.8.tgz";
1334 sha1 = "ce813e725fa82f7e6147d51c9a5ca68270551c22";
1335 })
1336 ];
2190 ];
1337 buildInputs =
1338 (self.nativeDeps."graceful-fs" or []);
1339 deps = {
1340 };
1341 peerDependencies = [
1342 ];
1343 passthru.names = [ "graceful-fs" ];
1344 };
1345 by-spec."graceful-fs"."~1.2.0" =
1346 self.by-version."graceful-fs"."1.2.3";
1347 by-version."graceful-fs"."1.2.3" = lib.makeOverridable self.buildNodePackage {
1348 name = "graceful-fs-1.2.3";
1349 bin = false;
1350 src = [
1351 (fetchurl {
1352 url = "http://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz";
1353 name = "graceful-fs-1.2.3.tgz";
1354 sha1 = "15a4806a57547cb2d2dbf27f42e89a8c3451b364";
1355 })
2191 })
1356 ];
2192 sources."clone-1.0.2"
1357 buildInputs =
2193 sources."parse5-1.5.1"
1358 (self.nativeDeps."graceful-fs" or []);
2194 sources."es6-promise-2.3.0"
1359 deps = {
2195 sources."hydrolysis-1.24.1"
1360 };
2196 sources."path-posix-1.0.0"
1361 peerDependencies = [
2197 sources."update-notifier-0.6.3"
1362 ];
2198 sources."babel-polyfill-6.13.0"
1363 passthru.names = [ "graceful-fs" ];
2199 sources."doctrine-0.7.2"
1364 };
2200 (sources."escodegen-1.8.1" // {
1365 by-spec."graceful-readlink".">= 1.0.0" =
2201 dependencies = [
1366 self.by-version."graceful-readlink"."1.0.1";
2202 sources."estraverse-1.9.3"
1367 by-version."graceful-readlink"."1.0.1" = lib.makeOverridable self.buildNodePackage {
2203 sources."esutils-2.0.2"
1368 name = "graceful-readlink-1.0.1";
2204 sources."esprima-2.7.3"
1369 bin = false;
2205 sources."source-map-0.2.0"
1370 src = [
1371 (fetchurl {
1372 url = "http://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz";
1373 name = "graceful-readlink-1.0.1.tgz";
1374 sha1 = "4cafad76bc62f02fa039b2f94e9a3dd3a391a725";
1375 })
1376 ];
1377 buildInputs =
1378 (self.nativeDeps."graceful-readlink" or []);
1379 deps = {
1380 };
1381 peerDependencies = [
1382 ];
2206 ];
1383 passthru.names = [ "graceful-readlink" ];
1384 };
1385 by-spec."grunt".">=0.4.0" =
1386 self.by-version."grunt"."0.4.5";
1387 by-version."grunt"."0.4.5" = lib.makeOverridable self.buildNodePackage {
1388 name = "grunt-0.4.5";
1389 bin = false;
1390 src = [
1391 (fetchurl {
1392 url = "http://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz";
1393 name = "grunt-0.4.5.tgz";
1394 sha1 = "56937cd5194324adff6d207631832a9d6ba4e7f0";
1395 })
2207 })
1396 ];
2208 sources."espree-3.1.7"
1397 buildInputs =
2209 sources."estraverse-3.1.0"
1398 (self.nativeDeps."grunt" or []);
2210 sources."path-is-absolute-1.0.0"
1399 deps = {
2211 sources."babel-runtime-6.11.6"
1400 "async-0.1.22" = self.by-version."async"."0.1.22";
2212 sources."regenerator-runtime-0.9.5"
1401 "coffee-script-1.3.3" = self.by-version."coffee-script"."1.3.3";
2213 sources."esutils-1.1.6"
1402 "colors-0.6.2" = self.by-version."colors"."0.6.2";
2214 sources."isarray-0.0.1"
1403 "dateformat-1.0.2-1.2.3" = self.by-version."dateformat"."1.0.2-1.2.3";
2215 sources."optionator-0.8.1"
1404 "eventemitter2-0.4.14" = self.by-version."eventemitter2"."0.4.14";
2216 sources."prelude-ls-1.1.2"
1405 "findup-sync-0.1.3" = self.by-version."findup-sync"."0.1.3";
2217 sources."deep-is-0.1.3"
1406 "glob-3.1.21" = self.by-version."glob"."3.1.21";
2218 sources."wordwrap-1.0.0"
1407 "hooker-0.2.3" = self.by-version."hooker"."0.2.3";
2219 sources."type-check-0.3.2"
1408 "iconv-lite-0.2.11" = self.by-version."iconv-lite"."0.2.11";
2220 sources."levn-0.3.0"
1409 "minimatch-0.2.14" = self.by-version."minimatch"."0.2.14";
2221 sources."fast-levenshtein-1.1.4"
1410 "nopt-1.0.10" = self.by-version."nopt"."1.0.10";
2222 sources."acorn-3.3.0"
1411 "rimraf-2.2.8" = self.by-version."rimraf"."2.2.8";
2223 sources."acorn-jsx-3.0.1"
1412 "lodash-0.9.2" = self.by-version."lodash"."0.9.2";
2224 sources."boxen-0.3.1"
1413 "underscore.string-2.2.1" = self.by-version."underscore.string"."2.2.1";
2225 (sources."configstore-2.0.0" // {
1414 "which-1.0.9" = self.by-version."which"."1.0.9";
2226 dependencies = [
1415 "js-yaml-2.0.5" = self.by-version."js-yaml"."2.0.5";
2227 sources."graceful-fs-4.1.6"
1416 "exit-0.1.2" = self.by-version."exit"."0.1.2";
1417 "getobject-0.1.0" = self.by-version."getobject"."0.1.0";
1418 "grunt-legacy-util-0.2.0" = self.by-version."grunt-legacy-util"."0.2.0";
1419 "grunt-legacy-log-0.1.3" = self.by-version."grunt-legacy-log"."0.1.3";
1420 };
1421 peerDependencies = [
1422 ];
1423 passthru.names = [ "grunt" ];
1424 };
1425 by-spec."grunt"."^0.4.5" =
1426 self.by-version."grunt"."0.4.5";
1427 "grunt" = self.by-version."grunt"."0.4.5";
1428 by-spec."grunt"."~0.4.0" =
1429 self.by-version."grunt"."0.4.5";
1430 by-spec."grunt-contrib-concat"."^0.5.1" =
1431 self.by-version."grunt-contrib-concat"."0.5.1";
1432 by-version."grunt-contrib-concat"."0.5.1" = lib.makeOverridable self.buildNodePackage {
1433 name = "grunt-contrib-concat-0.5.1";
1434 bin = false;
1435 src = [
1436 (fetchurl {
1437 url = "http://registry.npmjs.org/grunt-contrib-concat/-/grunt-contrib-concat-0.5.1.tgz";
1438 name = "grunt-contrib-concat-0.5.1.tgz";
1439 sha1 = "953c6efdfdfd2c107ab9c85077f2d4b24d31cd49";
1440 })
1441 ];
2228 ];
1442 buildInputs =
1443 (self.nativeDeps."grunt-contrib-concat" or []);
1444 deps = {
1445 "chalk-0.5.1" = self.by-version."chalk"."0.5.1";
1446 "source-map-0.3.0" = self.by-version."source-map"."0.3.0";
1447 };
1448 peerDependencies = [
1449 self.by-version."grunt"."0.4.5"
1450 ];
1451 passthru.names = [ "grunt-contrib-concat" ];
1452 };
1453 "grunt-contrib-concat" = self.by-version."grunt-contrib-concat"."0.5.1";
1454 by-spec."grunt-contrib-jshint"."^0.12.0" =
1455 self.by-version."grunt-contrib-jshint"."0.12.0";
1456 by-version."grunt-contrib-jshint"."0.12.0" = lib.makeOverridable self.buildNodePackage {
1457 name = "grunt-contrib-jshint-0.12.0";
1458 bin = false;
1459 src = [
1460 (fetchurl {
1461 url = "http://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-0.12.0.tgz";
1462 name = "grunt-contrib-jshint-0.12.0.tgz";
1463 sha1 = "f6b2f06fc715264837a7ab6c69a1ce1a689c2c29";
1464 })
2229 })
1465 ];
2230 sources."is-npm-1.0.0"
1466 buildInputs =
2231 sources."latest-version-2.0.0"
1467 (self.nativeDeps."grunt-contrib-jshint" or []);
2232 sources."semver-diff-2.1.0"
1468 deps = {
2233 sources."filled-array-1.1.0"
1469 "hooker-0.2.3" = self.by-version."hooker"."0.2.3";
2234 sources."object-assign-4.1.0"
1470 "jshint-2.9.1" = self.by-version."jshint"."2.9.1";
2235 sources."repeating-2.0.1"
1471 };
2236 sources."string-width-1.0.2"
1472 peerDependencies = [
2237 sources."widest-line-1.0.0"
1473 self.by-version."grunt"."0.4.5"
2238 sources."is-finite-1.0.1"
1474 ];
2239 sources."number-is-nan-1.0.0"
1475 passthru.names = [ "grunt-contrib-jshint" ];
2240 sources."code-point-at-1.0.0"
1476 };
2241 sources."is-fullwidth-code-point-1.0.0"
1477 "grunt-contrib-jshint" = self.by-version."grunt-contrib-jshint"."0.12.0";
2242 sources."dot-prop-2.4.0"
1478 by-spec."grunt-contrib-less"."^1.1.0" =
2243 sources."os-tmpdir-1.0.1"
1479 self.by-version."grunt-contrib-less"."1.1.0";
2244 sources."osenv-0.1.3"
1480 by-version."grunt-contrib-less"."1.1.0" = lib.makeOverridable self.buildNodePackage {
2245 sources."uuid-2.0.2"
1481 name = "grunt-contrib-less-1.1.0";
2246 (sources."write-file-atomic-1.2.0" // {
1482 bin = false;
2247 dependencies = [
1483 src = [
2248 sources."graceful-fs-4.1.6"
1484 (fetchurl {
1485 url = "http://registry.npmjs.org/grunt-contrib-less/-/grunt-contrib-less-1.1.0.tgz";
1486 name = "grunt-contrib-less-1.1.0.tgz";
1487 sha1 = "44d5c5521ad76f3675a12374125d019b5dd03f51";
1488 })
1489 ];
2249 ];
1490 buildInputs =
1491 (self.nativeDeps."grunt-contrib-less" or []);
1492 deps = {
1493 "async-0.9.2" = self.by-version."async"."0.9.2";
1494 "chalk-1.1.1" = self.by-version."chalk"."1.1.1";
1495 "less-2.5.3" = self.by-version."less"."2.5.3";
1496 "lodash-3.10.1" = self.by-version."lodash"."3.10.1";
1497 };
1498 peerDependencies = [
1499 self.by-version."grunt"."0.4.5"
1500 ];
1501 passthru.names = [ "grunt-contrib-less" ];
1502 };
1503 "grunt-contrib-less" = self.by-version."grunt-contrib-less"."1.1.0";
1504 by-spec."grunt-contrib-watch"."^0.6.1" =
1505 self.by-version."grunt-contrib-watch"."0.6.1";
1506 by-version."grunt-contrib-watch"."0.6.1" = lib.makeOverridable self.buildNodePackage {
1507 name = "grunt-contrib-watch-0.6.1";
1508 bin = false;
1509 src = [
1510 (fetchurl {
1511 url = "http://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-0.6.1.tgz";
1512 name = "grunt-contrib-watch-0.6.1.tgz";
1513 sha1 = "64fdcba25a635f5b4da1b6ce6f90da0aeb6e3f15";
1514 })
2250 })
1515 ];
2251 sources."xdg-basedir-2.0.0"
1516 buildInputs =
2252 sources."is-obj-1.0.1"
1517 (self.nativeDeps."grunt-contrib-watch" or []);
2253 sources."os-homedir-1.0.1"
1518 deps = {
2254 sources."imurmurhash-0.1.4"
1519 "gaze-0.5.2" = self.by-version."gaze"."0.5.2";
2255 sources."slide-1.1.6"
1520 "tiny-lr-fork-0.0.5" = self.by-version."tiny-lr-fork"."0.0.5";
2256 sources."package-json-2.3.3"
1521 "lodash-2.4.2" = self.by-version."lodash"."2.4.2";
2257 sources."got-5.6.0"
1522 "async-0.2.10" = self.by-version."async"."0.2.10";
2258 (sources."rc-1.1.6" // {
1523 };
2259 dependencies = [
1524 peerDependencies = [
2260 sources."minimist-1.2.0"
1525 self.by-version."grunt"."0.4.5"
1526 ];
1527 passthru.names = [ "grunt-contrib-watch" ];
1528 };
1529 "grunt-contrib-watch" = self.by-version."grunt-contrib-watch"."0.6.1";
1530 by-spec."grunt-legacy-log"."~0.1.0" =
1531 self.by-version."grunt-legacy-log"."0.1.3";
1532 by-version."grunt-legacy-log"."0.1.3" = lib.makeOverridable self.buildNodePackage {
1533 name = "grunt-legacy-log-0.1.3";
1534 bin = false;
1535 src = [
1536 (fetchurl {
1537 url = "http://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz";
1538 name = "grunt-legacy-log-0.1.3.tgz";
1539 sha1 = "ec29426e803021af59029f87d2f9cd7335a05531";
1540 })
1541 ];
2261 ];
1542 buildInputs =
1543 (self.nativeDeps."grunt-legacy-log" or []);
1544 deps = {
1545 "colors-0.6.2" = self.by-version."colors"."0.6.2";
1546 "grunt-legacy-log-utils-0.1.1" = self.by-version."grunt-legacy-log-utils"."0.1.1";
1547 "hooker-0.2.3" = self.by-version."hooker"."0.2.3";
1548 "lodash-2.4.2" = self.by-version."lodash"."2.4.2";
1549 "underscore.string-2.3.3" = self.by-version."underscore.string"."2.3.3";
1550 };
1551 peerDependencies = [
1552 ];
1553 passthru.names = [ "grunt-legacy-log" ];
1554 };
1555 by-spec."grunt-legacy-log-utils"."~0.1.1" =
1556 self.by-version."grunt-legacy-log-utils"."0.1.1";
1557 by-version."grunt-legacy-log-utils"."0.1.1" = lib.makeOverridable self.buildNodePackage {
1558 name = "grunt-legacy-log-utils-0.1.1";
1559 bin = false;
1560 src = [
1561 (fetchurl {
1562 url = "http://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz";
1563 name = "grunt-legacy-log-utils-0.1.1.tgz";
1564 sha1 = "c0706b9dd9064e116f36f23fe4e6b048672c0f7e";
1565 })
2262 })
1566 ];
2263 sources."registry-url-3.1.0"
1567 buildInputs =
2264 sources."semver-5.3.0"
1568 (self.nativeDeps."grunt-legacy-log-utils" or []);
2265 sources."create-error-class-3.0.2"
1569 deps = {
2266 sources."duplexer2-0.1.4"
1570 "lodash-2.4.2" = self.by-version."lodash"."2.4.2";
2267 sources."is-plain-obj-1.1.0"
1571 "underscore.string-2.3.3" = self.by-version."underscore.string"."2.3.3";
2268 sources."is-redirect-1.0.0"
1572 "colors-0.6.2" = self.by-version."colors"."0.6.2";
2269 sources."is-retry-allowed-1.1.0"
1573 };
2270 sources."is-stream-1.1.0"
1574 peerDependencies = [
2271 sources."lowercase-keys-1.0.0"
1575 ];
2272 sources."node-status-codes-1.0.0"
1576 passthru.names = [ "grunt-legacy-log-utils" ];
2273 sources."parse-json-2.2.0"
1577 };
2274 sources."pinkie-promise-2.0.1"
1578 by-spec."grunt-legacy-util"."~0.2.0" =
2275 sources."read-all-stream-3.1.0"
1579 self.by-version."grunt-legacy-util"."0.2.0";
2276 (sources."readable-stream-2.1.5" // {
1580 by-version."grunt-legacy-util"."0.2.0" = lib.makeOverridable self.buildNodePackage {
2277 dependencies = [
1581 name = "grunt-legacy-util-0.2.0";
2278 sources."isarray-1.0.0"
1582 bin = false;
1583 src = [
1584 (fetchurl {
1585 url = "http://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz";
1586 name = "grunt-legacy-util-0.2.0.tgz";
1587 sha1 = "93324884dbf7e37a9ff7c026dff451d94a9e554b";
1588 })
1589 ];
2279 ];
1590 buildInputs =
1591 (self.nativeDeps."grunt-legacy-util" or []);
1592 deps = {
1593 "hooker-0.2.3" = self.by-version."hooker"."0.2.3";
1594 "async-0.1.22" = self.by-version."async"."0.1.22";
1595 "lodash-0.9.2" = self.by-version."lodash"."0.9.2";
1596 "exit-0.1.2" = self.by-version."exit"."0.1.2";
1597 "underscore.string-2.2.1" = self.by-version."underscore.string"."2.2.1";
1598 "getobject-0.1.0" = self.by-version."getobject"."0.1.0";
1599 "which-1.0.9" = self.by-version."which"."1.0.9";
1600 };
1601 peerDependencies = [
1602 ];
1603 passthru.names = [ "grunt-legacy-util" ];
1604 };
1605 by-spec."har-validator"."~2.0.2" =
1606 self.by-version."har-validator"."2.0.6";
1607 by-version."har-validator"."2.0.6" = lib.makeOverridable self.buildNodePackage {
1608 name = "har-validator-2.0.6";
1609 bin = true;
1610 src = [
1611 (fetchurl {
1612 url = "http://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz";
1613 name = "har-validator-2.0.6.tgz";
1614 sha1 = "cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d";
1615 })
2280 })
2281 sources."timed-out-2.0.0"
2282 sources."unzip-response-1.0.0"
2283 sources."url-parse-lax-1.0.0"
2284 sources."capture-stack-trace-1.0.0"
2285 sources."error-ex-1.3.0"
2286 sources."is-arrayish-0.2.1"
2287 sources."pinkie-2.0.4"
2288 sources."buffer-shims-1.0.0"
2289 sources."core-util-is-1.0.2"
2290 sources."process-nextick-args-1.0.7"
2291 sources."string_decoder-0.10.31"
2292 sources."util-deprecate-1.0.2"
2293 sources."prepend-http-1.0.4"
2294 sources."ini-1.3.4"
2295 sources."strip-json-comments-1.0.4"
2296 (sources."cli-1.0.0" // {
2297 dependencies = [
2298 sources."glob-7.0.6"
2299 sources."minimatch-3.0.3"
1616 ];
2300 ];
1617 buildInputs =
2301 })
1618 (self.nativeDeps."har-validator" or []);
2302 sources."console-browserify-1.1.0"
1619 deps = {
2303 (sources."htmlparser2-3.8.3" // {
1620 "chalk-1.1.1" = self.by-version."chalk"."1.1.1";
2304 dependencies = [
1621 "commander-2.9.0" = self.by-version."commander"."2.9.0";
2305 sources."readable-stream-1.1.14"
1622 "is-my-json-valid-2.12.4" = self.by-version."is-my-json-valid"."2.12.4";
1623 "pinkie-promise-2.0.0" = self.by-version."pinkie-promise"."2.0.0";
1624 };
1625 peerDependencies = [
1626 ];
2306 ];
1627 passthru.names = [ "har-validator" ];
1628 };
1629 by-spec."has-ansi"."^0.1.0" =
1630 self.by-version."has-ansi"."0.1.0";
1631 by-version."has-ansi"."0.1.0" = lib.makeOverridable self.buildNodePackage {
1632 name = "has-ansi-0.1.0";
1633 bin = true;
1634 src = [
1635 (fetchurl {
1636 url = "http://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz";
1637 name = "has-ansi-0.1.0.tgz";
1638 sha1 = "84f265aae8c0e6a88a12d7022894b7568894c62e";
1639 })
2307 })
2308 sources."shelljs-0.3.0"
2309 sources."fs.realpath-1.0.0"
2310 sources."inflight-1.0.5"
2311 sources."once-1.3.3"
2312 sources."wrappy-1.0.2"
2313 sources."brace-expansion-1.1.6"
2314 sources."balanced-match-0.4.2"
2315 sources."concat-map-0.0.1"
2316 sources."date-now-0.1.4"
2317 sources."domhandler-2.3.0"
2318 sources."domutils-1.5.1"
2319 sources."domelementtype-1.3.0"
2320 sources."entities-1.0.0"
2321 (sources."dom-serializer-0.1.0" // {
2322 dependencies = [
2323 sources."domelementtype-1.1.3"
2324 sources."entities-1.1.1"
1640 ];
2325 ];
1641 buildInputs =
1642 (self.nativeDeps."has-ansi" or []);
1643 deps = {
1644 "ansi-regex-0.2.1" = self.by-version."ansi-regex"."0.2.1";
1645 };
1646 peerDependencies = [
1647 ];
1648 passthru.names = [ "has-ansi" ];
1649 };
1650 by-spec."has-ansi"."^2.0.0" =
1651 self.by-version."has-ansi"."2.0.0";
1652 by-version."has-ansi"."2.0.0" = lib.makeOverridable self.buildNodePackage {
1653 name = "has-ansi-2.0.0";
1654 bin = false;
1655 src = [
1656 (fetchurl {
1657 url = "http://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz";
1658 name = "has-ansi-2.0.0.tgz";
1659 sha1 = "34f5049ce1ecdf2b0649af3ef24e45ed35416d91";
1660 })
2326 })
1661 ];
2327 ];
1662 buildInputs =
2328 meta = {
1663 (self.nativeDeps."has-ansi" or []);
2329 };
1664 deps = {
2330 production = false;
1665 "ansi-regex-2.0.0" = self.by-version."ansi-regex"."2.0.0";
2331 };
1666 };
2332 in
1667 peerDependencies = [
2333 {
1668 ];
2334 tarball = nodeEnv.buildNodeSourceDist args;
1669 passthru.names = [ "has-ansi" ];
2335 package = nodeEnv.buildNodePackage args;
1670 };
2336 shell = nodeEnv.buildNodeShell args;
1671 by-spec."hawk"."~3.1.0" =
2337 } No newline at end of file
1672 self.by-version."hawk"."3.1.3";
1673 by-version."hawk"."3.1.3" = lib.makeOverridable self.buildNodePackage {
1674 name = "hawk-3.1.3";
1675 bin = false;
1676 src = [
1677 (fetchurl {
1678 url = "http://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz";
1679 name = "hawk-3.1.3.tgz";
1680 sha1 = "078444bd7c1640b0fe540d2c9b73d59678e8e1c4";
1681 })
1682 ];
1683 buildInputs =
1684 (self.nativeDeps."hawk" or []);
1685 deps = {
1686 "hoek-2.16.3" = self.by-version."hoek"."2.16.3";
1687 "boom-2.10.1" = self.by-version."boom"."2.10.1";
1688 "cryptiles-2.0.5" = self.by-version."cryptiles"."2.0.5";
1689 "sntp-1.0.9" = self.by-version."sntp"."1.0.9";
1690 };
1691 peerDependencies = [
1692 ];
1693 passthru.names = [ "hawk" ];
1694 };
1695 by-spec."hoek"."2.x.x" =
1696 self.by-version."hoek"."2.16.3";
1697 by-version."hoek"."2.16.3" = lib.makeOverridable self.buildNodePackage {
1698 name = "hoek-2.16.3";
1699 bin = false;
1700 src = [
1701 (fetchurl {
1702 url = "http://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz";
1703 name = "hoek-2.16.3.tgz";
1704 sha1 = "20bb7403d3cea398e91dc4710a8ff1b8274a25ed";
1705 })
1706 ];
1707 buildInputs =
1708 (self.nativeDeps."hoek" or []);
1709 deps = {
1710 };
1711 peerDependencies = [
1712 ];
1713 passthru.names = [ "hoek" ];
1714 };
1715 by-spec."hooker"."^0.2.3" =
1716 self.by-version."hooker"."0.2.3";
1717 by-version."hooker"."0.2.3" = lib.makeOverridable self.buildNodePackage {
1718 name = "hooker-0.2.3";
1719 bin = false;
1720 src = [
1721 (fetchurl {
1722 url = "http://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz";
1723 name = "hooker-0.2.3.tgz";
1724 sha1 = "b834f723cc4a242aa65963459df6d984c5d3d959";
1725 })
1726 ];
1727 buildInputs =
1728 (self.nativeDeps."hooker" or []);
1729 deps = {
1730 };
1731 peerDependencies = [
1732 ];
1733 passthru.names = [ "hooker" ];
1734 };
1735 by-spec."hooker"."~0.2.3" =
1736 self.by-version."hooker"."0.2.3";
1737 by-spec."htmlparser2"."3.8.x" =
1738 self.by-version."htmlparser2"."3.8.3";
1739 by-version."htmlparser2"."3.8.3" = lib.makeOverridable self.buildNodePackage {
1740 name = "htmlparser2-3.8.3";
1741 bin = false;
1742 src = [
1743 (fetchurl {
1744 url = "http://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz";
1745 name = "htmlparser2-3.8.3.tgz";
1746 sha1 = "996c28b191516a8be86501a7d79757e5c70c1068";
1747 })
1748 ];
1749 buildInputs =
1750 (self.nativeDeps."htmlparser2" or []);
1751 deps = {
1752 "domhandler-2.3.0" = self.by-version."domhandler"."2.3.0";
1753 "domutils-1.5.1" = self.by-version."domutils"."1.5.1";
1754 "domelementtype-1.3.0" = self.by-version."domelementtype"."1.3.0";
1755 "readable-stream-1.1.13" = self.by-version."readable-stream"."1.1.13";
1756 "entities-1.0.0" = self.by-version."entities"."1.0.0";
1757 };
1758 peerDependencies = [
1759 ];
1760 passthru.names = [ "htmlparser2" ];
1761 };
1762 by-spec."http-signature"."~1.1.0" =
1763 self.by-version."http-signature"."1.1.0";
1764 by-version."http-signature"."1.1.0" = lib.makeOverridable self.buildNodePackage {
1765 name = "http-signature-1.1.0";
1766 bin = false;
1767 src = [
1768 (fetchurl {
1769 url = "http://registry.npmjs.org/http-signature/-/http-signature-1.1.0.tgz";
1770 name = "http-signature-1.1.0.tgz";
1771 sha1 = "5d2d7e9b6ef49980ad5b128d8e4ef09a31c90d95";
1772 })
1773 ];
1774 buildInputs =
1775 (self.nativeDeps."http-signature" or []);
1776 deps = {
1777 "assert-plus-0.1.5" = self.by-version."assert-plus"."0.1.5";
1778 "jsprim-1.2.2" = self.by-version."jsprim"."1.2.2";
1779 "sshpk-1.7.3" = self.by-version."sshpk"."1.7.3";
1780 };
1781 peerDependencies = [
1782 ];
1783 passthru.names = [ "http-signature" ];
1784 };
1785 by-spec."iconv-lite"."~0.2.11" =
1786 self.by-version."iconv-lite"."0.2.11";
1787 by-version."iconv-lite"."0.2.11" = lib.makeOverridable self.buildNodePackage {
1788 name = "iconv-lite-0.2.11";
1789 bin = false;
1790 src = [
1791 (fetchurl {
1792 url = "http://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz";
1793 name = "iconv-lite-0.2.11.tgz";
1794 sha1 = "1ce60a3a57864a292d1321ff4609ca4bb965adc8";
1795 })
1796 ];
1797 buildInputs =
1798 (self.nativeDeps."iconv-lite" or []);
1799 deps = {
1800 };
1801 peerDependencies = [
1802 ];
1803 passthru.names = [ "iconv-lite" ];
1804 };
1805 by-spec."image-size"."~0.3.5" =
1806 self.by-version."image-size"."0.3.5";
1807 by-version."image-size"."0.3.5" = lib.makeOverridable self.buildNodePackage {
1808 name = "image-size-0.3.5";
1809 bin = true;
1810 src = [
1811 (fetchurl {
1812 url = "http://registry.npmjs.org/image-size/-/image-size-0.3.5.tgz";
1813 name = "image-size-0.3.5.tgz";
1814 sha1 = "83240eab2fb5b00b04aab8c74b0471e9cba7ad8c";
1815 })
1816 ];
1817 buildInputs =
1818 (self.nativeDeps."image-size" or []);
1819 deps = {
1820 };
1821 peerDependencies = [
1822 ];
1823 passthru.names = [ "image-size" ];
1824 };
1825 by-spec."inherits"."1" =
1826 self.by-version."inherits"."1.0.2";
1827 by-version."inherits"."1.0.2" = lib.makeOverridable self.buildNodePackage {
1828 name = "inherits-1.0.2";
1829 bin = false;
1830 src = [
1831 (fetchurl {
1832 url = "http://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz";
1833 name = "inherits-1.0.2.tgz";
1834 sha1 = "ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b";
1835 })
1836 ];
1837 buildInputs =
1838 (self.nativeDeps."inherits" or []);
1839 deps = {
1840 };
1841 peerDependencies = [
1842 ];
1843 passthru.names = [ "inherits" ];
1844 };
1845 by-spec."inherits"."2" =
1846 self.by-version."inherits"."2.0.1";
1847 by-version."inherits"."2.0.1" = lib.makeOverridable self.buildNodePackage {
1848 name = "inherits-2.0.1";
1849 bin = false;
1850 src = [
1851 (fetchurl {
1852 url = "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz";
1853 name = "inherits-2.0.1.tgz";
1854 sha1 = "b17d08d326b4423e568eff719f91b0b1cbdf69f1";
1855 })
1856 ];
1857 buildInputs =
1858 (self.nativeDeps."inherits" or []);
1859 deps = {
1860 };
1861 peerDependencies = [
1862 ];
1863 passthru.names = [ "inherits" ];
1864 };
1865 by-spec."inherits"."~2.0.1" =
1866 self.by-version."inherits"."2.0.1";
1867 by-spec."is-my-json-valid"."^2.12.4" =
1868 self.by-version."is-my-json-valid"."2.12.4";
1869 by-version."is-my-json-valid"."2.12.4" = lib.makeOverridable self.buildNodePackage {
1870 name = "is-my-json-valid-2.12.4";
1871 bin = false;
1872 src = [
1873 (fetchurl {
1874 url = "http://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.12.4.tgz";
1875 name = "is-my-json-valid-2.12.4.tgz";
1876 sha1 = "d4ed2bc1d7f88daf8d0f763b3e3e39a69bd37880";
1877 })
1878 ];
1879 buildInputs =
1880 (self.nativeDeps."is-my-json-valid" or []);
1881 deps = {
1882 "generate-function-2.0.0" = self.by-version."generate-function"."2.0.0";
1883 "generate-object-property-1.2.0" = self.by-version."generate-object-property"."1.2.0";
1884 "jsonpointer-2.0.0" = self.by-version."jsonpointer"."2.0.0";
1885 "xtend-4.0.1" = self.by-version."xtend"."4.0.1";
1886 };
1887 peerDependencies = [
1888 ];
1889 passthru.names = [ "is-my-json-valid" ];
1890 };
1891 by-spec."is-property"."^1.0.0" =
1892 self.by-version."is-property"."1.0.2";
1893 by-version."is-property"."1.0.2" = lib.makeOverridable self.buildNodePackage {
1894 name = "is-property-1.0.2";
1895 bin = false;
1896 src = [
1897 (fetchurl {
1898 url = "http://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz";
1899 name = "is-property-1.0.2.tgz";
1900 sha1 = "57fe1c4e48474edd65b09911f26b1cd4095dda84";
1901 })
1902 ];
1903 buildInputs =
1904 (self.nativeDeps."is-property" or []);
1905 deps = {
1906 };
1907 peerDependencies = [
1908 ];
1909 passthru.names = [ "is-property" ];
1910 };
1911 by-spec."is-typedarray"."~1.0.0" =
1912 self.by-version."is-typedarray"."1.0.0";
1913 by-version."is-typedarray"."1.0.0" = lib.makeOverridable self.buildNodePackage {
1914 name = "is-typedarray-1.0.0";
1915 bin = false;
1916 src = [
1917 (fetchurl {
1918 url = "http://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz";
1919 name = "is-typedarray-1.0.0.tgz";
1920 sha1 = "e479c80858df0c1b11ddda6940f96011fcda4a9a";
1921 })
1922 ];
1923 buildInputs =
1924 (self.nativeDeps."is-typedarray" or []);
1925 deps = {
1926 };
1927 peerDependencies = [
1928 ];
1929 passthru.names = [ "is-typedarray" ];
1930 };
1931 by-spec."isarray"."0.0.1" =
1932 self.by-version."isarray"."0.0.1";
1933 by-version."isarray"."0.0.1" = lib.makeOverridable self.buildNodePackage {
1934 name = "isarray-0.0.1";
1935 bin = false;
1936 src = [
1937 (fetchurl {
1938 url = "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz";
1939 name = "isarray-0.0.1.tgz";
1940 sha1 = "8a18acfca9a8f4177e09abfc6038939b05d1eedf";
1941 })
1942 ];
1943 buildInputs =
1944 (self.nativeDeps."isarray" or []);
1945 deps = {
1946 };
1947 peerDependencies = [
1948 ];
1949 passthru.names = [ "isarray" ];
1950 };
1951 by-spec."isstream"."~0.1.2" =
1952 self.by-version."isstream"."0.1.2";
1953 by-version."isstream"."0.1.2" = lib.makeOverridable self.buildNodePackage {
1954 name = "isstream-0.1.2";
1955 bin = false;
1956 src = [
1957 (fetchurl {
1958 url = "http://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz";
1959 name = "isstream-0.1.2.tgz";
1960 sha1 = "47e63f7af55afa6f92e1500e690eb8b8529c099a";
1961 })
1962 ];
1963 buildInputs =
1964 (self.nativeDeps."isstream" or []);
1965 deps = {
1966 };
1967 peerDependencies = [
1968 ];
1969 passthru.names = [ "isstream" ];
1970 };
1971 by-spec."jodid25519".">=1.0.0 <2.0.0" =
1972 self.by-version."jodid25519"."1.0.2";
1973 by-version."jodid25519"."1.0.2" = lib.makeOverridable self.buildNodePackage {
1974 name = "jodid25519-1.0.2";
1975 bin = false;
1976 src = [
1977 (fetchurl {
1978 url = "http://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz";
1979 name = "jodid25519-1.0.2.tgz";
1980 sha1 = "06d4912255093419477d425633606e0e90782967";
1981 })
1982 ];
1983 buildInputs =
1984 (self.nativeDeps."jodid25519" or []);
1985 deps = {
1986 "jsbn-0.1.0" = self.by-version."jsbn"."0.1.0";
1987 };
1988 peerDependencies = [
1989 ];
1990 passthru.names = [ "jodid25519" ];
1991 };
1992 by-spec."js-yaml"."~2.0.5" =
1993 self.by-version."js-yaml"."2.0.5";
1994 by-version."js-yaml"."2.0.5" = lib.makeOverridable self.buildNodePackage {
1995 name = "js-yaml-2.0.5";
1996 bin = true;
1997 src = [
1998 (fetchurl {
1999 url = "http://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz";
2000 name = "js-yaml-2.0.5.tgz";
2001 sha1 = "a25ae6509999e97df278c6719da11bd0687743a8";
2002 })
2003 ];
2004 buildInputs =
2005 (self.nativeDeps."js-yaml" or []);
2006 deps = {
2007 "argparse-0.1.16" = self.by-version."argparse"."0.1.16";
2008 "esprima-1.0.4" = self.by-version."esprima"."1.0.4";
2009 };
2010 peerDependencies = [
2011 ];
2012 passthru.names = [ "js-yaml" ];
2013 };
2014 by-spec."jsbn".">=0.1.0 <0.2.0" =
2015 self.by-version."jsbn"."0.1.0";
2016 by-version."jsbn"."0.1.0" = lib.makeOverridable self.buildNodePackage {
2017 name = "jsbn-0.1.0";
2018 bin = false;
2019 src = [
2020 (fetchurl {
2021 url = "http://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz";
2022 name = "jsbn-0.1.0.tgz";
2023 sha1 = "650987da0dd74f4ebf5a11377a2aa2d273e97dfd";
2024 })
2025 ];
2026 buildInputs =
2027 (self.nativeDeps."jsbn" or []);
2028 deps = {
2029 };
2030 peerDependencies = [
2031 ];
2032 passthru.names = [ "jsbn" ];
2033 };
2034 by-spec."jsbn"."~0.1.0" =
2035 self.by-version."jsbn"."0.1.0";
2036 by-spec."jshint"."^2.9.1-rc3" =
2037 self.by-version."jshint"."2.9.1";
2038 by-version."jshint"."2.9.1" = lib.makeOverridable self.buildNodePackage {
2039 name = "jshint-2.9.1";
2040 bin = true;
2041 src = [
2042 (fetchurl {
2043 url = "http://registry.npmjs.org/jshint/-/jshint-2.9.1.tgz";
2044 name = "jshint-2.9.1.tgz";
2045 sha1 = "3136b68f8b6fa37423aacb8ec5e18a1ada7a2638";
2046 })
2047 ];
2048 buildInputs =
2049 (self.nativeDeps."jshint" or []);
2050 deps = {
2051 "cli-0.6.6" = self.by-version."cli"."0.6.6";
2052 "console-browserify-1.1.0" = self.by-version."console-browserify"."1.1.0";
2053 "exit-0.1.2" = self.by-version."exit"."0.1.2";
2054 "htmlparser2-3.8.3" = self.by-version."htmlparser2"."3.8.3";
2055 "minimatch-2.0.10" = self.by-version."minimatch"."2.0.10";
2056 "shelljs-0.3.0" = self.by-version."shelljs"."0.3.0";
2057 "strip-json-comments-1.0.4" = self.by-version."strip-json-comments"."1.0.4";
2058 "lodash-3.7.0" = self.by-version."lodash"."3.7.0";
2059 };
2060 peerDependencies = [
2061 ];
2062 passthru.names = [ "jshint" ];
2063 };
2064 "jshint" = self.by-version."jshint"."2.9.1";
2065 by-spec."jshint"."~2.9.1" =
2066 self.by-version."jshint"."2.9.1";
2067 by-spec."json-schema"."0.2.2" =
2068 self.by-version."json-schema"."0.2.2";
2069 by-version."json-schema"."0.2.2" = lib.makeOverridable self.buildNodePackage {
2070 name = "json-schema-0.2.2";
2071 bin = false;
2072 src = [
2073 (fetchurl {
2074 url = "http://registry.npmjs.org/json-schema/-/json-schema-0.2.2.tgz";
2075 name = "json-schema-0.2.2.tgz";
2076 sha1 = "50354f19f603917c695f70b85afa77c3b0f23506";
2077 })
2078 ];
2079 buildInputs =
2080 (self.nativeDeps."json-schema" or []);
2081 deps = {
2082 };
2083 peerDependencies = [
2084 ];
2085 passthru.names = [ "json-schema" ];
2086 };
2087 by-spec."json-stringify-safe"."~5.0.1" =
2088 self.by-version."json-stringify-safe"."5.0.1";
2089 by-version."json-stringify-safe"."5.0.1" = lib.makeOverridable self.buildNodePackage {
2090 name = "json-stringify-safe-5.0.1";
2091 bin = false;
2092 src = [
2093 (fetchurl {
2094 url = "http://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz";
2095 name = "json-stringify-safe-5.0.1.tgz";
2096 sha1 = "1296a2d58fd45f19a0f6ce01d65701e2c735b6eb";
2097 })
2098 ];
2099 buildInputs =
2100 (self.nativeDeps."json-stringify-safe" or []);
2101 deps = {
2102 };
2103 peerDependencies = [
2104 ];
2105 passthru.names = [ "json-stringify-safe" ];
2106 };
2107 by-spec."jsonpointer"."2.0.0" =
2108 self.by-version."jsonpointer"."2.0.0";
2109 by-version."jsonpointer"."2.0.0" = lib.makeOverridable self.buildNodePackage {
2110 name = "jsonpointer-2.0.0";
2111 bin = false;
2112 src = [
2113 (fetchurl {
2114 url = "http://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz";
2115 name = "jsonpointer-2.0.0.tgz";
2116 sha1 = "3af1dd20fe85463910d469a385e33017d2a030d9";
2117 })
2118 ];
2119 buildInputs =
2120 (self.nativeDeps."jsonpointer" or []);
2121 deps = {
2122 };
2123 peerDependencies = [
2124 ];
2125 passthru.names = [ "jsonpointer" ];
2126 };
2127 by-spec."jsprim"."^1.2.2" =
2128 self.by-version."jsprim"."1.2.2";
2129 by-version."jsprim"."1.2.2" = lib.makeOverridable self.buildNodePackage {
2130 name = "jsprim-1.2.2";
2131 bin = false;
2132 src = [
2133 (fetchurl {
2134 url = "http://registry.npmjs.org/jsprim/-/jsprim-1.2.2.tgz";
2135 name = "jsprim-1.2.2.tgz";
2136 sha1 = "f20c906ac92abd58e3b79ac8bc70a48832512da1";
2137 })
2138 ];
2139 buildInputs =
2140 (self.nativeDeps."jsprim" or []);
2141 deps = {
2142 "extsprintf-1.0.2" = self.by-version."extsprintf"."1.0.2";
2143 "json-schema-0.2.2" = self.by-version."json-schema"."0.2.2";
2144 "verror-1.3.6" = self.by-version."verror"."1.3.6";
2145 };
2146 peerDependencies = [
2147 ];
2148 passthru.names = [ "jsprim" ];
2149 };
2150 by-spec."less"."~2.5.0" =
2151 self.by-version."less"."2.5.3";
2152 by-version."less"."2.5.3" = lib.makeOverridable self.buildNodePackage {
2153 name = "less-2.5.3";
2154 bin = true;
2155 src = [
2156 (fetchurl {
2157 url = "http://registry.npmjs.org/less/-/less-2.5.3.tgz";
2158 name = "less-2.5.3.tgz";
2159 sha1 = "9ff586e8a703515fc18dc99c7bc498d2f3ad4849";
2160 })
2161 ];
2162 buildInputs =
2163 (self.nativeDeps."less" or []);
2164 deps = {
2165 "errno-0.1.4" = self.by-version."errno"."0.1.4";
2166 "graceful-fs-3.0.8" = self.by-version."graceful-fs"."3.0.8";
2167 "image-size-0.3.5" = self.by-version."image-size"."0.3.5";
2168 "mime-1.3.4" = self.by-version."mime"."1.3.4";
2169 "mkdirp-0.5.1" = self.by-version."mkdirp"."0.5.1";
2170 "promise-6.1.0" = self.by-version."promise"."6.1.0";
2171 "request-2.67.0" = self.by-version."request"."2.67.0";
2172 "source-map-0.4.4" = self.by-version."source-map"."0.4.4";
2173 };
2174 peerDependencies = [
2175 ];
2176 passthru.names = [ "less" ];
2177 };
2178 by-spec."lodash"."3.7.x" =
2179 self.by-version."lodash"."3.7.0";
2180 by-version."lodash"."3.7.0" = lib.makeOverridable self.buildNodePackage {
2181 name = "lodash-3.7.0";
2182 bin = false;
2183 src = [
2184 (fetchurl {
2185 url = "http://registry.npmjs.org/lodash/-/lodash-3.7.0.tgz";
2186 name = "lodash-3.7.0.tgz";
2187 sha1 = "3678bd8ab995057c07ade836ed2ef087da811d45";
2188 })
2189 ];
2190 buildInputs =
2191 (self.nativeDeps."lodash" or []);
2192 deps = {
2193 };
2194 peerDependencies = [
2195 ];
2196 passthru.names = [ "lodash" ];
2197 };
2198 by-spec."lodash"."^3.2.0" =
2199 self.by-version."lodash"."3.10.1";
2200 by-version."lodash"."3.10.1" = lib.makeOverridable self.buildNodePackage {
2201 name = "lodash-3.10.1";
2202 bin = false;
2203 src = [
2204 (fetchurl {
2205 url = "http://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz";
2206 name = "lodash-3.10.1.tgz";
2207 sha1 = "5bf45e8e49ba4189e17d482789dfd15bd140b7b6";
2208 })
2209 ];
2210 buildInputs =
2211 (self.nativeDeps."lodash" or []);
2212 deps = {
2213 };
2214 peerDependencies = [
2215 ];
2216 passthru.names = [ "lodash" ];
2217 };
2218 by-spec."lodash"."~0.9.2" =
2219 self.by-version."lodash"."0.9.2";
2220 by-version."lodash"."0.9.2" = lib.makeOverridable self.buildNodePackage {
2221 name = "lodash-0.9.2";
2222 bin = false;
2223 src = [
2224 (fetchurl {
2225 url = "http://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz";
2226 name = "lodash-0.9.2.tgz";
2227 sha1 = "8f3499c5245d346d682e5b0d3b40767e09f1a92c";
2228 })
2229 ];
2230 buildInputs =
2231 (self.nativeDeps."lodash" or []);
2232 deps = {
2233 };
2234 peerDependencies = [
2235 ];
2236 passthru.names = [ "lodash" ];
2237 };
2238 by-spec."lodash"."~1.0.1" =
2239 self.by-version."lodash"."1.0.2";
2240 by-version."lodash"."1.0.2" = lib.makeOverridable self.buildNodePackage {
2241 name = "lodash-1.0.2";
2242 bin = false;
2243 src = [
2244 (fetchurl {
2245 url = "http://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz";
2246 name = "lodash-1.0.2.tgz";
2247 sha1 = "8f57560c83b59fc270bd3d561b690043430e2551";
2248 })
2249 ];
2250 buildInputs =
2251 (self.nativeDeps."lodash" or []);
2252 deps = {
2253 };
2254 peerDependencies = [
2255 ];
2256 passthru.names = [ "lodash" ];
2257 };
2258 by-spec."lodash"."~2.4.1" =
2259 self.by-version."lodash"."2.4.2";
2260 by-version."lodash"."2.4.2" = lib.makeOverridable self.buildNodePackage {
2261 name = "lodash-2.4.2";
2262 bin = false;
2263 src = [
2264 (fetchurl {
2265 url = "http://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz";
2266 name = "lodash-2.4.2.tgz";
2267 sha1 = "fadd834b9683073da179b3eae6d9c0d15053f73e";
2268 })
2269 ];
2270 buildInputs =
2271 (self.nativeDeps."lodash" or []);
2272 deps = {
2273 };
2274 peerDependencies = [
2275 ];
2276 passthru.names = [ "lodash" ];
2277 };
2278 by-spec."lru-cache"."2" =
2279 self.by-version."lru-cache"."2.7.3";
2280 by-version."lru-cache"."2.7.3" = lib.makeOverridable self.buildNodePackage {
2281 name = "lru-cache-2.7.3";
2282 bin = false;
2283 src = [
2284 (fetchurl {
2285 url = "http://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz";
2286 name = "lru-cache-2.7.3.tgz";
2287 sha1 = "6d4524e8b955f95d4f5b58851ce21dd72fb4e952";
2288 })
2289 ];
2290 buildInputs =
2291 (self.nativeDeps."lru-cache" or []);
2292 deps = {
2293 };
2294 peerDependencies = [
2295 ];
2296 passthru.names = [ "lru-cache" ];
2297 };
2298 by-spec."mime"."^1.2.11" =
2299 self.by-version."mime"."1.3.4";
2300 by-version."mime"."1.3.4" = lib.makeOverridable self.buildNodePackage {
2301 name = "mime-1.3.4";
2302 bin = true;
2303 src = [
2304 (fetchurl {
2305 url = "http://registry.npmjs.org/mime/-/mime-1.3.4.tgz";
2306 name = "mime-1.3.4.tgz";
2307 sha1 = "115f9e3b6b3daf2959983cb38f149a2d40eb5d53";
2308 })
2309 ];
2310 buildInputs =
2311 (self.nativeDeps."mime" or []);
2312 deps = {
2313 };
2314 peerDependencies = [
2315 ];
2316 passthru.names = [ "mime" ];
2317 };
2318 by-spec."mime-db"."~1.21.0" =
2319 self.by-version."mime-db"."1.21.0";
2320 by-version."mime-db"."1.21.0" = lib.makeOverridable self.buildNodePackage {
2321 name = "mime-db-1.21.0";
2322 bin = false;
2323 src = [
2324 (fetchurl {
2325 url = "http://registry.npmjs.org/mime-db/-/mime-db-1.21.0.tgz";
2326 name = "mime-db-1.21.0.tgz";
2327 sha1 = "9b5239e3353cf6eb015a00d890261027c36d4bac";
2328 })
2329 ];
2330 buildInputs =
2331 (self.nativeDeps."mime-db" or []);
2332 deps = {
2333 };
2334 peerDependencies = [
2335 ];
2336 passthru.names = [ "mime-db" ];
2337 };
2338 by-spec."mime-types"."^2.1.3" =
2339 self.by-version."mime-types"."2.1.9";
2340 by-version."mime-types"."2.1.9" = lib.makeOverridable self.buildNodePackage {
2341 name = "mime-types-2.1.9";
2342 bin = false;
2343 src = [
2344 (fetchurl {
2345 url = "http://registry.npmjs.org/mime-types/-/mime-types-2.1.9.tgz";
2346 name = "mime-types-2.1.9.tgz";
2347 sha1 = "dfb396764b5fdf75be34b1f4104bc3687fb635f8";
2348 })
2349 ];
2350 buildInputs =
2351 (self.nativeDeps."mime-types" or []);
2352 deps = {
2353 "mime-db-1.21.0" = self.by-version."mime-db"."1.21.0";
2354 };
2355 peerDependencies = [
2356 ];
2357 passthru.names = [ "mime-types" ];
2358 };
2359 by-spec."mime-types"."~2.1.7" =
2360 self.by-version."mime-types"."2.1.9";
2361 by-spec."minimatch"."0.3" =
2362 self.by-version."minimatch"."0.3.0";
2363 by-version."minimatch"."0.3.0" = lib.makeOverridable self.buildNodePackage {
2364 name = "minimatch-0.3.0";
2365 bin = false;
2366 src = [
2367 (fetchurl {
2368 url = "http://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz";
2369 name = "minimatch-0.3.0.tgz";
2370 sha1 = "275d8edaac4f1bb3326472089e7949c8394699dd";
2371 })
2372 ];
2373 buildInputs =
2374 (self.nativeDeps."minimatch" or []);
2375 deps = {
2376 "lru-cache-2.7.3" = self.by-version."lru-cache"."2.7.3";
2377 "sigmund-1.0.1" = self.by-version."sigmund"."1.0.1";
2378 };
2379 peerDependencies = [
2380 ];
2381 passthru.names = [ "minimatch" ];
2382 };
2383 by-spec."minimatch"."2.0.x" =
2384 self.by-version."minimatch"."2.0.10";
2385 by-version."minimatch"."2.0.10" = lib.makeOverridable self.buildNodePackage {
2386 name = "minimatch-2.0.10";
2387 bin = false;
2388 src = [
2389 (fetchurl {
2390 url = "http://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz";
2391 name = "minimatch-2.0.10.tgz";
2392 sha1 = "8d087c39c6b38c001b97fca7ce6d0e1e80afbac7";
2393 })
2394 ];
2395 buildInputs =
2396 (self.nativeDeps."minimatch" or []);
2397 deps = {
2398 "brace-expansion-1.1.2" = self.by-version."brace-expansion"."1.1.2";
2399 };
2400 peerDependencies = [
2401 ];
2402 passthru.names = [ "minimatch" ];
2403 };
2404 by-spec."minimatch"."~0.2.11" =
2405 self.by-version."minimatch"."0.2.14";
2406 by-version."minimatch"."0.2.14" = lib.makeOverridable self.buildNodePackage {
2407 name = "minimatch-0.2.14";
2408 bin = false;
2409 src = [
2410 (fetchurl {
2411 url = "http://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz";
2412 name = "minimatch-0.2.14.tgz";
2413 sha1 = "c74e780574f63c6f9a090e90efbe6ef53a6a756a";
2414 })
2415 ];
2416 buildInputs =
2417 (self.nativeDeps."minimatch" or []);
2418 deps = {
2419 "lru-cache-2.7.3" = self.by-version."lru-cache"."2.7.3";
2420 "sigmund-1.0.1" = self.by-version."sigmund"."1.0.1";
2421 };
2422 peerDependencies = [
2423 ];
2424 passthru.names = [ "minimatch" ];
2425 };
2426 by-spec."minimatch"."~0.2.12" =
2427 self.by-version."minimatch"."0.2.14";
2428 by-spec."minimist"."0.0.8" =
2429 self.by-version."minimist"."0.0.8";
2430 by-version."minimist"."0.0.8" = lib.makeOverridable self.buildNodePackage {
2431 name = "minimist-0.0.8";
2432 bin = false;
2433 src = [
2434 (fetchurl {
2435 url = "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz";
2436 name = "minimist-0.0.8.tgz";
2437 sha1 = "857fcabfc3397d2625b8228262e86aa7a011b05d";
2438 })
2439 ];
2440 buildInputs =
2441 (self.nativeDeps."minimist" or []);
2442 deps = {
2443 };
2444 peerDependencies = [
2445 ];
2446 passthru.names = [ "minimist" ];
2447 };
2448 by-spec."mkdirp"."^0.5.0" =
2449 self.by-version."mkdirp"."0.5.1";
2450 by-version."mkdirp"."0.5.1" = lib.makeOverridable self.buildNodePackage {
2451 name = "mkdirp-0.5.1";
2452 bin = true;
2453 src = [
2454 (fetchurl {
2455 url = "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz";
2456 name = "mkdirp-0.5.1.tgz";
2457 sha1 = "30057438eac6cf7f8c4767f38648d6697d75c903";
2458 })
2459 ];
2460 buildInputs =
2461 (self.nativeDeps."mkdirp" or []);
2462 deps = {
2463 "minimist-0.0.8" = self.by-version."minimist"."0.0.8";
2464 };
2465 peerDependencies = [
2466 ];
2467 passthru.names = [ "mkdirp" ];
2468 };
2469 by-spec."node-uuid"."~1.4.7" =
2470 self.by-version."node-uuid"."1.4.7";
2471 by-version."node-uuid"."1.4.7" = lib.makeOverridable self.buildNodePackage {
2472 name = "node-uuid-1.4.7";
2473 bin = true;
2474 src = [
2475 (fetchurl {
2476 url = "http://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz";
2477 name = "node-uuid-1.4.7.tgz";
2478 sha1 = "6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f";
2479 })
2480 ];
2481 buildInputs =
2482 (self.nativeDeps."node-uuid" or []);
2483 deps = {
2484 };
2485 peerDependencies = [
2486 ];
2487 passthru.names = [ "node-uuid" ];
2488 };
2489 by-spec."nopt"."~1.0.10" =
2490 self.by-version."nopt"."1.0.10";
2491 by-version."nopt"."1.0.10" = lib.makeOverridable self.buildNodePackage {
2492 name = "nopt-1.0.10";
2493 bin = true;
2494 src = [
2495 (fetchurl {
2496 url = "http://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz";
2497 name = "nopt-1.0.10.tgz";
2498 sha1 = "6ddd21bd2a31417b92727dd585f8a6f37608ebee";
2499 })
2500 ];
2501 buildInputs =
2502 (self.nativeDeps."nopt" or []);
2503 deps = {
2504 "abbrev-1.0.7" = self.by-version."abbrev"."1.0.7";
2505 };
2506 peerDependencies = [
2507 ];
2508 passthru.names = [ "nopt" ];
2509 };
2510 by-spec."nopt"."~2.0.0" =
2511 self.by-version."nopt"."2.0.0";
2512 by-version."nopt"."2.0.0" = lib.makeOverridable self.buildNodePackage {
2513 name = "nopt-2.0.0";
2514 bin = true;
2515 src = [
2516 (fetchurl {
2517 url = "http://registry.npmjs.org/nopt/-/nopt-2.0.0.tgz";
2518 name = "nopt-2.0.0.tgz";
2519 sha1 = "ca7416f20a5e3f9c3b86180f96295fa3d0b52e0d";
2520 })
2521 ];
2522 buildInputs =
2523 (self.nativeDeps."nopt" or []);
2524 deps = {
2525 "abbrev-1.0.7" = self.by-version."abbrev"."1.0.7";
2526 };
2527 peerDependencies = [
2528 ];
2529 passthru.names = [ "nopt" ];
2530 };
2531 by-spec."noptify"."~0.0.3" =
2532 self.by-version."noptify"."0.0.3";
2533 by-version."noptify"."0.0.3" = lib.makeOverridable self.buildNodePackage {
2534 name = "noptify-0.0.3";
2535 bin = false;
2536 src = [
2537 (fetchurl {
2538 url = "http://registry.npmjs.org/noptify/-/noptify-0.0.3.tgz";
2539 name = "noptify-0.0.3.tgz";
2540 sha1 = "58f654a73d9753df0c51d9686dc92104a67f4bbb";
2541 })
2542 ];
2543 buildInputs =
2544 (self.nativeDeps."noptify" or []);
2545 deps = {
2546 "nopt-2.0.0" = self.by-version."nopt"."2.0.0";
2547 };
2548 peerDependencies = [
2549 ];
2550 passthru.names = [ "noptify" ];
2551 };
2552 by-spec."oauth-sign"."~0.8.0" =
2553 self.by-version."oauth-sign"."0.8.0";
2554 by-version."oauth-sign"."0.8.0" = lib.makeOverridable self.buildNodePackage {
2555 name = "oauth-sign-0.8.0";
2556 bin = false;
2557 src = [
2558 (fetchurl {
2559 url = "http://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.0.tgz";
2560 name = "oauth-sign-0.8.0.tgz";
2561 sha1 = "938fdc875765ba527137d8aec9d178e24debc553";
2562 })
2563 ];
2564 buildInputs =
2565 (self.nativeDeps."oauth-sign" or []);
2566 deps = {
2567 };
2568 peerDependencies = [
2569 ];
2570 passthru.names = [ "oauth-sign" ];
2571 };
2572 by-spec."pinkie"."^2.0.0" =
2573 self.by-version."pinkie"."2.0.1";
2574 by-version."pinkie"."2.0.1" = lib.makeOverridable self.buildNodePackage {
2575 name = "pinkie-2.0.1";
2576 bin = false;
2577 src = [
2578 (fetchurl {
2579 url = "http://registry.npmjs.org/pinkie/-/pinkie-2.0.1.tgz";
2580 name = "pinkie-2.0.1.tgz";
2581 sha1 = "4236c86fc29f261c2045bbe81f78cbb2a5e8306c";
2582 })
2583 ];
2584 buildInputs =
2585 (self.nativeDeps."pinkie" or []);
2586 deps = {
2587 };
2588 peerDependencies = [
2589 ];
2590 passthru.names = [ "pinkie" ];
2591 };
2592 by-spec."pinkie-promise"."^2.0.0" =
2593 self.by-version."pinkie-promise"."2.0.0";
2594 by-version."pinkie-promise"."2.0.0" = lib.makeOverridable self.buildNodePackage {
2595 name = "pinkie-promise-2.0.0";
2596 bin = false;
2597 src = [
2598 (fetchurl {
2599 url = "http://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.0.tgz";
2600 name = "pinkie-promise-2.0.0.tgz";
2601 sha1 = "4c83538de1f6e660c29e0a13446844f7a7e88259";
2602 })
2603 ];
2604 buildInputs =
2605 (self.nativeDeps."pinkie-promise" or []);
2606 deps = {
2607 "pinkie-2.0.1" = self.by-version."pinkie"."2.0.1";
2608 };
2609 peerDependencies = [
2610 ];
2611 passthru.names = [ "pinkie-promise" ];
2612 };
2613 by-spec."process-nextick-args"."~1.0.6" =
2614 self.by-version."process-nextick-args"."1.0.6";
2615 by-version."process-nextick-args"."1.0.6" = lib.makeOverridable self.buildNodePackage {
2616 name = "process-nextick-args-1.0.6";
2617 bin = false;
2618 src = [
2619 (fetchurl {
2620 url = "http://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.6.tgz";
2621 name = "process-nextick-args-1.0.6.tgz";
2622 sha1 = "0f96b001cea90b12592ce566edb97ec11e69bd05";
2623 })
2624 ];
2625 buildInputs =
2626 (self.nativeDeps."process-nextick-args" or []);
2627 deps = {
2628 };
2629 peerDependencies = [
2630 ];
2631 passthru.names = [ "process-nextick-args" ];
2632 };
2633 by-spec."promise"."^6.0.1" =
2634 self.by-version."promise"."6.1.0";
2635 by-version."promise"."6.1.0" = lib.makeOverridable self.buildNodePackage {
2636 name = "promise-6.1.0";
2637 bin = false;
2638 src = [
2639 (fetchurl {
2640 url = "http://registry.npmjs.org/promise/-/promise-6.1.0.tgz";
2641 name = "promise-6.1.0.tgz";
2642 sha1 = "2ce729f6b94b45c26891ad0602c5c90e04c6eef6";
2643 })
2644 ];
2645 buildInputs =
2646 (self.nativeDeps."promise" or []);
2647 deps = {
2648 "asap-1.0.0" = self.by-version."asap"."1.0.0";
2649 };
2650 peerDependencies = [
2651 ];
2652 passthru.names = [ "promise" ];
2653 };
2654 by-spec."prr"."~0.0.0" =
2655 self.by-version."prr"."0.0.0";
2656 by-version."prr"."0.0.0" = lib.makeOverridable self.buildNodePackage {
2657 name = "prr-0.0.0";
2658 bin = false;
2659 src = [
2660 (fetchurl {
2661 url = "http://registry.npmjs.org/prr/-/prr-0.0.0.tgz";
2662 name = "prr-0.0.0.tgz";
2663 sha1 = "1a84b85908325501411853d0081ee3fa86e2926a";
2664 })
2665 ];
2666 buildInputs =
2667 (self.nativeDeps."prr" or []);
2668 deps = {
2669 };
2670 peerDependencies = [
2671 ];
2672 passthru.names = [ "prr" ];
2673 };
2674 by-spec."qs"."~0.5.2" =
2675 self.by-version."qs"."0.5.6";
2676 by-version."qs"."0.5.6" = lib.makeOverridable self.buildNodePackage {
2677 name = "qs-0.5.6";
2678 bin = false;
2679 src = [
2680 (fetchurl {
2681 url = "http://registry.npmjs.org/qs/-/qs-0.5.6.tgz";
2682 name = "qs-0.5.6.tgz";
2683 sha1 = "31b1ad058567651c526921506b9a8793911a0384";
2684 })
2685 ];
2686 buildInputs =
2687 (self.nativeDeps."qs" or []);
2688 deps = {
2689 };
2690 peerDependencies = [
2691 ];
2692 passthru.names = [ "qs" ];
2693 };
2694 by-spec."qs"."~5.2.0" =
2695 self.by-version."qs"."5.2.0";
2696 by-version."qs"."5.2.0" = lib.makeOverridable self.buildNodePackage {
2697 name = "qs-5.2.0";
2698 bin = false;
2699 src = [
2700 (fetchurl {
2701 url = "http://registry.npmjs.org/qs/-/qs-5.2.0.tgz";
2702 name = "qs-5.2.0.tgz";
2703 sha1 = "a9f31142af468cb72b25b30136ba2456834916be";
2704 })
2705 ];
2706 buildInputs =
2707 (self.nativeDeps."qs" or []);
2708 deps = {
2709 };
2710 peerDependencies = [
2711 ];
2712 passthru.names = [ "qs" ];
2713 };
2714 by-spec."readable-stream"."1.1" =
2715 self.by-version."readable-stream"."1.1.13";
2716 by-version."readable-stream"."1.1.13" = lib.makeOverridable self.buildNodePackage {
2717 name = "readable-stream-1.1.13";
2718 bin = false;
2719 src = [
2720 (fetchurl {
2721 url = "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz";
2722 name = "readable-stream-1.1.13.tgz";
2723 sha1 = "f6eef764f514c89e2b9e23146a75ba106756d23e";
2724 })
2725 ];
2726 buildInputs =
2727 (self.nativeDeps."readable-stream" or []);
2728 deps = {
2729 "core-util-is-1.0.2" = self.by-version."core-util-is"."1.0.2";
2730 "isarray-0.0.1" = self.by-version."isarray"."0.0.1";
2731 "string_decoder-0.10.31" = self.by-version."string_decoder"."0.10.31";
2732 "inherits-2.0.1" = self.by-version."inherits"."2.0.1";
2733 };
2734 peerDependencies = [
2735 ];
2736 passthru.names = [ "readable-stream" ];
2737 };
2738 by-spec."readable-stream"."~2.0.5" =
2739 self.by-version."readable-stream"."2.0.5";
2740 by-version."readable-stream"."2.0.5" = lib.makeOverridable self.buildNodePackage {
2741 name = "readable-stream-2.0.5";
2742 bin = false;
2743 src = [
2744 (fetchurl {
2745 url = "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.5.tgz";
2746 name = "readable-stream-2.0.5.tgz";
2747 sha1 = "a2426f8dcd4551c77a33f96edf2886a23c829669";
2748 })
2749 ];
2750 buildInputs =
2751 (self.nativeDeps."readable-stream" or []);
2752 deps = {
2753 "core-util-is-1.0.2" = self.by-version."core-util-is"."1.0.2";
2754 "inherits-2.0.1" = self.by-version."inherits"."2.0.1";
2755 "isarray-0.0.1" = self.by-version."isarray"."0.0.1";
2756 "process-nextick-args-1.0.6" = self.by-version."process-nextick-args"."1.0.6";
2757 "string_decoder-0.10.31" = self.by-version."string_decoder"."0.10.31";
2758 "util-deprecate-1.0.2" = self.by-version."util-deprecate"."1.0.2";
2759 };
2760 peerDependencies = [
2761 ];
2762 passthru.names = [ "readable-stream" ];
2763 };
2764 by-spec."request"."^2.51.0" =
2765 self.by-version."request"."2.67.0";
2766 by-version."request"."2.67.0" = lib.makeOverridable self.buildNodePackage {
2767 name = "request-2.67.0";
2768 bin = false;
2769 src = [
2770 (fetchurl {
2771 url = "http://registry.npmjs.org/request/-/request-2.67.0.tgz";
2772 name = "request-2.67.0.tgz";
2773 sha1 = "8af74780e2bf11ea0ae9aa965c11f11afd272742";
2774 })
2775 ];
2776 buildInputs =
2777 (self.nativeDeps."request" or []);
2778 deps = {
2779 "bl-1.0.1" = self.by-version."bl"."1.0.1";
2780 "caseless-0.11.0" = self.by-version."caseless"."0.11.0";
2781 "extend-3.0.0" = self.by-version."extend"."3.0.0";
2782 "forever-agent-0.6.1" = self.by-version."forever-agent"."0.6.1";
2783 "form-data-1.0.0-rc3" = self.by-version."form-data"."1.0.0-rc3";
2784 "json-stringify-safe-5.0.1" = self.by-version."json-stringify-safe"."5.0.1";
2785 "mime-types-2.1.9" = self.by-version."mime-types"."2.1.9";
2786 "node-uuid-1.4.7" = self.by-version."node-uuid"."1.4.7";
2787 "qs-5.2.0" = self.by-version."qs"."5.2.0";
2788 "tunnel-agent-0.4.2" = self.by-version."tunnel-agent"."0.4.2";
2789 "tough-cookie-2.2.1" = self.by-version."tough-cookie"."2.2.1";
2790 "http-signature-1.1.0" = self.by-version."http-signature"."1.1.0";
2791 "oauth-sign-0.8.0" = self.by-version."oauth-sign"."0.8.0";
2792 "hawk-3.1.3" = self.by-version."hawk"."3.1.3";
2793 "aws-sign2-0.6.0" = self.by-version."aws-sign2"."0.6.0";
2794 "stringstream-0.0.5" = self.by-version."stringstream"."0.0.5";
2795 "combined-stream-1.0.5" = self.by-version."combined-stream"."1.0.5";
2796 "isstream-0.1.2" = self.by-version."isstream"."0.1.2";
2797 "is-typedarray-1.0.0" = self.by-version."is-typedarray"."1.0.0";
2798 "har-validator-2.0.6" = self.by-version."har-validator"."2.0.6";
2799 };
2800 peerDependencies = [
2801 ];
2802 passthru.names = [ "request" ];
2803 };
2804 by-spec."rimraf"."~2.2.8" =
2805 self.by-version."rimraf"."2.2.8";
2806 by-version."rimraf"."2.2.8" = lib.makeOverridable self.buildNodePackage {
2807 name = "rimraf-2.2.8";
2808 bin = true;
2809 src = [
2810 (fetchurl {
2811 url = "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz";
2812 name = "rimraf-2.2.8.tgz";
2813 sha1 = "e439be2aaee327321952730f99a8929e4fc50582";
2814 })
2815 ];
2816 buildInputs =
2817 (self.nativeDeps."rimraf" or []);
2818 deps = {
2819 };
2820 peerDependencies = [
2821 ];
2822 passthru.names = [ "rimraf" ];
2823 };
2824 by-spec."shelljs"."0.3.x" =
2825 self.by-version."shelljs"."0.3.0";
2826 by-version."shelljs"."0.3.0" = lib.makeOverridable self.buildNodePackage {
2827 name = "shelljs-0.3.0";
2828 bin = true;
2829 src = [
2830 (fetchurl {
2831 url = "http://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz";
2832 name = "shelljs-0.3.0.tgz";
2833 sha1 = "3596e6307a781544f591f37da618360f31db57b1";
2834 })
2835 ];
2836 buildInputs =
2837 (self.nativeDeps."shelljs" or []);
2838 deps = {
2839 };
2840 peerDependencies = [
2841 ];
2842 passthru.names = [ "shelljs" ];
2843 };
2844 by-spec."sigmund"."~1.0.0" =
2845 self.by-version."sigmund"."1.0.1";
2846 by-version."sigmund"."1.0.1" = lib.makeOverridable self.buildNodePackage {
2847 name = "sigmund-1.0.1";
2848 bin = false;
2849 src = [
2850 (fetchurl {
2851 url = "http://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz";
2852 name = "sigmund-1.0.1.tgz";
2853 sha1 = "3ff21f198cad2175f9f3b781853fd94d0d19b590";
2854 })
2855 ];
2856 buildInputs =
2857 (self.nativeDeps."sigmund" or []);
2858 deps = {
2859 };
2860 peerDependencies = [
2861 ];
2862 passthru.names = [ "sigmund" ];
2863 };
2864 by-spec."sntp"."1.x.x" =
2865 self.by-version."sntp"."1.0.9";
2866 by-version."sntp"."1.0.9" = lib.makeOverridable self.buildNodePackage {
2867 name = "sntp-1.0.9";
2868 bin = false;
2869 src = [
2870 (fetchurl {
2871 url = "http://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz";
2872 name = "sntp-1.0.9.tgz";
2873 sha1 = "6541184cc90aeea6c6e7b35e2659082443c66198";
2874 })
2875 ];
2876 buildInputs =
2877 (self.nativeDeps."sntp" or []);
2878 deps = {
2879 "hoek-2.16.3" = self.by-version."hoek"."2.16.3";
2880 };
2881 peerDependencies = [
2882 ];
2883 passthru.names = [ "sntp" ];
2884 };
2885 by-spec."source-map"."^0.3.0" =
2886 self.by-version."source-map"."0.3.0";
2887 by-version."source-map"."0.3.0" = lib.makeOverridable self.buildNodePackage {
2888 name = "source-map-0.3.0";
2889 bin = false;
2890 src = [
2891 (fetchurl {
2892 url = "http://registry.npmjs.org/source-map/-/source-map-0.3.0.tgz";
2893 name = "source-map-0.3.0.tgz";
2894 sha1 = "8586fb9a5a005e5b501e21cd18b6f21b457ad1f9";
2895 })
2896 ];
2897 buildInputs =
2898 (self.nativeDeps."source-map" or []);
2899 deps = {
2900 "amdefine-1.0.0" = self.by-version."amdefine"."1.0.0";
2901 };
2902 peerDependencies = [
2903 ];
2904 passthru.names = [ "source-map" ];
2905 };
2906 by-spec."source-map"."^0.4.2" =
2907 self.by-version."source-map"."0.4.4";
2908 by-version."source-map"."0.4.4" = lib.makeOverridable self.buildNodePackage {
2909 name = "source-map-0.4.4";
2910 bin = false;
2911 src = [
2912 (fetchurl {
2913 url = "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz";
2914 name = "source-map-0.4.4.tgz";
2915 sha1 = "eba4f5da9c0dc999de68032d8b4f76173652036b";
2916 })
2917 ];
2918 buildInputs =
2919 (self.nativeDeps."source-map" or []);
2920 deps = {
2921 "amdefine-1.0.0" = self.by-version."amdefine"."1.0.0";
2922 };
2923 peerDependencies = [
2924 ];
2925 passthru.names = [ "source-map" ];
2926 };
2927 by-spec."sshpk"."^1.7.0" =
2928 self.by-version."sshpk"."1.7.3";
2929 by-version."sshpk"."1.7.3" = lib.makeOverridable self.buildNodePackage {
2930 name = "sshpk-1.7.3";
2931 bin = true;
2932 src = [
2933 (fetchurl {
2934 url = "http://registry.npmjs.org/sshpk/-/sshpk-1.7.3.tgz";
2935 name = "sshpk-1.7.3.tgz";
2936 sha1 = "caa8ef95e30765d856698b7025f9f211ab65962f";
2937 })
2938 ];
2939 buildInputs =
2940 (self.nativeDeps."sshpk" or []);
2941 deps = {
2942 "asn1-0.2.3" = self.by-version."asn1"."0.2.3";
2943 "assert-plus-0.2.0" = self.by-version."assert-plus"."0.2.0";
2944 "dashdash-1.12.2" = self.by-version."dashdash"."1.12.2";
2945 "jsbn-0.1.0" = self.by-version."jsbn"."0.1.0";
2946 "tweetnacl-0.13.3" = self.by-version."tweetnacl"."0.13.3";
2947 "jodid25519-1.0.2" = self.by-version."jodid25519"."1.0.2";
2948 "ecc-jsbn-0.1.1" = self.by-version."ecc-jsbn"."0.1.1";
2949 };
2950 peerDependencies = [
2951 ];
2952 passthru.names = [ "sshpk" ];
2953 };
2954 by-spec."string_decoder"."~0.10.x" =
2955 self.by-version."string_decoder"."0.10.31";
2956 by-version."string_decoder"."0.10.31" = lib.makeOverridable self.buildNodePackage {
2957 name = "string_decoder-0.10.31";
2958 bin = false;
2959 src = [
2960 (fetchurl {
2961 url = "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz";
2962 name = "string_decoder-0.10.31.tgz";
2963 sha1 = "62e203bc41766c6c28c9fc84301dab1c5310fa94";
2964 })
2965 ];
2966 buildInputs =
2967 (self.nativeDeps."string_decoder" or []);
2968 deps = {
2969 };
2970 peerDependencies = [
2971 ];
2972 passthru.names = [ "string_decoder" ];
2973 };
2974 by-spec."stringstream"."~0.0.4" =
2975 self.by-version."stringstream"."0.0.5";
2976 by-version."stringstream"."0.0.5" = lib.makeOverridable self.buildNodePackage {
2977 name = "stringstream-0.0.5";
2978 bin = false;
2979 src = [
2980 (fetchurl {
2981 url = "http://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz";
2982 name = "stringstream-0.0.5.tgz";
2983 sha1 = "4e484cd4de5a0bbbee18e46307710a8a81621878";
2984 })
2985 ];
2986 buildInputs =
2987 (self.nativeDeps."stringstream" or []);
2988 deps = {
2989 };
2990 peerDependencies = [
2991 ];
2992 passthru.names = [ "stringstream" ];
2993 };
2994 by-spec."strip-ansi"."^0.3.0" =
2995 self.by-version."strip-ansi"."0.3.0";
2996 by-version."strip-ansi"."0.3.0" = lib.makeOverridable self.buildNodePackage {
2997 name = "strip-ansi-0.3.0";
2998 bin = true;
2999 src = [
3000 (fetchurl {
3001 url = "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz";
3002 name = "strip-ansi-0.3.0.tgz";
3003 sha1 = "25f48ea22ca79187f3174a4db8759347bb126220";
3004 })
3005 ];
3006 buildInputs =
3007 (self.nativeDeps."strip-ansi" or []);
3008 deps = {
3009 "ansi-regex-0.2.1" = self.by-version."ansi-regex"."0.2.1";
3010 };
3011 peerDependencies = [
3012 ];
3013 passthru.names = [ "strip-ansi" ];
3014 };
3015 by-spec."strip-ansi"."^3.0.0" =
3016 self.by-version."strip-ansi"."3.0.0";
3017 by-version."strip-ansi"."3.0.0" = lib.makeOverridable self.buildNodePackage {
3018 name = "strip-ansi-3.0.0";
3019 bin = false;
3020 src = [
3021 (fetchurl {
3022 url = "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz";
3023 name = "strip-ansi-3.0.0.tgz";
3024 sha1 = "7510b665567ca914ccb5d7e072763ac968be3724";
3025 })
3026 ];
3027 buildInputs =
3028 (self.nativeDeps."strip-ansi" or []);
3029 deps = {
3030 "ansi-regex-2.0.0" = self.by-version."ansi-regex"."2.0.0";
3031 };
3032 peerDependencies = [
3033 ];
3034 passthru.names = [ "strip-ansi" ];
3035 };
3036 by-spec."strip-json-comments"."1.0.x" =
3037 self.by-version."strip-json-comments"."1.0.4";
3038 by-version."strip-json-comments"."1.0.4" = lib.makeOverridable self.buildNodePackage {
3039 name = "strip-json-comments-1.0.4";
3040 bin = true;
3041 src = [
3042 (fetchurl {
3043 url = "http://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz";
3044 name = "strip-json-comments-1.0.4.tgz";
3045 sha1 = "1e15fbcac97d3ee99bf2d73b4c656b082bbafb91";
3046 })
3047 ];
3048 buildInputs =
3049 (self.nativeDeps."strip-json-comments" or []);
3050 deps = {
3051 };
3052 peerDependencies = [
3053 ];
3054 passthru.names = [ "strip-json-comments" ];
3055 };
3056 by-spec."supports-color"."^0.2.0" =
3057 self.by-version."supports-color"."0.2.0";
3058 by-version."supports-color"."0.2.0" = lib.makeOverridable self.buildNodePackage {
3059 name = "supports-color-0.2.0";
3060 bin = true;
3061 src = [
3062 (fetchurl {
3063 url = "http://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz";
3064 name = "supports-color-0.2.0.tgz";
3065 sha1 = "d92de2694eb3f67323973d7ae3d8b55b4c22190a";
3066 })
3067 ];
3068 buildInputs =
3069 (self.nativeDeps."supports-color" or []);
3070 deps = {
3071 };
3072 peerDependencies = [
3073 ];
3074 passthru.names = [ "supports-color" ];
3075 };
3076 by-spec."supports-color"."^2.0.0" =
3077 self.by-version."supports-color"."2.0.0";
3078 by-version."supports-color"."2.0.0" = lib.makeOverridable self.buildNodePackage {
3079 name = "supports-color-2.0.0";
3080 bin = false;
3081 src = [
3082 (fetchurl {
3083 url = "http://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz";
3084 name = "supports-color-2.0.0.tgz";
3085 sha1 = "535d045ce6b6363fa40117084629995e9df324c7";
3086 })
3087 ];
3088 buildInputs =
3089 (self.nativeDeps."supports-color" or []);
3090 deps = {
3091 };
3092 peerDependencies = [
3093 ];
3094 passthru.names = [ "supports-color" ];
3095 };
3096 by-spec."tiny-lr-fork"."0.0.5" =
3097 self.by-version."tiny-lr-fork"."0.0.5";
3098 by-version."tiny-lr-fork"."0.0.5" = lib.makeOverridable self.buildNodePackage {
3099 name = "tiny-lr-fork-0.0.5";
3100 bin = true;
3101 src = [
3102 (fetchurl {
3103 url = "http://registry.npmjs.org/tiny-lr-fork/-/tiny-lr-fork-0.0.5.tgz";
3104 name = "tiny-lr-fork-0.0.5.tgz";
3105 sha1 = "1e99e1e2a8469b736ab97d97eefa98c71f76ed0a";
3106 })
3107 ];
3108 buildInputs =
3109 (self.nativeDeps."tiny-lr-fork" or []);
3110 deps = {
3111 "qs-0.5.6" = self.by-version."qs"."0.5.6";
3112 "faye-websocket-0.4.4" = self.by-version."faye-websocket"."0.4.4";
3113 "noptify-0.0.3" = self.by-version."noptify"."0.0.3";
3114 "debug-0.7.4" = self.by-version."debug"."0.7.4";
3115 };
3116 peerDependencies = [
3117 ];
3118 passthru.names = [ "tiny-lr-fork" ];
3119 };
3120 by-spec."tough-cookie"."~2.2.0" =
3121 self.by-version."tough-cookie"."2.2.1";
3122 by-version."tough-cookie"."2.2.1" = lib.makeOverridable self.buildNodePackage {
3123 name = "tough-cookie-2.2.1";
3124 bin = false;
3125 src = [
3126 (fetchurl {
3127 url = "http://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.1.tgz";
3128 name = "tough-cookie-2.2.1.tgz";
3129 sha1 = "3b0516b799e70e8164436a1446e7e5877fda118e";
3130 })
3131 ];
3132 buildInputs =
3133 (self.nativeDeps."tough-cookie" or []);
3134 deps = {
3135 };
3136 peerDependencies = [
3137 ];
3138 passthru.names = [ "tough-cookie" ];
3139 };
3140 by-spec."tunnel-agent"."~0.4.1" =
3141 self.by-version."tunnel-agent"."0.4.2";
3142 by-version."tunnel-agent"."0.4.2" = lib.makeOverridable self.buildNodePackage {
3143 name = "tunnel-agent-0.4.2";
3144 bin = false;
3145 src = [
3146 (fetchurl {
3147 url = "http://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.2.tgz";
3148 name = "tunnel-agent-0.4.2.tgz";
3149 sha1 = "1104e3f36ac87125c287270067d582d18133bfee";
3150 })
3151 ];
3152 buildInputs =
3153 (self.nativeDeps."tunnel-agent" or []);
3154 deps = {
3155 };
3156 peerDependencies = [
3157 ];
3158 passthru.names = [ "tunnel-agent" ];
3159 };
3160 by-spec."tweetnacl".">=0.13.0 <1.0.0" =
3161 self.by-version."tweetnacl"."0.13.3";
3162 by-version."tweetnacl"."0.13.3" = lib.makeOverridable self.buildNodePackage {
3163 name = "tweetnacl-0.13.3";
3164 bin = false;
3165 src = [
3166 (fetchurl {
3167 url = "http://registry.npmjs.org/tweetnacl/-/tweetnacl-0.13.3.tgz";
3168 name = "tweetnacl-0.13.3.tgz";
3169 sha1 = "d628b56f3bcc3d5ae74ba9d4c1a704def5ab4b56";
3170 })
3171 ];
3172 buildInputs =
3173 (self.nativeDeps."tweetnacl" or []);
3174 deps = {
3175 };
3176 peerDependencies = [
3177 ];
3178 passthru.names = [ "tweetnacl" ];
3179 };
3180 by-spec."underscore"."~1.7.0" =
3181 self.by-version."underscore"."1.7.0";
3182 by-version."underscore"."1.7.0" = lib.makeOverridable self.buildNodePackage {
3183 name = "underscore-1.7.0";
3184 bin = false;
3185 src = [
3186 (fetchurl {
3187 url = "http://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz";
3188 name = "underscore-1.7.0.tgz";
3189 sha1 = "6bbaf0877500d36be34ecaa584e0db9fef035209";
3190 })
3191 ];
3192 buildInputs =
3193 (self.nativeDeps."underscore" or []);
3194 deps = {
3195 };
3196 peerDependencies = [
3197 ];
3198 passthru.names = [ "underscore" ];
3199 };
3200 by-spec."underscore.string"."~2.2.1" =
3201 self.by-version."underscore.string"."2.2.1";
3202 by-version."underscore.string"."2.2.1" = lib.makeOverridable self.buildNodePackage {
3203 name = "underscore.string-2.2.1";
3204 bin = false;
3205 src = [
3206 (fetchurl {
3207 url = "http://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz";
3208 name = "underscore.string-2.2.1.tgz";
3209 sha1 = "d7c0fa2af5d5a1a67f4253daee98132e733f0f19";
3210 })
3211 ];
3212 buildInputs =
3213 (self.nativeDeps."underscore.string" or []);
3214 deps = {
3215 };
3216 peerDependencies = [
3217 ];
3218 passthru.names = [ "underscore.string" ];
3219 };
3220 by-spec."underscore.string"."~2.3.3" =
3221 self.by-version."underscore.string"."2.3.3";
3222 by-version."underscore.string"."2.3.3" = lib.makeOverridable self.buildNodePackage {
3223 name = "underscore.string-2.3.3";
3224 bin = false;
3225 src = [
3226 (fetchurl {
3227 url = "http://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz";
3228 name = "underscore.string-2.3.3.tgz";
3229 sha1 = "71c08bf6b428b1133f37e78fa3a21c82f7329b0d";
3230 })
3231 ];
3232 buildInputs =
3233 (self.nativeDeps."underscore.string" or []);
3234 deps = {
3235 };
3236 peerDependencies = [
3237 ];
3238 passthru.names = [ "underscore.string" ];
3239 };
3240 by-spec."underscore.string"."~2.4.0" =
3241 self.by-version."underscore.string"."2.4.0";
3242 by-version."underscore.string"."2.4.0" = lib.makeOverridable self.buildNodePackage {
3243 name = "underscore.string-2.4.0";
3244 bin = false;
3245 src = [
3246 (fetchurl {
3247 url = "http://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz";
3248 name = "underscore.string-2.4.0.tgz";
3249 sha1 = "8cdd8fbac4e2d2ea1e7e2e8097c42f442280f85b";
3250 })
3251 ];
3252 buildInputs =
3253 (self.nativeDeps."underscore.string" or []);
3254 deps = {
3255 };
3256 peerDependencies = [
3257 ];
3258 passthru.names = [ "underscore.string" ];
3259 };
3260 by-spec."util-deprecate"."~1.0.1" =
3261 self.by-version."util-deprecate"."1.0.2";
3262 by-version."util-deprecate"."1.0.2" = lib.makeOverridable self.buildNodePackage {
3263 name = "util-deprecate-1.0.2";
3264 bin = false;
3265 src = [
3266 (fetchurl {
3267 url = "http://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz";
3268 name = "util-deprecate-1.0.2.tgz";
3269 sha1 = "450d4dc9fa70de732762fbd2d4a28981419a0ccf";
3270 })
3271 ];
3272 buildInputs =
3273 (self.nativeDeps."util-deprecate" or []);
3274 deps = {
3275 };
3276 peerDependencies = [
3277 ];
3278 passthru.names = [ "util-deprecate" ];
3279 };
3280 by-spec."verror"."1.3.6" =
3281 self.by-version."verror"."1.3.6";
3282 by-version."verror"."1.3.6" = lib.makeOverridable self.buildNodePackage {
3283 name = "verror-1.3.6";
3284 bin = false;
3285 src = [
3286 (fetchurl {
3287 url = "http://registry.npmjs.org/verror/-/verror-1.3.6.tgz";
3288 name = "verror-1.3.6.tgz";
3289 sha1 = "cff5df12946d297d2baaefaa2689e25be01c005c";
3290 })
3291 ];
3292 buildInputs =
3293 (self.nativeDeps."verror" or []);
3294 deps = {
3295 "extsprintf-1.0.2" = self.by-version."extsprintf"."1.0.2";
3296 };
3297 peerDependencies = [
3298 ];
3299 passthru.names = [ "verror" ];
3300 };
3301 by-spec."which"."~1.0.5" =
3302 self.by-version."which"."1.0.9";
3303 by-version."which"."1.0.9" = lib.makeOverridable self.buildNodePackage {
3304 name = "which-1.0.9";
3305 bin = true;
3306 src = [
3307 (fetchurl {
3308 url = "http://registry.npmjs.org/which/-/which-1.0.9.tgz";
3309 name = "which-1.0.9.tgz";
3310 sha1 = "460c1da0f810103d0321a9b633af9e575e64486f";
3311 })
3312 ];
3313 buildInputs =
3314 (self.nativeDeps."which" or []);
3315 deps = {
3316 };
3317 peerDependencies = [
3318 ];
3319 passthru.names = [ "which" ];
3320 };
3321 by-spec."xtend"."^4.0.0" =
3322 self.by-version."xtend"."4.0.1";
3323 by-version."xtend"."4.0.1" = lib.makeOverridable self.buildNodePackage {
3324 name = "xtend-4.0.1";
3325 bin = false;
3326 src = [
3327 (fetchurl {
3328 url = "http://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz";
3329 name = "xtend-4.0.1.tgz";
3330 sha1 = "a5c6d532be656e23db820efb943a1f04998d63af";
3331 })
3332 ];
3333 buildInputs =
3334 (self.nativeDeps."xtend" or []);
3335 deps = {
3336 };
3337 peerDependencies = [
3338 ];
3339 passthru.names = [ "xtend" ];
3340 };
3341 }
@@ -14,6 +14,20 b' let'
14 url = http://www.repoze.org/LICENSE.txt;
14 url = http://www.repoze.org/LICENSE.txt;
15 };
15 };
16 };
16 };
17
18 # johbo: Interim bridge which allows us to build with the upcoming
19 # nixos.16.09 branch (unstable at the moment of writing this note) and the
20 # current stable nixos-16.03.
21 backwardsCompatibleFetchgit = { ... }@args:
22 let
23 origSources = pkgs.fetchgit args;
24 in
25 pkgs.lib.overrideDerivation origSources (oldAttrs: {
26 NIX_PREFETCH_GIT_CHECKOUT_HOOK = ''
27 find $out -name '.git*' -print0 | xargs -0 rm -rf
28 '';
29 });
30
17 in
31 in
18
32
19 self: super: {
33 self: super: {
@@ -96,7 +110,7 b' self: super: {'
96 });
110 });
97
111
98 py-gfm = super.py-gfm.override {
112 py-gfm = super.py-gfm.override {
99 src = pkgs.fetchgit {
113 src = backwardsCompatibleFetchgit {
100 url = "https://code.rhodecode.com/upstream/py-gfm";
114 url = "https://code.rhodecode.com/upstream/py-gfm";
101 rev = "0d66a19bc16e3d49de273c0f797d4e4781e8c0f2";
115 rev = "0d66a19bc16e3d49de273c0f797d4e4781e8c0f2";
102 sha256 = "0ryp74jyihd3ckszq31bml5jr3bciimhfp7va7kw6ld92930ksv3";
116 sha256 = "0ryp74jyihd3ckszq31bml5jr3bciimhfp7va7kw6ld92930ksv3";
@@ -120,7 +134,7 b' self: super: {'
120
134
121 Pylons = super.Pylons.override (attrs: {
135 Pylons = super.Pylons.override (attrs: {
122 name = "Pylons-1.0.1-patch1";
136 name = "Pylons-1.0.1-patch1";
123 src = pkgs.fetchgit {
137 src = backwardsCompatibleFetchgit {
124 url = "https://code.rhodecode.com/upstream/pylons";
138 url = "https://code.rhodecode.com/upstream/pylons";
125 rev = "707354ee4261b9c10450404fc9852ccea4fd667d";
139 rev = "707354ee4261b9c10450404fc9852ccea4fd667d";
126 sha256 = "b2763274c2780523a335f83a1df65be22ebe4ff413a7bc9e9288d23c1f62032e";
140 sha256 = "b2763274c2780523a335f83a1df65be22ebe4ff413a7bc9e9288d23c1f62032e";
@@ -51,19 +51,6 b''
51 license = [ { fullName = "BSD-like (http://repoze.org/license.html)"; } ];
51 license = [ { fullName = "BSD-like (http://repoze.org/license.html)"; } ];
52 };
52 };
53 };
53 };
54 Fabric = super.buildPythonPackage {
55 name = "Fabric-1.10.0";
56 buildInputs = with self; [];
57 doCheck = false;
58 propagatedBuildInputs = with self; [paramiko];
59 src = fetchurl {
60 url = "https://pypi.python.org/packages/e3/5f/b6ebdb5241d5ec9eab582a5c8a01255c1107da396f849e538801d2fe64a5/Fabric-1.10.0.tar.gz";
61 md5 = "2cb96473387f0e7aa035210892352f4a";
62 };
63 meta = {
64 license = [ pkgs.lib.licenses.bsdOriginal ];
65 };
66 };
67 FormEncode = super.buildPythonPackage {
54 FormEncode = super.buildPythonPackage {
68 name = "FormEncode-1.2.4";
55 name = "FormEncode-1.2.4";
69 buildInputs = with self; [];
56 buildInputs = with self; [];
@@ -1430,7 +1417,7 b''
1430 };
1417 };
1431 };
1418 };
1432 rhodecode-enterprise-ce = super.buildPythonPackage {
1419 rhodecode-enterprise-ce = super.buildPythonPackage {
1433 name = "rhodecode-enterprise-ce-4.3.1";
1420 name = "rhodecode-enterprise-ce-4.4.0";
1434 buildInputs = with self; [WebTest configobj cssselect flake8 lxml mock pytest pytest-cov pytest-runner];
1421 buildInputs = with self; [WebTest configobj cssselect flake8 lxml mock pytest pytest-cov pytest-runner];
1435 doCheck = true;
1422 doCheck = true;
1436 propagatedBuildInputs = with self; [Babel Beaker FormEncode Mako Markdown MarkupSafe MySQL-python Paste PasteDeploy PasteScript Pygments Pylons Pyro4 Routes SQLAlchemy Tempita URLObject WebError WebHelpers WebHelpers2 WebOb WebTest Whoosh alembic amqplib anyjson appenlight-client authomatic backport-ipaddress celery channelstream colander decorator deform docutils gevent gunicorn infrae.cache ipython iso8601 kombu msgpack-python packaging psycopg2 py-gfm pycrypto pycurl pyparsing pyramid pyramid-debugtoolbar pyramid-mako pyramid-beaker pysqlite python-dateutil python-ldap python-memcached python-pam recaptcha-client repoze.lru requests simplejson waitress zope.cachedescriptors dogpile.cache dogpile.core psutil py-bcrypt];
1423 propagatedBuildInputs = with self; [Babel Beaker FormEncode Mako Markdown MarkupSafe MySQL-python Paste PasteDeploy PasteScript Pygments Pylons Pyro4 Routes SQLAlchemy Tempita URLObject WebError WebHelpers WebHelpers2 WebOb WebTest Whoosh alembic amqplib anyjson appenlight-client authomatic backport-ipaddress celery channelstream colander decorator deform docutils gevent gunicorn infrae.cache ipython iso8601 kombu msgpack-python packaging psycopg2 py-gfm pycrypto pycurl pyparsing pyramid pyramid-debugtoolbar pyramid-mako pyramid-beaker pysqlite python-dateutil python-ldap python-memcached python-pam recaptcha-client repoze.lru requests simplejson waitress zope.cachedescriptors dogpile.cache dogpile.core psutil py-bcrypt];
@@ -1,7 +1,6 b''
1 Babel==1.3
1 Babel==1.3
2 Beaker==1.7.0
2 Beaker==1.7.0
3 CProfileV==1.0.6
3 CProfileV==1.0.6
4 Fabric==1.10.0
5 FormEncode==1.2.4
4 FormEncode==1.2.4
6 Jinja2==2.7.3
5 Jinja2==2.7.3
7 Mako==1.0.1
6 Mako==1.0.1
@@ -1,1 +1,1 b''
1 4.3.1 No newline at end of file
1 4.4.0 No newline at end of file
@@ -51,7 +51,7 b' PYRAMID_SETTINGS = {}'
51 EXTENSIONS = {}
51 EXTENSIONS = {}
52
52
53 __version__ = ('.'.join((str(each) for each in VERSION[:3])))
53 __version__ = ('.'.join((str(each) for each in VERSION[:3])))
54 __dbversion__ = 55 # defines current db version for migrations
54 __dbversion__ = 58 # defines current db version for migrations
55 __platform__ = platform.system()
55 __platform__ = platform.system()
56 __license__ = 'AGPLv3, and Commercial License'
56 __license__ = 'AGPLv3, and Commercial License'
57 __author__ = 'RhodeCode GmbH'
57 __author__ = 'RhodeCode GmbH'
@@ -60,3 +60,4 b' EXTENSIONS = {}'
60 is_windows = __platform__ in ['Windows']
60 is_windows = __platform__ in ['Windows']
61 is_unix = not is_windows
61 is_unix = not is_windows
62 is_test = False
62 is_test = False
63 disable_error_handler = False
@@ -29,7 +29,9 b' from rhodecode.lib.ext_json import json'
29 def url_gen(request):
29 def url_gen(request):
30 urls = {
30 urls = {
31 'connect': request.route_url('channelstream_connect'),
31 'connect': request.route_url('channelstream_connect'),
32 'subscribe': request.route_url('channelstream_subscribe')
32 'subscribe': request.route_url('channelstream_subscribe'),
33 'longpoll': request.registry.settings.get('channelstream.longpoll_url', ''),
34 'ws': request.registry.settings.get('channelstream.ws_url', '')
33 }
35 }
34 return json.dumps(urls)
36 return json.dumps(urls)
35
37
@@ -95,6 +95,7 b' class ChannelstreamView(object):'
95 'display_name': None,
95 'display_name': None,
96 'display_link': None,
96 'display_link': None,
97 }
97 }
98 user_data['permissions'] = c.rhodecode_user.permissions
98 payload = {
99 payload = {
99 'username': user.username,
100 'username': user.username,
100 'user_state': user_data,
101 'user_state': user_data,
@@ -28,7 +28,11 b' from rhodecode.lib.utils2 import __get_l'
28
28
29 # language map is also used by whoosh indexer, which for those specified
29 # language map is also used by whoosh indexer, which for those specified
30 # extensions will index it's content
30 # extensions will index it's content
31 LANGUAGES_EXTENSIONS_MAP = __get_lem()
31 # custom extensions to lexers, format is 'ext': 'LexerClass'
32 extra = {
33 'vbs': 'VbNet'
34 }
35 LANGUAGES_EXTENSIONS_MAP = __get_lem(extra)
32
36
33 DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
37 DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
34
38
@@ -158,6 +158,8 b' def load_pyramid_environment(global_conf'
158 # This has to be done before the database connection is initialized.
158 # This has to be done before the database connection is initialized.
159 if settings['is_test']:
159 if settings['is_test']:
160 rhodecode.is_test = True
160 rhodecode.is_test = True
161 rhodecode.disable_error_handler = True
162
161 utils.initialize_test_environment(settings_merged)
163 utils.initialize_test_environment(settings_merged)
162
164
163 # Initialize the database connection.
165 # Initialize the database connection.
@@ -44,9 +44,10 b' from rhodecode.config import patches'
44 from rhodecode.config.routing import STATIC_FILE_PREFIX
44 from rhodecode.config.routing import STATIC_FILE_PREFIX
45 from rhodecode.config.environment import (
45 from rhodecode.config.environment import (
46 load_environment, load_pyramid_environment)
46 load_environment, load_pyramid_environment)
47 from rhodecode.lib.exceptions import VCSServerUnavailable
48 from rhodecode.lib.vcs.exceptions import VCSCommunicationError
47 from rhodecode.lib.middleware import csrf
49 from rhodecode.lib.middleware import csrf
48 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
50 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
49 from rhodecode.lib.middleware.disable_vcs import DisableVCSPagesWrapper
50 from rhodecode.lib.middleware.https_fixup import HttpsFixup
51 from rhodecode.lib.middleware.https_fixup import HttpsFixup
51 from rhodecode.lib.middleware.vcs import VCSMiddleware
52 from rhodecode.lib.middleware.vcs import VCSMiddleware
52 from rhodecode.lib.plugins.utils import register_rhodecode_plugin
53 from rhodecode.lib.plugins.utils import register_rhodecode_plugin
@@ -193,10 +194,6 b' def make_not_found_view(config):'
193
194
194 pylons_app_as_view = wsgiapp(pylons_app)
195 pylons_app_as_view = wsgiapp(pylons_app)
195
196
196 # Protect from VCS Server error related pages when server is not available
197 if not vcs_server_enabled:
198 pylons_app_as_view = DisableVCSPagesWrapper(pylons_app_as_view)
199
200 def pylons_app_with_error_handler(context, request):
197 def pylons_app_with_error_handler(context, request):
201 """
198 """
202 Handle exceptions from rc pylons app:
199 Handle exceptions from rc pylons app:
@@ -221,10 +218,18 b' def make_not_found_view(config):'
221 return error_handler(response, request)
218 return error_handler(response, request)
222 except HTTPError as e: # pyramid type exceptions
219 except HTTPError as e: # pyramid type exceptions
223 return error_handler(e, request)
220 return error_handler(e, request)
224 except Exception:
221 except Exception as e:
225 if settings.get('debugtoolbar.enabled', False):
222 log.exception(e)
223
224 if (settings.get('debugtoolbar.enabled', False) or
225 rhodecode.disable_error_handler):
226 raise
226 raise
227
228 if isinstance(e, VCSCommunicationError):
229 return error_handler(VCSServerUnavailable(), request)
230
227 return error_handler(HTTPInternalServerError(), request)
231 return error_handler(HTTPInternalServerError(), request)
232
228 return response
233 return response
229
234
230 return pylons_app_with_error_handler
235 return pylons_app_with_error_handler
@@ -249,7 +254,6 b' def webob_to_pyramid_http_response(webob'
249
254
250
255
251 def error_handler(exception, request):
256 def error_handler(exception, request):
252 # TODO: dan: replace the old pylons error controller with this
253 from rhodecode.model.settings import SettingsModel
257 from rhodecode.model.settings import SettingsModel
254 from rhodecode.lib.utils2 import AttributeDict
258 from rhodecode.lib.utils2 import AttributeDict
255
259
@@ -278,6 +282,10 b' def error_handler(exception, request):'
278 if not c.rhodecode_name:
282 if not c.rhodecode_name:
279 c.rhodecode_name = 'Rhodecode'
283 c.rhodecode_name = 'Rhodecode'
280
284
285 c.causes = []
286 if hasattr(base_response, 'causes'):
287 c.causes = base_response.causes
288
281 response = render_to_response(
289 response = render_to_response(
282 '/errors/error_document.html', {'c': c}, request=request,
290 '/errors/error_document.html', {'c': c}, request=request,
283 response=base_response)
291 response=base_response)
@@ -42,6 +42,7 b" STATIC_FILE_PREFIX = '/_static'"
42 URL_NAME_REQUIREMENTS = {
42 URL_NAME_REQUIREMENTS = {
43 # group name can have a slash in them, but they must not end with a slash
43 # group name can have a slash in them, but they must not end with a slash
44 'group_name': r'.*?[^/]',
44 'group_name': r'.*?[^/]',
45 'repo_group_name': r'.*?[^/]',
45 # repo names can have a slash in them, but they must not end with a slash
46 # repo names can have a slash in them, but they must not end with a slash
46 'repo_name': r'.*?[^/]',
47 'repo_name': r'.*?[^/]',
47 # file path eats up everything at the end
48 # file path eats up everything at the end
@@ -531,9 +532,7 b' def make_map(config):'
531 action='my_account_update', conditions={'method': ['POST']})
532 action='my_account_update', conditions={'method': ['POST']})
532
533
533 m.connect('my_account_password', '/my_account/password',
534 m.connect('my_account_password', '/my_account/password',
534 action='my_account_password', conditions={'method': ['GET']})
535 action='my_account_password', conditions={'method': ['GET', 'POST']})
535 m.connect('my_account_password', '/my_account/password',
536 action='my_account_password_update', conditions={'method': ['POST']})
537
536
538 m.connect('my_account_repos', '/my_account/repos',
537 m.connect('my_account_repos', '/my_account/repos',
539 action='my_account_repos', conditions={'method': ['GET']})
538 action='my_account_repos', conditions={'method': ['GET']})
@@ -32,17 +32,21 b' from pylons.controllers.util import redi'
32 from pylons.i18n.translation import _
32 from pylons.i18n.translation import _
33 from sqlalchemy.orm import joinedload
33 from sqlalchemy.orm import joinedload
34
34
35 from rhodecode import forms
35 from rhodecode.lib import helpers as h
36 from rhodecode.lib import helpers as h
36 from rhodecode.lib import auth
37 from rhodecode.lib import auth
37 from rhodecode.lib.auth import (
38 from rhodecode.lib.auth import (
38 LoginRequired, NotAnonymous, AuthUser, generate_auth_token)
39 LoginRequired, NotAnonymous, AuthUser, generate_auth_token)
39 from rhodecode.lib.base import BaseController, render
40 from rhodecode.lib.base import BaseController, render
41 from rhodecode.lib.utils import jsonify
40 from rhodecode.lib.utils2 import safe_int, md5
42 from rhodecode.lib.utils2 import safe_int, md5
41 from rhodecode.lib.ext_json import json
43 from rhodecode.lib.ext_json import json
44
45 from rhodecode.model.validation_schema.schemas import user_schema
42 from rhodecode.model.db import (
46 from rhodecode.model.db import (
43 Repository, PullRequest, PullRequestReviewers, UserEmailMap, User,
47 Repository, PullRequest, PullRequestReviewers, UserEmailMap, User,
44 UserFollowing)
48 UserFollowing)
45 from rhodecode.model.forms import UserForm, PasswordChangeForm
49 from rhodecode.model.forms import UserForm
46 from rhodecode.model.scm import RepoList
50 from rhodecode.model.scm import RepoList
47 from rhodecode.model.user import UserModel
51 from rhodecode.model.user import UserModel
48 from rhodecode.model.repo import RepoModel
52 from rhodecode.model.repo import RepoModel
@@ -185,38 +189,44 b' class MyAccountController(BaseController'
185 force_defaults=False
189 force_defaults=False
186 )
190 )
187
191
188 @auth.CSRFRequired()
192 @auth.CSRFRequired(except_methods=['GET'])
189 def my_account_password_update(self):
193 def my_account_password(self):
190 c.active = 'password'
194 c.active = 'password'
191 self.__load_data()
195 self.__load_data()
192 _form = PasswordChangeForm(c.rhodecode_user.username)()
196
197 schema = user_schema.ChangePasswordSchema().bind(
198 username=c.rhodecode_user.username)
199
200 form = forms.Form(schema,
201 buttons=(forms.buttons.save, forms.buttons.reset))
202
203 if request.method == 'POST':
204 controls = request.POST.items()
193 try:
205 try:
194 form_result = _form.to_python(request.POST)
206 valid_data = form.validate(controls)
195 UserModel().update_user(c.rhodecode_user.user_id, **form_result)
207 UserModel().update_user(c.rhodecode_user.user_id, **valid_data)
196 instance = c.rhodecode_user.get_instance()
208 instance = c.rhodecode_user.get_instance()
197 instance.update_userdata(force_password_change=False)
209 instance.update_userdata(force_password_change=False)
198 Session().commit()
210 Session().commit()
211 except forms.ValidationFailure as e:
212 request.session.flash(
213 _('Error occurred during update of user password'),
214 queue='error')
215 form = e
216 except Exception:
217 log.exception("Exception updating password")
218 request.session.flash(
219 _('Error occurred during update of user password'),
220 queue='error')
221 else:
199 session.setdefault('rhodecode_user', {}).update(
222 session.setdefault('rhodecode_user', {}).update(
200 {'password': md5(instance.password)})
223 {'password': md5(instance.password)})
201 session.save()
224 session.save()
202 h.flash(_("Successfully updated password"), category='success')
225 request.session.flash(
203 except formencode.Invalid as errors:
226 _("Successfully updated password"), queue='success')
204 return htmlfill.render(
227 return redirect(url('my_account_password'))
205 render('admin/my_account/my_account.html'),
206 defaults=errors.value,
207 errors=errors.error_dict or {},
208 prefix_error=False,
209 encoding="UTF-8",
210 force_defaults=False)
211 except Exception:
212 log.exception("Exception updating password")
213 h.flash(_('Error occurred during update of user password'),
214 category='error')
215 return render('admin/my_account/my_account.html')
216
228
217 def my_account_password(self):
229 c.form = form
218 c.active = 'password'
219 self.__load_data()
220 return render('admin/my_account/my_account.html')
230 return render('admin/my_account/my_account.html')
221
231
222 def my_account_repos(self):
232 def my_account_repos(self):
@@ -352,11 +362,10 b' class MyAccountController(BaseController'
352 return render('admin/my_account/my_account.html')
362 return render('admin/my_account/my_account.html')
353
363
354 @auth.CSRFRequired()
364 @auth.CSRFRequired()
365 @jsonify
355 def my_notifications_toggle_visibility(self):
366 def my_notifications_toggle_visibility(self):
356 user = c.rhodecode_user.get_instance()
367 user = c.rhodecode_user.get_instance()
357 user_data = user.user_data
368 new_status = not user.user_data.get('notification_status', True)
358 status = user_data.get('notification_status', False)
369 user.update_userdata(notification_status=new_status)
359 user_data['notification_status'] = not status
360 user.user_data = user_data
361 Session().commit()
370 Session().commit()
362 return redirect(url('my_account_notifications'))
371 return user.user_data['notification_status']
@@ -135,6 +135,7 b' class SettingsController(BaseController)'
135 c.svn_tag_patterns = model.get_global_svn_tag_patterns()
135 c.svn_tag_patterns = model.get_global_svn_tag_patterns()
136
136
137 application_form = ApplicationUiSettingsForm()()
137 application_form = ApplicationUiSettingsForm()()
138
138 try:
139 try:
139 form_result = application_form.to_python(dict(request.POST))
140 form_result = application_form.to_python(dict(request.POST))
140 except formencode.Invalid as errors:
141 except formencode.Invalid as errors:
@@ -151,12 +152,14 b' class SettingsController(BaseController)'
151 )
152 )
152
153
153 try:
154 try:
154 model.update_global_ssl_setting(form_result['web_push_ssl'])
155 if c.visual.allow_repo_location_change:
155 if c.visual.allow_repo_location_change:
156 model.update_global_path_setting(
156 model.update_global_path_setting(
157 form_result['paths_root_path'])
157 form_result['paths_root_path'])
158
159 model.update_global_ssl_setting(form_result['web_push_ssl'])
158 model.update_global_hook_settings(form_result)
160 model.update_global_hook_settings(form_result)
159 model.create_global_svn_settings(form_result)
161
162 model.create_or_update_global_svn_settings(form_result)
160 model.create_or_update_global_hg_settings(form_result)
163 model.create_or_update_global_hg_settings(form_result)
161 model.create_or_update_global_pr_settings(form_result)
164 model.create_or_update_global_pr_settings(form_result)
162 except Exception:
165 except Exception:
@@ -789,18 +792,5 b' LabSetting = collections.namedtuple('
789 # This list has to be kept in sync with the form
792 # This list has to be kept in sync with the form
790 # rhodecode.model.forms.LabsSettingsForm.
793 # rhodecode.model.forms.LabsSettingsForm.
791 _LAB_SETTINGS = [
794 _LAB_SETTINGS = [
792 LabSetting(
795
793 key='rhodecode_proxy_subversion_http_requests',
794 type='bool',
795 group=lazy_ugettext('Subversion HTTP Support'),
796 label=lazy_ugettext('Proxy subversion HTTP requests'),
797 help='' # Do not translate the empty string!
798 ),
799 LabSetting(
800 key='rhodecode_subversion_http_server_url',
801 type='str',
802 group=lazy_ugettext('Subversion HTTP Server URL'),
803 label='', # Do not translate the empty string!
804 help=lazy_ugettext('e.g. http://localhost:8080/')
805 ),
806 ]
796 ]
@@ -44,6 +44,8 b' from rhodecode.lib.vcs.backends.base imp'
44 from rhodecode.lib.vcs.exceptions import (
44 from rhodecode.lib.vcs.exceptions import (
45 CommitError, EmptyRepositoryError, NodeDoesNotExistError)
45 CommitError, EmptyRepositoryError, NodeDoesNotExistError)
46 from rhodecode.model.db import Statistics, CacheKey, User
46 from rhodecode.model.db import Statistics, CacheKey, User
47 from rhodecode.model.repo import ReadmeFinder
48
47
49
48 log = logging.getLogger(__name__)
50 log = logging.getLogger(__name__)
49
51
@@ -61,37 +63,16 b' class SummaryController(BaseRepoControll'
61 @cache_region('long_term')
63 @cache_region('long_term')
62 def _generate_readme(cache_key):
64 def _generate_readme(cache_key):
63 readme_data = None
65 readme_data = None
64 readme_file = None
66 readme_node = None
65 try:
67 readme_filename = None
66 # gets the landing revision or tip if fails
68 commit = self._get_landing_commit_or_none(db_repo)
67 commit = db_repo.get_landing_commit()
69 if commit:
68 if isinstance(commit, EmptyCommit):
70 log.debug("Searching for a README file.")
69 raise EmptyRepositoryError()
71 readme_node = ReadmeFinder(default_renderer).search(commit)
70 renderer = MarkupRenderer()
72 if readme_node:
71 for f in renderer.pick_readme_order(default_renderer):
73 readme_data = self._render_readme_or_none(commit, readme_node)
72 try:
74 readme_filename = readme_node.path
73 node = commit.get_node(f)
75 return readme_data, readme_filename
74 except NodeDoesNotExistError:
75 continue
76
77 if not node.is_file():
78 continue
79
80 readme_file = f
81 log.debug('Found README file `%s` rendering...',
82 readme_file)
83 readme_data = renderer.render(node.content,
84 filename=f)
85 break
86 except CommitError:
87 log.exception("Problem getting commit")
88 pass
89 except EmptyRepositoryError:
90 pass
91 except Exception:
92 log.exception("General failure")
93
94 return readme_data, readme_file
95
76
96 invalidator_context = CacheKey.repo_context_cache(
77 invalidator_context = CacheKey.repo_context_cache(
97 _generate_readme, repo_name, CacheKey.CACHE_TYPE_README)
78 _generate_readme, repo_name, CacheKey.CACHE_TYPE_README)
@@ -102,11 +83,36 b' class SummaryController(BaseRepoControll'
102
83
103 return computed
84 return computed
104
85
86 def _get_landing_commit_or_none(self, db_repo):
87 log.debug("Getting the landing commit.")
88 try:
89 commit = db_repo.get_landing_commit()
90 if not isinstance(commit, EmptyCommit):
91 return commit
92 else:
93 log.debug("Repository is empty, no README to render.")
94 except CommitError:
95 log.exception(
96 "Problem getting commit when trying to render the README.")
97
98 def _render_readme_or_none(self, commit, readme_node):
99 log.debug(
100 'Found README file `%s` rendering...', readme_node.path)
101 renderer = MarkupRenderer()
102 try:
103 return renderer.render(
104 readme_node.content, filename=readme_node.path)
105 except Exception:
106 log.exception(
107 "Exception while trying to render the README")
105
108
106 @LoginRequired()
109 @LoginRequired()
107 @HasRepoPermissionAnyDecorator(
110 @HasRepoPermissionAnyDecorator(
108 'repository.read', 'repository.write', 'repository.admin')
111 'repository.read', 'repository.write', 'repository.admin')
109 def index(self, repo_name):
112 def index(self, repo_name):
113
114 # Prepare the clone URL
115
110 username = ''
116 username = ''
111 if c.rhodecode_user.username != User.DEFAULT_USER:
117 if c.rhodecode_user.username != User.DEFAULT_USER:
112 username = safe_str(c.rhodecode_user.username)
118 username = safe_str(c.rhodecode_user.username)
@@ -124,6 +130,8 b' class SummaryController(BaseRepoControll'
124 c.clone_repo_url_id = c.rhodecode_db_repo.clone_url(
130 c.clone_repo_url_id = c.rhodecode_db_repo.clone_url(
125 user=username, uri_tmpl=_def_clone_uri_by_id)
131 user=username, uri_tmpl=_def_clone_uri_by_id)
126
132
133 # If enabled, get statistics data
134
127 c.show_stats = bool(c.rhodecode_db_repo.enable_statistics)
135 c.show_stats = bool(c.rhodecode_db_repo.enable_statistics)
128
136
129 stats = self.sa.query(Statistics)\
137 stats = self.sa.query(Statistics)\
@@ -47,7 +47,7 b' def _commits_as_dict(commit_ids, repos):'
47 if not commit_ids:
47 if not commit_ids:
48 return []
48 return []
49
49
50 needed_commits = set(commit_ids)
50 needed_commits = list(commit_ids)
51
51
52 commits = []
52 commits = []
53 reviewers = []
53 reviewers = []
@@ -57,6 +57,7 b' def _commits_as_dict(commit_ids, repos):'
57
57
58 vcs_repo = repo.scm_instance(cache=False)
58 vcs_repo = repo.scm_instance(cache=False)
59 try:
59 try:
60 # use copy of needed_commits since we modify it while iterating
60 for commit_id in list(needed_commits):
61 for commit_id in list(needed_commits):
61 try:
62 try:
62 cs = vcs_repo.get_changeset(commit_id)
63 cs = vcs_repo.get_changeset(commit_id)
@@ -78,7 +79,7 b' def _commits_as_dict(commit_ids, repos):'
78 repo.repo_name)
79 repo.repo_name)
79 commits.append(cs_data)
80 commits.append(cs_data)
80
81
81 needed_commits.discard(commit_id)
82 needed_commits.remove(commit_id)
82
83
83 except Exception as e:
84 except Exception as e:
84 log.exception(e)
85 log.exception(e)
@@ -1,21 +1,22 b''
1 # English translations for rhodecode.
1 # Translations template for rhodecode-enterprise-ce.
2 # Copyright (C) 2015 RhodeCode GmbH
2 # Copyright (C) 2016 RhodeCode GmbH
3 # This file is distributed under the same license as the rhodecode project.
3 # This file is distributed under the same license as the rhodecode-enterprise-ce project.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5 #
4 #
5 # Translators:
6 msgid ""
6 msgid ""
7 msgstr ""
7 msgstr ""
8 "Project-Id-Version: rhodecode 0.1\n"
8 "Project-Id-Version: RhodeCode\n"
9 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
9 "Report-Msgid-Bugs-To: marcin@rhodecode.com\n"
10 "POT-Creation-Date: 2013-06-01 18:38+0200\n"
10 "POT-Creation-Date: 2013-06-01 18:38+0200\n"
11 "PO-Revision-Date: 2011-02-25 19:13+0100\n"
11 "PO-Revision-Date: 2011-02-25 19:13+0100\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Last-Translator: Marcin Kuzminski <marcin@rhodecode.com>\n"
13 "Language-Team: en <LL@li.org>\n"
13 "Language-Team: en <admin@rhodecode.com>\n"
14 "Plural-Forms: nplurals=2; plural=(n != 1)\n"
15 "MIME-Version: 1.0\n"
14 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=utf-8\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
16 "Content-Transfer-Encoding: 8bit\n"
18 "Generated-By: Babel 0.9.6\n"
17 "Generated-By: Babel 1.3\n"
18 "Language: en\n"
19 "Plural-Forms: nplurals=2; plural=(n != 1)\n"
19
20
20 #: rhodecode/controllers/changelog.py:149
21 #: rhodecode/controllers/changelog.py:149
21 msgid "All Branches"
22 msgid "All Branches"
@@ -20,7 +20,7 b''
20
20
21 import logging
21 import logging
22
22
23 from rhodecode.model.db import Repository, Integration
23 from rhodecode.model.db import Repository, Integration, RepoGroup
24 from rhodecode.config.routing import (
24 from rhodecode.config.routing import (
25 ADMIN_PREFIX, add_route_requirements, URL_NAME_REQUIREMENTS)
25 ADMIN_PREFIX, add_route_requirements, URL_NAME_REQUIREMENTS)
26 from rhodecode.integrations import integration_type_registry
26 from rhodecode.integrations import integration_type_registry
@@ -29,6 +29,17 b' log = logging.getLogger(__name__)'
29
29
30
30
31 def includeme(config):
31 def includeme(config):
32
33 # global integrations
34
35 config.add_route('global_integrations_new',
36 ADMIN_PREFIX + '/integrations/new')
37 config.add_view('rhodecode.integrations.views.GlobalIntegrationsView',
38 attr='new_integration',
39 renderer='rhodecode:templates/admin/integrations/new.html',
40 request_method='GET',
41 route_name='global_integrations_new')
42
32 config.add_route('global_integrations_home',
43 config.add_route('global_integrations_home',
33 ADMIN_PREFIX + '/integrations')
44 ADMIN_PREFIX + '/integrations')
34 config.add_route('global_integrations_list',
45 config.add_route('global_integrations_list',
@@ -46,18 +57,80 b' def includeme(config):'
46 config.add_route('global_integrations_edit',
57 config.add_route('global_integrations_edit',
47 ADMIN_PREFIX + '/integrations/{integration}/{integration_id}',
58 ADMIN_PREFIX + '/integrations/{integration}/{integration_id}',
48 custom_predicates=(valid_integration,))
59 custom_predicates=(valid_integration,))
60
61
49 for route_name in ['global_integrations_create', 'global_integrations_edit']:
62 for route_name in ['global_integrations_create', 'global_integrations_edit']:
50 config.add_view('rhodecode.integrations.views.GlobalIntegrationsView',
63 config.add_view('rhodecode.integrations.views.GlobalIntegrationsView',
51 attr='settings_get',
64 attr='settings_get',
52 renderer='rhodecode:templates/admin/integrations/edit.html',
65 renderer='rhodecode:templates/admin/integrations/form.html',
53 request_method='GET',
66 request_method='GET',
54 route_name=route_name)
67 route_name=route_name)
55 config.add_view('rhodecode.integrations.views.GlobalIntegrationsView',
68 config.add_view('rhodecode.integrations.views.GlobalIntegrationsView',
56 attr='settings_post',
69 attr='settings_post',
57 renderer='rhodecode:templates/admin/integrations/edit.html',
70 renderer='rhodecode:templates/admin/integrations/form.html',
58 request_method='POST',
71 request_method='POST',
59 route_name=route_name)
72 route_name=route_name)
60
73
74
75 # repo group integrations
76 config.add_route('repo_group_integrations_home',
77 add_route_requirements(
78 '{repo_group_name}/settings/integrations',
79 URL_NAME_REQUIREMENTS
80 ),
81 custom_predicates=(valid_repo_group,)
82 )
83 config.add_route('repo_group_integrations_list',
84 add_route_requirements(
85 '{repo_group_name}/settings/integrations/{integration}',
86 URL_NAME_REQUIREMENTS
87 ),
88 custom_predicates=(valid_repo_group, valid_integration))
89 for route_name in ['repo_group_integrations_home', 'repo_group_integrations_list']:
90 config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView',
91 attr='index',
92 renderer='rhodecode:templates/admin/integrations/list.html',
93 request_method='GET',
94 route_name=route_name)
95
96 config.add_route('repo_group_integrations_new',
97 add_route_requirements(
98 '{repo_group_name}/settings/integrations/new',
99 URL_NAME_REQUIREMENTS
100 ),
101 custom_predicates=(valid_repo_group,))
102 config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView',
103 attr='new_integration',
104 renderer='rhodecode:templates/admin/integrations/new.html',
105 request_method='GET',
106 route_name='repo_group_integrations_new')
107
108 config.add_route('repo_group_integrations_create',
109 add_route_requirements(
110 '{repo_group_name}/settings/integrations/{integration}/new',
111 URL_NAME_REQUIREMENTS
112 ),
113 custom_predicates=(valid_repo_group, valid_integration))
114 config.add_route('repo_group_integrations_edit',
115 add_route_requirements(
116 '{repo_group_name}/settings/integrations/{integration}/{integration_id}',
117 URL_NAME_REQUIREMENTS
118 ),
119 custom_predicates=(valid_repo_group, valid_integration))
120 for route_name in ['repo_group_integrations_edit', 'repo_group_integrations_create']:
121 config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView',
122 attr='settings_get',
123 renderer='rhodecode:templates/admin/integrations/form.html',
124 request_method='GET',
125 route_name=route_name)
126 config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView',
127 attr='settings_post',
128 renderer='rhodecode:templates/admin/integrations/form.html',
129 request_method='POST',
130 route_name=route_name)
131
132
133 # repo integrations
61 config.add_route('repo_integrations_home',
134 config.add_route('repo_integrations_home',
62 add_route_requirements(
135 add_route_requirements(
63 '{repo_name}/settings/integrations',
136 '{repo_name}/settings/integrations',
@@ -74,8 +147,21 b' def includeme(config):'
74 config.add_view('rhodecode.integrations.views.RepoIntegrationsView',
147 config.add_view('rhodecode.integrations.views.RepoIntegrationsView',
75 attr='index',
148 attr='index',
76 request_method='GET',
149 request_method='GET',
150 renderer='rhodecode:templates/admin/integrations/list.html',
77 route_name=route_name)
151 route_name=route_name)
78
152
153 config.add_route('repo_integrations_new',
154 add_route_requirements(
155 '{repo_name}/settings/integrations/new',
156 URL_NAME_REQUIREMENTS
157 ),
158 custom_predicates=(valid_repo,))
159 config.add_view('rhodecode.integrations.views.RepoIntegrationsView',
160 attr='new_integration',
161 renderer='rhodecode:templates/admin/integrations/new.html',
162 request_method='GET',
163 route_name='repo_integrations_new')
164
79 config.add_route('repo_integrations_create',
165 config.add_route('repo_integrations_create',
80 add_route_requirements(
166 add_route_requirements(
81 '{repo_name}/settings/integrations/{integration}/new',
167 '{repo_name}/settings/integrations/{integration}/new',
@@ -91,12 +177,12 b' def includeme(config):'
91 for route_name in ['repo_integrations_edit', 'repo_integrations_create']:
177 for route_name in ['repo_integrations_edit', 'repo_integrations_create']:
92 config.add_view('rhodecode.integrations.views.RepoIntegrationsView',
178 config.add_view('rhodecode.integrations.views.RepoIntegrationsView',
93 attr='settings_get',
179 attr='settings_get',
94 renderer='rhodecode:templates/admin/integrations/edit.html',
180 renderer='rhodecode:templates/admin/integrations/form.html',
95 request_method='GET',
181 request_method='GET',
96 route_name=route_name)
182 route_name=route_name)
97 config.add_view('rhodecode.integrations.views.RepoIntegrationsView',
183 config.add_view('rhodecode.integrations.views.RepoIntegrationsView',
98 attr='settings_post',
184 attr='settings_post',
99 renderer='rhodecode:templates/admin/integrations/edit.html',
185 renderer='rhodecode:templates/admin/integrations/form.html',
100 request_method='POST',
186 request_method='POST',
101 route_name=route_name)
187 route_name=route_name)
102
188
@@ -107,20 +193,37 b' def valid_repo(info, request):'
107 return True
193 return True
108
194
109
195
196 def valid_repo_group(info, request):
197 repo_group = RepoGroup.get_by_group_name(info['match']['repo_group_name'])
198 if repo_group:
199 return True
200 return False
201
202
110 def valid_integration(info, request):
203 def valid_integration(info, request):
111 integration_type = info['match']['integration']
204 integration_type = info['match']['integration']
112 integration_id = info['match'].get('integration_id')
205 integration_id = info['match'].get('integration_id')
113 repo_name = info['match'].get('repo_name')
206 repo_name = info['match'].get('repo_name')
207 repo_group_name = info['match'].get('repo_group_name')
114
208
115 if integration_type not in integration_type_registry:
209 if integration_type not in integration_type_registry:
116 return False
210 return False
117
211
118 repo = None
212 repo, repo_group = None, None
119 if repo_name:
213 if repo_name:
120 repo = Repository.get_by_repo_name(info['match']['repo_name'])
214 repo = Repository.get_by_repo_name(repo_name)
121 if not repo:
215 if not repo:
122 return False
216 return False
123
217
218 if repo_group_name:
219 repo_group = RepoGroup.get_by_group_name(repo_group_name)
220 if not repo_group:
221 return False
222
223 if repo_name and repo_group:
224 raise Exception('Either repo or repo_group can be set, not both')
225
226
124 if integration_id:
227 if integration_id:
125 integration = Integration.get(integration_id)
228 integration = Integration.get(integration_id)
126 if not integration:
229 if not integration:
@@ -129,5 +232,7 b' def valid_integration(info, request):'
129 return False
232 return False
130 if repo and repo.repo_id != integration.repo_id:
233 if repo and repo.repo_id != integration.repo_id:
131 return False
234 return False
235 if repo_group and repo_group.group_id != integration.repo_group_id:
236 return False
132
237
133 return True
238 return True
@@ -20,26 +20,52 b''
20
20
21 import colander
21 import colander
22
22
23 from rhodecode.translation import lazy_ugettext
23 from rhodecode.translation import _
24
24
25
25
26 class IntegrationSettingsSchemaBase(colander.MappingSchema):
26 class IntegrationOptionsSchemaBase(colander.MappingSchema):
27 """
28 This base schema is intended for use in integrations.
29 It adds a few default settings (e.g., "enabled"), so that integration
30 authors don't have to maintain a bunch of boilerplate.
31 """
32 enabled = colander.SchemaNode(
27 enabled = colander.SchemaNode(
33 colander.Bool(),
28 colander.Bool(),
34 default=True,
29 default=True,
35 description=lazy_ugettext('Enable or disable this integration.'),
30 description=_('Enable or disable this integration.'),
36 missing=False,
31 missing=False,
37 title=lazy_ugettext('Enabled'),
32 title=_('Enabled'),
38 )
33 )
39
34
40 name = colander.SchemaNode(
35 name = colander.SchemaNode(
41 colander.String(),
36 colander.String(),
42 description=lazy_ugettext('Short name for this integration.'),
37 description=_('Short name for this integration.'),
43 missing=colander.required,
38 missing=colander.required,
44 title=lazy_ugettext('Integration name'),
39 title=_('Integration name'),
45 )
40 )
41
42
43 class RepoIntegrationOptionsSchema(IntegrationOptionsSchemaBase):
44 pass
45
46
47 class RepoGroupIntegrationOptionsSchema(IntegrationOptionsSchemaBase):
48 child_repos_only = colander.SchemaNode(
49 colander.Bool(),
50 default=True,
51 description=_(
52 'Limit integrations to to work only on the direct children '
53 'repositories of this repository group (no subgroups)'),
54 missing=False,
55 title=_('Limit to childen repos only'),
56 )
57
58
59 class GlobalIntegrationOptionsSchema(IntegrationOptionsSchemaBase):
60 child_repos_only = colander.SchemaNode(
61 colander.Bool(),
62 default=False,
63 description=_(
64 'Limit integrations to to work only on root level repositories'),
65 missing=False,
66 title=_('Root repositories only'),
67 )
68
69
70 class IntegrationSettingsSchemaBase(colander.MappingSchema):
71 pass
@@ -18,25 +18,84 b''
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 from rhodecode.integrations.schema import IntegrationSettingsSchemaBase
21 import colander
22 from rhodecode.translation import _
22
23
23
24
24 class IntegrationTypeBase(object):
25 class IntegrationTypeBase(object):
25 """ Base class for IntegrationType plugins """
26 """ Base class for IntegrationType plugins """
26
27
28 description = ''
29 icon = '''
30 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
31 <svg
32 xmlns:dc="http://purl.org/dc/elements/1.1/"
33 xmlns:cc="http://creativecommons.org/ns#"
34 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
35 xmlns:svg="http://www.w3.org/2000/svg"
36 xmlns="http://www.w3.org/2000/svg"
37 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
38 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
39 viewBox="0 -256 1792 1792"
40 id="svg3025"
41 version="1.1"
42 inkscape:version="0.48.3.1 r9886"
43 width="100%"
44 height="100%"
45 sodipodi:docname="cog_font_awesome.svg">
46 <metadata
47 id="metadata3035">
48 <rdf:RDF>
49 <cc:Work
50 rdf:about="">
51 <dc:format>image/svg+xml</dc:format>
52 <dc:type
53 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
54 </cc:Work>
55 </rdf:RDF>
56 </metadata>
57 <defs
58 id="defs3033" />
59 <sodipodi:namedview
60 pagecolor="#ffffff"
61 bordercolor="#666666"
62 borderopacity="1"
63 objecttolerance="10"
64 gridtolerance="10"
65 guidetolerance="10"
66 inkscape:pageopacity="0"
67 inkscape:pageshadow="2"
68 inkscape:window-width="640"
69 inkscape:window-height="480"
70 id="namedview3031"
71 showgrid="false"
72 inkscape:zoom="0.13169643"
73 inkscape:cx="896"
74 inkscape:cy="896"
75 inkscape:window-x="0"
76 inkscape:window-y="25"
77 inkscape:window-maximized="0"
78 inkscape:current-layer="svg3025" />
79 <g
80 transform="matrix(1,0,0,-1,121.49153,1285.4237)"
81 id="g3027">
82 <path
83 d="m 1024,640 q 0,106 -75,181 -75,75 -181,75 -106,0 -181,-75 -75,-75 -75,-181 0,-106 75,-181 75,-75 181,-75 106,0 181,75 75,75 75,181 z m 512,109 V 527 q 0,-12 -8,-23 -8,-11 -20,-13 l -185,-28 q -19,-54 -39,-91 35,-50 107,-138 10,-12 10,-25 0,-13 -9,-23 -27,-37 -99,-108 -72,-71 -94,-71 -12,0 -26,9 l -138,108 q -44,-23 -91,-38 -16,-136 -29,-186 -7,-28 -36,-28 H 657 q -14,0 -24.5,8.5 Q 622,-111 621,-98 L 593,86 q -49,16 -90,37 L 362,16 Q 352,7 337,7 323,7 312,18 186,132 147,186 q -7,10 -7,23 0,12 8,23 15,21 51,66.5 36,45.5 54,70.5 -27,50 -41,99 L 29,495 Q 16,497 8,507.5 0,518 0,531 v 222 q 0,12 8,23 8,11 19,13 l 186,28 q 14,46 39,92 -40,57 -107,138 -10,12 -10,24 0,10 9,23 26,36 98.5,107.5 72.5,71.5 94.5,71.5 13,0 26,-10 l 138,-107 q 44,23 91,38 16,136 29,186 7,28 36,28 h 222 q 14,0 24.5,-8.5 Q 914,1391 915,1378 l 28,-184 q 49,-16 90,-37 l 142,107 q 9,9 24,9 13,0 25,-10 129,-119 165,-170 7,-8 7,-22 0,-12 -8,-23 -15,-21 -51,-66.5 -36,-45.5 -54,-70.5 26,-50 41,-98 l 183,-28 q 13,-2 21,-12.5 8,-10.5 8,-23.5 z"
84 id="path3029"
85 inkscape:connector-curvature="0"
86 style="fill:currentColor" />
87 </g>
88 </svg>
89 '''
90
27 def __init__(self, settings):
91 def __init__(self, settings):
28 """
92 """
29 :param settings: dict of settings to be used for the integration
93 :param settings: dict of settings to be used for the integration
30 """
94 """
31 self.settings = settings
95 self.settings = settings
32
96
33
34 def settings_schema(self):
97 def settings_schema(self):
35 """
98 """
36 A colander schema of settings for the integration type
99 A colander schema of settings for the integration type
37
38 Subclasses can return their own schema but should always
39 inherit from IntegrationSettingsSchemaBase
40 """
100 """
41 return IntegrationSettingsSchemaBase()
101 return colander.Schema()
42
@@ -26,11 +26,10 b' import colander'
26 from mako.template import Template
26 from mako.template import Template
27
27
28 from rhodecode import events
28 from rhodecode import events
29 from rhodecode.translation import _, lazy_ugettext
29 from rhodecode.translation import _
30 from rhodecode.lib.celerylib import run_task
30 from rhodecode.lib.celerylib import run_task
31 from rhodecode.lib.celerylib import tasks
31 from rhodecode.lib.celerylib import tasks
32 from rhodecode.integrations.types.base import IntegrationTypeBase
32 from rhodecode.integrations.types.base import IntegrationTypeBase
33 from rhodecode.integrations.schema import IntegrationSettingsSchemaBase
34
33
35
34
36 log = logging.getLogger(__name__)
35 log = logging.getLogger(__name__)
@@ -147,18 +146,79 b" repo_push_template_html = Template('''"
147 </html>
146 </html>
148 ''')
147 ''')
149
148
149 email_icon = '''
150 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
151 <svg
152 xmlns:dc="http://purl.org/dc/elements/1.1/"
153 xmlns:cc="http://creativecommons.org/ns#"
154 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
155 xmlns:svg="http://www.w3.org/2000/svg"
156 xmlns="http://www.w3.org/2000/svg"
157 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
158 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
159 viewBox="0 -256 1850 1850"
160 id="svg2989"
161 version="1.1"
162 inkscape:version="0.48.3.1 r9886"
163 width="100%"
164 height="100%"
165 sodipodi:docname="envelope_font_awesome.svg">
166 <metadata
167 id="metadata2999">
168 <rdf:RDF>
169 <cc:Work
170 rdf:about="">
171 <dc:format>image/svg+xml</dc:format>
172 <dc:type
173 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
174 </cc:Work>
175 </rdf:RDF>
176 </metadata>
177 <defs
178 id="defs2997" />
179 <sodipodi:namedview
180 pagecolor="#ffffff"
181 bordercolor="#666666"
182 borderopacity="1"
183 objecttolerance="10"
184 gridtolerance="10"
185 guidetolerance="10"
186 inkscape:pageopacity="0"
187 inkscape:pageshadow="2"
188 inkscape:window-width="640"
189 inkscape:window-height="480"
190 id="namedview2995"
191 showgrid="false"
192 inkscape:zoom="0.13169643"
193 inkscape:cx="896"
194 inkscape:cy="896"
195 inkscape:window-x="0"
196 inkscape:window-y="25"
197 inkscape:window-maximized="0"
198 inkscape:current-layer="svg2989" />
199 <g
200 transform="matrix(1,0,0,-1,37.966102,1282.678)"
201 id="g2991">
202 <path
203 d="m 1664,32 v 768 q -32,-36 -69,-66 -268,-206 -426,-338 -51,-43 -83,-67 -32,-24 -86.5,-48.5 Q 945,256 897,256 h -1 -1 Q 847,256 792.5,280.5 738,305 706,329 674,353 623,396 465,528 197,734 160,764 128,800 V 32 Q 128,19 137.5,9.5 147,0 160,0 h 1472 q 13,0 22.5,9.5 9.5,9.5 9.5,22.5 z m 0,1051 v 11 13.5 q 0,0 -0.5,13 -0.5,13 -3,12.5 -2.5,-0.5 -5.5,9 -3,9.5 -9,7.5 -6,-2 -14,2.5 H 160 q -13,0 -22.5,-9.5 Q 128,1133 128,1120 128,952 275,836 468,684 676,519 682,514 711,489.5 740,465 757,452 774,439 801.5,420.5 829,402 852,393 q 23,-9 43,-9 h 1 1 q 20,0 43,9 23,9 50.5,27.5 27.5,18.5 44.5,31.5 17,13 46,37.5 29,24.5 35,29.5 208,165 401,317 54,43 100.5,115.5 46.5,72.5 46.5,131.5 z m 128,37 V 32 q 0,-66 -47,-113 -47,-47 -113,-47 H 160 Q 94,-128 47,-81 0,-34 0,32 v 1088 q 0,66 47,113 47,47 113,47 h 1472 q 66,0 113,-47 47,-47 47,-113 z"
204 id="path2993"
205 inkscape:connector-curvature="0"
206 style="fill:currentColor" />
207 </g>
208 </svg>
209 '''
150
210
151 class EmailSettingsSchema(IntegrationSettingsSchemaBase):
211 class EmailSettingsSchema(colander.Schema):
152 @colander.instantiate(validator=colander.Length(min=1))
212 @colander.instantiate(validator=colander.Length(min=1))
153 class recipients(colander.SequenceSchema):
213 class recipients(colander.SequenceSchema):
154 title = lazy_ugettext('Recipients')
214 title = _('Recipients')
155 description = lazy_ugettext('Email addresses to send push events to')
215 description = _('Email addresses to send push events to')
156 widget = deform.widget.SequenceWidget(min_len=1)
216 widget = deform.widget.SequenceWidget(min_len=1)
157
217
158 recipient = colander.SchemaNode(
218 recipient = colander.SchemaNode(
159 colander.String(),
219 colander.String(),
160 title=lazy_ugettext('Email address'),
220 title=_('Email address'),
161 description=lazy_ugettext('Email address'),
221 description=_('Email address'),
162 default='',
222 default='',
163 validator=colander.Email(),
223 validator=colander.Email(),
164 widget=deform.widget.TextInputWidget(
224 widget=deform.widget.TextInputWidget(
@@ -169,8 +229,9 b' class EmailSettingsSchema(IntegrationSet'
169
229
170 class EmailIntegrationType(IntegrationTypeBase):
230 class EmailIntegrationType(IntegrationTypeBase):
171 key = 'email'
231 key = 'email'
172 display_name = lazy_ugettext('Email')
232 display_name = _('Email')
173 SettingsSchema = EmailSettingsSchema
233 description = _('Send repo push summaries to a list of recipients via email')
234 icon = email_icon
174
235
175 def settings_schema(self):
236 def settings_schema(self):
176 schema = EmailSettingsSchema()
237 schema = EmailSettingsSchema()
@@ -29,29 +29,28 b' from celery.task import task'
29 from mako.template import Template
29 from mako.template import Template
30
30
31 from rhodecode import events
31 from rhodecode import events
32 from rhodecode.translation import lazy_ugettext
32 from rhodecode.translation import _
33 from rhodecode.lib import helpers as h
33 from rhodecode.lib import helpers as h
34 from rhodecode.lib.celerylib import run_task
34 from rhodecode.lib.celerylib import run_task
35 from rhodecode.lib.colander_utils import strip_whitespace
35 from rhodecode.lib.colander_utils import strip_whitespace
36 from rhodecode.integrations.types.base import IntegrationTypeBase
36 from rhodecode.integrations.types.base import IntegrationTypeBase
37 from rhodecode.integrations.schema import IntegrationSettingsSchemaBase
38
37
39 log = logging.getLogger(__name__)
38 log = logging.getLogger(__name__)
40
39
41
40
42 class HipchatSettingsSchema(IntegrationSettingsSchemaBase):
41 class HipchatSettingsSchema(colander.Schema):
43 color_choices = [
42 color_choices = [
44 ('yellow', lazy_ugettext('Yellow')),
43 ('yellow', _('Yellow')),
45 ('red', lazy_ugettext('Red')),
44 ('red', _('Red')),
46 ('green', lazy_ugettext('Green')),
45 ('green', _('Green')),
47 ('purple', lazy_ugettext('Purple')),
46 ('purple', _('Purple')),
48 ('gray', lazy_ugettext('Gray')),
47 ('gray', _('Gray')),
49 ]
48 ]
50
49
51 server_url = colander.SchemaNode(
50 server_url = colander.SchemaNode(
52 colander.String(),
51 colander.String(),
53 title=lazy_ugettext('Hipchat server URL'),
52 title=_('Hipchat server URL'),
54 description=lazy_ugettext('Hipchat integration url.'),
53 description=_('Hipchat integration url.'),
55 default='',
54 default='',
56 preparer=strip_whitespace,
55 preparer=strip_whitespace,
57 validator=colander.url,
56 validator=colander.url,
@@ -61,15 +60,15 b' class HipchatSettingsSchema(IntegrationS'
61 )
60 )
62 notify = colander.SchemaNode(
61 notify = colander.SchemaNode(
63 colander.Bool(),
62 colander.Bool(),
64 title=lazy_ugettext('Notify'),
63 title=_('Notify'),
65 description=lazy_ugettext('Make a notification to the users in room.'),
64 description=_('Make a notification to the users in room.'),
66 missing=False,
65 missing=False,
67 default=False,
66 default=False,
68 )
67 )
69 color = colander.SchemaNode(
68 color = colander.SchemaNode(
70 colander.String(),
69 colander.String(),
71 title=lazy_ugettext('Color'),
70 title=_('Color'),
72 description=lazy_ugettext('Background color of message.'),
71 description=_('Background color of message.'),
73 missing='',
72 missing='',
74 validator=colander.OneOf([x[0] for x in color_choices]),
73 validator=colander.OneOf([x[0] for x in color_choices]),
75 widget=deform.widget.Select2Widget(
74 widget=deform.widget.Select2Widget(
@@ -79,29 +78,28 b' class HipchatSettingsSchema(IntegrationS'
79
78
80
79
81 repo_push_template = Template('''
80 repo_push_template = Template('''
82 <b>${data['actor']['username']}</b> pushed to
81 <b>${data['actor']['username']}</b> pushed to repo <a href="${data['repo']['url']}">${data['repo']['repo_name']}</a>:
83 %if data['push']['branches']:
84 ${len(data['push']['branches']) > 1 and 'branches' or 'branch'}
85 ${', '.join('<a href="%s">%s</a>' % (branch['url'], branch['name']) for branch in data['push']['branches'])}
86 %else:
87 unknown branch
88 %endif
89 in <a href="${data['repo']['url']}">${data['repo']['repo_name']}</a>
90 <br>
82 <br>
91 <ul>
83 <ul>
92 %for commit in data['push']['commits']:
84 %for branch, branch_commits in branches_commits.items():
93 <li>
85 <li>
94 <a href="${commit['url']}">${commit['short_id']}</a> - ${commit['message_html']}
86 <a href="${branch_commits['branch']['url']}">branch: ${branch_commits['branch']['name']}</a>
87 <ul>
88 %for commit in branch_commits['commits']:
89 <li><a href="${commit['url']}">${commit['short_id']}</a> - ${commit['message_html']}</li>
90 %endfor
91 </ul>
95 </li>
92 </li>
96 %endfor
93 %endfor
97 </ul>
98 ''')
94 ''')
99
95
100
96
101
102 class HipchatIntegrationType(IntegrationTypeBase):
97 class HipchatIntegrationType(IntegrationTypeBase):
103 key = 'hipchat'
98 key = 'hipchat'
104 display_name = lazy_ugettext('Hipchat')
99 display_name = _('Hipchat')
100 description = _('Send events such as repo pushes and pull requests to '
101 'your hipchat channel.')
102 icon = '''<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve"><g><g transform="translate(0.000000,511.000000) scale(0.100000,-0.100000)"><path fill="#205281" d="M4197.1,4662.4c-1661.5-260.4-3018-1171.6-3682.6-2473.3C219.9,1613.6,100,1120.3,100,462.6c0-1014,376.8-1918.4,1127-2699.4C2326.7-3377.6,3878.5-3898.3,5701-3730.5l486.5,44.5l208.9-123.3c637.2-373.4,1551.8-640.6,2240.4-650.9c304.9-6.9,335.7,0,417.9,75.4c185,174.7,147.3,411.1-89.1,548.1c-315.2,181.6-620,544.7-733.1,870.1l-51.4,157.6l472.7,472.7c349.4,349.4,520.7,551.5,657.7,774.2c784.5,1281.2,784.5,2788.5,0,4052.6c-236.4,376.8-794.8,966-1178.4,1236.7c-572.1,407.7-1264.1,709.1-1993.7,870.1c-267.2,58.2-479.6,75.4-1038,82.2C4714.4,4686.4,4310.2,4679.6,4197.1,4662.4z M5947.6,3740.9c1856.7-380.3,3127.6-1709.4,3127.6-3275c0-1000.3-534.4-1949.2-1466.2-2600.1c-188.4-133.6-287.8-226.1-301.5-284.4c-41.1-157.6,263.8-938.6,397.4-1020.8c20.5-10.3,34.3-44.5,34.3-75.4c0-167.8-811.9,195.3-1363.4,609.8l-181.6,137l-332.3-58.2c-445.3-78.8-1281.2-78.8-1702.6,0C2796-2569.2,1734.1-1832.6,1220.2-801.5C983.8-318.5,905,51.5,929,613.3c27.4,640.6,243.2,1192.1,685.1,1740.3c620,770.8,1661.5,1305.2,2822.8,1452.5C4806.9,3854,5553.7,3819.7,5947.6,3740.9z"/><path fill="#205281" d="M2381.5-345.9c-75.4-106.2-68.5-167.8,34.3-322c332.3-500.2,1010.6-928.4,1760.8-1120.2c417.9-106.2,1226.4-106.2,1644.3,0c712.5,181.6,1270.9,517.3,1685.4,1014C7681-561.7,7715.3-424.7,7616-325.4c-89.1,89.1-167.9,65.1-431.7-133.6c-835.8-630.3-2028-856.4-3086.5-585.8C3683.3-938.6,3142-685,2830.3-448.7C2576.8-253.4,2463.7-229.4,2381.5-345.9z"/></g></g><!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon --></svg>'''
105 valid_events = [
103 valid_events = [
106 events.PullRequestCloseEvent,
104 events.PullRequestCloseEvent,
107 events.PullRequestMergeEvent,
105 events.PullRequestMergeEvent,
@@ -217,8 +215,23 b' class HipchatIntegrationType(Integration'
217 )
215 )
218
216
219 def format_repo_push_event(self, data):
217 def format_repo_push_event(self, data):
218 branch_data = {branch['name']: branch
219 for branch in data['push']['branches']}
220
221 branches_commits = {}
222 for commit in data['push']['commits']:
223 log.critical(commit)
224 if commit['branch'] not in branches_commits:
225 branch_commits = {'branch': branch_data[commit['branch']],
226 'commits': []}
227 branches_commits[commit['branch']] = branch_commits
228
229 branch_commits = branches_commits[commit['branch']]
230 branch_commits['commits'].append(commit)
231
220 result = repo_push_template.render(
232 result = repo_push_template.render(
221 data=data,
233 data=data,
234 branches_commits=branches_commits,
222 )
235 )
223 return result
236 return result
224
237
@@ -29,21 +29,20 b' from celery.task import task'
29 from mako.template import Template
29 from mako.template import Template
30
30
31 from rhodecode import events
31 from rhodecode import events
32 from rhodecode.translation import lazy_ugettext
32 from rhodecode.translation import _
33 from rhodecode.lib import helpers as h
33 from rhodecode.lib import helpers as h
34 from rhodecode.lib.celerylib import run_task
34 from rhodecode.lib.celerylib import run_task
35 from rhodecode.lib.colander_utils import strip_whitespace
35 from rhodecode.lib.colander_utils import strip_whitespace
36 from rhodecode.integrations.types.base import IntegrationTypeBase
36 from rhodecode.integrations.types.base import IntegrationTypeBase
37 from rhodecode.integrations.schema import IntegrationSettingsSchemaBase
38
37
39 log = logging.getLogger(__name__)
38 log = logging.getLogger(__name__)
40
39
41
40
42 class SlackSettingsSchema(IntegrationSettingsSchemaBase):
41 class SlackSettingsSchema(colander.Schema):
43 service = colander.SchemaNode(
42 service = colander.SchemaNode(
44 colander.String(),
43 colander.String(),
45 title=lazy_ugettext('Slack service URL'),
44 title=_('Slack service URL'),
46 description=h.literal(lazy_ugettext(
45 description=h.literal(_(
47 'This can be setup at the '
46 'This can be setup at the '
48 '<a href="https://my.slack.com/services/new/incoming-webhook/">'
47 '<a href="https://my.slack.com/services/new/incoming-webhook/">'
49 'slack app manager</a>')),
48 'slack app manager</a>')),
@@ -56,8 +55,8 b' class SlackSettingsSchema(IntegrationSet'
56 )
55 )
57 username = colander.SchemaNode(
56 username = colander.SchemaNode(
58 colander.String(),
57 colander.String(),
59 title=lazy_ugettext('Username'),
58 title=_('Username'),
60 description=lazy_ugettext('Username to show notifications coming from.'),
59 description=_('Username to show notifications coming from.'),
61 missing='Rhodecode',
60 missing='Rhodecode',
62 preparer=strip_whitespace,
61 preparer=strip_whitespace,
63 widget=deform.widget.TextInputWidget(
62 widget=deform.widget.TextInputWidget(
@@ -66,8 +65,8 b' class SlackSettingsSchema(IntegrationSet'
66 )
65 )
67 channel = colander.SchemaNode(
66 channel = colander.SchemaNode(
68 colander.String(),
67 colander.String(),
69 title=lazy_ugettext('Channel'),
68 title=_('Channel'),
70 description=lazy_ugettext('Channel to send notifications to.'),
69 description=_('Channel to send notifications to.'),
71 missing='',
70 missing='',
72 preparer=strip_whitespace,
71 preparer=strip_whitespace,
73 widget=deform.widget.TextInputWidget(
72 widget=deform.widget.TextInputWidget(
@@ -76,8 +75,8 b' class SlackSettingsSchema(IntegrationSet'
76 )
75 )
77 icon_emoji = colander.SchemaNode(
76 icon_emoji = colander.SchemaNode(
78 colander.String(),
77 colander.String(),
79 title=lazy_ugettext('Emoji'),
78 title=_('Emoji'),
80 description=lazy_ugettext('Emoji to use eg. :studio_microphone:'),
79 description=_('Emoji to use eg. :studio_microphone:'),
81 missing='',
80 missing='',
82 preparer=strip_whitespace,
81 preparer=strip_whitespace,
83 widget=deform.widget.TextInputWidget(
82 widget=deform.widget.TextInputWidget(
@@ -87,25 +86,22 b' class SlackSettingsSchema(IntegrationSet'
87
86
88
87
89 repo_push_template = Template(r'''
88 repo_push_template = Template(r'''
90 *${data['actor']['username']}* pushed to \
89 *${data['actor']['username']}* pushed to repo <${data['repo']['url']}|${data['repo']['repo_name']}>:
91 %if data['push']['branches']:
90 %for branch, branch_commits in branches_commits.items():
92 ${len(data['push']['branches']) > 1 and 'branches' or 'branch'} \
91 branch: <${branch_commits['branch']['url']}|${branch_commits['branch']['name']}>
93 ${', '.join('<%s|%s>' % (branch['url'], branch['name']) for branch in data['push']['branches'])} \
92 %for commit in branch_commits['commits']:
94 %else:
93 > <${commit['url']}|${commit['short_id']}> - ${commit['message_html']|html_to_slack_links}
95 unknown branch \
94 %endfor
96 %endif
97 in <${data['repo']['url']}|${data['repo']['repo_name']}>
98 >>>
99 %for commit in data['push']['commits']:
100 <${commit['url']}|${commit['short_id']}> - ${commit['message_html']|html_to_slack_links}
101 %endfor
95 %endfor
102 ''')
96 ''')
103
97
104
98
105 class SlackIntegrationType(IntegrationTypeBase):
99 class SlackIntegrationType(IntegrationTypeBase):
106 key = 'slack'
100 key = 'slack'
107 display_name = lazy_ugettext('Slack')
101 display_name = _('Slack')
108 SettingsSchema = SlackSettingsSchema
102 description = _('Send events such as repo pushes and pull requests to '
103 'your slack channel.')
104 icon = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"><g><path d="M165.963541,15.8384262 C162.07318,3.86308197 149.212328,-2.69009836 137.239082,1.20236066 C125.263738,5.09272131 118.710557,17.9535738 122.603016,29.9268197 L181.550164,211.292328 C185.597902,222.478689 197.682361,228.765377 209.282098,225.426885 C221.381246,221.943607 228.756984,209.093246 224.896,197.21023 C224.749115,196.756984 165.963541,15.8384262 165.963541,15.8384262" fill="#DFA22F"></path><path d="M74.6260984,45.515541 C70.7336393,33.5422951 57.8727869,26.9891148 45.899541,30.8794754 C33.9241967,34.7698361 27.3710164,47.6306885 31.2634754,59.6060328 L90.210623,240.971541 C94.2583607,252.157902 106.34282,258.44459 117.942557,255.104 C130.041705,251.62282 137.417443,238.772459 133.556459,226.887344 C133.409574,226.436197 74.6260984,45.515541 74.6260984,45.515541" fill="#3CB187"></path><path d="M240.161574,166.045377 C252.136918,162.155016 258.688,149.294164 254.797639,137.31882 C250.907279,125.345574 238.046426,118.792393 226.07318,122.682754 L44.7076721,181.632 C33.5213115,185.677639 27.234623,197.762098 30.5731148,209.361836 C34.0563934,221.460984 46.9067541,228.836721 58.7897705,224.975738 C59.2430164,224.828852 240.161574,166.045377 240.161574,166.045377" fill="#CE1E5B"></path><path d="M82.507541,217.270557 C94.312918,213.434754 109.528131,208.491016 125.855475,203.186361 C122.019672,191.380984 117.075934,176.163672 111.76918,159.83423 L68.4191475,173.924721 L82.507541,217.270557" fill="#392538"></path><path d="M173.847082,187.591344 C190.235279,182.267803 205.467279,177.31777 217.195016,173.507148 C213.359213,161.70177 208.413377,146.480262 203.106623,130.146623 L159.75659,144.237115 L173.847082,187.591344" fill="#BB242A"></path><path d="M210.484459,74.7058361 C222.457705,70.8154754 229.010885,57.954623 225.120525,45.9792787 C221.230164,34.0060328 208.369311,27.4528525 196.393967,31.3432131 L15.028459,90.292459 C3.84209836,94.3380984 -2.44459016,106.422557 0.896,118.022295 C4.37718033,130.121443 17.227541,137.49718 29.1126557,133.636197 C29.5638033,133.489311 210.484459,74.7058361 210.484459,74.7058361" fill="#72C5CD"></path><path d="M52.8220328,125.933115 C64.6274098,122.097311 79.8468197,117.151475 96.1762623,111.84682 C90.8527213,95.4565246 85.9026885,80.2245246 82.0920656,68.4946885 L38.731541,82.5872787 L52.8220328,125.933115" fill="#248C73"></path><path d="M144.159475,96.256 C160.551869,90.9303607 175.785967,85.9803279 187.515803,82.1676066 C182.190164,65.7752131 177.240131,50.5390164 173.42741,38.807082 L130.068984,52.8996721 L144.159475,96.256" fill="#62803A"></path></g></svg>'''
109 valid_events = [
105 valid_events = [
110 events.PullRequestCloseEvent,
106 events.PullRequestCloseEvent,
111 events.PullRequestMergeEvent,
107 events.PullRequestMergeEvent,
@@ -221,8 +217,23 b' class SlackIntegrationType(IntegrationTy'
221 )
217 )
222
218
223 def format_repo_push_event(self, data):
219 def format_repo_push_event(self, data):
220 branch_data = {branch['name']: branch
221 for branch in data['push']['branches']}
222
223 branches_commits = {}
224 for commit in data['push']['commits']:
225 log.critical(commit)
226 if commit['branch'] not in branches_commits:
227 branch_commits = {'branch': branch_data[commit['branch']],
228 'commits': []}
229 branches_commits[commit['branch']] = branch_commits
230
231 branch_commits = branches_commits[commit['branch']]
232 branch_commits['commits'].append(commit)
233
224 result = repo_push_template.render(
234 result = repo_push_template.render(
225 data=data,
235 data=data,
236 branches_commits=branches_commits,
226 html_to_slack_links=html_to_slack_links,
237 html_to_slack_links=html_to_slack_links,
227 )
238 )
228 return result
239 return result
@@ -28,19 +28,19 b' from celery.task import task'
28 from mako.template import Template
28 from mako.template import Template
29
29
30 from rhodecode import events
30 from rhodecode import events
31 from rhodecode.translation import lazy_ugettext
31 from rhodecode.translation import _
32 from rhodecode.integrations.types.base import IntegrationTypeBase
32 from rhodecode.integrations.types.base import IntegrationTypeBase
33 from rhodecode.integrations.schema import IntegrationSettingsSchemaBase
34
33
35 log = logging.getLogger(__name__)
34 log = logging.getLogger(__name__)
36
35
37
36
38 class WebhookSettingsSchema(IntegrationSettingsSchemaBase):
37 class WebhookSettingsSchema(colander.Schema):
39 url = colander.SchemaNode(
38 url = colander.SchemaNode(
40 colander.String(),
39 colander.String(),
41 title=lazy_ugettext('Webhook URL'),
40 title=_('Webhook URL'),
42 description=lazy_ugettext('URL of the webhook to receive POST event.'),
41 description=_('URL of the webhook to receive POST event.'),
43 default='',
42 missing=colander.required,
43 required=True,
44 validator=colander.url,
44 validator=colander.url,
45 widget=deform.widget.TextInputWidget(
45 widget=deform.widget.TextInputWidget(
46 placeholder='https://www.example.com/webhook'
46 placeholder='https://www.example.com/webhook'
@@ -48,18 +48,24 b' class WebhookSettingsSchema(IntegrationS'
48 )
48 )
49 secret_token = colander.SchemaNode(
49 secret_token = colander.SchemaNode(
50 colander.String(),
50 colander.String(),
51 title=lazy_ugettext('Secret Token'),
51 title=_('Secret Token'),
52 description=lazy_ugettext('String used to validate received payloads.'),
52 description=_('String used to validate received payloads.'),
53 default='',
53 default='',
54 missing='',
54 widget=deform.widget.TextInputWidget(
55 widget=deform.widget.TextInputWidget(
55 placeholder='secret_token'
56 placeholder='secret_token'
56 ),
57 ),
57 )
58 )
58
59
59
60
61
62
60 class WebhookIntegrationType(IntegrationTypeBase):
63 class WebhookIntegrationType(IntegrationTypeBase):
61 key = 'webhook'
64 key = 'webhook'
62 display_name = lazy_ugettext('Webhook')
65 display_name = _('Webhook')
66 description = _('Post json events to a webhook endpoint')
67 icon = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg viewBox="0 0 256 239" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid"><g><path d="M119.540432,100.502743 C108.930124,118.338815 98.7646301,135.611455 88.3876025,152.753617 C85.7226696,157.154315 84.4040417,160.738531 86.5332204,166.333309 C92.4107024,181.787152 84.1193605,196.825836 68.5350381,200.908244 C53.8383677,204.759349 39.5192953,195.099955 36.6032893,179.365384 C34.0194114,165.437749 44.8274148,151.78491 60.1824106,149.608284 C61.4694072,149.424428 62.7821041,149.402681 64.944891,149.240571 C72.469175,136.623655 80.1773157,123.700312 88.3025935,110.073173 C73.611854,95.4654658 64.8677898,78.3885437 66.803227,57.2292132 C68.1712787,42.2715849 74.0527146,29.3462646 84.8033863,18.7517722 C105.393354,-1.53572199 136.805164,-4.82141828 161.048542,10.7510424 C184.333097,25.7086706 194.996783,54.8450075 185.906752,79.7822957 C179.052655,77.9239597 172.151111,76.049808 164.563565,73.9917997 C167.418285,60.1274266 165.306899,47.6765751 155.95591,37.0109123 C149.777932,29.9690049 141.850349,26.2780332 132.835442,24.9178894 C114.764113,22.1877169 97.0209573,33.7983633 91.7563309,51.5355878 C85.7800012,71.6669027 94.8245623,88.1111998 119.540432,100.502743 L119.540432,100.502743 Z" fill="#C73A63"></path><path d="M149.841194,79.4106285 C157.316054,92.5969067 164.905578,105.982857 172.427885,119.246236 C210.44865,107.483365 239.114472,128.530009 249.398582,151.063322 C261.81978,178.282014 253.328765,210.520191 228.933162,227.312431 C203.893073,244.551464 172.226236,241.605803 150.040866,219.46195 C155.694953,214.729124 161.376716,209.974552 167.44794,204.895759 C189.360489,219.088306 208.525074,218.420096 222.753207,201.614016 C234.885769,187.277151 234.622834,165.900356 222.138374,151.863988 C207.730339,135.66681 188.431321,135.172572 165.103273,150.721309 C155.426087,133.553447 145.58086,116.521995 136.210101,99.2295848 C133.05093,93.4015266 129.561608,90.0209366 122.440622,88.7873178 C110.547271,86.7253555 102.868785,76.5124151 102.408155,65.0698097 C101.955433,53.7537294 108.621719,43.5249733 119.04224,39.5394355 C129.363912,35.5914599 141.476705,38.7783085 148.419765,47.554004 C154.093621,54.7244134 155.896602,62.7943365 152.911402,71.6372484 C152.081082,74.1025091 151.00562,76.4886916 149.841194,79.4106285 L149.841194,79.4106285 Z" fill="#4B4B4B"></path><path d="M167.706921,187.209935 L121.936499,187.209935 C117.54964,205.253587 108.074103,219.821756 91.7464461,229.085759 C79.0544063,236.285822 65.3738898,238.72736 50.8136292,236.376762 C24.0061432,232.053165 2.08568567,207.920497 0.156179306,180.745298 C-2.02835403,149.962159 19.1309765,122.599149 47.3341915,116.452801 C49.2814904,123.524363 51.2485589,130.663141 53.1958579,137.716911 C27.3195169,150.919004 18.3639187,167.553089 25.6054984,188.352614 C31.9811726,206.657224 50.0900643,216.690262 69.7528413,212.809503 C89.8327554,208.847688 99.9567329,192.160226 98.7211371,165.37844 C117.75722,165.37844 136.809118,165.180745 155.847178,165.475311 C163.280522,165.591951 169.019617,164.820939 174.620326,158.267339 C183.840836,147.48306 200.811003,148.455721 210.741239,158.640984 C220.88894,169.049642 220.402609,185.79839 209.663799,195.768166 C199.302587,205.38802 182.933414,204.874012 173.240413,194.508846 C171.247644,192.37176 169.677943,189.835329 167.706921,187.209935 L167.706921,187.209935 Z" fill="#4A4A4A"></path></g></svg>'''
68
63 valid_events = [
69 valid_events = [
64 events.PullRequestCloseEvent,
70 events.PullRequestCloseEvent,
65 events.PullRequestMergeEvent,
71 events.PullRequestMergeEvent,
@@ -18,23 +18,29 b''
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 import colander
22 import logging
23 import pylons
21 import pylons
24 import deform
22 import deform
23 import logging
24 import colander
25 import peppercorn
26 import webhelpers.paginate
25
27
26 from pyramid.httpexceptions import HTTPFound, HTTPForbidden
28 from pyramid.httpexceptions import HTTPFound, HTTPForbidden, HTTPBadRequest
27 from pyramid.renderers import render
29 from pyramid.renderers import render
28 from pyramid.response import Response
30 from pyramid.response import Response
29
31
30 from rhodecode.lib import auth
32 from rhodecode.lib import auth
31 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
33 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
32 from rhodecode.model.db import Repository, Session, Integration
34 from rhodecode.lib.utils2 import safe_int
35 from rhodecode.lib.helpers import Page
36 from rhodecode.model.db import Repository, RepoGroup, Session, Integration
33 from rhodecode.model.scm import ScmModel
37 from rhodecode.model.scm import ScmModel
34 from rhodecode.model.integration import IntegrationModel
38 from rhodecode.model.integration import IntegrationModel
35 from rhodecode.admin.navigation import navigation_list
39 from rhodecode.admin.navigation import navigation_list
36 from rhodecode.translation import _
40 from rhodecode.translation import _
37 from rhodecode.integrations import integration_type_registry
41 from rhodecode.integrations import integration_type_registry
42 from rhodecode.model.validation_schema.schemas.integration_schema import (
43 make_integration_schema, IntegrationScopeType)
38
44
39 log = logging.getLogger(__name__)
45 log = logging.getLogger(__name__)
40
46
@@ -59,28 +65,51 b' class IntegrationSettingsViewBase(object'
59
65
60 self.IntegrationType = None
66 self.IntegrationType = None
61 self.repo = None
67 self.repo = None
68 self.repo_group = None
62 self.integration = None
69 self.integration = None
63 self.integrations = {}
70 self.integrations = {}
64
71
65 request = self.request
72 request = self.request
66
73
67 if 'repo_name' in request.matchdict: # we're in a repo context
74 if 'repo_name' in request.matchdict: # in repo settings context
68 repo_name = request.matchdict['repo_name']
75 repo_name = request.matchdict['repo_name']
69 self.repo = Repository.get_by_repo_name(repo_name)
76 self.repo = Repository.get_by_repo_name(repo_name)
70
77
71 if 'integration' in request.matchdict: # we're in integration context
78 if 'repo_group_name' in request.matchdict: # in group settings context
79 repo_group_name = request.matchdict['repo_group_name']
80 self.repo_group = RepoGroup.get_by_group_name(repo_group_name)
81
82
83 if 'integration' in request.matchdict: # integration type context
72 integration_type = request.matchdict['integration']
84 integration_type = request.matchdict['integration']
73 self.IntegrationType = integration_type_registry[integration_type]
85 self.IntegrationType = integration_type_registry[integration_type]
74
86
75 if 'integration_id' in request.matchdict: # single integration context
87 if 'integration_id' in request.matchdict: # single integration context
76 integration_id = request.matchdict['integration_id']
88 integration_id = request.matchdict['integration_id']
77 self.integration = Integration.get(integration_id)
89 self.integration = Integration.get(integration_id)
78 else: # list integrations context
90
79 for integration in IntegrationModel().get_integrations(self.repo):
91 # extra perms check just in case
80 self.integrations.setdefault(integration.integration_type, []
92 if not self._has_perms_for_integration(self.integration):
81 ).append(integration)
93 raise HTTPForbidden()
82
94
83 self.settings = self.integration and self.integration.settings or {}
95 self.settings = self.integration and self.integration.settings or {}
96 self.admin_view = not (self.repo or self.repo_group)
97
98 def _has_perms_for_integration(self, integration):
99 perms = self.request.user.permissions
100
101 if 'hg.admin' in perms['global']:
102 return True
103
104 if integration.repo:
105 return perms['repositories'].get(
106 integration.repo.repo_name) == 'repository.admin'
107
108 if integration.repo_group:
109 return perms['repositories_groups'].get(
110 integration.repo_group.group_name) == 'group.admin'
111
112 return False
84
113
85 def _template_c_context(self):
114 def _template_c_context(self):
86 # TODO: dan: this is a stopgap in order to inherit from current pylons
115 # TODO: dan: this is a stopgap in order to inherit from current pylons
@@ -91,7 +120,10 b' class IntegrationSettingsViewBase(object'
91 c.active = 'integrations'
120 c.active = 'integrations'
92 c.rhodecode_user = self.request.user
121 c.rhodecode_user = self.request.user
93 c.repo = self.repo
122 c.repo = self.repo
123 c.repo_group = self.repo_group
94 c.repo_name = self.repo and self.repo.repo_name or None
124 c.repo_name = self.repo and self.repo.repo_name or None
125 c.repo_group_name = self.repo_group and self.repo_group.group_name or None
126
95 if self.repo:
127 if self.repo:
96 c.repo_info = self.repo
128 c.repo_info = self.repo
97 c.rhodecode_db_repo = self.repo
129 c.rhodecode_db_repo = self.repo
@@ -102,34 +134,77 b' class IntegrationSettingsViewBase(object'
102 return c
134 return c
103
135
104 def _form_schema(self):
136 def _form_schema(self):
105 if self.integration:
137 schema = make_integration_schema(IntegrationType=self.IntegrationType,
106 settings = self.integration.settings
138 settings=self.settings)
107 else:
108 settings = {}
109 return self.IntegrationType(settings=settings).settings_schema()
110
139
111 def settings_get(self, defaults=None, errors=None, form=None):
140 # returns a clone, important if mutating the schema later
112 """
141 return schema.bind(
113 View that displays the plugin settings as a form.
142 permissions=self.request.user.permissions,
114 """
143 no_scope=not self.admin_view)
115 defaults = defaults or {}
144
116 errors = errors or {}
145
146 def _form_defaults(self):
147 defaults = {}
117
148
118 if self.integration:
149 if self.integration:
119 defaults = self.integration.settings or {}
150 defaults['settings'] = self.integration.settings or {}
120 defaults['name'] = self.integration.name
151 defaults['options'] = {
121 defaults['enabled'] = self.integration.enabled
152 'name': self.integration.name,
153 'enabled': self.integration.enabled,
154 'scope': {
155 'repo': self.integration.repo,
156 'repo_group': self.integration.repo_group,
157 'child_repos_only': self.integration.child_repos_only,
158 },
159 }
122 else:
160 else:
123 if self.repo:
161 if self.repo:
124 scope = self.repo.repo_name
162 scope = _('{repo_name} repository').format(
163 repo_name=self.repo.repo_name)
164 elif self.repo_group:
165 scope = _('{repo_group_name} repo group').format(
166 repo_group_name=self.repo_group.group_name)
125 else:
167 else:
126 scope = _('Global')
168 scope = _('Global')
127
169
128 defaults['name'] = '{} {} integration'.format(scope,
170 defaults['options'] = {
129 self.IntegrationType.display_name)
171 'enabled': True,
130 defaults['enabled'] = True
172 'name': _('{name} integration').format(
173 name=self.IntegrationType.display_name),
174 }
175 defaults['options']['scope'] = {
176 'repo': self.repo,
177 'repo_group': self.repo_group,
178 }
179
180 return defaults
131
181
132 schema = self._form_schema().bind(request=self.request)
182 def _delete_integration(self, integration):
183 Session().delete(self.integration)
184 Session().commit()
185 self.request.session.flash(
186 _('Integration {integration_name} deleted successfully.').format(
187 integration_name=self.integration.name),
188 queue='success')
189
190 if self.repo:
191 redirect_to = self.request.route_url(
192 'repo_integrations_home', repo_name=self.repo.repo_name)
193 elif self.repo_group:
194 redirect_to = self.request.route_url(
195 'repo_group_integrations_home',
196 repo_group_name=self.repo_group.group_name)
197 else:
198 redirect_to = self.request.route_url('global_integrations_home')
199 raise HTTPFound(redirect_to)
200
201 def settings_get(self, defaults=None, form=None):
202 """
203 View that displays the integration settings as a form.
204 """
205
206 defaults = defaults or self._form_defaults()
207 schema = self._form_schema()
133
208
134 if self.integration:
209 if self.integration:
135 buttons = ('submit', 'delete')
210 buttons = ('submit', 'delete')
@@ -138,23 +213,10 b' class IntegrationSettingsViewBase(object'
138
213
139 form = form or deform.Form(schema, appstruct=defaults, buttons=buttons)
214 form = form or deform.Form(schema, appstruct=defaults, buttons=buttons)
140
215
141 for node in schema:
142 setting = self.settings.get(node.name)
143 if setting is not None:
144 defaults.setdefault(node.name, setting)
145 else:
146 if node.default:
147 defaults.setdefault(node.name, node.default)
148
149 template_context = {
216 template_context = {
150 'form': form,
217 'form': form,
151 'defaults': defaults,
152 'errors': errors,
153 'schema': schema,
154 'current_IntegrationType': self.IntegrationType,
218 'current_IntegrationType': self.IntegrationType,
155 'integration': self.integration,
219 'integration': self.integration,
156 'settings': self.settings,
157 'resource': self.context,
158 'c': self._template_c_context(),
220 'c': self._template_c_context(),
159 }
221 }
160
222
@@ -163,71 +225,93 b' class IntegrationSettingsViewBase(object'
163 @auth.CSRFRequired()
225 @auth.CSRFRequired()
164 def settings_post(self):
226 def settings_post(self):
165 """
227 """
166 View that validates and stores the plugin settings.
228 View that validates and stores the integration settings.
167 """
229 """
168 if self.request.params.get('delete'):
230 controls = self.request.POST.items()
169 Session().delete(self.integration)
231 pstruct = peppercorn.parse(controls)
170 Session().commit()
232
171 self.request.session.flash(
233 if self.integration and pstruct.get('delete'):
172 _('Integration {integration_name} deleted successfully.').format(
234 return self._delete_integration(self.integration)
173 integration_name=self.integration.name),
235
174 queue='success')
236 schema = self._form_schema()
175 if self.repo:
237
176 redirect_to = self.request.route_url(
238 skip_settings_validation = False
177 'repo_integrations_home', repo_name=self.repo.repo_name)
239 if self.integration and 'enabled' not in pstruct.get('options', {}):
178 else:
240 skip_settings_validation = True
179 redirect_to = self.request.route_url('global_integrations_home')
241 schema['settings'].validator = None
180 raise HTTPFound(redirect_to)
242 for field in schema['settings'].children:
243 field.validator = None
244 field.missing = ''
181
245
182 schema = self._form_schema().bind(request=self.request)
246 if self.integration:
247 buttons = ('submit', 'delete')
248 else:
249 buttons = ('submit',)
183
250
184 form = deform.Form(schema, buttons=('submit', 'delete'))
251 form = deform.Form(schema, buttons=buttons)
185
252
186 params = {}
253 if not self.admin_view:
187 for node in schema.children:
254 # scope is read only field in these cases, and has to be added
188 if type(node.typ) in (colander.Set, colander.List):
255 options = pstruct.setdefault('options', {})
189 val = self.request.params.getall(node.name)
256 if 'scope' not in options:
190 else:
257 options['scope'] = IntegrationScopeType().serialize(None, {
191 val = self.request.params.get(node.name)
258 'repo': self.repo,
192 if val:
259 'repo_group': self.repo_group,
193 params[node.name] = val
260 })
194
261
195 controls = self.request.POST.items()
196 try:
262 try:
197 valid_data = form.validate(controls)
263 valid_data = form.validate_pstruct(pstruct)
198 except deform.ValidationFailure as e:
264 except deform.ValidationFailure as e:
199 self.request.session.flash(
265 self.request.session.flash(
200 _('Errors exist when saving integration settings. '
266 _('Errors exist when saving integration settings. '
201 'Please check the form inputs.'),
267 'Please check the form inputs.'),
202 queue='error')
268 queue='error')
203 return self.settings_get(errors={}, defaults=params, form=e)
269 return self.settings_get(form=e)
204
270
205 if not self.integration:
271 if not self.integration:
206 self.integration = Integration()
272 self.integration = Integration()
207 self.integration.integration_type = self.IntegrationType.key
273 self.integration.integration_type = self.IntegrationType.key
208 if self.repo:
209 self.integration.repo = self.repo
210 Session().add(self.integration)
274 Session().add(self.integration)
211
275
212 self.integration.enabled = valid_data.pop('enabled', False)
276 scope = valid_data['options']['scope']
213 self.integration.name = valid_data.pop('name')
214 self.integration.settings = valid_data
215
277
278 IntegrationModel().update_integration(self.integration,
279 name=valid_data['options']['name'],
280 enabled=valid_data['options']['enabled'],
281 settings=valid_data['settings'],
282 repo=scope['repo'],
283 repo_group=scope['repo_group'],
284 child_repos_only=scope['child_repos_only'],
285 )
286
287
288 self.integration.settings = valid_data['settings']
216 Session().commit()
289 Session().commit()
217
218 # Display success message and redirect.
290 # Display success message and redirect.
219 self.request.session.flash(
291 self.request.session.flash(
220 _('Integration {integration_name} updated successfully.').format(
292 _('Integration {integration_name} updated successfully.').format(
221 integration_name=self.IntegrationType.display_name),
293 integration_name=self.IntegrationType.display_name),
222 queue='success')
294 queue='success')
223
295
224 if self.repo:
296
225 redirect_to = self.request.route_url(
297 # if integration scope changes, we must redirect to the right place
226 'repo_integrations_edit', repo_name=self.repo.repo_name,
298 # keeping in mind if the original view was for /repo/ or /_admin/
299 admin_view = not (self.repo or self.repo_group)
300
301 if self.integration.repo and not admin_view:
302 redirect_to = self.request.route_path(
303 'repo_integrations_edit',
304 repo_name=self.integration.repo.repo_name,
305 integration=self.integration.integration_type,
306 integration_id=self.integration.integration_id)
307 elif self.integration.repo_group and not admin_view:
308 redirect_to = self.request.route_path(
309 'repo_group_integrations_edit',
310 repo_group_name=self.integration.repo_group.group_name,
227 integration=self.integration.integration_type,
311 integration=self.integration.integration_type,
228 integration_id=self.integration.integration_id)
312 integration_id=self.integration.integration_id)
229 else:
313 else:
230 redirect_to = self.request.route_url(
314 redirect_to = self.request.route_path(
231 'global_integrations_edit',
315 'global_integrations_edit',
232 integration=self.integration.integration_type,
316 integration=self.integration.integration_type,
233 integration_id=self.integration.integration_id)
317 integration_id=self.integration.integration_id)
@@ -235,31 +319,60 b' class IntegrationSettingsViewBase(object'
235 return HTTPFound(redirect_to)
319 return HTTPFound(redirect_to)
236
320
237 def index(self):
321 def index(self):
238 current_integrations = self.integrations
322 """ List integrations """
239 if self.IntegrationType:
323 if self.repo:
240 current_integrations = {
324 scope = self.repo
241 self.IntegrationType.key: self.integrations.get(
325 elif self.repo_group:
242 self.IntegrationType.key, [])
326 scope = self.repo_group
243 }
327 else:
328 scope = 'all'
329
330 integrations = []
331
332 for integration in IntegrationModel().get_integrations(
333 scope=scope, IntegrationType=self.IntegrationType):
334
335 # extra permissions check *just in case*
336 if not self._has_perms_for_integration(integration):
337 continue
338 integrations.append(integration)
339
340 sort_arg = self.request.GET.get('sort', 'name:asc')
341 if ':' in sort_arg:
342 sort_field, sort_dir = sort_arg.split(':')
343 else:
344 sort_field = sort_arg, 'asc'
345
346 assert sort_field in ('name', 'integration_type', 'enabled', 'scope')
347
348 integrations.sort(
349 key=lambda x: getattr(x[1], sort_field), reverse=(sort_dir=='desc'))
350
351
352 page_url = webhelpers.paginate.PageURL(
353 self.request.path, self.request.GET)
354 page = safe_int(self.request.GET.get('page', 1), 1)
355
356 integrations = Page(integrations, page=page, items_per_page=10,
357 url=page_url)
244
358
245 template_context = {
359 template_context = {
360 'sort_field': sort_field,
361 'rev_sort_dir': sort_dir != 'desc' and 'desc' or 'asc',
246 'current_IntegrationType': self.IntegrationType,
362 'current_IntegrationType': self.IntegrationType,
247 'current_integrations': current_integrations,
363 'integrations_list': integrations,
248 'available_integrations': integration_type_registry,
364 'available_integrations': integration_type_registry,
249 'c': self._template_c_context()
365 'c': self._template_c_context(),
366 'request': self.request,
250 }
367 }
368 return template_context
251
369
252 if self.repo:
370 def new_integration(self):
253 html = render('rhodecode:templates/admin/integrations/list.html',
371 template_context = {
254 template_context,
372 'available_integrations': integration_type_registry,
255 request=self.request)
373 'c': self._template_c_context(),
256 else:
374 }
257 html = render('rhodecode:templates/admin/integrations/list.html',
375 return template_context
258 template_context,
259 request=self.request)
260
261 return Response(html)
262
263
376
264 class GlobalIntegrationsView(IntegrationSettingsViewBase):
377 class GlobalIntegrationsView(IntegrationSettingsViewBase):
265 def perm_check(self, user):
378 def perm_check(self, user):
@@ -270,3 +383,10 b' class RepoIntegrationsView(IntegrationSe'
270 def perm_check(self, user):
383 def perm_check(self, user):
271 return auth.HasRepoPermissionAll('repository.admin'
384 return auth.HasRepoPermissionAll('repository.admin'
272 )(repo_name=self.repo.repo_name, user=user)
385 )(repo_name=self.repo.repo_name, user=user)
386
387
388 class RepoGroupIntegrationsView(IntegrationSettingsViewBase):
389 def perm_check(self, user):
390 return auth.HasRepoGroupPermissionAll('group.admin'
391 )(group_name=self.repo_group.group_name, user=user)
392
@@ -48,12 +48,12 b' def annotate_highlight('
48 :param headers: dictionary with headers (keys are whats in ``order``
48 :param headers: dictionary with headers (keys are whats in ``order``
49 parameter)
49 parameter)
50 """
50 """
51 from rhodecode.lib.utils import get_custom_lexer
51 from rhodecode.lib.helpers import get_lexer_for_filenode
52 options['linenos'] = True
52 options['linenos'] = True
53 formatter = AnnotateHtmlFormatter(
53 formatter = AnnotateHtmlFormatter(
54 filenode=filenode, order=order, headers=headers,
54 filenode=filenode, order=order, headers=headers,
55 annotate_from_commit_func=annotate_from_commit_func, **options)
55 annotate_from_commit_func=annotate_from_commit_func, **options)
56 lexer = get_custom_lexer(filenode.extension) or filenode.lexer
56 lexer = get_lexer_for_filenode(filenode)
57 highlighted = highlight(filenode.content, lexer, formatter)
57 highlighted = highlight(filenode.content, lexer, formatter)
58 return highlighted
58 return highlighted
59
59
@@ -1116,9 +1116,11 b' class CSRFRequired(object):'
1116 For use with the ``webhelpers.secure_form`` helper functions.
1116 For use with the ``webhelpers.secure_form`` helper functions.
1117
1117
1118 """
1118 """
1119 def __init__(self, token=csrf_token_key, header='X-CSRF-Token'):
1119 def __init__(self, token=csrf_token_key, header='X-CSRF-Token',
1120 except_methods=None):
1120 self.token = token
1121 self.token = token
1121 self.header = header
1122 self.header = header
1123 self.except_methods = except_methods or []
1122
1124
1123 def __call__(self, func):
1125 def __call__(self, func):
1124 return get_cython_compat_decorator(self.__wrapper, func)
1126 return get_cython_compat_decorator(self.__wrapper, func)
@@ -1131,6 +1133,9 b' class CSRFRequired(object):'
1131 return supplied_token and supplied_token == cur_token
1133 return supplied_token and supplied_token == cur_token
1132
1134
1133 def __wrapper(self, func, *fargs, **fkwargs):
1135 def __wrapper(self, func, *fargs, **fkwargs):
1136 if request.method in self.except_methods:
1137 return func(*fargs, **fkwargs)
1138
1134 cur_token = get_csrf_token(save_if_missing=False)
1139 cur_token = get_csrf_token(save_if_missing=False)
1135 if self.check_csrf(request, cur_token):
1140 if self.check_csrf(request, cur_token):
1136 if request.POST.get(self.token):
1141 if request.POST.get(self.token):
@@ -28,6 +28,7 b' import logging'
28 import socket
28 import socket
29
29
30 import ipaddress
30 import ipaddress
31 import pyramid.threadlocal
31
32
32 from paste.auth.basic import AuthBasicAuthenticator
33 from paste.auth.basic import AuthBasicAuthenticator
33 from paste.httpexceptions import HTTPUnauthorized, HTTPForbidden, get_exception
34 from paste.httpexceptions import HTTPUnauthorized, HTTPForbidden, get_exception
@@ -276,7 +277,7 b' def attach_context_attributes(context, r'
276 # Visual options
277 # Visual options
277 context.visual = AttributeDict({})
278 context.visual = AttributeDict({})
278
279
279 # DB store
280 # DB stored Visual Items
280 context.visual.show_public_icon = str2bool(
281 context.visual.show_public_icon = str2bool(
281 rc_config.get('rhodecode_show_public_icon'))
282 rc_config.get('rhodecode_show_public_icon'))
282 context.visual.show_private_icon = str2bool(
283 context.visual.show_private_icon = str2bool(
@@ -368,6 +369,8 b' def attach_context_attributes(context, r'
368 context.unread_notifications = NotificationModel().get_unread_cnt_for_user(
369 context.unread_notifications = NotificationModel().get_unread_cnt_for_user(
369 context.rhodecode_user.user_id)
370 context.rhodecode_user.user_id)
370
371
372 context.pyramid_request = pyramid.threadlocal.get_current_request()
373
371
374
372 def get_auth_user(environ):
375 def get_auth_user(environ):
373 ip_addr = get_ip_addr(environ)
376 ip_addr = get_ip_addr(environ)
@@ -84,6 +84,7 b' def get_user_data(user_id):'
84 'icon_link': h.gravatar_url(user.email, 14),
84 'icon_link': h.gravatar_url(user.email, 14),
85 'display_name': h.person(user, 'username_or_name_or_email'),
85 'display_name': h.person(user, 'username_or_name_or_email'),
86 'display_link': h.link_to_user(user),
86 'display_link': h.link_to_user(user),
87 'notifications': user.user_data.get('notification_status', True)
87 }
88 }
88
89
89
90
@@ -55,6 +55,7 b' def wrap_to_table(str_):'
55 return '''<table class="code-difftable">
55 return '''<table class="code-difftable">
56 <tr class="line no-comment">
56 <tr class="line no-comment">
57 <td class="add-comment-line tooltip" title="%s"><span class="add-comment-content"></span></td>
57 <td class="add-comment-line tooltip" title="%s"><span class="add-comment-content"></span></td>
58 <td></td>
58 <td class="lineno new"></td>
59 <td class="lineno new"></td>
59 <td class="code no-comment"><pre>%s</pre></td>
60 <td class="code no-comment"><pre>%s</pre></td>
60 </tr>
61 </tr>
@@ -691,14 +692,14 b' class DiffProcessor(object):'
691 anchor_link = False
692 anchor_link = False
692
693
693 ###########################################################
694 ###########################################################
694 # COMMENT ICON
695 # COMMENT ICONS
695 ###########################################################
696 ###########################################################
696 _html.append('''\t<td class="add-comment-line"><span class="add-comment-content">''')
697 _html.append('''\t<td class="add-comment-line"><span class="add-comment-content">''')
697
698
698 if enable_comments and change['action'] != Action.CONTEXT:
699 if enable_comments and change['action'] != Action.CONTEXT:
699 _html.append('''<a href="#"><span class="icon-comment-add"></span></a>''')
700 _html.append('''<a href="#"><span class="icon-comment-add"></span></a>''')
700
701
701 _html.append('''</span></td>\n''')
702 _html.append('''</span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>\n''')
702
703
703 ###########################################################
704 ###########################################################
704 # OLD LINE NUMBER
705 # OLD LINE NUMBER
@@ -23,6 +23,7 b' Set of custom exceptions used in RhodeCo'
23 """
23 """
24
24
25 from webob.exc import HTTPClientError
25 from webob.exc import HTTPClientError
26 from pyramid.httpexceptions import HTTPBadGateway
26
27
27
28
28 class LdapUsernameError(Exception):
29 class LdapUsernameError(Exception):
@@ -120,3 +121,19 b' class NotAllowedToCreateUserError(Except'
120
121
121 class RepositoryCreationError(Exception):
122 class RepositoryCreationError(Exception):
122 pass
123 pass
124
125
126 class VCSServerUnavailable(HTTPBadGateway):
127 """ HTTP Exception class for VCS Server errors """
128 code = 502
129 title = 'VCS Server Error'
130 causes = [
131 'VCS Server is not running',
132 'Incorrect vcs.server=host:port',
133 'Incorrect vcs.server.protocol',
134 ]
135 def __init__(self, message=''):
136 self.explanation = 'Could not connect to VCS Server'
137 if message:
138 self.explanation += ': ' + message
139 super(VCSServerUnavailable, self).__init__()
@@ -520,13 +520,18 b' def get_lexer_safe(mimetype=None, filepa'
520 return lexer
520 return lexer
521
521
522
522
523 def get_lexer_for_filenode(filenode):
524 lexer = get_custom_lexer(filenode.extension) or filenode.lexer
525 return lexer
526
527
523 def pygmentize(filenode, **kwargs):
528 def pygmentize(filenode, **kwargs):
524 """
529 """
525 pygmentize function using pygments
530 pygmentize function using pygments
526
531
527 :param filenode:
532 :param filenode:
528 """
533 """
529 lexer = get_custom_lexer(filenode.extension) or filenode.lexer
534 lexer = get_lexer_for_filenode(filenode)
530 return literal(code_highlight(filenode.content, lexer,
535 return literal(code_highlight(filenode.content, lexer,
531 CodeHtmlFormatter(**kwargs)))
536 CodeHtmlFormatter(**kwargs)))
532
537
@@ -772,10 +777,10 b' def get_repo_type_by_name(repo_name):'
772
777
773
778
774 def is_svn_without_proxy(repository):
779 def is_svn_without_proxy(repository):
775 from rhodecode import CONFIG
776 if is_svn(repository):
780 if is_svn(repository):
777 if not CONFIG.get('rhodecode_proxy_subversion_http_requests', False):
781 from rhodecode.model.settings import VcsSettingsModel
778 return True
782 conf = VcsSettingsModel().get_ui_settings_as_config_obj()
783 return not str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled'))
779 return False
784 return False
780
785
781
786
@@ -1946,6 +1951,13 b' def route_path(*args, **kwds):'
1946 return req.route_path(*args, **kwds)
1951 return req.route_path(*args, **kwds)
1947
1952
1948
1953
1954 def route_path_or_none(*args, **kwargs):
1955 try:
1956 return route_path(*args, **kwargs)
1957 except KeyError:
1958 return None
1959
1960
1949 def static_url(*args, **kwds):
1961 def static_url(*args, **kwds):
1950 """
1962 """
1951 Wrapper around pyramids `route_path` function. It is used to generate
1963 Wrapper around pyramids `route_path` function. It is used to generate
@@ -265,7 +265,7 b' class WhooshResultWrapper(object):'
265
265
266 f_path = '' # noqa
266 f_path = '' # noqa
267 if self.search_type in ['content', 'path']:
267 if self.search_type in ['content', 'path']:
268 f_path = res['path'].split(res['repository'])[-1]
268 f_path = res['path'][len(res['repository']):]
269 f_path = f_path.lstrip(os.sep)
269 f_path = f_path.lstrip(os.sep)
270
270
271 if self.search_type == 'content':
271 if self.search_type == 'content':
@@ -51,18 +51,10 b' class MarkupRenderer(object):'
51 RST_PAT = re.compile(r'\.re?st$', re.IGNORECASE)
51 RST_PAT = re.compile(r'\.re?st$', re.IGNORECASE)
52 PLAIN_PAT = re.compile(r'^readme$', re.IGNORECASE)
52 PLAIN_PAT = re.compile(r'^readme$', re.IGNORECASE)
53
53
54 # list of readme files to search in file tree and display in summary
55 # attached weights defines the search order lower is first
56 ALL_READMES = [
57 ('readme', 0), ('README', 0), ('Readme', 0),
58 ('doc/readme', 1), ('doc/README', 1), ('doc/Readme', 1),
59 ('Docs/readme', 2), ('Docs/README', 2), ('Docs/Readme', 2),
60 ('DOCS/readme', 2), ('DOCS/README', 2), ('DOCS/Readme', 2),
61 ('docs/readme', 2), ('docs/README', 2), ('docs/Readme', 2),
62 ]
63 # extension together with weights. Lower is first means we control how
54 # extension together with weights. Lower is first means we control how
64 # extensions are attached to readme names with those.
55 # extensions are attached to readme names with those.
65 PLAIN_EXTS = [
56 PLAIN_EXTS = [
57 # prefer no extension
66 ('', 0), # special case that renders READMES names without extension
58 ('', 0), # special case that renders READMES names without extension
67 ('.text', 2), ('.TEXT', 2),
59 ('.text', 2), ('.TEXT', 2),
68 ('.txt', 3), ('.TXT', 3)
60 ('.txt', 3), ('.TXT', 3)
@@ -80,8 +72,6 b' class MarkupRenderer(object):'
80 ('.markdown', 4), ('.MARKDOWN', 4)
72 ('.markdown', 4), ('.MARKDOWN', 4)
81 ]
73 ]
82
74
83 ALL_EXTS = PLAIN_EXTS + MARKDOWN_EXTS + RST_EXTS
84
85 def _detect_renderer(self, source, filename=None):
75 def _detect_renderer(self, source, filename=None):
86 """
76 """
87 runs detection of what renderer should be used for generating html
77 runs detection of what renderer should be used for generating html
@@ -124,29 +114,6 b' class MarkupRenderer(object):'
124
114
125 return None
115 return None
126
116
127 @classmethod
128 def generate_readmes(cls, all_readmes, extensions):
129 combined = itertools.product(all_readmes, extensions)
130 # sort by filename weight(y[0][1]) + extensions weight(y[1][1])
131 prioritized_readmes = sorted(combined, key=lambda y: y[0][1] + y[1][1])
132 # filename, extension
133 return [''.join([x[0][0], x[1][0]]) for x in prioritized_readmes]
134
135 def pick_readme_order(self, default_renderer):
136
137 if default_renderer == 'markdown':
138 markdown = self.generate_readmes(self.ALL_READMES, self.MARKDOWN_EXTS)
139 readme_order = markdown + self.generate_readmes(
140 self.ALL_READMES, self.RST_EXTS + self.PLAIN_EXTS)
141 elif default_renderer == 'rst':
142 markdown = self.generate_readmes(self.ALL_READMES, self.RST_EXTS)
143 readme_order = markdown + self.generate_readmes(
144 self.ALL_READMES, self.MARKDOWN_EXTS + self.PLAIN_EXTS)
145 else:
146 readme_order = self.generate_readmes(self.ALL_READMES, self.ALL_EXTS)
147
148 return readme_order
149
150 def render(self, source, filename=None):
117 def render(self, source, filename=None):
151 """
118 """
152 Renders a given filename using detected renderer
119 Renders a given filename using detected renderer
@@ -23,12 +23,15 b' SimpleGit middleware for handling git pr'
23 It's implemented with basic auth function
23 It's implemented with basic auth function
24 """
24 """
25 import re
25 import re
26 import logging
26 import urlparse
27 import urlparse
27
28
28 import rhodecode
29 import rhodecode
29 from rhodecode.lib import utils2
30 from rhodecode.lib import utils2
30 from rhodecode.lib.middleware import simplevcs
31 from rhodecode.lib.middleware import simplevcs
31
32
33 log = logging.getLogger(__name__)
34
32
35
33 GIT_PROTO_PAT = re.compile(
36 GIT_PROTO_PAT = re.compile(
34 r'^/(.+)/(info/refs|git-upload-pack|git-receive-pack)')
37 r'^/(.+)/(info/refs|git-upload-pack|git-receive-pack)')
@@ -23,12 +23,15 b' SimpleHG middleware for handling mercuri'
23 (push/clone etc.). It's implemented with basic auth function
23 (push/clone etc.). It's implemented with basic auth function
24 """
24 """
25
25
26 import logging
26 import urlparse
27 import urlparse
27
28
28 from rhodecode.lib import utils
29 from rhodecode.lib import utils
29 from rhodecode.lib.ext_json import json
30 from rhodecode.lib.ext_json import json
30 from rhodecode.lib.middleware import simplevcs
31 from rhodecode.lib.middleware import simplevcs
31
32
33 log = logging.getLogger(__name__)
34
32
35
33 class SimpleHg(simplevcs.SimpleVCS):
36 class SimpleHg(simplevcs.SimpleVCS):
34
37
@@ -18,13 +18,17 b''
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 import logging
21 from urlparse import urljoin
22 from urlparse import urljoin
22
23
23 import requests
24 import requests
25 from webob.exc import HTTPNotAcceptable
24
26
25 import rhodecode
26 from rhodecode.lib.middleware import simplevcs
27 from rhodecode.lib.middleware import simplevcs
27 from rhodecode.lib.utils import is_valid_repo
28 from rhodecode.lib.utils import is_valid_repo
29 from rhodecode.lib.utils2 import str2bool
30
31 log = logging.getLogger(__name__)
28
32
29
33
30 class SimpleSvnApp(object):
34 class SimpleSvnApp(object):
@@ -92,10 +96,21 b' class SimpleSvnApp(object):'
92 return headers
96 return headers
93
97
94
98
99 class DisabledSimpleSvnApp(object):
100 def __init__(self, config):
101 self.config = config
102
103 def __call__(self, environ, start_response):
104 reason = 'Cannot handle SVN call because: SVN HTTP Proxy is not enabled'
105 log.warning(reason)
106 return HTTPNotAcceptable(reason)(environ, start_response)
107
108
95 class SimpleSvn(simplevcs.SimpleVCS):
109 class SimpleSvn(simplevcs.SimpleVCS):
96
110
97 SCM = 'svn'
111 SCM = 'svn'
98 READ_ONLY_COMMANDS = ('OPTIONS', 'PROPFIND', 'GET', 'REPORT')
112 READ_ONLY_COMMANDS = ('OPTIONS', 'PROPFIND', 'GET', 'REPORT')
113 DEFAULT_HTTP_SERVER = 'http://localhost:8090'
99
114
100 def _get_repository_name(self, environ):
115 def _get_repository_name(self, environ):
101 """
116 """
@@ -126,11 +141,19 b' class SimpleSvn(simplevcs.SimpleVCS):'
126 else 'push')
141 else 'push')
127
142
128 def _create_wsgi_app(self, repo_path, repo_name, config):
143 def _create_wsgi_app(self, repo_path, repo_name, config):
144 if self._is_svn_enabled():
129 return SimpleSvnApp(config)
145 return SimpleSvnApp(config)
146 # we don't have http proxy enabled return dummy request handler
147 return DisabledSimpleSvnApp(config)
148
149 def _is_svn_enabled(self):
150 conf = self.repo_vcs_config
151 return str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled'))
130
152
131 def _create_config(self, extras, repo_name):
153 def _create_config(self, extras, repo_name):
132 server_url = rhodecode.CONFIG.get(
154 conf = self.repo_vcs_config
133 'rhodecode_subversion_http_server_url', '')
155 server_url = conf.get('vcs_svn_proxy', 'http_server_url')
134 extras['subversion_http_server_url'] = (
156 server_url = server_url or self.DEFAULT_HTTP_SERVER
135 server_url or 'http://localhost/')
157
158 extras['subversion_http_server_url'] = server_url
136 return extras
159 return extras
@@ -46,10 +46,11 b' from rhodecode.lib.utils import ('
46 is_valid_repo, get_rhodecode_realm, get_rhodecode_base_path)
46 is_valid_repo, get_rhodecode_realm, get_rhodecode_base_path)
47 from rhodecode.lib.utils2 import safe_str, fix_PATH, str2bool
47 from rhodecode.lib.utils2 import safe_str, fix_PATH, str2bool
48 from rhodecode.lib.vcs.conf import settings as vcs_settings
48 from rhodecode.lib.vcs.conf import settings as vcs_settings
49 from rhodecode.lib.vcs.backends import base
49 from rhodecode.model import meta
50 from rhodecode.model import meta
50 from rhodecode.model.db import User, Repository
51 from rhodecode.model.db import User, Repository
51 from rhodecode.model.scm import ScmModel
52 from rhodecode.model.scm import ScmModel
52 from rhodecode.model.settings import SettingsModel
53
53
54
54 log = logging.getLogger(__name__)
55 log = logging.getLogger(__name__)
55
56
@@ -86,6 +87,10 b' class SimpleVCS(object):'
86 self.registry = registry
87 self.registry = registry
87 self.application = application
88 self.application = application
88 self.config = config
89 self.config = config
90 # re-populated by specialized middleware
91 self.repo_name = None
92 self.repo_vcs_config = base.Config()
93
89 # base path of repo locations
94 # base path of repo locations
90 self.basepath = get_rhodecode_base_path()
95 self.basepath = get_rhodecode_base_path()
91 # authenticate this VCS request using authfunc
96 # authenticate this VCS request using authfunc
@@ -111,9 +116,7 b' class SimpleVCS(object):'
111 def _get_by_id(self, repo_name):
116 def _get_by_id(self, repo_name):
112 """
117 """
113 Gets a special pattern _<ID> from clone url and tries to replace it
118 Gets a special pattern _<ID> from clone url and tries to replace it
114 with a repository_name for support of _<ID> non changable urls
119 with a repository_name for support of _<ID> non changeable urls
115
116 :param repo_name:
117 """
120 """
118
121
119 data = repo_name.split('/')
122 data = repo_name.split('/')
@@ -205,8 +208,7 b' class SimpleVCS(object):'
205 """
208 """
206 org_proto = environ['wsgi._org_proto']
209 org_proto = environ['wsgi._org_proto']
207 # check if we have SSL required ! if not it's a bad request !
210 # check if we have SSL required ! if not it's a bad request !
208 require_ssl = str2bool(
211 require_ssl = str2bool(self.repo_vcs_config.get('web', 'push_ssl'))
209 SettingsModel().get_ui_by_key('push_ssl').ui_value)
210 if require_ssl and org_proto == 'http':
212 if require_ssl and org_proto == 'http':
211 log.debug('proto is %s and SSL is required BAD REQUEST !',
213 log.debug('proto is %s and SSL is required BAD REQUEST !',
212 org_proto)
214 org_proto)
@@ -231,6 +233,12 b' class SimpleVCS(object):'
231 log.debug('User not allowed to proceed, %s', reason)
233 log.debug('User not allowed to proceed, %s', reason)
232 return HTTPNotAcceptable(reason)(environ, start_response)
234 return HTTPNotAcceptable(reason)(environ, start_response)
233
235
236 if not self.repo_name:
237 log.warning('Repository name is empty: %s', self.repo_name)
238 # failed to get repo name, we fail now
239 return HTTPNotFound()(environ, start_response)
240 log.debug('Extracted repo name is %s', self.repo_name)
241
234 ip_addr = get_ip_addr(environ)
242 ip_addr = get_ip_addr(environ)
235 username = None
243 username = None
236
244
@@ -238,19 +246,6 b' class SimpleVCS(object):'
238 environ['pylons.status_code_redirect'] = True
246 environ['pylons.status_code_redirect'] = True
239
247
240 # ======================================================================
248 # ======================================================================
241 # EXTRACT REPOSITORY NAME FROM ENV
242 # ======================================================================
243 environ['PATH_INFO'] = self._get_by_id(environ['PATH_INFO'])
244 repo_name = self._get_repository_name(environ)
245 environ['REPO_NAME'] = repo_name
246 log.debug('Extracted repo name is %s', repo_name)
247
248 # check for type, presence in database and on filesystem
249 if not self.is_valid_and_existing_repo(
250 repo_name, self.basepath, self.SCM):
251 return HTTPNotFound()(environ, start_response)
252
253 # ======================================================================
254 # GET ACTION PULL or PUSH
249 # GET ACTION PULL or PUSH
255 # ======================================================================
250 # ======================================================================
256 action = self._get_action(environ)
251 action = self._get_action(environ)
@@ -264,7 +259,7 b' class SimpleVCS(object):'
264 if anonymous_user.active:
259 if anonymous_user.active:
265 # ONLY check permissions if the user is activated
260 # ONLY check permissions if the user is activated
266 anonymous_perm = self._check_permission(
261 anonymous_perm = self._check_permission(
267 action, anonymous_user, repo_name, ip_addr)
262 action, anonymous_user, self.repo_name, ip_addr)
268 else:
263 else:
269 anonymous_perm = False
264 anonymous_perm = False
270
265
@@ -328,7 +323,8 b' class SimpleVCS(object):'
328 return HTTPNotAcceptable(reason)(environ, start_response)
323 return HTTPNotAcceptable(reason)(environ, start_response)
329
324
330 # check permissions for this repository
325 # check permissions for this repository
331 perm = self._check_permission(action, user, repo_name, ip_addr)
326 perm = self._check_permission(
327 action, user, self.repo_name, ip_addr)
332 if not perm:
328 if not perm:
333 return HTTPForbidden()(environ, start_response)
329 return HTTPForbidden()(environ, start_response)
334
330
@@ -336,14 +332,14 b' class SimpleVCS(object):'
336 # in hooks executed by rhodecode
332 # in hooks executed by rhodecode
337 check_locking = _should_check_locking(environ.get('QUERY_STRING'))
333 check_locking = _should_check_locking(environ.get('QUERY_STRING'))
338 extras = vcs_operation_context(
334 extras = vcs_operation_context(
339 environ, repo_name=repo_name, username=username,
335 environ, repo_name=self.repo_name, username=username,
340 action=action, scm=self.SCM,
336 action=action, scm=self.SCM,
341 check_locking=check_locking)
337 check_locking=check_locking)
342
338
343 # ======================================================================
339 # ======================================================================
344 # REQUEST HANDLING
340 # REQUEST HANDLING
345 # ======================================================================
341 # ======================================================================
346 str_repo_name = safe_str(repo_name)
342 str_repo_name = safe_str(self.repo_name)
347 repo_path = os.path.join(safe_str(self.basepath), str_repo_name)
343 repo_path = os.path.join(safe_str(self.basepath), str_repo_name)
348 log.debug('Repository path is %s', repo_path)
344 log.debug('Repository path is %s', repo_path)
349
345
@@ -354,7 +350,7 b' class SimpleVCS(object):'
354 action, self.SCM, str_repo_name, safe_str(username), ip_addr)
350 action, self.SCM, str_repo_name, safe_str(username), ip_addr)
355
351
356 return self._generate_vcs_response(
352 return self._generate_vcs_response(
357 environ, start_response, repo_path, repo_name, extras, action)
353 environ, start_response, repo_path, self.repo_name, extras, action)
358
354
359 @initialize_generator
355 @initialize_generator
360 def _generate_vcs_response(
356 def _generate_vcs_response(
@@ -24,12 +24,14 b' import logging'
24 import tempfile
24 import tempfile
25 import urlparse
25 import urlparse
26
26
27 from webob.exc import HTTPNotFound
28
27 import rhodecode
29 import rhodecode
28 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
30 from rhodecode.lib.middleware.appenlight import wrap_in_appenlight_if_enabled
29 from rhodecode.lib.middleware.simplegit import SimpleGit, GIT_PROTO_PAT
31 from rhodecode.lib.middleware.simplegit import SimpleGit, GIT_PROTO_PAT
30 from rhodecode.lib.middleware.simplehg import SimpleHg
32 from rhodecode.lib.middleware.simplehg import SimpleHg
31 from rhodecode.lib.middleware.simplesvn import SimpleSvn
33 from rhodecode.lib.middleware.simplesvn import SimpleSvn
32
34 from rhodecode.model.settings import VcsSettingsModel
33
35
34 log = logging.getLogger(__name__)
36 log = logging.getLogger(__name__)
35
37
@@ -131,31 +133,66 b' class VCSMiddleware(object):'
131 self.config = config
133 self.config = config
132 self.appenlight_client = appenlight_client
134 self.appenlight_client = appenlight_client
133 self.registry = registry
135 self.registry = registry
136 self.use_gzip = True
137 # order in which we check the middlewares, based on vcs.backends config
138 self.check_middlewares = config['vcs.backends']
139 self.checks = {
140 'hg': (is_hg, SimpleHg),
141 'git': (is_git, SimpleGit),
142 'svn': (is_svn, SimpleSvn),
143 }
144
145 def vcs_config(self, repo_name=None):
146 """
147 returns serialized VcsSettings
148 """
149 return VcsSettingsModel(repo=repo_name).get_ui_settings_as_config_obj()
150
151 def wrap_in_gzip_if_enabled(self, app, config):
152 if self.use_gzip:
153 app = GunzipMiddleware(app)
154 return app
134
155
135 def _get_handler_app(self, environ):
156 def _get_handler_app(self, environ):
136 app = None
157 app = None
137 if is_hg(environ):
158 log.debug('Checking vcs types in order: %r', self.check_middlewares)
138 app = SimpleHg(self.application, self.config, self.registry)
159 for vcs_type in self.check_middlewares:
139
160 vcs_check, handler = self.checks[vcs_type]
140 if is_git(environ):
161 if vcs_check(environ):
141 app = SimpleGit(self.application, self.config, self.registry)
162 log.debug(
142
163 'Found VCS Middleware to handle the request %s', handler)
143 proxy_svn = rhodecode.CONFIG.get(
164 app = handler(self.application, self.config, self.registry)
144 'rhodecode_proxy_subversion_http_requests', False)
165 break
145 if proxy_svn and is_svn(environ):
146 app = SimpleSvn(self.application, self.config, self.registry)
147
148 if app:
149 app = GunzipMiddleware(app)
150 app, _ = wrap_in_appenlight_if_enabled(
151 app, self.config, self.appenlight_client)
152
166
153 return app
167 return app
154
168
155 def __call__(self, environ, start_response):
169 def __call__(self, environ, start_response):
156 # check if we handle one of interesting protocols ?
170 # check if we handle one of interesting protocols, optionally extract
171 # specific vcsSettings and allow changes of how things are wrapped
157 vcs_handler = self._get_handler_app(environ)
172 vcs_handler = self._get_handler_app(environ)
158 if vcs_handler:
173 if vcs_handler:
174 # translate the _REPO_ID into real repo NAME for usage
175 # in middleware
176 environ['PATH_INFO'] = vcs_handler._get_by_id(environ['PATH_INFO'])
177 repo_name = vcs_handler._get_repository_name(environ)
178
179 # check for type, presence in database and on filesystem
180 if not vcs_handler.is_valid_and_existing_repo(
181 repo_name, vcs_handler.basepath, vcs_handler.SCM):
182 return HTTPNotFound()(environ, start_response)
183
184 # TODO: johbo: Needed for the Pyro4 backend and Mercurial only.
185 # Remove once we fully switched to the HTTP backend.
186 environ['REPO_NAME'] = repo_name
187
188 # register repo_name and it's config back to the handler
189 vcs_handler.repo_name = repo_name
190 vcs_handler.repo_vcs_config = self.vcs_config(repo_name)
191
192 vcs_handler = self.wrap_in_gzip_if_enabled(
193 vcs_handler, self.config)
194 vcs_handler, _ = wrap_in_appenlight_if_enabled(
195 vcs_handler, self.config, self.appenlight_client)
159 return vcs_handler(environ, start_response)
196 return vcs_handler(environ, start_response)
160
197
161 return self.application(environ, start_response)
198 return self.application(environ, start_response)
@@ -54,7 +54,7 b' def md5_safe(s):'
54 return md5(safe_str(s))
54 return md5(safe_str(s))
55
55
56
56
57 def __get_lem():
57 def __get_lem(extra_mapping=None):
58 """
58 """
59 Get language extension map based on what's inside pygments lexers
59 Get language extension map based on what's inside pygments lexers
60 """
60 """
@@ -82,7 +82,16 b' def __get_lem():'
82 desc = lx.replace('Lexer', '')
82 desc = lx.replace('Lexer', '')
83 d[ext].append(desc)
83 d[ext].append(desc)
84
84
85 return dict(d)
85 data = dict(d)
86
87 extra_mapping = extra_mapping or {}
88 if extra_mapping:
89 for k, v in extra_mapping.items():
90 if k not in data:
91 # register new mapping2lexer
92 data[k] = [v]
93
94 return data
86
95
87
96
88 def str2bool(_str):
97 def str2bool(_str):
@@ -110,7 +119,7 b' def aslist(obj, sep=None, strip=True):'
110 :param sep:
119 :param sep:
111 :param strip:
120 :param strip:
112 """
121 """
113 if isinstance(obj, (basestring)):
122 if isinstance(obj, (basestring,)):
114 lst = obj.split(sep)
123 lst = obj.split(sep)
115 if strip:
124 if strip:
116 lst = [v.strip() for v in lst]
125 lst = [v.strip() for v in lst]
@@ -1438,7 +1438,8 b' class Config(object):'
1438 return clone
1438 return clone
1439
1439
1440 def __repr__(self):
1440 def __repr__(self):
1441 return '<Config(%s values) at %s>' % (len(self._values), hex(id(self)))
1441 return '<Config(%s sections) at %s>' % (
1442 len(self._values), hex(id(self)))
1442
1443
1443 def items(self, section):
1444 def items(self, section):
1444 return self._values.get(section, {}).iteritems()
1445 return self._values.get(section, {}).iteritems()
@@ -98,7 +98,7 b' class GitInMemoryCommit(base.BaseInMemor'
98 self.repository._rebuild_cache(self.repository.commit_ids)
98 self.repository._rebuild_cache(self.repository.commit_ids)
99
99
100 # invalidate parsed refs after commit
100 # invalidate parsed refs after commit
101 self.repository._parsed_refs = self.repository._get_parsed_refs()
101 self.repository._refs = self.repository._get_refs()
102 self.repository.branches = self.repository._get_branches()
102 self.repository.branches = self.repository._get_branches()
103 tip = self.repository.get_commit()
103 tip = self.repository.get_commit()
104 self.reset()
104 self.reset()
@@ -205,12 +205,6 b' class GitRepository(BaseRepository):'
205 return []
205 return []
206 return output.splitlines()
206 return output.splitlines()
207
207
208 def _get_all_commit_ids2(self):
209 # alternate implementation
210 includes = [x[1][0] for x in self._parsed_refs.iteritems()
211 if x[1][1] != 'T']
212 return [c.commit.id for c in self._remote.get_walker(include=includes)]
213
214 def _get_commit_id(self, commit_id_or_idx):
208 def _get_commit_id(self, commit_id_or_idx):
215 def is_null(value):
209 def is_null(value):
216 return len(value) == commit_id_or_idx.count('0')
210 return len(value) == commit_id_or_idx.count('0')
@@ -232,17 +226,23 b' class GitRepository(BaseRepository):'
232 raise CommitDoesNotExistError(msg)
226 raise CommitDoesNotExistError(msg)
233
227
234 elif is_bstr:
228 elif is_bstr:
235 # get by branch/tag name
229 # check full path ref, eg. refs/heads/master
236 ref_id = self._parsed_refs.get(commit_id_or_idx)
230 ref_id = self._refs.get(commit_id_or_idx)
237 if ref_id: # and ref_id[1] in ['H', 'RH', 'T']:
231 if ref_id:
238 return ref_id[0]
232 return ref_id
239
233
240 tag_ids = self.tags.values()
234 # check branch name
241 # maybe it's a tag ? we don't have them in self.commit_ids
235 branch_ids = self.branches.values()
242 if commit_id_or_idx in tag_ids:
236 ref_id = self._refs.get('refs/heads/%s' % commit_id_or_idx)
243 return commit_id_or_idx
237 if ref_id:
238 return ref_id
244
239
245 elif (not SHA_PATTERN.match(commit_id_or_idx) or
240 # check tag name
241 ref_id = self._refs.get('refs/tags/%s' % commit_id_or_idx)
242 if ref_id:
243 return ref_id
244
245 if (not SHA_PATTERN.match(commit_id_or_idx) or
246 commit_id_or_idx not in self.commit_ids):
246 commit_id_or_idx not in self.commit_ids):
247 msg = "Commit %s does not exist for %s" % (
247 msg = "Commit %s does not exist for %s" % (
248 commit_id_or_idx, self)
248 commit_id_or_idx, self)
@@ -289,20 +289,25 b' class GitRepository(BaseRepository):'
289 description = self._remote.get_description()
289 description = self._remote.get_description()
290 return safe_unicode(description or self.DEFAULT_DESCRIPTION)
290 return safe_unicode(description or self.DEFAULT_DESCRIPTION)
291
291
292 def _get_refs_entry(self, value, reverse):
292 def _get_refs_entries(self, prefix='', reverse=False, strip_prefix=True):
293 if self.is_empty():
293 if self.is_empty():
294 return {}
294 return OrderedDict()
295
295
296 def get_name(ctx):
296 result = []
297 return ctx[0]
297 for ref, sha in self._refs.iteritems():
298 if ref.startswith(prefix):
299 ref_name = ref
300 if strip_prefix:
301 ref_name = ref[len(prefix):]
302 result.append((safe_unicode(ref_name), sha))
298
303
299 _branches = [
304 def get_name(entry):
300 (safe_unicode(x[0]), x[1][0])
305 return entry[0]
301 for x in self._parsed_refs.iteritems() if x[1][1] == value]
306
302 return OrderedDict(sorted(_branches, key=get_name, reverse=reverse))
307 return OrderedDict(sorted(result, key=get_name, reverse=reverse))
303
308
304 def _get_branches(self):
309 def _get_branches(self):
305 return self._get_refs_entry('H', False)
310 return self._get_refs_entries(prefix='refs/heads/', strip_prefix=True)
306
311
307 @LazyProperty
312 @LazyProperty
308 def branches(self):
313 def branches(self):
@@ -324,10 +329,12 b' class GitRepository(BaseRepository):'
324 return self._get_tags()
329 return self._get_tags()
325
330
326 def _get_tags(self):
331 def _get_tags(self):
327 return self._get_refs_entry('T', True)
332 return self._get_refs_entries(
333 prefix='refs/tags/', strip_prefix=True, reverse=True)
328
334
329 def tag(self, name, user, commit_id=None, message=None, date=None,
335 def tag(self, name, user, commit_id=None, message=None, date=None,
330 **kwargs):
336 **kwargs):
337 # TODO: fix this method to apply annotated tags correct with message
331 """
338 """
332 Creates and returns a tag for the given ``commit_id``.
339 Creates and returns a tag for the given ``commit_id``.
333
340
@@ -346,7 +353,7 b' class GitRepository(BaseRepository):'
346 name, commit.raw_id)
353 name, commit.raw_id)
347 self._remote.set_refs('refs/tags/%s' % name, commit._commit['id'])
354 self._remote.set_refs('refs/tags/%s' % name, commit._commit['id'])
348
355
349 self._parsed_refs = self._get_parsed_refs()
356 self._refs = self._get_refs()
350 self.tags = self._get_tags()
357 self.tags = self._get_tags()
351 return commit
358 return commit
352
359
@@ -367,24 +374,28 b' class GitRepository(BaseRepository):'
367 self._remote.get_refs_path(), 'refs', 'tags', name)
374 self._remote.get_refs_path(), 'refs', 'tags', name)
368 try:
375 try:
369 os.remove(tagpath)
376 os.remove(tagpath)
370 self._parsed_refs = self._get_parsed_refs()
377 self._refs = self._get_refs()
371 self.tags = self._get_tags()
378 self.tags = self._get_tags()
372 except OSError as e:
379 except OSError as e:
373 raise RepositoryError(e.strerror)
380 raise RepositoryError(e.strerror)
374
381
382 def _get_refs(self):
383 return self._remote.get_refs()
384
375 @LazyProperty
385 @LazyProperty
376 def _parsed_refs(self):
386 def _refs(self):
377 return self._get_parsed_refs()
387 return self._get_refs()
378
388
379 def _get_parsed_refs(self):
389 @property
380 # TODO: (oliver) who needs RH; branches?
390 def _ref_tree(self):
381 # Remote Heads were commented out, as they may overwrite local branches
391 node = tree = {}
382 # See the TODO note in rhodecode.lib.vcs.remote.git:get_refs for more
392 for ref, sha in self._refs.iteritems():
383 # details.
393 path = ref.split('/')
384 keys = [('refs/heads/', 'H'),
394 for bit in path[:-1]:
385 #('refs/remotes/origin/', 'RH'),
395 node = node.setdefault(bit, {})
386 ('refs/tags/', 'T')]
396 node[path[-1]] = sha
387 return self._remote.get_refs(keys=keys)
397 node = tree
398 return tree
388
399
389 def get_commit(self, commit_id=None, commit_idx=None, pre_load=None):
400 def get_commit(self, commit_id=None, commit_idx=None, pre_load=None):
390 """
401 """
@@ -305,7 +305,7 b' def _get_proxy_method(proxy, name):'
305 try:
305 try:
306 return getattr(proxy, name)
306 return getattr(proxy, name)
307 except CommunicationError:
307 except CommunicationError:
308 raise CommunicationError(
308 raise exceptions.PyroVCSCommunicationError(
309 'Unable to connect to remote pyro server %s' % proxy)
309 'Unable to connect to remote pyro server %s' % proxy)
310
310
311
311
@@ -36,6 +36,7 b' import urllib2'
36 import urlparse
36 import urlparse
37 import uuid
37 import uuid
38
38
39 import pycurl
39 import msgpack
40 import msgpack
40 import requests
41 import requests
41
42
@@ -172,7 +173,11 b' class RemoteObject(object):'
172
173
173
174
174 def _remote_call(url, payload, exceptions_map, session):
175 def _remote_call(url, payload, exceptions_map, session):
176 try:
175 response = session.post(url, data=msgpack.packb(payload))
177 response = session.post(url, data=msgpack.packb(payload))
178 except pycurl.error as e:
179 raise exceptions.HttpVCSCommunicationError(e)
180
176 response = msgpack.unpackb(response.content)
181 response = msgpack.unpackb(response.content)
177 error = response.get('error')
182 error = response.get('error')
178 if error:
183 if error:
@@ -24,6 +24,19 b' Custom vcs exceptions module.'
24
24
25 import functools
25 import functools
26 import urllib2
26 import urllib2
27 import pycurl
28 from Pyro4.errors import CommunicationError
29
30 class VCSCommunicationError(Exception):
31 pass
32
33
34 class PyroVCSCommunicationError(VCSCommunicationError):
35 pass
36
37
38 class HttpVCSCommunicationError(VCSCommunicationError):
39 pass
27
40
28
41
29 class VCSError(Exception):
42 class VCSError(Exception):
@@ -161,7 +174,6 b' def map_vcs_exceptions(func):'
161 try:
174 try:
162 return func(*args, **kwargs)
175 return func(*args, **kwargs)
163 except Exception as e:
176 except Exception as e:
164
165 # The error middleware adds information if it finds
177 # The error middleware adds information if it finds
166 # __traceback_info__ in a frame object. This way the remote
178 # __traceback_info__ in a frame object. This way the remote
167 # traceback information is made available in error reports.
179 # traceback information is made available in error reports.
@@ -182,5 +194,4 b' def map_vcs_exceptions(func):'
182 raise _EXCEPTION_MAP[kind](*e.args)
194 raise _EXCEPTION_MAP[kind](*e.args)
183 else:
195 else:
184 raise
196 raise
185
186 return wrapper
197 return wrapper
@@ -27,6 +27,7 b' import stat'
27
27
28 from zope.cachedescriptors.property import Lazy as LazyProperty
28 from zope.cachedescriptors.property import Lazy as LazyProperty
29
29
30 from rhodecode.config.conf import LANGUAGES_EXTENSIONS_MAP
30 from rhodecode.lib.utils import safe_unicode, safe_str
31 from rhodecode.lib.utils import safe_unicode, safe_str
31 from rhodecode.lib.utils2 import md5
32 from rhodecode.lib.utils2 import md5
32 from rhodecode.lib.vcs import path as vcspath
33 from rhodecode.lib.vcs import path as vcspath
@@ -435,11 +436,26 b' class FileNode(Node):'
435 content, name and mimetype.
436 content, name and mimetype.
436 """
437 """
437 from pygments import lexers
438 from pygments import lexers
439
440 lexer = None
438 try:
441 try:
439 lexer = lexers.guess_lexer_for_filename(self.name, self.content, stripnl=False)
442 lexer = lexers.guess_lexer_for_filename(
443 self.name, self.content, stripnl=False)
440 except lexers.ClassNotFound:
444 except lexers.ClassNotFound:
445 lexer = None
446
447 # try our EXTENSION_MAP
448 if not lexer:
449 try:
450 lexer_class = LANGUAGES_EXTENSIONS_MAP.get(self.extension)
451 if lexer_class:
452 lexer = lexers.get_lexer_by_name(lexer_class[0])
453 except lexers.ClassNotFound:
454 lexer = None
455
456 if not lexer:
441 lexer = lexers.TextLexer(stripnl=False)
457 lexer = lexers.TextLexer(stripnl=False)
442 # returns first alias
458
443 return lexer
459 return lexer
444
460
445 @LazyProperty
461 @LazyProperty
@@ -2036,6 +2036,8 b' class RepoGroup(Base, BaseModel):'
2036 users_group_to_perm = relationship('UserGroupRepoGroupToPerm', cascade='all')
2036 users_group_to_perm = relationship('UserGroupRepoGroupToPerm', cascade='all')
2037 parent_group = relationship('RepoGroup', remote_side=group_id)
2037 parent_group = relationship('RepoGroup', remote_side=group_id)
2038 user = relationship('User')
2038 user = relationship('User')
2039 integrations = relationship('Integration',
2040 cascade="all, delete, delete-orphan")
2039
2041
2040 def __init__(self, group_name='', parent_group=None):
2042 def __init__(self, group_name='', parent_group=None):
2041 self.group_name = group_name
2043 self.group_name = group_name
@@ -3481,6 +3483,8 b' class Integration(Base, BaseModel):'
3481 integration_type = Column('integration_type', String(255))
3483 integration_type = Column('integration_type', String(255))
3482 enabled = Column('enabled', Boolean(), nullable=False)
3484 enabled = Column('enabled', Boolean(), nullable=False)
3483 name = Column('name', String(255), nullable=False)
3485 name = Column('name', String(255), nullable=False)
3486 child_repos_only = Column('child_repos_only', Boolean(), nullable=False,
3487 default=False)
3484
3488
3485 settings = Column(
3489 settings = Column(
3486 'settings_json', MutationObj.as_mutable(
3490 'settings_json', MutationObj.as_mutable(
@@ -3490,10 +3494,23 b' class Integration(Base, BaseModel):'
3490 nullable=True, unique=None, default=None)
3494 nullable=True, unique=None, default=None)
3491 repo = relationship('Repository', lazy='joined')
3495 repo = relationship('Repository', lazy='joined')
3492
3496
3493 def __repr__(self):
3497 repo_group_id = Column(
3498 'repo_group_id', Integer(), ForeignKey('groups.group_id'),
3499 nullable=True, unique=None, default=None)
3500 repo_group = relationship('RepoGroup', lazy='joined')
3501
3502 @property
3503 def scope(self):
3494 if self.repo:
3504 if self.repo:
3495 scope = 'repo=%r' % self.repo
3505 return repr(self.repo)
3506 if self.repo_group:
3507 if self.child_repos_only:
3508 return repr(self.repo_group) + ' (child repos only)'
3496 else:
3509 else:
3497 scope = 'global'
3510 return repr(self.repo_group) + ' (recursive)'
3498
3511 if self.child_repos_only:
3499 return '<Integration(%r, %r)>' % (self.integration_type, scope)
3512 return 'root_repos'
3513 return 'global'
3514
3515 def __repr__(self):
3516 return '<Integration(%r, %r)>' % (self.integration_type, self.scope)
@@ -102,20 +102,6 b' def LoginForm():'
102 return _LoginForm
102 return _LoginForm
103
103
104
104
105 def PasswordChangeForm(username):
106 class _PasswordChangeForm(formencode.Schema):
107 allow_extra_fields = True
108 filter_extra_fields = True
109
110 current_password = v.ValidOldPassword(username)(not_empty=True)
111 new_password = All(v.ValidPassword(), v.UnicodeString(strip=False, min=6))
112 new_password_confirmation = All(v.ValidPassword(), v.UnicodeString(strip=False, min=6))
113
114 chained_validators = [v.ValidPasswordsMatch('new_password',
115 'new_password_confirmation')]
116 return _PasswordChangeForm
117
118
119 def UserForm(edit=False, available_languages=[], old_data={}):
105 def UserForm(edit=False, available_languages=[], old_data={}):
120 class _UserForm(formencode.Schema):
106 class _UserForm(formencode.Schema):
121 allow_extra_fields = True
107 allow_extra_fields = True
@@ -403,6 +389,9 b' class _BaseVcsSettingsForm(formencode.Sc'
403 rhodecode_use_outdated_comments = v.StringBoolean(if_missing=False)
389 rhodecode_use_outdated_comments = v.StringBoolean(if_missing=False)
404 rhodecode_hg_use_rebase_for_merging = v.StringBoolean(if_missing=False)
390 rhodecode_hg_use_rebase_for_merging = v.StringBoolean(if_missing=False)
405
391
392 vcs_svn_proxy_http_requests_enabled = v.StringBoolean(if_missing=False)
393 vcs_svn_proxy_http_server_url = v.UnicodeString(strip=True, if_missing=None)
394
406
395
407 def ApplicationUiSettingsForm():
396 def ApplicationUiSettingsForm():
408 class _ApplicationUiSettingsForm(_BaseVcsSettingsForm):
397 class _ApplicationUiSettingsForm(_BaseVcsSettingsForm):
@@ -435,11 +424,6 b' def LabsSettingsForm():'
435 allow_extra_fields = True
424 allow_extra_fields = True
436 filter_extra_fields = False
425 filter_extra_fields = False
437
426
438 rhodecode_proxy_subversion_http_requests = v.StringBoolean(
439 if_missing=False)
440 rhodecode_subversion_http_server_url = v.UnicodeString(
441 strip=True, if_missing=None)
442
443 return _LabSettingsForm
427 return _LabSettingsForm
444
428
445
429
@@ -29,7 +29,7 b' import traceback'
29
29
30 from pylons import tmpl_context as c
30 from pylons import tmpl_context as c
31 from pylons.i18n.translation import _, ungettext
31 from pylons.i18n.translation import _, ungettext
32 from sqlalchemy import or_
32 from sqlalchemy import or_, and_
33 from sqlalchemy.sql.expression import false, true
33 from sqlalchemy.sql.expression import false, true
34 from mako import exceptions
34 from mako import exceptions
35
35
@@ -39,7 +39,7 b' from rhodecode.lib import helpers as h'
39 from rhodecode.lib.caching_query import FromCache
39 from rhodecode.lib.caching_query import FromCache
40 from rhodecode.lib.utils import PartialRenderer
40 from rhodecode.lib.utils import PartialRenderer
41 from rhodecode.model import BaseModel
41 from rhodecode.model import BaseModel
42 from rhodecode.model.db import Integration, User
42 from rhodecode.model.db import Integration, User, Repository, RepoGroup
43 from rhodecode.model.meta import Session
43 from rhodecode.model.meta import Session
44 from rhodecode.integrations import integration_type_registry
44 from rhodecode.integrations import integration_type_registry
45 from rhodecode.integrations.types.base import IntegrationTypeBase
45 from rhodecode.integrations.types.base import IntegrationTypeBase
@@ -61,28 +61,35 b' class IntegrationModel(BaseModel):'
61 raise Exception('integration must be int, long or Instance'
61 raise Exception('integration must be int, long or Instance'
62 ' of Integration got %s' % type(integration))
62 ' of Integration got %s' % type(integration))
63
63
64 def create(self, IntegrationType, enabled, name, settings, repo=None):
64 def create(self, IntegrationType, name, enabled, repo, repo_group,
65 child_repos_only, settings):
65 """ Create an IntegrationType integration """
66 """ Create an IntegrationType integration """
66 integration = Integration()
67 integration = Integration()
67 integration.integration_type = IntegrationType.key
68 integration.integration_type = IntegrationType.key
68 integration.settings = {}
69 integration.repo = repo
70 integration.enabled = enabled
71 integration.name = name
72
73 self.sa.add(integration)
69 self.sa.add(integration)
70 self.update_integration(integration, name, enabled, repo, repo_group,
71 child_repos_only, settings)
74 self.sa.commit()
72 self.sa.commit()
75 return integration
73 return integration
76
74
75 def update_integration(self, integration, name, enabled, repo, repo_group,
76 child_repos_only, settings):
77 integration = self.__get_integration(integration)
78
79 integration.repo = repo
80 integration.repo_group = repo_group
81 integration.child_repos_only = child_repos_only
82 integration.name = name
83 integration.enabled = enabled
84 integration.settings = settings
85
86 return integration
87
77 def delete(self, integration):
88 def delete(self, integration):
78 try:
79 integration = self.__get_integration(integration)
89 integration = self.__get_integration(integration)
80 if integration:
90 if integration:
81 self.sa.delete(integration)
91 self.sa.delete(integration)
82 return True
92 return True
83 except Exception:
84 log.error(traceback.format_exc())
85 raise
86 return False
93 return False
87
94
88 def get_integration_handler(self, integration):
95 def get_integration_handler(self, integration):
@@ -100,33 +107,116 b' class IntegrationModel(BaseModel):'
100 if handler:
107 if handler:
101 handler.send_event(event)
108 handler.send_event(event)
102
109
103 def get_integrations(self, repo=None):
110 def get_integrations(self, scope, IntegrationType=None):
104 if repo:
111 """
105 return self.sa.query(Integration).filter(
112 Return integrations for a scope, which must be one of:
106 Integration.repo_id==repo.repo_id).all()
113
114 'all' - every integration, global/repogroup/repo
115 'global' - global integrations only
116 <Repository> instance - integrations for this repo only
117 <RepoGroup> instance - integrations for this repogroup only
118 """
107
119
120 if isinstance(scope, Repository):
121 query = self.sa.query(Integration).filter(
122 Integration.repo==scope)
123 elif isinstance(scope, RepoGroup):
124 query = self.sa.query(Integration).filter(
125 Integration.repo_group==scope)
126 elif scope == 'global':
108 # global integrations
127 # global integrations
109 return self.sa.query(Integration).filter(
128 query = self.sa.query(Integration).filter(
110 Integration.repo_id==None).all()
129 and_(Integration.repo_id==None, Integration.repo_group_id==None)
130 )
131 elif scope == 'root-repos':
132 query = self.sa.query(Integration).filter(
133 and_(Integration.repo_id==None,
134 Integration.repo_group_id==None,
135 Integration.child_repos_only==True)
136 )
137 elif scope == 'all':
138 query = self.sa.query(Integration)
139 else:
140 raise Exception(
141 "invalid `scope`, must be one of: "
142 "['global', 'all', <Repository>, <RepoGroup>]")
143
144 if IntegrationType is not None:
145 query = query.filter(
146 Integration.integration_type==IntegrationType.key)
147
148 result = []
149 for integration in query.all():
150 IntType = integration_type_registry.get(integration.integration_type)
151 result.append((IntType, integration))
152 return result
111
153
112 def get_for_event(self, event, cache=False):
154 def get_for_event(self, event, cache=False):
113 """
155 """
114 Get integrations that match an event
156 Get integrations that match an event
115 """
157 """
116 query = self.sa.query(Integration).filter(Integration.enabled==True)
158 query = self.sa.query(
159 Integration
160 ).filter(
161 Integration.enabled==True
162 )
163
164 global_integrations_filter = and_(
165 Integration.repo_id==None,
166 Integration.repo_group_id==None,
167 Integration.child_repos_only==False,
168 )
169
170 if isinstance(event, events.RepoEvent):
171 root_repos_integrations_filter = and_(
172 Integration.repo_id==None,
173 Integration.repo_group_id==None,
174 Integration.child_repos_only==True,
175 )
176
177 clauses = [
178 global_integrations_filter,
179 ]
117
180
118 if isinstance(event, events.RepoEvent): # global + repo integrations
181 # repo integrations
119 query = query.filter(
182 if event.repo.repo_id: # pre create events dont have a repo_id yet
120 or_(Integration.repo_id==None,
183 clauses.append(
121 Integration.repo_id==event.repo.repo_id))
184 Integration.repo_id==event.repo.repo_id
185 )
186
187 if event.repo.group:
188 clauses.append(
189 and_(
190 Integration.repo_group_id==event.repo.group.group_id,
191 Integration.child_repos_only==True
192 )
193 )
194 # repo group cascade to kids
195 clauses.append(
196 and_(
197 Integration.repo_group_id.in_(
198 [group.group_id for group in
199 event.repo.groups_with_parents]
200 ),
201 Integration.child_repos_only==False
202 )
203 )
204
205
206 if not event.repo.group: # root repo
207 clauses.append(root_repos_integrations_filter)
208
209 query = query.filter(or_(*clauses))
210
122 if cache:
211 if cache:
123 query = query.options(FromCache(
212 query = query.options(FromCache(
124 "sql_cache_short",
213 "sql_cache_short",
125 "get_enabled_repo_integrations_%i" % event.repo.repo_id))
214 "get_enabled_repo_integrations_%i" % event.repo.repo_id))
126 else: # only global integrations
215 else: # only global integrations
127 query = query.filter(Integration.repo_id==None)
216 query = query.filter(global_integrations_filter)
128 if cache:
217 if cache:
129 query = query.options(FromCache(
218 query = query.options(FromCache(
130 "sql_cache_short", "get_enabled_global_integrations"))
219 "sql_cache_short", "get_enabled_global_integrations"))
131
220
132 return query.all()
221 result = query.all()
222 return result No newline at end of file
@@ -40,11 +40,13 b' from rhodecode.lib.auth import HasUserGr'
40 from rhodecode.lib.caching_query import FromCache
40 from rhodecode.lib.caching_query import FromCache
41 from rhodecode.lib.exceptions import AttachedForksError
41 from rhodecode.lib.exceptions import AttachedForksError
42 from rhodecode.lib.hooks_base import log_delete_repository
42 from rhodecode.lib.hooks_base import log_delete_repository
43 from rhodecode.lib.markup_renderer import MarkupRenderer
43 from rhodecode.lib.utils import make_db_config
44 from rhodecode.lib.utils import make_db_config
44 from rhodecode.lib.utils2 import (
45 from rhodecode.lib.utils2 import (
45 safe_str, safe_unicode, remove_prefix, obfuscate_url_pw,
46 safe_str, safe_unicode, remove_prefix, obfuscate_url_pw,
46 get_current_rhodecode_user, safe_int, datetime_to_time, action_logger_generic)
47 get_current_rhodecode_user, safe_int, datetime_to_time, action_logger_generic)
47 from rhodecode.lib.vcs.backends import get_backend
48 from rhodecode.lib.vcs.backends import get_backend
49 from rhodecode.lib.vcs.exceptions import NodeDoesNotExistError
48 from rhodecode.model import BaseModel
50 from rhodecode.model import BaseModel
49 from rhodecode.model.db import (
51 from rhodecode.model.db import (
50 Repository, UserRepoToPerm, UserGroupRepoToPerm, UserRepoGroupToPerm,
52 Repository, UserRepoToPerm, UserGroupRepoToPerm, UserRepoGroupToPerm,
@@ -933,3 +935,119 b' class RepoModel(BaseModel):'
933
935
934 if os.path.isdir(rm_path):
936 if os.path.isdir(rm_path):
935 shutil.move(rm_path, os.path.join(self.repos_path, _d))
937 shutil.move(rm_path, os.path.join(self.repos_path, _d))
938
939
940 class ReadmeFinder:
941 """
942 Utility which knows how to find a readme for a specific commit.
943
944 The main idea is that this is a configurable algorithm. When creating an
945 instance you can define parameters, currently only the `default_renderer`.
946 Based on this configuration the method :meth:`search` behaves slightly
947 different.
948 """
949
950 readme_re = re.compile(r'^readme(\.[^\.]+)?$', re.IGNORECASE)
951 path_re = re.compile(r'^docs?', re.IGNORECASE)
952
953 default_priorities = {
954 None: 0,
955 '.text': 2,
956 '.txt': 3,
957 '.rst': 1,
958 '.rest': 2,
959 '.md': 1,
960 '.mkdn': 2,
961 '.mdown': 3,
962 '.markdown': 4,
963 }
964
965 path_priority = {
966 'doc': 0,
967 'docs': 1,
968 }
969
970 FALLBACK_PRIORITY = 99
971
972 RENDERER_TO_EXTENSION = {
973 'rst': ['.rst', '.rest'],
974 'markdown': ['.md', 'mkdn', '.mdown', '.markdown'],
975 }
976
977 def __init__(self, default_renderer=None):
978 self._default_renderer = default_renderer
979 self._renderer_extensions = self.RENDERER_TO_EXTENSION.get(
980 default_renderer, [])
981
982 def search(self, commit, path='/'):
983 """
984 Find a readme in the given `commit`.
985 """
986 nodes = commit.get_nodes(path)
987 matches = self._match_readmes(nodes)
988 matches = self._sort_according_to_priority(matches)
989 if matches:
990 return matches[0].node
991
992 paths = self._match_paths(nodes)
993 paths = self._sort_paths_according_to_priority(paths)
994 for path in paths:
995 match = self.search(commit, path=path)
996 if match:
997 return match
998
999 return None
1000
1001 def _match_readmes(self, nodes):
1002 for node in nodes:
1003 if not node.is_file():
1004 continue
1005 path = node.path.rsplit('/', 1)[-1]
1006 match = self.readme_re.match(path)
1007 if match:
1008 extension = match.group(1)
1009 yield ReadmeMatch(node, match, self._priority(extension))
1010
1011 def _match_paths(self, nodes):
1012 for node in nodes:
1013 if not node.is_dir():
1014 continue
1015 match = self.path_re.match(node.path)
1016 if match:
1017 yield node.path
1018
1019 def _priority(self, extension):
1020 renderer_priority = (
1021 0 if extension in self._renderer_extensions else 1)
1022 extension_priority = self.default_priorities.get(
1023 extension, self.FALLBACK_PRIORITY)
1024 return (renderer_priority, extension_priority)
1025
1026 def _sort_according_to_priority(self, matches):
1027
1028 def priority_and_path(match):
1029 return (match.priority, match.path)
1030
1031 return sorted(matches, key=priority_and_path)
1032
1033 def _sort_paths_according_to_priority(self, paths):
1034
1035 def priority_and_path(path):
1036 return (self.path_priority.get(path, self.FALLBACK_PRIORITY), path)
1037
1038 return sorted(paths, key=priority_and_path)
1039
1040
1041 class ReadmeMatch:
1042
1043 def __init__(self, node, match, priority):
1044 self.node = node
1045 self._match = match
1046 self.priority = priority
1047
1048 @property
1049 def path(self):
1050 return self.node.path
1051
1052 def __repr__(self):
1053 return '<ReadmeMatch {} priority={}'.format(self.path, self.priority)
@@ -469,6 +469,8 b' class RepoGroupModel(BaseModel):'
469
469
470 def delete(self, repo_group, force_delete=False, fs_remove=True):
470 def delete(self, repo_group, force_delete=False, fs_remove=True):
471 repo_group = self._get_repo_group(repo_group)
471 repo_group = self._get_repo_group(repo_group)
472 if not repo_group:
473 return False
472 try:
474 try:
473 self.sa.delete(repo_group)
475 self.sa.delete(repo_group)
474 if fs_remove:
476 if fs_remove:
@@ -478,6 +480,7 b' class RepoGroupModel(BaseModel):'
478
480
479 # Trigger delete event.
481 # Trigger delete event.
480 events.trigger(events.RepoGroupDeleteEvent(repo_group))
482 events.trigger(events.RepoGroupDeleteEvent(repo_group))
483 return True
481
484
482 except Exception:
485 except Exception:
483 log.error('Error removing repo_group %s', repo_group)
486 log.error('Error removing repo_group %s', repo_group)
@@ -24,9 +24,9 b' from collections import namedtuple'
24 from functools import wraps
24 from functools import wraps
25
25
26 from rhodecode.lib import caches
26 from rhodecode.lib import caches
27 from rhodecode.lib.caching_query import FromCache
28 from rhodecode.lib.utils2 import (
27 from rhodecode.lib.utils2 import (
29 Optional, AttributeDict, safe_str, remove_prefix, str2bool)
28 Optional, AttributeDict, safe_str, remove_prefix, str2bool)
29 from rhodecode.lib.vcs.backends import base
30 from rhodecode.model import BaseModel
30 from rhodecode.model import BaseModel
31 from rhodecode.model.db import (
31 from rhodecode.model.db import (
32 RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, RhodeCodeSetting)
32 RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, RhodeCodeSetting)
@@ -402,15 +402,25 b' class VcsSettingsModel(object):'
402
402
403 INHERIT_SETTINGS = 'inherit_vcs_settings'
403 INHERIT_SETTINGS = 'inherit_vcs_settings'
404 GENERAL_SETTINGS = (
404 GENERAL_SETTINGS = (
405 'use_outdated_comments', 'pr_merge_enabled',
405 'use_outdated_comments',
406 'pr_merge_enabled',
406 'hg_use_rebase_for_merging')
407 'hg_use_rebase_for_merging')
408
407 HOOKS_SETTINGS = (
409 HOOKS_SETTINGS = (
408 ('hooks', 'changegroup.repo_size'),
410 ('hooks', 'changegroup.repo_size'),
409 ('hooks', 'changegroup.push_logger'),
411 ('hooks', 'changegroup.push_logger'),
410 ('hooks', 'outgoing.pull_logger'))
412 ('hooks', 'outgoing.pull_logger'))
411 HG_SETTINGS = (
413 HG_SETTINGS = (
412 ('extensions', 'largefiles'), ('phases', 'publish'))
414 ('extensions', 'largefiles'),
413 GLOBAL_HG_SETTINGS = HG_SETTINGS + (('extensions', 'hgsubversion'), )
415 ('phases', 'publish'))
416 GLOBAL_HG_SETTINGS = (
417 ('extensions', 'largefiles'),
418 ('phases', 'publish'),
419 ('extensions', 'hgsubversion'))
420 GLOBAL_SVN_SETTINGS = (
421 ('vcs_svn_proxy', 'http_requests_enabled'),
422 ('vcs_svn_proxy', 'http_server_url'))
423
414 SVN_BRANCH_SECTION = 'vcs_svn_branch'
424 SVN_BRANCH_SECTION = 'vcs_svn_branch'
415 SVN_TAG_SECTION = 'vcs_svn_tag'
425 SVN_TAG_SECTION = 'vcs_svn_tag'
416 SSL_SETTING = ('web', 'push_ssl')
426 SSL_SETTING = ('web', 'push_ssl')
@@ -520,13 +530,10 b' class VcsSettingsModel(object):'
520 def create_repo_svn_settings(self, data):
530 def create_repo_svn_settings(self, data):
521 return self._create_svn_settings(self.repo_settings, data)
531 return self._create_svn_settings(self.repo_settings, data)
522
532
523 def create_global_svn_settings(self, data):
524 return self._create_svn_settings(self.global_settings, data)
525
526 @assert_repo_settings
533 @assert_repo_settings
527 def create_or_update_repo_hg_settings(self, data):
534 def create_or_update_repo_hg_settings(self, data):
528 largefiles, phases = self.HG_SETTINGS
535 largefiles, phases = self.HG_SETTINGS
529 largefiles_key, phases_key = self._get_hg_settings(
536 largefiles_key, phases_key = self._get_settings_keys(
530 self.HG_SETTINGS, data)
537 self.HG_SETTINGS, data)
531 self._create_or_update_ui(
538 self._create_or_update_ui(
532 self.repo_settings, *largefiles, value='',
539 self.repo_settings, *largefiles, value='',
@@ -535,8 +542,8 b' class VcsSettingsModel(object):'
535 self.repo_settings, *phases, value=safe_str(data[phases_key]))
542 self.repo_settings, *phases, value=safe_str(data[phases_key]))
536
543
537 def create_or_update_global_hg_settings(self, data):
544 def create_or_update_global_hg_settings(self, data):
538 largefiles, phases, subversion = self.GLOBAL_HG_SETTINGS
545 largefiles, phases, hgsubversion = self.GLOBAL_HG_SETTINGS
539 largefiles_key, phases_key, subversion_key = self._get_hg_settings(
546 largefiles_key, phases_key, subversion_key = self._get_settings_keys(
540 self.GLOBAL_HG_SETTINGS, data)
547 self.GLOBAL_HG_SETTINGS, data)
541 self._create_or_update_ui(
548 self._create_or_update_ui(
542 self.global_settings, *largefiles, value='',
549 self.global_settings, *largefiles, value='',
@@ -544,7 +551,22 b' class VcsSettingsModel(object):'
544 self._create_or_update_ui(
551 self._create_or_update_ui(
545 self.global_settings, *phases, value=safe_str(data[phases_key]))
552 self.global_settings, *phases, value=safe_str(data[phases_key]))
546 self._create_or_update_ui(
553 self._create_or_update_ui(
547 self.global_settings, *subversion, active=data[subversion_key])
554 self.global_settings, *hgsubversion, active=data[subversion_key])
555
556 def create_or_update_global_svn_settings(self, data):
557 # branch/tags patterns
558 self._create_svn_settings(self.global_settings, data)
559
560 http_requests_enabled, http_server_url = self.GLOBAL_SVN_SETTINGS
561 http_requests_enabled_key, http_server_url_key = self._get_settings_keys(
562 self.GLOBAL_SVN_SETTINGS, data)
563
564 self._create_or_update_ui(
565 self.global_settings, *http_requests_enabled,
566 value=safe_str(data[http_requests_enabled_key]))
567 self._create_or_update_ui(
568 self.global_settings, *http_server_url,
569 value=data[http_server_url_key])
548
570
549 def update_global_ssl_setting(self, value):
571 def update_global_ssl_setting(self, value):
550 self._create_or_update_ui(
572 self._create_or_update_ui(
@@ -582,6 +604,16 b' class VcsSettingsModel(object):'
582 def get_global_ui_settings(self, section=None, key=None):
604 def get_global_ui_settings(self, section=None, key=None):
583 return self.global_settings.get_ui(section, key)
605 return self.global_settings.get_ui(section, key)
584
606
607 def get_ui_settings_as_config_obj(self, section=None, key=None):
608 config = base.Config()
609
610 ui_settings = self.get_ui_settings(section=section, key=key)
611
612 for entry in ui_settings:
613 config.set(entry.section, entry.key, entry.value)
614
615 return config
616
585 def get_ui_settings(self, section=None, key=None):
617 def get_ui_settings(self, section=None, key=None):
586 if not self.repo_settings or self.inherit_global_settings:
618 if not self.repo_settings or self.inherit_global_settings:
587 return self.get_global_ui_settings(section, key)
619 return self.get_global_ui_settings(section, key)
@@ -689,7 +721,7 b' class VcsSettingsModel(object):'
689 name, data[data_key], 'bool')
721 name, data[data_key], 'bool')
690 Session().add(setting)
722 Session().add(setting)
691
723
692 def _get_hg_settings(self, settings, data):
724 def _get_settings_keys(self, settings, data):
693 data_keys = [self._get_form_ui_key(*s) for s in settings]
725 data_keys = [self._get_form_ui_key(*s) for s in settings]
694 for data_key in data_keys:
726 for data_key in data_keys:
695 if data_key not in data:
727 if data_key not in data:
@@ -147,7 +147,6 b' class UserModel(BaseModel):'
147 # cleanups, my_account password change form
147 # cleanups, my_account password change form
148 kwargs.pop('current_password', None)
148 kwargs.pop('current_password', None)
149 kwargs.pop('new_password', None)
149 kwargs.pop('new_password', None)
150 kwargs.pop('new_password_confirmation', None)
151
150
152 # cleanups, user edit password change form
151 # cleanups, user edit password change form
153 kwargs.pop('password_confirmation', None)
152 kwargs.pop('password_confirmation', None)
@@ -315,6 +314,7 b' class UserModel(BaseModel):'
315 new_user.update_userdata(force_password_change=True)
314 new_user.update_userdata(force_password_change=True)
316 if language:
315 if language:
317 new_user.update_userdata(language=language)
316 new_user.update_userdata(language=language)
317 new_user.update_userdata(notification_status=True)
318
318
319 self.sa.add(new_user)
319 self.sa.add(new_user)
320
320
@@ -20,6 +20,8 b''
20
20
21 import colander
21 import colander
22
22
23 from rhodecode.model.db import User, UserGroup
24
23
25
24 class GroupNameType(colander.String):
26 class GroupNameType(colander.String):
25 SEPARATOR = '/'
27 SEPARATOR = '/'
@@ -32,3 +34,72 b' class GroupNameType(colander.String):'
32 path = path.split(self.SEPARATOR)
34 path = path.split(self.SEPARATOR)
33 path = [item for item in path if item]
35 path = [item for item in path if item]
34 return self.SEPARATOR.join(path)
36 return self.SEPARATOR.join(path)
37
38
39 class UserOrUserGroupType(colander.SchemaType):
40 """ colander Schema type for valid rhodecode user and/or usergroup """
41 scopes = ('user', 'usergroup')
42
43 def __init__(self):
44 self.users = 'user' in self.scopes
45 self.usergroups = 'usergroup' in self.scopes
46
47 def serialize(self, node, appstruct):
48 if appstruct is colander.null:
49 return colander.null
50
51 if self.users:
52 if isinstance(appstruct, User):
53 if self.usergroups:
54 return 'user:%s' % appstruct.username
55 return appstruct.username
56
57 if self.usergroups:
58 if isinstance(appstruct, UserGroup):
59 if self.users:
60 return 'usergroup:%s' % appstruct.users_group_name
61 return appstruct.users_group_name
62
63 raise colander.Invalid(
64 node, '%s is not a valid %s' % (appstruct, ' or '.join(self.scopes)))
65
66 def deserialize(self, node, cstruct):
67 if cstruct is colander.null:
68 return colander.null
69
70 user, usergroup = None, None
71 if self.users:
72 if cstruct.startswith('user:'):
73 user = User.get_by_username(cstruct.split(':')[1])
74 else:
75 user = User.get_by_username(cstruct)
76
77 if self.usergroups:
78 if cstruct.startswith('usergroup:'):
79 usergroup = UserGroup.get_by_group_name(cstruct.split(':')[1])
80 else:
81 usergroup = UserGroup.get_by_group_name(cstruct)
82
83 if self.users and self.usergroups:
84 if user and usergroup:
85 raise colander.Invalid(node, (
86 '%s is both a user and usergroup, specify which '
87 'one was wanted by prepending user: or usergroup: to the '
88 'name') % cstruct)
89
90 if self.users and user:
91 return user
92
93 if self.usergroups and usergroup:
94 return usergroup
95
96 raise colander.Invalid(
97 node, '%s is not a valid %s' % (cstruct, ' or '.join(self.scopes)))
98
99
100 class UserType(UserOrUserGroupType):
101 scopes = ('user',)
102
103
104 class UserGroupType(UserOrUserGroupType):
105 scopes = ('usergroup',)
@@ -13,7 +13,3 b' def ip_addr_validator(node, value):'
13 except ValueError:
13 except ValueError:
14 msg = _(u'Please enter a valid IPv4 or IpV6 address')
14 msg = _(u'Please enter a valid IPv4 or IpV6 address')
15 raise colander.Invalid(node, msg)
15 raise colander.Invalid(node, msg)
16
17
18
19
@@ -4,24 +4,97 b''
4 <title>Error - 502 Bad Gateway</title>
4 <title>Error - 502 Bad Gateway</title>
5 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
5 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
6 <meta name="robots" content="index, nofollow"/>
6 <meta name="robots" content="index, nofollow"/>
7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8 <style>
9 * {
10 box-sizing: border-box;
11 }
12 body {
13 background:#eeeeee;
14 color: #323232;
15 font-family: "proximanovaregular","Proxima Nova Regular","Proxima Nova",sans-serif;
16 margin: 0 auto;
17 max-width: 1000px;
18 letter-spacing: .02em;
19 font-size: 13px;
20 line-height: 1.41em;
21 }
22 h1 {
23 padding: 20px 0;
24 font-size: 1.54em;
25 }
26 ul {
27 padding-left: 10px;
28 }
29 li {
30 list-style-type: none;
31 }
32 li:before {
33 content: "\2014\00A0";
34 }
35 .error_message {
36 font-weight: normal;
37 }
38 .logo-container {
39 float: left;
40 width: 150px;
41 text-align: center;
42 }
43 a {
44 color: #427cc9;
45 text-decoration: none;
46 outline: none;
47 cursor: pointer;
48 }
49 body {
50 padding: 10px;
51 padding-top: 10%;
7
52
8 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
53 }
54 .inner-column {
55 padding: 10px 30px;
56 width: 33%;
57 float: left;
58 border-right: 1px solid #dbd9da;
9
59
10 <style>body { background:#eeeeee; }</style>
60 }
61 .inner-column:last-child {
62 border: none;
63 }
64 .side {
65 min-height: 220px;
66 width: 150px;
67 float: left;
68 text-align: center;
69 border-right: 1px solid #ddd;
70 }
71 .logo {
72 width: 120px;
73 height: 150px;
74 }
75 .main {
76 padding-left: 170px;
77 }
78 @media (max-width: 979px) {
79 .inner-column {
80 width: 100%;
81 }
82 }
83 </style>
11
84
12 </head>
85 </head>
13
14 <body>
86 <body>
15
87 <div class="side">
16 <div class="wrapper error_page">
88 <img class="logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAScAAAFxCAYAAAAxjW6rAAAACXBIWXMAABcSAAAXEgFnn9JSAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAM9BJREFUeNrsnQtwHVeZ548etmX5dQMJSZx1LANhA+us5YlhSLyLpcCw2AtYXrY2Do9YKqaAhA22h0fBEtZyDdQACcieLFMkM5TkzBRJpgBLvBwYEstbE2cZEixT4RHiwtd5OInz8JUfsmRb1vb/6hy5dX373u6+fU6f7v7/qrquJV/dc7v7nH9/33e+8x0hCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEkGxRx0tAAtLqHDn577YK7xtyjoL8d14ehFCcSE20yAPis0AKkvpdrQzK1z1SvIYoXoTiREppk1YQxGeZFJ/WGL+PsrbcwuW2wAjFiaRQhJTlsypCK8gkg9K6OuSytoZ4aylOhCJkK0qo9lO0KE4kflpdLlhWRKhW0VI/E4oTiQAVD4JFtFj+u5WXpWb3cMjlHg7yklCcSGVaXOJDayg+K0uJF4PwFCcKkZieO0TsIC9FioJFcaIQkcQI1h66hBSnJNImj2XifOCapNslHHRZWHleEoqTLVaREqI2wWA1mXT93GJF64riZAQ1c7ZKnM+uJqQagy53cFAwdkVxitBFU2JESJSuIMWK4kQxIhQrilPy3LQOihGhWFGc4qalRIwYMyJJEasBkbEAe9rFKedy0zoEp/VJ8lGzgUqs8hSn5FlHa+mqkQy5gANps6rSIk5tUoxoHZGsW1X9YjJW1S8SHqtKsjh1uASJsSNCLkRZVP1JdP+SJE65EkEihARz/3YkVahsFaRO59jpHBM87D7a2tomcrkcr4X9xz7n2GR7CMRWy4kum2W0tLRMOxYvXjzt57KP6qEhUSgUiq/Dw8NicHBw6mdinUXVZ1uMyiZxQkLkRgpSjDegtVU4lo9wLKDiz6tWrSr+jN9HTT6fnzoOHTo0JWQQMBIb/a4YVexCFbc4tUi3bYPgLJtRC0gJEQSokvUTB0q03BaX+h0xgpr1g0UV29MiLnHqFAxsG7OClAumLKJE+yCOYEGk9u/fT2vL0LPCObbH4faZFKcW6bZ10m2L3hKC8CxbtmzKKsrcCJKW1Z49e6YEjLGtyOkzaU2ZECfltrXx3oZHxX5wKBFKgyVk0tKie5gsa0qXOMEy2iQYSwptDbmFCK82xYSSjpoxxKHcQ1pZ4S6lmIxNbRUacqd0iFO3dN/ougUUIgSnVayImAeWFURKzR4ylhUIJVKRqXyU4oQRtZPuG4UojYJFC8s3XdLds0qcIEycfXOBmJAKVNM1S5dgqcC7Siwl01gehQUVlTh1SHHKtFWkhAivWZwxyyoIsEOkVNCd1lVxNq/dFnE6KDIW+Ib4QISUe0ariChUwB3WFcQqo7GrJaLGIHkU4gQTYV+WxAivjBWRMK5ghsQKwfHuuMWpV0zmMqXSTYMYdXR0UIxI5GI1MDCQZjcwL62nWMXpqEhJ2gBESIkR3TRi0g3s7++fsqxSlCRaU2C8VnFKdCAcAuQWJEJsQM0CKssqwfSJydSCWMQpcS4dYkcbNmygdUQSZ1XhNWFpC/iyF8UlTomYpYMQrV27lrEjknjcQpUQ9y+0a1eLOFk7S6dKhVCQSNrdvx07dtguVNucY7Npcep2ji02WkidnZ3suYRCZQf4MqFm7WoRp33SeqLLRoiFQtXX12dLjCpUQmZYcYIKHI3rTFVQGxYSBYkQb2BJYdYv5mB6qMXAYcXJeAqBmvbfuHEjZ9kICYia9YNFFUN6AsqprDMlTj1ispicdmAdKbeNEFI7iEkpt89QfCpUSkFYcdIab4JlBAuJbhshZtw+CJVmAsedwoiT1njTpk2bRE9PD3sNIQZBEL29vV1nXCpw3Kk+RCPaLKalS5eK6z/ZzZ5CiGEwyaTZKFgV9A/CiFObrm//8Y9/3HFMx8QfCmfYWwgxjOa4bmCjJow4LdP17VevXi1ac/Wi74/D7CmEGEbX1vMmxUnLt4dLt2DBgsl/N4+LX700xt5CiGE074UY6MODihOC4S26xEnxnssaxF1PsGg8IaZB+SCNBNKOoOKkzea78sorp/387kuE+LvfH2NvIcQgmjfmSKY4zZ8/f9rPsJ5+/sxJcfzMOfYYQgyBHEONuYWBzLKg4rRY17d2u3WK/76wXnx1P4PjhKTEekqm5VSO/3Rxg/jFcyMMjhNCcYr2w4OwcuXKC343t1GI297QKL742FH2GEIMoXnJmG/ls0acvEDsafzcOIPjhBhC84ydb+ULIk7ahKlcvMlN1+JG8a3fHRPPjYyz5xCScK8xUeKkki8rWU+XNdU57t2rvLWEaEZzIqYWy0kbpWkEXtYTAuP/eOAEew8hyWWBDnHSJqfXXHNN1ffAesK6O7p3hOhHY7VZ325dY5IuGKynjftPF927vndcwh5EUsPjjz8+7ec3velNYt68eVM/P//88+Lw4cOef1/6/ijEKe5dXIKI0wJdX+L666/3J7mO5YRDuXcfeeNc9mqSeFDT+zOf+cy03919993i2muvnfr5Rz/6kbjnnns8P6P0/TYbZTrculYbzuwL/35G8ZXuHUkDx48fF9/85jervg+WU1o8xkS5ddVm69xg1u6/LawXPzh8ju4dSTywhiq5awr3ez72sY9d8P8LFy6M9Hthxi6GXVrsE6dqeU6lfHTJTPHzI2N070ii+eMf/yjuu+++4r/hkpXGnbwsp3LilEbqk/ilsazl1tc3FP/91f0FlvUlieQb3/iGb8FRlhMsJFhbOH784x8X3cK0unZBLKc2m87uv17eKL733Fnxp5NCfPHxV8X333kpeztJDLCYlKUEq6lSMNttNUGk3IFxzNB9+tOfFu9973uTJk556y2noC6dm1tfP6mtsJxgQRGSBGDtuAWmu7vbl9Xk9Vn4+0ouId26kAQJhpfy1tc0FoPjALGnhw6fYs8n1rN169YpdwyBZ4hPqbggHuW2rB577LGp47vf/e4FS0xU7CoqNC/+9UWQTTUndHwBlErBrqNhGT5zTqz/5ZgYGa8T82bUi++/61JxRXMDRwAJxYoVKwL/DQRDVxuVPvuDH/xgUcSUgCHXKSowU4dNNjWBDx6s9qbGpHemBY4gwb2786nxYknfTz36MuNPlgJLAHsT6gLxF2RKI2iMwYqnf5RZ07aR5nNLhTiB9y2cIX7y/Bnx+xP1U/Gnzy/LUQ0yBlwlCCAOZFQX+8b73lecCbv88sut+Z5eFo5buBHkhtAqUUdQXIktzhMzdW5XMOo8J4pThHzpLU3iLx+fdO8Qf3rrJbPEOxfO5ojNOBApHBAoW/KD/CwzgTCp9yGeVCkhEoKVxtyn+rScyBWz68WHFp0/HZT2Zf4TUWB2DJZJEvOCKs3EQZhgidlkGdJyKsOHF89y3LuT4vBYQzH+hPwnLG9BoJwQDHIssI0ycBwlbuvH7abdeeedRctJBb+VKGHGLs1xtca0ndD/fsss8dHHTosZDSr+NCy+suIijkwyJVCwomx0g7y+U7UkzbSSOpPizfMbxYcXnc+Q6D90ktUzyQUuntcqfyUE6kj7jBgtJ8PcetVs8ZtjI8XZO4DZu4XNDQyQxwwGeqkF4CezGS6OV0wFrk6YOBISGTEjVkqpy4c4VRqzr9MmTkPCkppOfvjim+HejYmxiUmBQoD8inc0iqtzM3jXYwIzUKWD309CItaNVXLDYAVhRg6zWn6FClPx5cSJTBJ3Fcygbl2iFq8tciylDy+qF+cmJhPbJxM0Xym+knQBqwri9cMf/nAqN6gaEDF3gJlM59ChQ4kSp8Rx85ImsWLB+VU3z42cFZ3/9yX2vBS7jUGsoYSWG0kDg5kXJ9C9tEnUT5yd+hkzeNzePL0gpuXXeiJ2EyTmlMiaJFh79zdLZ4q/+s3ZYnoBwAzeFXMaxK1vns8ekFILKk6Uy6h2TFFr/tQriV6c9jtHR9Rf4JFHHtF+km+/eKZYc+lp8S8vnzcUsUHCwuZG0bG4mb2ARAJm9fwsNUHypG3r/UoZGhqK/TtkJnX69v8wV1zSeHra77BBAuqQk/SgFv+atLDQJjLPkXZQbVMAvBczi1iQHHUNpigpFLQ5SoM6xCnxpSZ7ls+ZFn8Ctz36CtfgpQg/2ywpYYrKxfrQhz4UaqcS1BB31xEn4cVJm533xBNPGDlZpBdg37uxs+cFCqkFmMGjQCUbxHdgvahSKdUorSRZC362dvKimhuYZbfOigzx4eFhY229+/JZ4t9ePSN+9tKEqK+rmxIo5EB9/12v4yJhC1Hr4bxE6cknnwycs2TT2jpYe1GKpeVu3R4d4pRPS2dH/OnX/zosXhmfNfU7lQPFKgZ2ilOUS0hsC0bD8kLGui07qGgUJm1unTZx2rt3r/ET7/3zeWL87PRgOFw7CBSzyNOLqoxpGza5dppdOt86EtRESM3+S8h/+va1zWLkzBkKVEa46aabxJYtW7S3U26Bsx/rMAMunVZx0iKpJnKdyrE0N0N8Ykn9tAC5EihmkacHtTOJ7oW+iBuh2sHu3buL7eHVr5Vm01Ka/fv303JSmAyIl/LRN8wR73jNuakFwgrsgUeBSo846SzWpkrlomKlOz1B1fb2K1C2LEROquWkRVJNpRJ48fXl80Wu7sINObHMhQKVfDDTh40sdYFqCJXED+LkJ+HTFutJY8wpH+TN9To/PAjPPPNMrDfkn67PiZHRkxSolIL8J11BZz/Ck6QyuxSnEp5++ulYbwgC5L1/Pv+CGTwKVPzA8nBvxw0XCgd+H2S/Nr/Z4zpI0oJfjW5dINWzIiAO4kgnKAUB8tveOEMMj1KgbEbFkFSBOaQH+AH5RDZmY9uE5usTqIJdmIC4FlmN23JS3Li42RGoxgtm8JRAMc3APpAe4Ndt2rNnDy9YPC6ddstJm/UUd1DcDWbwrsudLStQqGJAgbKP7u5uX+/jZgVVTBu95XkpTlHQc21OXDP3zAUpBoCJmvaB5Sh+4jpw7by2hSJaLafAXlcYcdImrXElY3px558tEPPECAUqIfh17Wg9eaMx5hRY9ayxnIANQXE3mMG7b+VFYuL0iYoCxXIrFCdaTVUJHOwLI07apNU2y0kJ1LfflhOjYyNl/58CZQ9+K1tSnIxbTSAf9A/C1nPSssGmbXEnBVIMkAPV9ctjorlpzgX/rwrW3XXda8VbL5nFXu5B2L3iECNyC4raLCCs5YS4E0rqKpCKoMqVlAqXn6zt0r8Jm3BZem28zlMXmtfUBTbL6kI21OscnTrOAIslly5dauXg2ouZul8eF5fPm+v5nq+seA03TagwiN2iEBYkYHoJwPvf//7AlSnd69/87EBcDSSKloIlNF4F88Kcpw6WLFmic6ffwFoTtqqaNondtWuXtYPrescq+utrmsXzx094vgebJvzjgRNUopiweUcTm4EoaRSmUP5ivcnG/GBj3MkNkjQhUEdOnPR8z1f3F5hNHhNJWsNmE5rjTaEyX8OKk7awPsQpzhIqfgWqe+nssstcFMwmj4cga+2ISz30Zs6H0otaimVrk1rbUgq8BOoLV8+oKFAqm/y5kXH2frp1VtPf36/VMDMtTtqk9qc//WkibigE6n2XTVQUKKQYfOAXLzLVgG6dtSC/SXMlglAfbqXlZHvcyc1fL8uJd7z2XEWBgmv3gYdedFy9EY4EunbWoTneFPrDG+NotBooPIecJ1tTCkr52xUXiU89dlQ89NKIuLjZO40AM3l/KJwWn3cELauiEcXOJ9XEB20ESSdwW1u6dmZRJV5sFNkdO3bo/PjQHlZdjQ3vdo42HWeEfJgvf/nLiRp8EKgHXxivmAcFkKiJhE3uj0fiBukDyG/SyEVxuHU1qWKaXDu3BfWeyxoq5kEBBMo/8IsjjEORtLt0oeNNUYiTtjODWxd3XXGdAqV2GGYcisTJwMCAVu2r5Y8barUKnWOTczTpOLNFixZFspzANKsXzhaz6s6Jnx8eEfNmzfR83+lzE+Lhw6fE4ZFx8U7nbwgxCWbourq6dDbxNef4Q1yWk1br6f7770/sjf/YVXOLmeRPF4bLlltxg4RNzOYxH4qYRHNuU7GJWv44CnHSZhcm1bVTIA/qq63zfAmUyofCZp6EmGD79u3WCpP1llPSrSclUNi0EwJ1ZrzyUhbkQ33q0VeKa/MI0Qlm6TQXl6vZaIlCnPJC41q7++67L/EdAQL17bctEK+eHC67aUIpqGpAN48k3KWr2WiJKtFGm2unEjKTDoLk3/vPF4vCyHExcqZ6CgHdPJJgl25IRLABb1TipFWGUXQrDaCiJgRq+OTxistdSt08lF9hdQMSmXI47pzG2k0gkpTzqMQpEqX0wuYCdGEE6qG/uFS8tmFUvDziL8epOJvHpE2SDKspEpcuSnHSaj2hvlPSA+NuFjU3iB+sukRcNuNM1WRNBZI2EYf6u98f4+gioUFuk+Z4U15EFIOOUpy0rh5MShkVv2BXFwgUssnzRwtVUw0U3/rdMdaIIuEtCEeYNJZHidRIqYv4ix10jhZdZ/3rX/+6mDWeNrBg+AfPjIp/N3+emNXor1AEFg1/8i3zxUfeOJcjjvhm+fLlulMIlttoOWl17UCaXDs3WI/3jT9bUMyFOjF22tffIECOfChaUcQvECXNwhSZS6dDnLS6dmnIefICuVDfue414vipE74D5WCywsGL3PGFVMVAIDzS8V+n4Qtqde3uvfdesXr16tR2oCewg/Cjr4hj443i0rlzRH2d/1uEOlHYN++K5gaORDINxJkuuugi3c0sERHO2uuodqZVntOS8+RFMdXgXa8Ti5rGfS15oRVFLLGaIk8n0mE5tUjrSRtpDYy7GT5zTnxp/7D43qERcfm8eWJuhdIrXlbU5/9jTlztiB0hmnfzBai90hflB+qw/zFP2abTtUPe05o1a1LdmZoa6opLXjArN/D0cPEx0jzDv9CgRtQ/Hzwp4BVCqEh26evr010nXInTaJQfqKuItdYrgYxx2zfejArUheq7/rXizOlR8dyxY77zoRTIi3r3rheKLh/JJgaEqU/UUI7XtDj16/iybsvpnnvuyUznggWFhM3FsyfEwaMFX5UN3KiSwFinxzV62QI1wjXXCQdaFv7rEqeC0JzzlOa0gnIgUA6BetelM4sCdfRU8GoFqHDwF44VxYA5raYIyesa6zrnnA85xyd0ffgxx8W58sorE7O3XRQgDtWxqLm49OVHzxwXY+NnxdyZM0VdgHQD1C3/1xdHxcPPnxKvnzdDXDGnkSM4pSAArrlGOMA0oBbTrE7zF9/nHK26Phwzdpi5yyJ7XxoTnXtfESPn6gIteymlY/Eccetb5jM3KoVAmBAM10ykuU2mLCeAKGyHTutp5cqVRQsqayxyLJ6b3zBHPORYQH8sjASezVP8YfhMcXsqWFSc1UsPSLq85ZZbxOjoqM5m4M5pSzzUveWs1sA4uOOOOzLbAeHePfSuS4szei+fHPG1kUI5ECRXs3qsvJkOkHSpufoA0BrQ0m05QbYvc46362oAZXyzaj0pbrisqRgwxz55L548JWY1NIqZjcFvLURq17OnxK9eHnPcvEbGoxJsNd100026rSa4crfobKDewLXSnjefZetJgXQDVNh884JG8azj7qKIXRgrCiAnCqkHKA/Mige0muIa1yaioLhKCIpfTetJv5u34fVzxTHHAtp7ZEQcGzstmhobxYyGcLcZ8SikHWAyEMtgZjXUceTTalJjOvKM8DjECbzoHJ06G4BArV+/nr1TunkrL5klfvLsiDgyMho6WO62pB7408li0JwiZTdf+9rXxIMPPqi7GRRWe0B3IyZ7mdZSKgAlSGFBkUmweBjpBkg7gAV1+by5oVMOFIhFIfWgY3EzL7CFVhMW+Bpw6bSlD8RhORXHitCYVkDr6UKQtLm+ZU7R3fuX50dEYbR2KwpB84cPnxIDh0bEvJn1rHqQPatJa/pAXJYTOOocOVpP5kERu42PvVp8jcqKoiWVSaupXWjKCI/TcgKzxWQ5FVpPhnldU8NUsPyXL49GYkW5LSmmH2TCakJBuS+YOifTlhOspoO0nuIFMSjs+PLMybNFK+p1c+fULFIKZJl/8s3zmW2eTqsp8oJyNllO2pMyaT1VB0tfbmxpFmPnJopWFLZGR07UbEeggiwiLgeK3GE5DBYWz2pgTCpFVlNeipMx4ljt+aRzbNItTlmrWBAUBMtVZvnuF8ZEYexMMS9qZn1DqOzyUl4eZeDclNVkIK8JbBYRbvtko1un6BWa856yXLEgKEg52Piro2KXXFc3b9ZM8bo5c8WMhugWEDBwrsnPMlN5AFbTEtPnFledjP26rSdULFiwYIFYsWIFe7APKwp1opQVdez0WXHMeRJjW6rZEcWiVOAcGedM5oxIMczUa4rFaorTcjJiPUGcHn/88eIr8W9F3fm7Y+KepyarZUYdMFdg4wZYUR+5ah5rSYWkvb3dRAnegrSaCqbPL85eod16GhsbE01NTZy5C2hFqeUve18+LV4dO1sMmJ85d07MmVl7wFwB6+k3r54uWlIIosPtu7iJIuUXiNLWrVtNNPU153gwjnOM267Wbj2BLOxzZ8KKanCE6eI5zeKi2bO1tIf0g4+8ca5458LZvPhVWL58uRga0u5pxWY1xW05GbGewNNPPy3WrVvHHh3SikI5ll87Vs6Lo+Pi5OkzYnhsrKZqB17AgkI9Kczw4bH5+nmNjEuVAQFwQztfx2Y12SBOUOQWobHOODhw4ABLqtSAyi7HGj2I1MjZc0VXDxsszG6cIRrqoxUQBM+xCQMqIRw8flZcnZsp5s+o540Qk6kDq1evNpE6kHeOWJ/oNjyWIE4HdTfC1IJoeMaxbr40VJhKOwBw9V7juHr1dfq6E1w+bMaQ9VQExJm6u7tNNGU0G9xGy0lZT+jVbTobYWpBNMB6QtqBCphjrd7ImTOicCra1INyLp87FWHhnMbMWVNIHTAUnsgLw9ngtlpOwMiaO6YWRAsC5n//1Alxx++OTf0OcahL58wRc2fN1N4+AudrHUsqKwF0Q6kDVlhNtlhOAA609ooFSC04cuSIWLNmDZUlAhAwv96xoFAzCqVY4PJhjd4x5zrDmoJQRR00d4N4lAqgY8v1JfNnpNaawmJ2rKEzAKYAb7HhnG2aCoHVhE04W0zcaOY+RY+72oFCx1KYSqjY1DsXNhUTPdMAguBIHYBbZ8JAE4bqNSVJnECnmMx90gqD43pRuVFw+6Zc6qYmcXFzszGRgjDB3UMAPenlWzZv3iy2bdtmoqlBKU5WYFtK7pAUKK2xJwTHkelM60kPcPU6rmx2xGlC/NZx94ou9dmz4uipU8XHIXKk6ur0PhcRNFe7GSfZ7UOipaH1cwDR9hdsOXcbM9zanGO37kYQFN+9ezczxw24egiY43XqiegI00XNs7WnH5QDC47h9t3gWFVJWNNnKBMc9AkLZuhstpxAXgpUi85GEBx/4oknWJROtws9p7EYML/SeX3CsWSQeoCtPlX6Af5twpJSoM4UEjyRkvCk833GHM/zijkNVmaiw5XbsWOHiaaQzrNaaN6HLg3iBPYIA8taWJTOHCjH8rGr5hZNdbh6qMIZp0gBzPYhd+ofnjxunVAh+G2oiByIdZlKktw6RY8JgWLuk3lKFxTb4O65QSAdbl+cM34Gc5rgqSyxsZ/YLE5GEjMB1irde++9VA3DIC8K8agH8ietFCmAmT4lVqZiVEh1MbhQHQ31U5yC0ykMpBYAiBNEipgHCZxf2l+YFjRXIoUUBJRoMZWCUAkE04tCdflsbTXRDe6kAmCatdvaL5JQjwIzd21079JPuZm9qftjOE+qGiiOB6vqBsf1i3L5DCwmWE6GMLKteJrFCeVU9ploiO6dPSIFS+oJmSNVKlILmmZFXja4ViBQk2IV3v0z7M6hjGa3zf0gCXVRkRSGuNPbdTeEuk/XXHONuOqqq6gQMYL0A9SPcqcfKJDMiVpSmOVrqKuPZBurKMDMn0pRQNInEkDBJU3+Zv8wO2eoTpMQ56sOjNrcD5JSZtBYcJzunX084Ax2uHvuNXsKLCyGu4c1fHEHz71AfOqtF88qWlZvc45yM4AGZ+eK3qOwNAieRHECHc6xk+4dRaqcSKkZvgWzmqyJS/kVq+9862+L6+cM0S9irnCZRnECRoLj4K677mL2eAJFqmj9WhqXKsdo/rfi0Jb/IcZPHjPRHKYAlwuLg+BJFqcWMRkcN+Lece1dskUKGedIQ7DZ5fvTZ95TFChDwDzblpT7m7SNwqD8mGd+j+6GuPbOftSSGLweGT1XTOp0c/bcOXHi9Oni8pjxcxNiZkNj5Jsx1MILvd3i+K9+Zqq5QWFJEbm0ihP4f2Iy/nSZ7oaw9o6lVeznqnkziouLUdccAlUqUli3d0qWbMEsHxwGWFVxMvLbR8Xz9/wvk01aVQ4ljW6dwljuE4B7x8XByQF5Uvc7Ll/psphpT+UYs88RXzpw63Wm4kzA+pymNImTkBd7i4mGEHeCQDG9IFl4rd0rBYFzFUQ38r2+/pfi+L8Zc+dQDGp5Eu9fkjenHzTl3qFy5lNPPcVdgxMGtrHCbsWIS2EzBlWqpZQzMjYFt+/0+Dkx07GkGuv1WFOv/uQ7xcMgq5PmzqVBnMAvneMTJhpC9jj3vUsmapeY266eVzbrXAHZQgZ6YXS0uOU63IrG+obIguiYlYPVZBC4c/cn9b6lYSN6Y+4dYPwpHVRaZOzl9tWSkoD40p8++1/EmSPP0p3LkDgBBMdbTTTE+FO6UHGpB587NW23GC8gUHNnzgocnzIcZxJSmIaSfG8aUtLHjLl3jD+lCxWXuvkNc8RV82d4unyK0+Pj0+JTeLpXW3z80j/3iKM//ye6cxkVJwT8hoWB5EyA+BPzn9IF4lIqqRP5Us4NntrWqhwqPoXdjd1C1dhQP60OOvKZDn/rr0yeyqCwbBeVrLt1CmNr7wB3Dk6/y4c0BORMeS2RqeT6NZ8dFX/65PUm85kStXYua+LUIgytvSu6BFx/lxl2HT7lCNVI8dUv576yXohnnzT5NWEx9aXlmtelsB8ZK60CMHMHC4oB8uxYU7ueOyXuOXCiojU1ce8WMfHoD01+tcSUQvFLQwr7zx+kBWVk9u7IkSPFY82aNRy5GQAB9GtfO3NabOrZk+PTkjshShM/udvk14IbZ92mmBSn8mBTzvWm3DtUL2CCZvZAOWH3TB848Pvfion/8z9Nf5V18qGcKupS3HeMLg4u2tUMkGfb5XvmmWK53eHhYZPNJnJRrx/qU9xXkIC22WSDGzZsKFpRJHtAkG6++WbTwjSYVmFKuzgBVP3rN9lBb7vtNtMdlFjA7bffbvrBhLSBrjRf0/oM9BvcwLypxtBBYUGR7HDHHXeI+++/P9X9muKk7wljdIr1kUceKVpQJP1AlL7+9a+n2iOIi4aM9CGjy1uUBcUZvHSDe3zjjTeabnZIpCyfKeviBFB7HDN4V5tq8OGHH+YOwikWpo6OjuJGGIa9ACxPGc3CNa7LWJ9C3hPSC1pMNQjrCSkGrAGVHjDhAWGKYWa2XUzO0GWC+oz1KxV/KpjuyMiBIRSmGtiaJWHKojgpn32z6Q4dQw4M0UAMKQMAwe/urF3rugz3s17n6DTZIBcJJxvMwMaQMjAk3blC1q53Q4b72oAwtHuLgouEkwtECflMMYUh8lm85g0Z73MPiMnyvk2mGoRLgPgTBSpZwhRT3tpNImNxJorTeTAl+zNhqP64W6CYA5UMkFAbU8Y/AuDfzvK1b2D3KyZoHpIunjGQA3XllVcyxcBi8BBZv3696VwmgAD4LVm//hSnSRB0bBGGCtQpdu3aRYGyWJiQMhDDDKvKAB/N+j2oYzechtENEqYa5UadVgFBQl2mGHLTEABvFwnfby4q6nkJprEujo4RU1If8RCmGJNmY+l/FKdkoGrkFOIYEBQoO4QppvuAfjfIu0C3rhpt0sUzCtfhxQtcuZiEqU+kvHAcLafoGIyjs3CZS3wgjykmYYqlr1Gckk2fiGGDQsQ6YpolyrQwxbAsBWSmNhPdOj1gg84O041yHV7qhSlVW4dTnOIBNaAQf2o13TAFKtXCxJQBilNkAnVQGNqkkwKVamECXXGEDJIGY07BnnTGy1bEmKmcWu6++24KEy2n1NEmYkgxoAUVHTFWGBCCKQO0nDQyGFfnogVFYaLlRPywyTl6aEFRmHyCwPdy3gVaTibYFlfcgBZUIoWpnXeBlpNpjNchpwWVKGHCBMoSkcH63xQnO8A+eK1xNEyBsl6YmMtEty5WYuuAdPEoTLScSDViyyKnBWWdMKkH1iDvBC0nG4ilDhQtKCuFiXWZKE7WEevmhxQoUdxXzgJh6uNQoFtnK63SxcvF0XhWXbyY18pRmGg50YLyY0Fde+21mSr5a4Ew9VGYKE5JEqjNcTWepZrklggTl6XQrUscnWIyUTMW0l6TnMJEy4kktPMqCwpbaqcJnBeFKf1wx18zLp7x7c4V2EobgzgtOwsrwcV27hQmihNJuECBNGx9bkksjcJEcaJA6RAoxKFWrFhBYQrHoOBuKRQnCpQe4A5h+6k1a9Yk5qKpBNMDBw7Efe9WO8couzHFiQKlcbAnRaCUMB05ciTuexZb7hrFiWROoHDccMMNoqmpyWphinlJDoUpJpjnFC+dIsY8KGDrchcLFvBSmChOFCgKFIWJXAiTMOOnT8Q8NQ33qb293YrlLrfffjuFidByogU1nbiXu1iQ9W3Fw4JQnChQlgiUWo6CPCwKE1Fwts4uYp/Fw3KXHTt2GMsmV8mVe/fupTARihMFqjomlrtYklxJYaI4kSQKlK7lLpYkV1KYKE4kpEANOMd654gtS1LHchcEvW+88caiC0lhIhSnZPKCc/wsboFSy11WrlxZczb53XffLT772c/acG1RqfQL7GL2wtm6ZBDrpgmKWpM1LUkVEIKbEVCcSPoEatGiReLee+8NFCjHjNyGDRtsqchJYUoIzBBPDohBLRExb3EN9w6BbL85Ser9FghTgcKULBhzShaoJfSAc7zHOS6L60sgkL1z586qM3mIVa1evbooUBYIE5ajPMguRIhectLFm4j7WL9+/cRLL710wXHXXXdN2PD9nOOodIkJIQbptUEAVq5cOXHgwIEpYfrc5z5nizDtozARknGBWrp06UR/f3/RkrJImHLsHoTEyyZLBIHCRAi5gE6KUvHoZVcgxD6wFu8ohYkQYiOtGRWoTt56QuynRcZdKEyEEOvIZUCgmMNESILpTakwHaQwEZJ8egRTBQghltIp0jMjR2EiJGW0iWTP5PXwFhKSXlplvIYzcoQQ60jSTN5RafERQjIkULbP5LGqACEZpltwRo4QYimdwq5AOdfIEUKmsGVN3ibeCkJIKXEGyiGMHbwFhJBKAmU6UM7ANyHEN6aqa8a+Fx8hJHnoLl7HjG9CSGhahZ44VCcvLSGkVuB27RSswUQIsZRuwcRKQoildIpwcSgmVhJCtBO0skEnLxkhxBRwz3YLltIlhFiKVwlg5i8RQmIHbps7DsX8JUKINag4FNfHEUIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCMkadWk9seuuu65FXFi7Ov/oo4/2Zf2mO9emzXlp47VJxL1CH26p9B7nvnUb/k45ObZWod84x34dfacxxfcVN3RLye8GnYMDcFKYeG2SwYYyD5JSjImTI0woKogSzP3OsUONM+f3G53XdkekChQnkjULAoMiVzJQMRCG8OoMiiFeJSMWE4Rps3Msc46N8h60y4cdyjN3JUacpAuxO8Sf5uUB9qATOh2wn10kcy7NWuGj9K/zXmX9DcACjPIJTqbA/eiHC+dcb4zprfL+dErBOur8fnNU195my6nF5Wu3yQ5YkK7HVna+VIsS7nevqBJr8XBXcfQ4n4F+spn9JFJy0lBwu5ytajw613xQ/jwYRWP1Cbw4m5zjoHMhWEg/ncLUIy3tlho/qlP2E+6bF73RoNjv8nLU/0X2MKhP6AWCSO2UZj9JjzD1yodPlP1kHx9kkQGLaIOMPQHE+RAU75DWrogy9henOLX7OLqkG+elxr18MqZKmHQ9bHplagmpAUd4BqUg7XSO7fLfanzid5ujbK8x5hP1A4Jvm2UMotwTsEcKGUmuMHVoFCZlQfWyn0QCDIYt8nrmxfldnbuinrBKRCqBDGquczrxzjIC1YanovOePPtNIoUpJ/zvEIwH2oB8YuPvYDUvE/428kQ/aQvwUCTeYxHGwmbptRR0jb2k5Tlt9uiI+N02dp1EAovJj8vVVSYLuV8KnEoMzFX5jA0iopkkEm18qRz1CbsYedUhS1jMrpJYNvp4z9ZKyyPkIFnnx3ri5U4OScwQ31/GegoVFJdP3I2y07Z4uBChE/pK1iC1lXmyD8ljR63uhithsbSdvDyXHVG5NPK8OsT5PJecx7Xrr2Tyy+tfzWrK+1k7hnNzPm+oSl9o8XFuLfLc1nqcm8pK3yPPb6iGfrG2jGCqe9UXsevsPqcWD5d5j+zveYpTvHGO3iqxijZ5bJFZr30B2+iWwlfJ1WiVR6fz/rx0XQYDttMmKicstsiB0CmT5LpqvHaY6t9S5bzUtUMy5DbhnTTrx5IJEmQdqPaggiCWExQpSj2ievwqV9I3cE03+xUpGfzvrXD9ip/tvG+DT2uwWj/f5KMflvb3fnlOsYpUfQaFCZ13n/AXRFWdsVeKja8O4Rz7fAzgciKy2287LmspSMJimzz3ZWE6upzu7wl4XpvkeeVCuuMDAdoq+Lyf5a5jkD5xwTWVou3ngbXT5/VrE/7iaJX6+e4Q/VDI67Av7jSdJFpO5QbWUACh2SnCZR8Xn5KVLBvXwshabiraWeC0s9mnxRSUXMhBuLOGmE2r/Pv2oO54QEuy38dAzJcRpt4I+iWsxGXO9+2q8CDZEuK61SJMuRrOJycfKu1xLapOlDjJwV9ugOwJcbMLsjPvcXXYnIwPdXrcWHTiJRU+v9ejQ+Hzi0lrMjaizkMtmrzA2nDes8crb8TllnpZD30lFoeKrbWEvO49Htcd54XFnxDtvBwUrXIQlrYFV6VbZ+0h6YYEsTw7IhImRae8b30eLqPJkEUugo9TKzGWx7FGMWmWUzmXIh8i+atfxnfKXfB+52Zsl0/6UqFpqRCz6PSwSC5oS/67X7a1w8PU75WWWsHDVWrxsCDL1dSB9bFNuh49ATt7myi/pASfua7kvIoBfhmzKBfT24gYlA2LcasIfC2o++a20LZEJBZ+3ego3bEW+Zndpu9RImJOrnhHOSsjaMo8ZiPWVRogsmN1VfDHy7pjHmLRVaWt4iD3eGp5xTE2elgx7VXa2iaCB8R7Pc7L8xrK33eVulA1uJSmHnReluigPApBr5lHRVYvhmQ7QyHHSUsA11GdU97HezfGcYMaYxQcP/GLFulmdXh0pG0Braa8V0ygzABTFkDpYFrlYTWVs2R8leyQrl5fmU68sfSJJdsqdy26fLaF5UCr/AwY6faEOi9ZQmN7GUttg4i54qZrKr/qg6z0XH1an+5VC37FeJ27L8vx0RPQCvJzTurBkne1VW1dI4yDDtP11OK0nHb7OHorxH82Vwsae1gXQdjjYdGUsrbckylgMHerV6eoJo5SdIO0dcjn+8qd11CAtsp15jYRP34EA/fvAsGX1qcfcd1Y4RpecO9LB768xu0iWAmSDT5FMF/SVpePdlbRrfOn/EtkJzHRVimtPjv7jiANyQ4z6KNTtNXaVo2DeCDgORXKWC5xV5LwJRgh/6/0PvkR420V3GO/+VMtovqER6Wk2GoPHOP3LInihItkTamUCt8jjAm8x0enaAnRscLGL3IRtDXk0/o0STXBKFSyDuUAryYarT77aH9EEwR+2tof8v+EqL34X2CSmiGOzrU7TOa2BnIenTtMh8OA2OI1kLzidJpW2nt1xt2yXneSqSaOQz7vVauPflqLYEQtTmtlvDGM+GRHnJwBVXXPvJI1XG1lOlhPmWnbOCy5MJ2bxGPp+hlkfu7fcAQiKESEZW0jEjBrsNqtg/UBy8g5EBjs87j5PTF/zShdlLDWFqndIgwqPH7wE0TmgyyJ4lQiVJhRKBfH6UhRCVbuFEJI3G5dSLyKzbWJdOxWmwSRjaLUrW9rAa693/idzAGrNp2+nQ8bipMO6ynvUbMnzkENt2pLjN+nxfA9iNKN3COqB43bhP+ZzxYfn+enDElUOT37RfWcqsj2efNBXgTP9aM4BRSDUnFakBILKExwXZc4FTysk9YIV6n7GShrA4hT1X4gM9dxbrkar+kqn3212nISk1Vcd+hceB01ScxzGvY5qGO1JELulbaqygDOewmGhvMaCiCgtTxoqtEZIKbo95pXFfxKbVaojlF63/yIeJvBa7k2SQM9c8XmNDFUa0eo0OEH3G6th0XTpum8BjW6PJWy4kvZ6eP6tfmweAZLr2klUazwf342/lTJldWsw9Yq60xzNfTBcm11BuyXLXENKopTROZyuae4R/XHSh2+3Pv7fQhG0FXjfl2JgRotGT9s9zmo9nm1Kwf3zgDn48dN3FJuIMu2NgZoy4/49pTrK3JBri9L1VWGpxq91ap24jrjPbKi6+64BlUjdSUS+sSFNXtUvaCqAVjZMct1+HKbKwyUcV+KncnPekM5uDprOK/iYBIB61t7rWrH72Qd7mrWHwbpQfletcxngfw7v65mv7LYfLaJgbzRJTR+98hzL/oe8HG91bn1ybDFYlF+0w0/Qu/n+/XI8+ovCZMsk222+rl3tJwSgBSQ7R7W0yYfwuRVUnVrmbb6PFyFnmomewALw8959foUpZyspLmzQn30zcL/tHubFMwtIlhhtdJdRfxWtGh1tec3prXVLb7CX+Bf1e/aIvzv5Vd6vwZFsJnNTa5zU+dX7npuiGNcUZyiY5uH3w/R2F0aV5CDFp1wn0eH2FphWc7WCk/63tJgPNqWYhKmrrTXeXXK8+rwEkIpSgddMZot5VwzGXzfrPHeFEo/X7a5VUc/KDNJstlgP/RT/iQosSQ6J9Gty3s83WK3npwb2OUhABCmNrlgdlA+tVqquAXdFdpCwbi1Hk/yTikc1QZrLuLzGpKf21rls8u6hPKchIi+dC6+U9kKobjGTpuLA7i51RgqV2NMuq79wkAVUHm/2kXtGxxcIFDC8K7a9SkRp1zIqfuoO0axhneVJ1e1WMKgz3hOlwi/LmuzCJD45/O8WkX5jUNLhWJ7JdEVwQusVesrFXcPkcui+iJoq19Uzp4Pc78KIkRGvs/7FfR75E2Pp8SJkzSZvWIuOQu+X7EYngie9VuQrly7z3K7quP2Be3sUgT2hDyvsIFRtLmkWoa5/P8l0uUq1DCY8PfL/SSMSoFaF3IAFl1GH3Xp1f3qD3ivBsNcB9f9qkV48/I6LokjIG7CrSuI6NPz8eQvN7vV4no6lWt3yMR3Vx1Rxpk2CO8a6Oo7DchYRSFEO11yB5eNFSwXdLIdJW3gvFYFuTbyb9dV2ca99NzQbn+QsjaynW65W7DaRtuPVTYozm+DHvRaqt1wOn221x+0Ldf1a5PXr8PjPPrF9JhjX5jQhat/bHXdr2qfM6juW1z71SnqBDFCuTKqOorESeHIlcRBChrPK1emwxd0dGyPtnQV2/MqfZuPsn5Y6f3SdS5V+kjk50UIIYQQQgghhBBCCCGEEEIIIYQQQgghhBBCCCGEEEIIIYSQ4Px/AQYAeGpRDl1A8RIAAAAASUVORK5CYII=">
17 <div class="main-content">
89 </div>
90 <div class="main">
18 <h1>
91 <h1>
19 502 Bad Gateway | <span class="error_message">Backend server is unreachable</span>
92 502 Bad Gateway | <span class="error_message">Backend server is unreachable</span>
20 </h1>
93 </h1>
21 <div class="inner-column">
94 <div class="inner-column">
22 <h4>Possible Cause</h4>
95 <h4>Possible Causes</h4>
23 <ul>
96 <ul>
24 <li>The server is beeing restarted.</li>
97 <li>The server is being restarted.</li>
25 <li>The server is overloaded.</li>
98 <li>The server is overloaded.</li>
26 <li>The link may be incorrect.</li>
99 <li>The link may be incorrect.</li>
27 </ul>
100 </ul>
@@ -37,8 +110,5 b''
37 <p>For more information, see <a href="https://rhodecode.com/r1/enterprise/docs/">docs.rhodecode.com</a>.</p>
110 <p>For more information, see <a href="https://rhodecode.com/r1/enterprise/docs/">docs.rhodecode.com</a>.</p>
38 </div>
111 </div>
39 </div>
112 </div>
40 </div>
41
42 </body>
113 </body>
43
44 </html>
114 </html>
@@ -255,7 +255,7 b' table.code-difftable {'
255
255
256 /** LINE NUMBERS **/
256 /** LINE NUMBERS **/
257 .lineno {
257 .lineno {
258 padding-left: 2px;
258 padding-left: 2px !important;
259 padding-right: 2px;
259 padding-right: 2px;
260 text-align: right;
260 text-align: right;
261 width: 32px;
261 width: 32px;
@@ -12,6 +12,7 b''
12
12
13 .control-label {
13 .control-label {
14 width: 200px;
14 width: 200px;
15 padding: 10px;
15 float: left;
16 float: left;
16 }
17 }
17 .control-inputs {
18 .control-inputs {
@@ -26,14 +27,37 b''
26
27
27 .form-group {
28 .form-group {
28 clear: left;
29 clear: left;
30 margin-bottom: 20px;
31
32 &:after { /* clear fix */
33 content: " ";
34 display: block;
35 clear: left;
36 }
29 }
37 }
30
38
31 .form-control {
39 .form-control {
32 width: 100%;
40 width: 100%;
41 padding: 0.9em;
42 border: 1px solid #979797;
43 border-radius: 2px;
44 }
45 .form-control.select2-container {
46 padding: 0; /* padding already applied in .drop-menu a */
47 }
48
49 .form-control.readonly {
50 background: #eeeeee;
51 cursor: not-allowed;
33 }
52 }
34
53
35 .error-block {
54 .error-block {
36 color: red;
55 color: red;
56 margin: 0;
57 }
58
59 .help-block {
60 margin: 0;
37 }
61 }
38
62
39 .deform-seq-container .control-inputs {
63 .deform-seq-container .control-inputs {
@@ -62,7 +86,9 b''
62 }
86 }
63 }
87 }
64
88
65 .form-control.select2-container { height: 40px; }
89 .form-control.select2-container {
90 height: 40px;
91 }
66
92
67 .deform-two-field-sequence .deform-seq-container .deform-seq-item label {
93 .deform-two-field-sequence .deform-seq-container .deform-seq-item label {
68 display: none;
94 display: none;
@@ -74,7 +100,7 b''
74 display: none;
100 display: none;
75 }
101 }
76 .deform-two-field-sequence .deform-seq-container .deform-seq-item.form-group {
102 .deform-two-field-sequence .deform-seq-container .deform-seq-item.form-group {
77 background: red;
103 margin: 0;
78 }
104 }
79 .deform-two-field-sequence .deform-seq-container .deform-seq-item .deform-seq-item-group .form-group {
105 .deform-two-field-sequence .deform-seq-container .deform-seq-item .deform-seq-item-group .form-group {
80 width: 45%; padding: 0 2px; float: left; clear: none;
106 width: 45%; padding: 0 2px; float: left; clear: none;
@@ -6,7 +6,8 b' div.diffblock .code-header .changeset_he'
6 // Line select and comment
6 // Line select and comment
7 div.diffblock.margined.comm tr {
7 div.diffblock.margined.comm tr {
8 td {
8 td {
9 position: relative;
9 // IMPORTANT - never position:relative this as it causes insanely
10 // slow rendering
10 }
11 }
11
12
12 .add-comment-line {
13 .add-comment-line {
@@ -23,11 +24,32 b' div.diffblock.margined.comm tr {'
23
24
24 a {
25 a {
25 display: none;
26 display: none;
27 margin-top: 2px;
28 margin-left: 2px;
29 color: @grey3;
30 }
31 }
32 }
33
34 .comment-toggle {
35 position: relative;
36 min-width: 20px;
37 width: 20px;
38 color: @rcblue;
39
40 .icon-comment {
26 position: absolute;
41 position: absolute;
27 top: 2px;
42 top: 2px;
28 left: 2px;
43 left: 0;
29 color: @grey3;
44 z-index: 100;
45 visibility: hidden;
30 }
46 }
47
48 &.active {
49 .icon-comment{
50 visibility: visible;
51 }
52 cursor: pointer;
31 }
53 }
32 }
54 }
33
55
@@ -75,4 +97,4 b' div.diffblock.margined.comm tr {'
75 clear: both;
97 clear: both;
76 font-family: @text-semibold;
98 font-family: @text-semibold;
77 }
99 }
78 } No newline at end of file
100 }
@@ -25,10 +25,8 b''
25 @import 'comments';
25 @import 'comments';
26 @import 'panels-bootstrap';
26 @import 'panels-bootstrap';
27 @import 'panels';
27 @import 'panels';
28 @import 'toastr';
29 @import 'deform';
28 @import 'deform';
30
29
31
32 //--- BASE ------------------//
30 //--- BASE ------------------//
33 .noscript-error {
31 .noscript-error {
34 top: 0;
32 top: 0;
@@ -1101,6 +1099,44 b' table.issuetracker {'
1101 }
1099 }
1102 }
1100 }
1103
1101
1102 table.integrations {
1103 .td-icon {
1104 width: 20px;
1105 .integration-icon {
1106 height: 20px;
1107 width: 20px;
1108 }
1109 }
1110 }
1111
1112 .integrations {
1113 a.integration-box {
1114 color: @text-color;
1115 &:hover {
1116 .panel {
1117 background: #fbfbfb;
1118 }
1119 }
1120 .integration-icon {
1121 width: 30px;
1122 height: 30px;
1123 margin-right: 20px;
1124 float: left;
1125 }
1126
1127 .panel-body {
1128 padding: 10px;
1129 }
1130 .panel {
1131 margin-bottom: 10px;
1132 }
1133 h2 {
1134 display: inline-block;
1135 margin: 0;
1136 min-width: 140px;
1137 }
1138 }
1139 }
1104
1140
1105 //Permissions Settings
1141 //Permissions Settings
1106 #add_perm {
1142 #add_perm {
@@ -2103,3 +2139,8 b' input[type=radio] {'
2103 padding: 0;
2139 padding: 0;
2104 border: none;
2140 border: none;
2105 }
2141 }
2142
2143 .toggle-ajax-spinner{
2144 height: 16px;
2145 width: 16px;
2146 }
@@ -202,9 +202,11 b' table.dataTable {'
202
202
203 &.td-tags {
203 &.td-tags {
204 padding: .5em 1em .5em 0;
204 padding: .5em 1em .5em 0;
205 width: 140px;
205
206
206 .tag {
207 .tag {
207 margin: 1px;
208 margin: 1px;
209 float: left;
208 }
210 }
209 }
211 }
210
212
@@ -270,7 +270,7 b' mark,'
270 text-align: right;
270 text-align: right;
271
271
272 li:before { content: none; }
272 li:before { content: none; }
273
273 li { float: right; }
274 a {
274 a {
275 display: inline-block;
275 display: inline-block;
276 margin-left: @textmargin/2;
276 margin-left: @textmargin/2;
@@ -366,15 +366,9 b' function offsetScroll(element, offset){'
366 // At the time of development, Chrome didn't seem to support jquery's :target
366 // At the time of development, Chrome didn't seem to support jquery's :target
367 // element, so I had to scroll manually
367 // element, so I had to scroll manually
368 if (location.hash) {
368 if (location.hash) {
369 var splitIx = location.hash.indexOf('/?/');
369 var result = splitDelimitedHash(location.hash);
370 if (splitIx !== -1){
370 var loc = result.loc;
371 var loc = location.hash.slice(0, splitIx);
371 var remainder = result.remainder;
372 var remainder = location.hash.slice(splitIx + 2);
373 }
374 else{
375 var loc = location.hash;
376 var remainder = null;
377 }
378 if (loc.length > 1){
372 if (loc.length > 1){
379 var lineno = $(loc+'.lineno');
373 var lineno = $(loc+'.lineno');
380 if (lineno.length > 0){
374 if (lineno.length > 0){
@@ -38,7 +38,8 b' var tableTr = function(cls, body){'
38 var comment_id = fromHTML(body).children[0].id.split('comment-')[1];
38 var comment_id = fromHTML(body).children[0].id.split('comment-')[1];
39 var id = 'comment-tr-{0}'.format(comment_id);
39 var id = 'comment-tr-{0}'.format(comment_id);
40 var _html = ('<table><tbody><tr id="{0}" class="{1}">'+
40 var _html = ('<table><tbody><tr id="{0}" class="{1}">'+
41 '<td class="add-comment-line"><span class="add-comment-content"></span></td>'+
41 '<td class="add-comment-line tooltip tooltip" title="Add Comment"><span class="add-comment-content"></span></td>'+
42 '<td></td>'+
42 '<td></td>'+
43 '<td></td>'+
43 '<td></td>'+
44 '<td></td>'+
44 '<td>{2}</td>'+
45 '<td>{2}</td>'+
@@ -282,8 +283,10 b' var placeInline = function(target_contai'
282 var target_line = $('#' + lineid).get(0);
283 var target_line = $('#' + lineid).get(0);
283 var comment = new $(tableTr('inline-comments', html));
284 var comment = new $(tableTr('inline-comments', html));
284 // check if there are comments already !
285 // check if there are comments already !
286 if (target_line) {
285 var parent_node = target_line.parentNode;
287 var parent_node = target_line.parentNode;
286 var root_parent = parent_node;
288 var root_parent = parent_node;
289
287 while (1) {
290 while (1) {
288 var n = parent_node.nextElementSibling;
291 var n = parent_node.nextElementSibling;
289 // next element are comments !
292 // next element are comments !
@@ -301,10 +304,24 b' var placeInline = function(target_contai'
301 if (show_add_button) {
304 if (show_add_button) {
302 placeAddButton(root_parent);
305 placeAddButton(root_parent);
303 }
306 }
307 addCommentToggle(target_line);
308 }
304
309
305 return target_line;
310 return target_line;
306 };
311 };
307
312
313 var addCommentToggle = function(target_line) {
314 // exposes comment toggle button
315 $(target_line).siblings('.comment-toggle').addClass('active');
316 return;
317 };
318
319 var bindToggleButtons = function() {
320 $('.comment-toggle').on('click', function() {
321 $(this).parent().nextUntil('tr.line').toggle('inline-comments');
322 });
323 };
324
308 var linkifyComments = function(comments) {
325 var linkifyComments = function(comments) {
309
326
310 for (var i = 0; i < comments.length; i++) {
327 for (var i = 0; i < comments.length; i++) {
@@ -74,6 +74,29 b' String.prototype.capitalizeFirstLetter ='
74
74
75
75
76 /**
76 /**
77 * Splits remainder
78 *
79 * @param input
80 */
81 function splitDelimitedHash(input){
82 var splitIx = input.indexOf('/?/');
83 if (splitIx !== -1){
84 var loc = input.slice(0, splitIx);
85 var remainder = input.slice(splitIx + 2);
86 }
87 else{
88 var loc = input;
89 var remainder = null;
90 }
91 //fixes for some urls generated incorrectly
92 var result = loc.match('#+(.*)');
93 if (result !== null){
94 loc = '#' + result[1];
95 }
96 return {loc:loc, remainder: remainder}
97 }
98
99 /**
77 * Escape html characters in string
100 * Escape html characters in string
78 */
101 */
79 var entityMap = {
102 var entityMap = {
@@ -1,4 +1,7 b''
1 /plugins/__REGISTER__ - launched after the onDomReady() code from rhodecode.js is executed
1 /plugins/__REGISTER__ - launched after the onDomReady() code from rhodecode.js is executed
2 /ui/plugins/code/anchor_focus - launched when rc starts to scroll on load to anchor on PR/Codeview
2 /ui/plugins/code/anchor_focus - launched when rc starts to scroll on load to anchor on PR/Codeview
3 /ui/plugins/code/comment_form_built - launched when injectInlineForm() is executed and the form object is created
3 /ui/plugins/code/comment_form_built - launched when injectInlineForm() is executed and the form object is created
4 /notifications - shows new event notifications No newline at end of file
4 /notifications - shows new event notifications
5 /connection_controller/subscribe - subscribes user to new channels
6 /connection_controller/presence - receives presence change messages
7 /connection_controller/channel_update - receives channel states
@@ -3,6 +3,8 b''
3 def inherit(context):
3 def inherit(context):
4 if context['c'].repo:
4 if context['c'].repo:
5 return "/admin/repos/repo_edit.html"
5 return "/admin/repos/repo_edit.html"
6 elif context['c'].repo_group:
7 return "/admin/repo_groups/repo_group_edit.html"
6 else:
8 else:
7 return "/admin/settings/settings.html"
9 return "/admin/settings/settings.html"
8 %>
10 %>
@@ -11,6 +11,19 b''
11 request.route_url(route_name='repo_integrations_list',
11 request.route_url(route_name='repo_integrations_list',
12 repo_name=c.repo.repo_name,
12 repo_name=c.repo.repo_name,
13 integration=current_IntegrationType.key))}
13 integration=current_IntegrationType.key))}
14 %elif c.repo_group:
15 ${h.link_to(_('Admin'),h.url('admin_home'))}
16 &raquo;
17 ${h.link_to(_('Repository Groups'),h.url('repo_groups'))}
18 &raquo;
19 ${h.link_to(c.repo_group.group_name,h.url('edit_repo_group', group_name=c.repo_group.group_name))}
20 &raquo;
21 ${h.link_to(_('Integrations'),request.route_url(route_name='repo_group_integrations_home', repo_group_name=c.repo_group.group_name))}
22 &raquo;
23 ${h.link_to(current_IntegrationType.display_name,
24 request.route_url(route_name='repo_group_integrations_list',
25 repo_group_name=c.repo_group.group_name,
26 integration=current_IntegrationType.key))}
14 %else:
27 %else:
15 ${h.link_to(_('Admin'),h.url('admin_home'))}
28 ${h.link_to(_('Admin'),h.url('admin_home'))}
16 &raquo;
29 &raquo;
@@ -22,18 +35,31 b''
22 request.route_url(route_name='global_integrations_list',
35 request.route_url(route_name='global_integrations_list',
23 integration=current_IntegrationType.key))}
36 integration=current_IntegrationType.key))}
24 %endif
37 %endif
38
25 %if integration:
39 %if integration:
26 &raquo;
40 &raquo;
27 ${integration.name}
41 ${integration.name}
42 %elif current_IntegrationType:
43 &raquo;
44 ${current_IntegrationType.display_name}
28 %endif
45 %endif
29 </%def>
46 </%def>
47
48 <style>
49 .control-inputs.item-options, .control-inputs.item-settings {
50 float: left;
51 width: 100%;
52 }
53 </style>
30 <div class="panel panel-default">
54 <div class="panel panel-default">
31 <div class="panel-heading">
55 <div class="panel-heading">
32 <h2 class="panel-title">
56 <h2 class="panel-title">
33 %if integration:
57 %if integration:
34 ${current_IntegrationType.display_name} - ${integration.name}
58 ${current_IntegrationType.display_name} - ${integration.name}
35 %else:
59 %else:
36 ${_('Create New %(integration_type)s Integration') % {'integration_type': current_IntegrationType.display_name}}
60 ${_('Create New %(integration_type)s Integration') % {
61 'integration_type': current_IntegrationType.display_name
62 }}
37 %endif
63 %endif
38 </h2>
64 </h2>
39 </div>
65 </div>
@@ -4,6 +4,12 b''
4 <%def name="breadcrumbs_links()">
4 <%def name="breadcrumbs_links()">
5 %if c.repo:
5 %if c.repo:
6 ${h.link_to('Settings',h.url('edit_repo', repo_name=c.repo.repo_name))}
6 ${h.link_to('Settings',h.url('edit_repo', repo_name=c.repo.repo_name))}
7 %elif c.repo_group:
8 ${h.link_to(_('Admin'),h.url('admin_home'))}
9 &raquo;
10 ${h.link_to(_('Repository Groups'),h.url('repo_groups'))}
11 &raquo;
12 ${h.link_to(c.repo_group.group_name,h.url('edit_repo_group', group_name=c.repo_group.group_name))}
7 %else:
13 %else:
8 ${h.link_to(_('Admin'),h.url('admin_home'))}
14 ${h.link_to(_('Admin'),h.url('admin_home'))}
9 &raquo;
15 &raquo;
@@ -15,6 +21,10 b''
15 ${h.link_to(_('Integrations'),
21 ${h.link_to(_('Integrations'),
16 request.route_url(route_name='repo_integrations_home',
22 request.route_url(route_name='repo_integrations_home',
17 repo_name=c.repo.repo_name))}
23 repo_name=c.repo.repo_name))}
24 %elif c.repo_group:
25 ${h.link_to(_('Integrations'),
26 request.route_url(route_name='repo_group_integrations_home',
27 repo_group_name=c.repo_group.group_name))}
18 %else:
28 %else:
19 ${h.link_to(_('Integrations'),
29 ${h.link_to(_('Integrations'),
20 request.route_url(route_name='global_integrations_home'))}
30 request.route_url(route_name='global_integrations_home'))}
@@ -26,50 +36,105 b''
26 ${_('Integrations')}
36 ${_('Integrations')}
27 %endif
37 %endif
28 </%def>
38 </%def>
39
29 <div class="panel panel-default">
40 <div class="panel panel-default">
30 <div class="panel-heading">
41 <div class="panel-heading">
31 <h3 class="panel-title">${_('Create New Integration')}</h3>
42 <h3 class="panel-title">
43 %if c.repo:
44 ${_('Current Integrations for Repository: {repo_name}').format(repo_name=c.repo.repo_name)}
45 %elif c.repo_group:
46 ${_('Current Integrations for repository group: {repo_group_name}').format(repo_group_name=c.repo_group.group_name)}
47 %else:
48 ${_('Current Integrations')}
49 %endif
50 </h3>
32 </div>
51 </div>
33 <div class="panel-body">
52 <div class="panel-body">
34 %if not available_integrations:
53 <%
35 ${_('No integrations available.')}
54 if c.repo:
36 %else:
55 home_url = request.route_path('repo_integrations_home',
37 %for integration in available_integrations:
56 repo_name=c.repo.repo_name)
57 elif c.repo_group:
58 home_url = request.route_path('repo_group_integrations_home',
59 repo_group_name=c.repo_group.group_name)
60 else:
61 home_url = request.route_path('global_integrations_home')
62 %>
63
64 <a href="${home_url}" class="btn ${not current_IntegrationType and 'btn-primary' or ''}">${_('All')}</a>
65
66 %for integration_key, IntegrationType in available_integrations.items():
38 <%
67 <%
39 if c.repo:
68 if c.repo:
40 create_url = request.route_url('repo_integrations_create',
69 list_url = request.route_path('repo_integrations_list',
41 repo_name=c.repo.repo_name,
70 repo_name=c.repo.repo_name,
42 integration=integration)
71 integration=integration_key)
72 elif c.repo_group:
73 list_url = request.route_path('repo_group_integrations_list',
74 repo_group_name=c.repo_group.group_name,
75 integration=integration_key)
43 else:
76 else:
44 create_url = request.route_url('global_integrations_create',
77 list_url = request.route_path('global_integrations_list',
45 integration=integration)
78 integration=integration_key)
46 %>
79 %>
47 <a href="${create_url}" class="btn">
80 <a href="${list_url}"
48 ${integration}
81 class="btn ${current_IntegrationType and integration_key == current_IntegrationType.key and 'btn-primary' or ''}">
82 ${IntegrationType.display_name}
49 </a>
83 </a>
50 %endfor
84 %endfor
51 %endif
85
52 </div>
86 <%
53 </div>
87 if c.repo:
54 <div class="panel panel-default">
88 create_url = h.route_path('repo_integrations_new', repo_name=c.repo.repo_name)
55 <div class="panel-heading">
89 elif c.repo_group:
56 <h3 class="panel-title">${_('Current Integrations')}</h3>
90 create_url = h.route_path('repo_group_integrations_new', repo_group_name=c.repo_group.group_name)
57 </div>
91 else:
58 <div class="panel-body">
92 create_url = h.route_path('global_integrations_new')
59 <table class="rctable issuetracker">
93 %>
94 <p class="pull-right">
95 <a href="${create_url}" class="btn btn-small btn-success">${_(u'Create new integration')}</a>
96 </p>
97
98 <table class="rctable integrations">
60 <thead>
99 <thead>
61 <tr>
100 <tr>
62 <th>${_('Enabled')}</th>
101 <th><a href="?sort=enabled:${rev_sort_dir}">${_('Enabled')}</a></th>
63 <th>${_('Description')}</th>
102 <th><a href="?sort=name:${rev_sort_dir}">${_('Name')}</a></th>
64 <th>${_('Type')}</th>
103 <th colspan="2"><a href="?sort=integration_type:${rev_sort_dir}">${_('Type')}</a></th>
104 <th><a href="?sort=scope:${rev_sort_dir}">${_('Scope')}</a></th>
65 <th>${_('Actions')}</th>
105 <th>${_('Actions')}</th>
66 <th></th>
106 <th></th>
67 </tr>
107 </tr>
68 </thead>
108 </thead>
69 <tbody>
109 <tbody>
110 %if not integrations_list:
111 <tr>
112 <td colspan="7">
113 <% integration_type = current_IntegrationType and current_IntegrationType.display_name or '' %>
114 %if c.repo:
115 ${_('No {type} integrations for repo {repo} exist yet.').format(type=integration_type, repo=c.repo.repo_name)}
116 %elif c.repo_group:
117 ${_('No {type} integrations for repogroup {repogroup} exist yet.').format(type=integration_type, repogroup=c.repo_group.group_name)}
118 %else:
119 ${_('No {type} integrations exist yet.').format(type=integration_type)}
120 %endif
70
121
71 %for integration_type, integrations in sorted(current_integrations.items()):
122 %if current_IntegrationType:
72 %for integration in sorted(integrations, key=lambda x: x.name):
123 <%
124 if c.repo:
125 create_url = h.route_path('repo_integrations_create', repo_name=c.repo.repo_name, integration=current_IntegrationType.key)
126 elif c.repo_group:
127 create_url = h.route_path('repo_group_integrations_create', repo_group_name=c.repo_group.group_name, integration=current_IntegrationType.key)
128 else:
129 create_url = h.route_path('global_integrations_create', integration=current_IntegrationType.key)
130 %>
131 %endif
132
133 <a href="${create_url}">${_(u'Create one')}</a>
134 </td>
135 </tr>
136 %endif
137 %for IntegrationType, integration in integrations_list:
73 <tr id="integration_${integration.integration_id}">
138 <tr id="integration_${integration.integration_id}">
74 <td class="td-enabled">
139 <td class="td-enabled">
75 %if integration.enabled:
140 %if integration.enabled:
@@ -81,21 +146,57 b''
81 <td class="td-description">
146 <td class="td-description">
82 ${integration.name}
147 ${integration.name}
83 </td>
148 </td>
84 <td class="td-regex">
149 <td class="td-icon">
150 %if integration.integration_type in available_integrations:
151 <div class="integration-icon">
152 ${available_integrations[integration.integration_type].icon|n}
153 </div>
154 %else:
155 ?
156 %endif
157 </td>
158 <td class="td-type">
85 ${integration.integration_type}
159 ${integration.integration_type}
86 </td>
160 </td>
161 <td class="td-scope">
162 %if integration.repo:
163 <a href="${h.url('summary_home', repo_name=integration.repo.repo_name)}">
164 ${_('repo')}:${integration.repo.repo_name}
165 </a>
166 %elif integration.repo_group:
167 <a href="${h.url('repo_group_home', group_name=integration.repo_group.group_name)}">
168 ${_('repogroup')}:${integration.repo_group.group_name}
169 %if integration.child_repos_only:
170 ${_('child repos only')}
171 %else:
172 ${_('cascade to all')}
173 %endif
174 </a>
175 %else:
176 %if integration.child_repos_only:
177 ${_('top level repos only')}
178 %else:
179 ${_('global')}
180 %endif
181 </td>
182 %endif
87 <td class="td-action">
183 <td class="td-action">
88 %if integration_type not in available_integrations:
184 %if not IntegrationType:
89 ${_('unknown integration')}
185 ${_('unknown integration')}
90 %else:
186 %else:
91 <%
187 <%
92 if c.repo:
188 if c.repo:
93 edit_url = request.route_url('repo_integrations_edit',
189 edit_url = request.route_path('repo_integrations_edit',
94 repo_name=c.repo.repo_name,
190 repo_name=c.repo.repo_name,
95 integration=integration.integration_type,
191 integration=integration.integration_type,
96 integration_id=integration.integration_id)
192 integration_id=integration.integration_id)
193 elif c.repo_group:
194 edit_url = request.route_path('repo_group_integrations_edit',
195 repo_group_name=c.repo_group.group_name,
196 integration=integration.integration_type,
197 integration_id=integration.integration_id)
97 else:
198 else:
98 edit_url = request.route_url('global_integrations_edit',
199 edit_url = request.route_path('global_integrations_edit',
99 integration=integration.integration_type,
200 integration=integration.integration_type,
100 integration_id=integration.integration_id)
201 integration_id=integration.integration_id)
101 %>
202 %>
@@ -114,10 +215,14 b''
114 </td>
215 </td>
115 </tr>
216 </tr>
116 %endfor
217 %endfor
117 %endfor
118 <tr id="last-row"></tr>
218 <tr id="last-row"></tr>
119 </tbody>
219 </tbody>
120 </table>
220 </table>
221 <div class="integrations-paginator">
222 <div class="pagination-wh pagination-left">
223 ${integrations_list.pager('$link_previous ~2~ $link_next')}
224 </div>
225 </div>
121 </div>
226 </div>
122 </div>
227 </div>
123 <script type="text/javascript">
228 <script type="text/javascript">
@@ -30,10 +30,10 b''
30 <li class="${'active' if c.active=='password' else ''}"><a href="${h.url('my_account_password')}">${_('Password')}</a></li>
30 <li class="${'active' if c.active=='password' else ''}"><a href="${h.url('my_account_password')}">${_('Password')}</a></li>
31 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.url('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
31 <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.url('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li>
32 ## TODO: Find a better integration of oauth views into navigation.
32 ## TODO: Find a better integration of oauth views into navigation.
33 %try:
33 <% my_account_oauth_url = h.route_path_or_none('my_account_oauth') %>
34 <li class="${'active' if c.active=='oauth' else ''}"><a href="${h.route_path('my_account_oauth')}">${_('OAuth Identities')}</a></li>
34 % if my_account_oauth_url:
35 %except KeyError:
35 <li class="${'active' if c.active=='oauth' else ''}"><a href="${my_account_oauth_url}">${_('OAuth Identities')}</a></li>
36 %endtry
36 % endif
37 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.url('my_account_emails')}">${_('My Emails')}</a></li>
37 <li class="${'active' if c.active=='emails' else ''}"><a href="${h.url('my_account_emails')}">${_('My Emails')}</a></li>
38 <li class="${'active' if c.active=='repos' else ''}"><a href="${h.url('my_account_repos')}">${_('My Repositories')}</a></li>
38 <li class="${'active' if c.active=='repos' else ''}"><a href="${h.url('my_account_repos')}">${_('My Repositories')}</a></li>
39 <li class="${'active' if c.active=='watched' else ''}"><a href="${h.url('my_account_watched')}">${_('Watched')}</a></li>
39 <li class="${'active' if c.active=='watched' else ''}"><a href="${h.url('my_account_watched')}">${_('Watched')}</a></li>
@@ -1,26 +1,57 b''
1 <template is="dom-bind" id="notificationsPage">
2 <iron-ajax id="toggleNotifications"
3 method="post"
4 url="${url('my_account_notifications_toggle_visibility')}"
5 content-type="application/json"
6 loading="{{changeNotificationsLoading}}"
7 on-response="handleNotifications"
8 handle-as="json"></iron-ajax>
9
1 <div class="panel panel-default">
10 <div class="panel panel-default">
2 <div class="panel-heading">
11 <div class="panel-heading">
3 <h3 class="panel-title">${_('Your live notification settings')}</h3>
12 <h3 class="panel-title">${_('Your Live Notification Settings')}</h3>
4 </div>
13 </div>
5
6 <div class="panel-body">
14 <div class="panel-body">
7
15
8 <p><strong>IMPORTANT:</strong> This feature requires enabled channelstream websocket server to function correctly.</p>
16 <p><strong>IMPORTANT:</strong> This feature requires enabled channelstream websocket server to function correctly.</p>
9
17
10 <p class="hidden">Status of browser notifications permission: <strong id="browser-notification-status"></strong></p>
18 <p class="hidden">Status of browser notifications permission: <strong id="browser-notification-status"></strong></p>
11
19
12 ${h.secure_form(url('my_account_notifications_toggle_visibility'), method='post', id='notification-status')}
20 <div class="form">
13 <button class="btn btn-default" type="submit">
21 <div class="fields">
14 ${_('Notifications')} <strong>${_('Enabled') if c.rhodecode_user.get_instance().user_data.get('notification_status') else _('Disabled')}</strong>
22 <div class="field">
15 </button>
23 <div class="label">
16 ${h.end_form()}
24 <label for="new_email">${_('Notifications Status')}:</label>
17
25 </div>
18 <a class="btn btn-info" id="test-notification">Test notification</a>
26 <div class="checkboxes">
27 <rhodecode-toggle id="live-notifications" active="[[changeNotificationsLoading]]" on-change="toggleNotifications" ${'checked' if c.rhodecode_user.get_instance().user_data.get('notification_status') else ''}></rhodecode-toggle>
28 </div>
29 </div>
30 <div class="buttons">
31 <a class="btn btn-default" id="test-notification" on-tap="testNotifications">Test notification</a>
32 </div>
33 </div>
34 </div>
19
35
20 </div>
36 </div>
21 </div>
37 </div>
22
38
23 <script type="application/javascript">
39 <script type="text/javascript">
40 /** because im not creating a custom element for this page
41 * we need to push the function onto the dom-template
42 * ideally we turn this into notification-settings elements
43 * then it will be cleaner
44 */
45 var ctrlr = $('#notificationsPage')[0];
46 ctrlr.toggleNotifications = function(event){
47 var ajax = $('#toggleNotifications')[0];
48 ajax.headers = {"X-CSRF-Token": CSRF_TOKEN}
49 ajax.body = {notification_status:event.target.active};
50 ajax.generateRequest();
51 };
52 ctrlr.handleNotifications = function(event){
53 $('#live-notifications')[0].checked = event.detail.response;
54 };
24
55
25 function checkBrowserStatus(){
56 function checkBrowserStatus(){
26 var browserStatus = 'Unknown';
57 var browserStatus = 'Unknown';
@@ -37,20 +68,20 b''
37 }
68 }
38
69
39 $('#browser-notification-status').text(browserStatus);
70 $('#browser-notification-status').text(browserStatus);
40 };
71 }
41
72
42 checkBrowserStatus();
73 ctrlr.testNotifications = function(event){
43
44 $('#test-notification').on('click', function(e){
45 var levels = ['info', 'error', 'warning', 'success'];
74 var levels = ['info', 'error', 'warning', 'success'];
46 var level = levels[Math.floor(Math.random()*levels.length)];
75 var level = levels[Math.floor(Math.random()*levels.length)];
47 var payload = {
76 var payload = {
48 message: {
77 message: {
49 message: 'This is a test notification.',
78 message: 'This is a test notification.',
50 level: level,
79 level: level,
51 testMessage: true
80 force: true
52 }
81 }
53 };
82 };
54 $.Topic('/notifications').publish(payload);
83 $.Topic('/notifications').publish(payload);
55 })
84 }
85
56 </script>
86 </script>
87 </template>
@@ -1,42 +1,5 b''
1 <div class="panel panel-default">
1 <%namespace name="widgets" file="/widgets.html"/>
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Change Your Account Password')}</h3>
4 </div>
5 ${h.secure_form(url('my_account_password'), method='post')}
6 <div class="panel-body">
7 <div class="fields">
8 <div class="field">
9 <div class="label">
10 <label for="current_password">${_('Current Password')}:</label>
11 </div>
12 <div class="input">
13 ${h.password('current_password',class_='medium',autocomplete="off")}
14 </div>
15 </div>
16
2
17 <div class="field">
3 <%widgets:panel title="${_('Change Your Account Password')}">
18 <div class="label">
4 ${c.form.render() | n}
19 <label for="new_password">${_('New Password')}:</label>
5 </%widgets:panel>
20 </div>
21 <div class="input">
22 ${h.password('new_password',class_='medium', autocomplete="off")}
23 </div>
24 </div>
25
26 <div class="field">
27 <div class="label">
28 <label for="password_confirmation">${_('Confirm New Password')}:</label>
29 </div>
30 <div class="input">
31 ${h.password('new_password_confirmation',class_='medium', autocomplete="off")}
32 </div>
33 </div>
34
35 <div class="buttons">
36 ${h.submit('save',_('Save'),class_="btn")}
37 ${h.reset('reset',_('Reset'),class_="btn")}
38 </div>
39 </div>
40 </div>
41 ${h.end_form()}
42 </div> No newline at end of file
@@ -12,7 +12,7 b''
12
12
13 <div class="panel panel-default">
13 <div class="panel panel-default">
14 <div class="panel-heading">
14 <div class="panel-heading">
15 <h3 class="panel-title">${_('Pull Requests You Opened')}</h3>
15 <h3 class="panel-title">${_('Pull Requests You Opened')}: ${len(c.my_pull_requests)}</h3>
16 </div>
16 </div>
17 <div class="panel-body">
17 <div class="panel-body">
18 <div class="pullrequestlist">
18 <div class="pullrequestlist">
@@ -24,7 +24,7 b''
24 <th>${_('Author')}</th>
24 <th>${_('Author')}</th>
25 <th></th>
25 <th></th>
26 <th>${_('Title')}</th>
26 <th>${_('Title')}</th>
27 <th class="td-time">${_('Opened On')}</th>
27 <th class="td-time">${_('Last Update')}</th>
28 <th></th>
28 <th></th>
29 </thead>
29 </thead>
30 %for pull_request in c.my_pull_requests:
30 %for pull_request in c.my_pull_requests:
@@ -54,9 +54,8 b''
54 <br/>${pull_request.description}</div>
54 <br/>${pull_request.description}</div>
55 </div>
55 </div>
56 </td>
56 </td>
57
58 <td class="td-time">
57 <td class="td-time">
59 ${h.age_component(pull_request.created_on)}
58 ${h.age_component(pull_request.updated_on)}
60 </td>
59 </td>
61 <td class="td-action repolist_actions">
60 <td class="td-action repolist_actions">
62 ${h.secure_form(url('pullrequest_delete', repo_name=pull_request.target_repo.repo_name, pull_request_id=pull_request.pull_request_id),method='delete')}
61 ${h.secure_form(url('pullrequest_delete', repo_name=pull_request.target_repo.repo_name, pull_request_id=pull_request.pull_request_id),method='delete')}
@@ -76,7 +75,7 b''
76
75
77 <div class="panel panel-default">
76 <div class="panel panel-default">
78 <div class="panel-heading">
77 <div class="panel-heading">
79 <h3 class="panel-title">${_('Pull Requests You Participate In')}</h3>
78 <h3 class="panel-title">${_('Pull Requests You Participate In')}: ${len(c.participate_in_pull_requests)}</h3>
80 </div>
79 </div>
81
80
82 <div class="panel-body">
81 <div class="panel-body">
@@ -89,7 +88,7 b''
89 <th>${_('Author')}</th>
88 <th>${_('Author')}</th>
90 <th></th>
89 <th></th>
91 <th>${_('Title')}</th>
90 <th>${_('Title')}</th>
92 <th class="td-time">${_('Opened On')}</th>
91 <th class="td-time">${_('Last Update')}</th>
93 </thead>
92 </thead>
94 %for pull_request in c.participate_in_pull_requests:
93 %for pull_request in c.participate_in_pull_requests:
95 <tr class="${'closed' if pull_request.is_closed() else ''} prwrapper">
94 <tr class="${'closed' if pull_request.is_closed() else ''} prwrapper">
@@ -118,9 +117,8 b''
118 <br/>${pull_request.description}</div>
117 <br/>${pull_request.description}</div>
119 </div>
118 </div>
120 </td>
119 </td>
121
122 <td class="td-time">
120 <td class="td-time">
123 ${h.age_component(pull_request.created_on)}
121 ${h.age_component(pull_request.updated_on)}
124 </td>
122 </td>
125 </tr>
123 </tr>
126 %endfor
124 %endfor
@@ -30,6 +30,10 b''
30 ${self.menu_items(active='admin')}
30 ${self.menu_items(active='admin')}
31 </%def>
31 </%def>
32
32
33 <%def name="main_content()">
34 <%include file="/admin/repo_groups/repo_group_edit_${c.active}.html"/>
35 </%def>
36
33 <%def name="main()">
37 <%def name="main()">
34 <div class="box">
38 <div class="box">
35 <div class="title">
39 <div class="title">
@@ -44,11 +48,12 b''
44 <li class="${'active' if c.active=='settings' else ''}"><a href="${h.url('edit_repo_group', group_name=c.repo_group.group_name)}">${_('Settings')}</a></li>
48 <li class="${'active' if c.active=='settings' else ''}"><a href="${h.url('edit_repo_group', group_name=c.repo_group.group_name)}">${_('Settings')}</a></li>
45 <li class="${'active' if c.active=='perms' else ''}"><a href="${h.url('edit_repo_group_perms', group_name=c.repo_group.group_name)}">${_('Permissions')}</a></li>
49 <li class="${'active' if c.active=='perms' else ''}"><a href="${h.url('edit_repo_group_perms', group_name=c.repo_group.group_name)}">${_('Permissions')}</a></li>
46 <li class="${'active' if c.active=='advanced' else ''}"><a href="${h.url('edit_repo_group_advanced', group_name=c.repo_group.group_name)}">${_('Advanced')}</a></li>
50 <li class="${'active' if c.active=='advanced' else ''}"><a href="${h.url('edit_repo_group_advanced', group_name=c.repo_group.group_name)}">${_('Advanced')}</a></li>
51 <li class="${'active' if c.active=='integrations' else ''}"><a href="${h.route_path('repo_group_integrations_home', repo_group_name=c.repo_group.group_name)}">${_('Integrations')}</a></li>
47 </ul>
52 </ul>
48 </div>
53 </div>
49
54
50 <div class="main-content-full-width">
55 <div class="main-content-full-width">
51 <%include file="/admin/repo_groups/repo_group_edit_${c.active}.html"/>
56 ${self.main_content()}
52 </div>
57 </div>
53
58
54 </div>
59 </div>
@@ -6,6 +6,9 b''
6 ${h.secure_form(url('admin_settings_labs'), method='post')}
6 ${h.secure_form(url('admin_settings_labs'), method='post')}
7 <div class="form">
7 <div class="form">
8 <div class="fields">
8 <div class="fields">
9 % if not c.lab_settings:
10 ${_('There are no Labs settings currently')}
11 % else:
9 % for lab_setting in c.lab_settings:
12 % for lab_setting in c.lab_settings:
10 <div class="field">
13 <div class="field">
11 <div class="label">
14 <div class="label">
@@ -45,6 +48,7 b''
45 ${h.submit('save', _('Save settings'), class_='btn')}
48 ${h.submit('save', _('Save settings'), class_='btn')}
46 ${h.reset('reset', _('Reset'), class_='btn')}
49 ${h.reset('reset', _('Reset'), class_='btn')}
47 </div>
50 </div>
51 % endif
48 </div>
52 </div>
49 </div>
53 </div>
50 ${h.end_form()}
54 ${h.end_form()}
@@ -9,6 +9,3 b' pyramid_registry = get_current_registry('
9 {'config':config}, request=get_current_request(), package='rc_ae')|n}
9 {'config':config}, request=get_current_request(), package='rc_ae')|n}
10 % endif
10 % endif
11 % endfor
11 % endfor
12 <script>
13 $.Topic('/plugins/__REGISTER__').prepareOrPublish({});
14 </script>
@@ -15,7 +15,6 b" if getattr(c, 'rhodecode_user', None) an"
15
15
16 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
16 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
17 %>
17 %>
18
19 <html xmlns="http://www.w3.org/1999/xhtml">
18 <html xmlns="http://www.w3.org/1999/xhtml">
20 <head>
19 <head>
21 <title>${self.title()}</title>
20 <title>${self.title()}</title>
@@ -43,6 +42,38 b" c.template_context['visual']['default_re"
43
42
44 ## JAVASCRIPT
43 ## JAVASCRIPT
45 <%def name="js()">
44 <%def name="js()">
45 <script>
46 // setup Polymer options
47 window.Polymer = {lazyRegister: true, dom: 'shadow'};
48
49 // Load webcomponentsjs polyfill if browser does not support native Web Components
50 (function() {
51 'use strict';
52 var onload = function() {
53 // For native Imports, manually fire WebComponentsReady so user code
54 // can use the same code path for native and polyfill'd imports.
55 if (!window.HTMLImports) {
56 document.dispatchEvent(
57 new CustomEvent('WebComponentsReady', {bubbles: true})
58 );
59 }
60 };
61 var webComponentsSupported = (
62 'registerElement' in document
63 && 'import' in document.createElement('link')
64 && 'content' in document.createElement('template')
65 );
66 if (!webComponentsSupported) {
67 var e = document.createElement('script');
68 e.async = true;
69 e.src = '${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}';
70 document.head.appendChild(e);
71 } else {
72 onload();
73 }
74 })();
75 </script>
76
46 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
77 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
47 <script type="text/javascript">
78 <script type="text/javascript">
48 // register templateContext to pass template variables to JS
79 // register templateContext to pass template variables to JS
@@ -80,11 +111,18 b" c.template_context['visual']['default_re"
80 }
111 }
81 };
112 };
82 </script>
113 </script>
114 <%include file="/base/plugins_base.html"/>
83 <!--[if lt IE 9]>
115 <!--[if lt IE 9]>
84 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
116 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
85 <![endif]-->
117 <![endif]-->
86 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
118 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
87 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
119 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
120 <script>
121 var e = document.createElement('script');
122 e.src = '${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}';
123 document.head.appendChild(e);
124 </script>
125 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
88 ## avoide escaping the %N
126 ## avoide escaping the %N
89 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
127 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
90
128
@@ -107,8 +145,11 b" c.template_context['visual']['default_re"
107
145
108 <%def name="head_extra()"></%def>
146 <%def name="head_extra()"></%def>
109 ${self.head_extra()}
147 ${self.head_extra()}
110 <%include file="/base/plugins_base.html"/>
148 <script>
111
149 window.addEventListener("load", function(event) {
150 $.Topic('/plugins/__REGISTER__').prepareOrPublish({});
151 });
152 </script>
112 ## extra stuff
153 ## extra stuff
113 %if c.pre_code:
154 %if c.pre_code:
114 ${c.pre_code|n}
155 ${c.pre_code|n}
@@ -135,5 +176,6 b" c.template_context['visual']['default_re"
135 %if c.post_code:
176 %if c.post_code:
136 ${c.post_code|n}
177 ${c.post_code|n}
137 %endif
178 %endif
179 <rhodecode-app></rhodecode-app>
138 </body>
180 </body>
139 </html>
181 </html>
@@ -116,6 +116,53 b''
116 % endif
116 % endif
117 </div>
117 </div>
118 </div>
118 </div>
119 ## LABS for HG
120 % if c.labs_active:
121 <div class="panel panel-danger">
122 <div class="panel-heading">
123 <h3 class="panel-title">${_('Mercurial Labs Settings')} (${_('These features are considered experimental and may not work as expected.')})</h3>
124 </div>
125 <div class="panel-body">
126
127 <div class="checkbox">
128 ${h.checkbox('rhodecode_hg_use_rebase_for_merging' + suffix, 'True', **kwargs)}
129 <label for="rhodecode_hg_use_rebase_for_merging{suffix}">${_('Use rebase as merge strategy')}</label>
130 </div>
131 <div class="label">
132 <span class="help-block">${_('Use rebase instead of creating a merge commit when merging via web interface.')}</span>
133 </div>
134
135 </div>
136 </div>
137 % endif
138
139 % endif
140
141 % if display_globals:
142 <div class="panel panel-default">
143 <div class="panel-heading">
144 <h3 class="panel-title">${_('Global Subversion Settings')}</h3>
145 </div>
146 <div class="panel-body">
147 <div class="field">
148 <div class="checkbox">
149 ${h.checkbox('vcs_svn_proxy_http_requests_enabled' + suffix, 'True', **kwargs)}
150 <label for="vcs_svn_proxy_http_requests_enabled{suffix}">${_('Proxy subversion HTTP requests')}</label>
151 </div>
152 <div class="label">
153 <span class="help-block">${_('Subversion HTTP Support. Enables communication with SVN over HTTP protocol.')}</span>
154 </div>
155 </div>
156 <div class="field">
157 <div class="label">
158 <label for="vcs_svn_proxy_http_server_url">${_('Subversion HTTP Server URL')}</label><br/>
159 </div>
160 <div class="input">
161 ${h.text('vcs_svn_proxy_http_server_url',size=59)}
162 </div>
163 </div>
164 </div>
165 </div>
119 % endif
166 % endif
120
167
121 % if display_globals or repo_type in ['svn']:
168 % if display_globals or repo_type in ['svn']:
@@ -190,6 +237,9 b''
190 ${h.hidden('new_svn_tag' + suffix, '')}
237 ${h.hidden('new_svn_tag' + suffix, '')}
191 % endif
238 % endif
192
239
240
241
242
193 % if display_globals or repo_type in ['hg', 'git']:
243 % if display_globals or repo_type in ['hg', 'git']:
194 <div class="panel panel-default">
244 <div class="panel panel-default">
195 <div class="panel-heading">
245 <div class="panel-heading">
@@ -214,31 +264,4 b''
214 </div>
264 </div>
215 % endif
265 % endif
216
266
217 ## This condition has to be adapted if we add more labs settings for
218 ## VCS types other than 'hg'
219 % if c.labs_active and (display_globals or repo_type in ['hg']):
220 <div class="panel panel-danger">
221 <div class="panel-heading">
222 <h3 class="panel-title">${_('Labs settings')}: ${_('These features are considered experimental and may not work as expected.')}</h3>
223 </div>
224 <div class="panel-body">
225 <div class="fields">
226
227 <div class="field">
228 <div class="label">
229 <label>${_('Mercurial server-side merge')}:</label>
230 </div>
231 <div class="checkboxes">
232 <div class="checkbox">
233 ${h.checkbox('rhodecode_hg_use_rebase_for_merging' + suffix, 'True', **kwargs)}
234 <label for="rhodecode_hg_use_rebase_for_merging${suffix}">${_('Use rebase instead of creating a merge commit when merging via web interface')}</label>
235 </div>
236 <!-- <p class="help-block">Help message here</p> -->
237 </div>
238 </div>
239
240 </div>
241 </div>
242 </div>
243 % endif
244 </%def>
267 </%def>
@@ -168,8 +168,8 b''
168 ${self.gravatar_with_user(commit.author)}
168 ${self.gravatar_with_user(commit.author)}
169 </td>
169 </td>
170
170
171 <td class="td-tags tags-col truncate-wrap">
171 <td class="td-tags tags-col">
172 <div class="truncate tags-truncate" id="t-${commit.raw_id}">
172 <div id="t-${commit.raw_id}">
173 ## branch
173 ## branch
174 %if commit.branch:
174 %if commit.branch:
175 <span class="branchtag tag" title="${_('Branch %s') % commit.branch}">
175 <span class="branchtag tag" title="${_('Branch %s') % commit.branch}">
@@ -55,8 +55,8 b''
55 ${base.gravatar_with_user(cs.author)}
55 ${base.gravatar_with_user(cs.author)}
56 </td>
56 </td>
57
57
58 <td class="td-tags truncate-wrap">
58 <td class="td-tags">
59 <div class="truncate tags-truncate"><div class="autoexpand">
59 <div class="autoexpand">
60 %if h.is_hg(c.rhodecode_repo):
60 %if h.is_hg(c.rhodecode_repo):
61 %for book in cs.bookmarks:
61 %for book in cs.bookmarks:
62 <span class="booktag tag" title="${_('Bookmark %s') % book}">
62 <span class="booktag tag" title="${_('Bookmark %s') % book}">
@@ -372,11 +372,13 b''
372 }
372 }
373 });
373 });
374
374
375 if (location.href.indexOf('#') != -1) {
375 if (location.hash) {
376 var id = '#'+location.href.substring(location.href.indexOf('#') + 1).split('#');
376 var result = splitDelimitedHash(location.hash);
377 var line = $('html').find(id);
377 var line = $('html').find(result.loc);
378 if (line.length > 0){
378 offsetScroll(line, 70);
379 offsetScroll(line, 70);
379 }
380 }
381 }
380
382
381 // browse tree @ revision
383 // browse tree @ revision
382 $('#files_link').on('click', function(e){
384 $('#files_link').on('click', function(e){
@@ -307,6 +307,6 b''
307 "#${form_id}", commitId, pullRequestId, lineNo, true);
307 "#${form_id}", commitId, pullRequestId, lineNo, true);
308
308
309 mainCommentForm.initStatusChangeSelector();
309 mainCommentForm.initStatusChangeSelector();
310
310 bindToggleButtons();
311 </script>
311 </script>
312 </%def>
312 </%def>
@@ -13,12 +13,4 b''
13 'webapp_location': ''};
13 'webapp_location': ''};
14 %endif
14 %endif
15
15
16 if (CHANNELSTREAM_SETTINGS.enabled) {
17 connCtrlr = new ConnectionController(
18 CHANNELSTREAM_SETTINGS.webapp_location,
19 CHANNELSTREAM_SETTINGS.ws_location,
20 CHANNELSTREAM_URLS
21 );
22 registerViewChannels();
23 }
24 </script>
16 </script>
@@ -39,11 +39,17 b''
39 <p>${_('You will be redirected to %s in %s seconds') % (c.redirect_module,c.redirect_time)}</p>
39 <p>${_('You will be redirected to %s in %s seconds') % (c.redirect_module,c.redirect_time)}</p>
40 %endif
40 %endif
41 <div class="inner-column">
41 <div class="inner-column">
42 <h4>Possible Cause</h4>
42 <h4>Possible Causes</h4>
43 <ul>
43 <ul>
44 % if c.causes:
45 %for cause in c.causes:
46 <li>${cause}</li>
47 %endfor
48 %else:
44 <li>The resource may have been deleted.</li>
49 <li>The resource may have been deleted.</li>
45 <li>You may not have access to this repository.</li>
50 <li>You may not have access to this repository.</li>
46 <li>The link may be incorrect.</li>
51 <li>The link may be incorrect.</li>
52 %endif
47 </ul>
53 </ul>
48 </div>
54 </div>
49 <div class="inner-column">
55 <div class="inner-column">
@@ -177,10 +177,12 b''
177 var _first_line = $('#L' + h_lines[0]).get(0);
177 var _first_line = $('#L' + h_lines[0]).get(0);
178 if (_first_line) {
178 if (_first_line) {
179 var line = $('#L' + h_lines[0]);
179 var line = $('#L' + h_lines[0]);
180 if (line.length > 0){
180 offsetScroll(line, 70);
181 offsetScroll(line, 70);
181 }
182 }
182 }
183 }
183 }
184 }
185 }
184
186
185 // select code link event
187 // select code link event
186 $("#hlcode").mouseup(getSelectionLink);
188 $("#hlcode").mouseup(getSelectionLink);
@@ -5,7 +5,8 b''
5 <span> <strong>${c.file}</strong></span>
5 <span> <strong>${c.file}</strong></span>
6 <span> | ${c.file.lines()[0]} ${ungettext('line', 'lines', c.file.lines()[0])}</span>
6 <span> | ${c.file.lines()[0]} ${ungettext('line', 'lines', c.file.lines()[0])}</span>
7 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
7 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
8 <span class="item last"> | ${c.file.mimetype}</span>
8 <span> | ${c.file.mimetype} </span>
9 <span class="item last"> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
9 </div>
10 </div>
10 <div class="buttons">
11 <div class="buttons">
11 <a id="file_history_overview" href="#">
12 <a id="file_history_overview" href="#">
@@ -10,7 +10,6 b''
10 id="item-${oid}"
10 id="item-${oid}"
11 tal:omit-tag="structural"
11 tal:omit-tag="structural"
12 i18n:domain="deform">
12 i18n:domain="deform">
13
14 <label for="${oid}"
13 <label for="${oid}"
15 class="control-label ${required and 'required' or ''}"
14 class="control-label ${required and 'required' or ''}"
16 tal:condition="not structural"
15 tal:condition="not structural"
@@ -18,7 +17,7 b''
18 >
17 >
19 ${title}
18 ${title}
20 </label>
19 </label>
21 <div class="control-inputs">
20 <div class="control-inputs ${field.widget.item_css_class or ''}">
22 <div tal:define="input_prepend field.widget.input_prepend | None;
21 <div tal:define="input_prepend field.widget.input_prepend | None;
23 input_append field.widget.input_append | None"
22 input_append field.widget.input_append | None"
24 tal:omit-tag="not (input_prepend or input_append)"
23 tal:omit-tag="not (input_prepend or input_append)"
@@ -412,11 +412,13 b''
412 %endif
412 %endif
413
413
414 <script type="text/javascript">
414 <script type="text/javascript">
415 if (location.href.indexOf('#') != -1) {
415 if (location.hash) {
416 var id = '#'+location.href.substring(location.href.indexOf('#') + 1).split('#');
416 var result = splitDelimitedHash(location.hash);
417 var line = $('html').find(id);
417 var line = $('html').find(result.loc);
418 if (line.length > 0){
418 offsetScroll(line, 70);
419 offsetScroll(line, 70);
419 }
420 }
421 }
420 $(function(){
422 $(function(){
421 ReviewerAutoComplete('user');
423 ReviewerAutoComplete('user');
422 // custom code mirror
424 // custom code mirror
@@ -105,7 +105,7 b''
105 { data: {"_": "comments",
105 { data: {"_": "comments",
106 "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false},
106 "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false},
107 { data: {"_": "updated_on",
107 { data: {"_": "updated_on",
108 "sort": "updated_on_raw"}, title: "${_('Updated on')}", className: "td-time" }
108 "sort": "updated_on_raw"}, title: "${_('Last Update')}", className: "td-time" }
109 ],
109 ],
110 language: {
110 language: {
111 paginate: DEFAULT_GRID_PAGINATION,
111 paginate: DEFAULT_GRID_PAGINATION,
@@ -21,6 +21,7 b''
21 import pytest
21 import pytest
22
22
23 from rhodecode.lib import helpers as h
23 from rhodecode.lib import helpers as h
24 from rhodecode.lib.auth import check_password
24 from rhodecode.model.db import User, UserFollowing, Repository, UserApiKeys
25 from rhodecode.model.db import User, UserFollowing, Repository, UserApiKeys
25 from rhodecode.model.meta import Session
26 from rhodecode.model.meta import Session
26 from rhodecode.tests import (
27 from rhodecode.tests import (
@@ -34,6 +35,7 b' fixture = Fixture()'
34
35
35 class TestMyAccountController(TestController):
36 class TestMyAccountController(TestController):
36 test_user_1 = 'testme'
37 test_user_1 = 'testme'
38 test_user_1_password = '0jd83nHNS/d23n'
37 destroy_users = set()
39 destroy_users = set()
38
40
39 @classmethod
41 @classmethod
@@ -158,7 +160,8 b' class TestMyAccountController(TestContro'
158 ('email', {'email': 'some@email.com'}),
160 ('email', {'email': 'some@email.com'}),
159 ])
161 ])
160 def test_my_account_update(self, name, attrs):
162 def test_my_account_update(self, name, attrs):
161 usr = fixture.create_user(self.test_user_1, password='qweqwe',
163 usr = fixture.create_user(self.test_user_1,
164 password=self.test_user_1_password,
162 email='testme@rhodecode.org',
165 email='testme@rhodecode.org',
163 extern_type='rhodecode',
166 extern_type='rhodecode',
164 extern_name=self.test_user_1,
167 extern_name=self.test_user_1,
@@ -167,7 +170,8 b' class TestMyAccountController(TestContro'
167
170
168 params = usr.get_api_data() # current user data
171 params = usr.get_api_data() # current user data
169 user_id = usr.user_id
172 user_id = usr.user_id
170 self.log_user(username=self.test_user_1, password='qweqwe')
173 self.log_user(
174 username=self.test_user_1, password=self.test_user_1_password)
171
175
172 params.update({'password_confirmation': ''})
176 params.update({'password_confirmation': ''})
173 params.update({'new_password': ''})
177 params.update({'new_password': ''})
@@ -321,8 +325,55 b' class TestMyAccountController(TestContro'
321 response = response.follow()
325 response = response.follow()
322 response.mustcontain(no=[api_key])
326 response.mustcontain(no=[api_key])
323
327
324 def test_password_is_updated_in_session_on_password_change(
328 def test_valid_change_password(self, user_util):
325 self, user_util):
329 new_password = 'my_new_valid_password'
330 user = user_util.create_user(password=self.test_user_1_password)
331 session = self.log_user(user.username, self.test_user_1_password)
332 form_data = [
333 ('current_password', self.test_user_1_password),
334 ('__start__', 'new_password:mapping'),
335 ('new_password', new_password),
336 ('new_password-confirm', new_password),
337 ('__end__', 'new_password:mapping'),
338 ('csrf_token', self.csrf_token),
339 ]
340 response = self.app.post(url('my_account_password'), form_data).follow()
341 assert 'Successfully updated password' in response
342
343 # check_password depends on user being in session
344 Session().add(user)
345 try:
346 assert check_password(new_password, user.password)
347 finally:
348 Session().expunge(user)
349
350 @pytest.mark.parametrize('current_pw,new_pw,confirm_pw', [
351 ('', 'abcdef123', 'abcdef123'),
352 ('wrong_pw', 'abcdef123', 'abcdef123'),
353 (test_user_1_password, test_user_1_password, test_user_1_password),
354 (test_user_1_password, '', ''),
355 (test_user_1_password, 'abcdef123', ''),
356 (test_user_1_password, '', 'abcdef123'),
357 (test_user_1_password, 'not_the', 'same_pw'),
358 (test_user_1_password, 'short', 'short'),
359 ])
360 def test_invalid_change_password(self, current_pw, new_pw, confirm_pw,
361 user_util):
362 user = user_util.create_user(password=self.test_user_1_password)
363 session = self.log_user(user.username, self.test_user_1_password)
364 old_password_hash = session['password']
365 form_data = [
366 ('current_password', current_pw),
367 ('__start__', 'new_password:mapping'),
368 ('new_password', new_pw),
369 ('new_password-confirm', confirm_pw),
370 ('__end__', 'new_password:mapping'),
371 ('csrf_token', self.csrf_token),
372 ]
373 response = self.app.post(url('my_account_password'), form_data)
374 assert 'Error occurred' in response
375
376 def test_password_is_updated_in_session_on_password_change(self, user_util):
326 old_password = 'abcdef123'
377 old_password = 'abcdef123'
327 new_password = 'abcdef124'
378 new_password = 'abcdef124'
328
379
@@ -330,12 +381,14 b' class TestMyAccountController(TestContro'
330 session = self.log_user(user.username, old_password)
381 session = self.log_user(user.username, old_password)
331 old_password_hash = session['password']
382 old_password_hash = session['password']
332
383
333 form_data = {
384 form_data = [
334 'current_password': old_password,
385 ('current_password', old_password),
335 'new_password': new_password,
386 ('__start__', 'new_password:mapping'),
336 'new_password_confirmation': new_password,
387 ('new_password', new_password),
337 'csrf_token': self.csrf_token
388 ('new_password-confirm', new_password),
338 }
389 ('__end__', 'new_password:mapping'),
390 ('csrf_token', self.csrf_token),
391 ]
339 self.app.post(url('my_account_password'), form_data)
392 self.app.post(url('my_account_password'), form_data)
340
393
341 response = self.app.get(url('home'))
394 response = self.app.get(url('home'))
@@ -347,13 +347,13 b' class TestAdminSettingsVcs:'
347 with mock.patch.dict(
347 with mock.patch.dict(
348 rhodecode.CONFIG, {'labs_settings_active': 'true'}):
348 rhodecode.CONFIG, {'labs_settings_active': 'true'}):
349 response = self.app.get(url('admin_settings_vcs'))
349 response = self.app.get(url('admin_settings_vcs'))
350 response.mustcontain('Labs settings:')
350 response.mustcontain('Labs Settings')
351
351
352 def test_has_not_a_section_for_labs_settings_if_disables(self, app):
352 def test_has_not_a_section_for_labs_settings_if_disables(self, app):
353 with mock.patch.dict(
353 with mock.patch.dict(
354 rhodecode.CONFIG, {'labs_settings_active': 'false'}):
354 rhodecode.CONFIG, {'labs_settings_active': 'false'}):
355 response = self.app.get(url('admin_settings_vcs'))
355 response = self.app.get(url('admin_settings_vcs'))
356 response.mustcontain(no='Labs settings:')
356 response.mustcontain(no='Labs Settings')
357
357
358 @pytest.mark.parametrize('new_value', [True, False])
358 @pytest.mark.parametrize('new_value', [True, False])
359 def test_allows_to_change_hg_rebase_merge_strategy(
359 def test_allows_to_change_hg_rebase_merge_strategy(
@@ -444,50 +444,6 b' class TestLabsSettings(object):'
444 assert '<p class="help-block">text help</p>' in response
444 assert '<p class="help-block">text help</p>' in response
445 assert 'name="rhodecode_text" size="60" type="text"' in response
445 assert 'name="rhodecode_text" size="60" type="text"' in response
446
446
447 @pytest.mark.parametrize('setting_name', [
448 'proxy_subversion_http_requests',
449 ])
450 def test_update_boolean_settings(self, csrf_token, setting_name):
451 self.app.post(
452 url('admin_settings_labs'),
453 params={
454 'rhodecode_{}'.format(setting_name): 'true',
455 'csrf_token': csrf_token,
456 })
457 setting = SettingsModel().get_setting_by_name(setting_name)
458 assert setting.app_settings_value
459
460 self.app.post(
461 url('admin_settings_labs'),
462 params={
463 'rhodecode_{}'.format(setting_name): 'false',
464 'csrf_token': csrf_token,
465 })
466 setting = SettingsModel().get_setting_by_name(setting_name)
467 assert not setting.app_settings_value
468
469 @pytest.mark.parametrize('setting_name', [
470 'subversion_http_server_url',
471 ])
472 def test_update_string_settings(self, csrf_token, setting_name):
473 self.app.post(
474 url('admin_settings_labs'),
475 params={
476 'rhodecode_{}'.format(setting_name): 'Test 1',
477 'csrf_token': csrf_token,
478 })
479 setting = SettingsModel().get_setting_by_name(setting_name)
480 assert setting.app_settings_value == 'Test 1'
481
482 self.app.post(
483 url('admin_settings_labs'),
484 params={
485 'rhodecode_{}'.format(setting_name): ' Test 2 ',
486 'csrf_token': csrf_token,
487 })
488 setting = SettingsModel().get_setting_by_name(setting_name)
489 assert setting.app_settings_value == 'Test 2'
490
491
447
492 @pytest.mark.usefixtures('app')
448 @pytest.mark.usefixtures('app')
493 class TestOpenSourceLicenses(object):
449 class TestOpenSourceLicenses(object):
@@ -57,7 +57,6 b' class TestChangesetController(object):'
57 revision=self.commit_id[backend.alias]))
57 revision=self.commit_id[backend.alias]))
58 assert response.body == self.diffs[backend.alias]
58 assert response.body == self.diffs[backend.alias]
59
59
60 @pytest.mark.xfail_backends("svn", reason="Depends on consistent diffs")
61 def test_single_commit_page_different_ops(self, backend):
60 def test_single_commit_page_different_ops(self, backend):
62 commit_id = {
61 commit_id = {
63 'hg': '603d6c72c46d953420c89d36372f08d9f305f5dd',
62 'hg': '603d6c72c46d953420c89d36372f08d9f305f5dd',
@@ -75,12 +74,16 b' class TestChangesetController(object):'
75 # files op files
74 # files op files
76 response.mustcontain('File no longer present at commit: %s' %
75 response.mustcontain('File no longer present at commit: %s' %
77 _shorten_commit_id(commit_id))
76 _shorten_commit_id(commit_id))
77
78 # svn uses a different filename
79 if backend.alias == 'svn':
80 response.mustcontain('new file 10644')
81 else:
78 response.mustcontain('new file 100644')
82 response.mustcontain('new file 100644')
79 response.mustcontain('Changed theme to ADC theme') # commit msg
83 response.mustcontain('Changed theme to ADC theme') # commit msg
80
84
81 self._check_diff_menus(response, right_menu=True)
85 self._check_diff_menus(response, right_menu=True)
82
86
83 @pytest.mark.xfail_backends("svn", reason="Depends on consistent diffs")
84 def test_commit_range_page_different_ops(self, backend):
87 def test_commit_range_page_different_ops(self, backend):
85 commit_id_range = {
88 commit_id_range = {
86 'hg': (
89 'hg': (
@@ -101,18 +104,23 b' class TestChangesetController(object):'
101
104
102 response.mustcontain(_shorten_commit_id(commit_ids[0]))
105 response.mustcontain(_shorten_commit_id(commit_ids[0]))
103 response.mustcontain(_shorten_commit_id(commit_ids[1]))
106 response.mustcontain(_shorten_commit_id(commit_ids[1]))
107
108 # svn is special
109 if backend.alias == 'svn':
110 response.mustcontain('new file 10644')
111 response.mustcontain('34 files changed: 1184 inserted, 311 deleted')
112 else:
113 response.mustcontain('new file 100644')
104 response.mustcontain('33 files changed: 1165 inserted, 308 deleted')
114 response.mustcontain('33 files changed: 1165 inserted, 308 deleted')
105
115
106 # files op files
116 # files op files
107 response.mustcontain('File no longer present at commit: %s' %
117 response.mustcontain('File no longer present at commit: %s' %
108 _shorten_commit_id(commit_ids[1]))
118 _shorten_commit_id(commit_ids[1]))
109 response.mustcontain('new file 100644')
110 response.mustcontain('Added docstrings to vcs.cli') # commit msg
119 response.mustcontain('Added docstrings to vcs.cli') # commit msg
111 response.mustcontain('Changed theme to ADC theme') # commit msg
120 response.mustcontain('Changed theme to ADC theme') # commit msg
112
121
113 self._check_diff_menus(response)
122 self._check_diff_menus(response)
114
123
115 @pytest.mark.xfail_backends("svn", reason="Depends on consistent diffs")
116 def test_combined_compare_commit_page_different_ops(self, backend):
124 def test_combined_compare_commit_page_different_ops(self, backend):
117 commit_id_range = {
125 commit_id_range = {
118 'hg': (
126 'hg': (
@@ -134,12 +142,19 b' class TestChangesetController(object):'
134
142
135 response.mustcontain(_shorten_commit_id(commit_ids[0]))
143 response.mustcontain(_shorten_commit_id(commit_ids[0]))
136 response.mustcontain(_shorten_commit_id(commit_ids[1]))
144 response.mustcontain(_shorten_commit_id(commit_ids[1]))
137 response.mustcontain('32 files changed: 1165 inserted, 308 deleted')
138
145
139 # files op files
146 # files op files
140 response.mustcontain('File no longer present at commit: %s' %
147 response.mustcontain('File no longer present at commit: %s' %
141 _shorten_commit_id(commit_ids[1]))
148 _shorten_commit_id(commit_ids[1]))
149
150 # svn is special
151 if backend.alias == 'svn':
152 response.mustcontain('new file 10644')
153 response.mustcontain('32 files changed: 1179 inserted, 310 deleted')
154 else:
142 response.mustcontain('new file 100644')
155 response.mustcontain('new file 100644')
156 response.mustcontain('32 files changed: 1165 inserted, 308 deleted')
157
143 response.mustcontain('Added docstrings to vcs.cli') # commit msg
158 response.mustcontain('Added docstrings to vcs.cli') # commit msg
144 response.mustcontain('Changed theme to ADC theme') # commit msg
159 response.mustcontain('Changed theme to ADC theme') # commit msg
145
160
@@ -32,7 +32,7 b' from rhodecode.tests.utils import Assert'
32 @pytest.mark.usefixtures("autologin_user", "app")
32 @pytest.mark.usefixtures("autologin_user", "app")
33 class TestCompareController:
33 class TestCompareController:
34
34
35 @pytest.mark.xfail_backends("svn", "git")
35 @pytest.mark.xfail_backends("svn", reason="Requires pull")
36 def test_compare_remote_with_different_commit_indexes(self, backend):
36 def test_compare_remote_with_different_commit_indexes(self, backend):
37 # Preparing the following repository structure:
37 # Preparing the following repository structure:
38 #
38 #
@@ -80,6 +80,8 b' class TestCompareController:'
80 origin_repo.pull(fork.repo_full_path, commit_ids=[commit3.raw_id])
80 origin_repo.pull(fork.repo_full_path, commit_ids=[commit3.raw_id])
81
81
82 # Verify test fixture setup
82 # Verify test fixture setup
83 # This does not work for git
84 if backend.alias != 'git':
83 assert 5 == len(fork.scm_instance().commit_ids)
85 assert 5 == len(fork.scm_instance().commit_ids)
84 assert 2 == len(origin_repo.commit_ids)
86 assert 2 == len(origin_repo.commit_ids)
85
87
@@ -224,7 +226,7 b' class TestCompareController:'
224
226
225 response.mustcontain("Repositories unrelated.")
227 response.mustcontain("Repositories unrelated.")
226
228
227 @pytest.mark.xfail_backends("svn", "git")
229 @pytest.mark.xfail_backends("svn")
228 def test_compare_cherry_pick_commits_from_bottom(self, backend):
230 def test_compare_cherry_pick_commits_from_bottom(self, backend):
229
231
230 # repo1:
232 # repo1:
@@ -275,10 +277,10 b' class TestCompareController:'
275 repo_name=repo2.repo_name,
277 repo_name=repo2.repo_name,
276 source_ref_type="rev",
278 source_ref_type="rev",
277 # parent of commit2, in target repo2
279 # parent of commit2, in target repo2
278 source_ref=commit1.short_id,
280 source_ref=commit1.raw_id,
279 target_repo=repo1.repo_name,
281 target_repo=repo1.repo_name,
280 target_ref_type="rev",
282 target_ref_type="rev",
281 target_ref=commit4.short_id,
283 target_ref=commit4.raw_id,
282 merge='1',))
284 merge='1',))
283 response.mustcontain('%s@%s' % (repo2.repo_name, commit1.short_id))
285 response.mustcontain('%s@%s' % (repo2.repo_name, commit1.short_id))
284 response.mustcontain('%s@%s' % (repo1.repo_name, commit4.short_id))
286 response.mustcontain('%s@%s' % (repo1.repo_name, commit4.short_id))
@@ -291,7 +293,7 b' class TestCompareController:'
291 ('file1', 'a_c--826e8142e6ba'),
293 ('file1', 'a_c--826e8142e6ba'),
292 ])
294 ])
293
295
294 @pytest.mark.xfail_backends("svn", "git")
296 @pytest.mark.xfail_backends("svn")
295 def test_compare_cherry_pick_commits_from_top(self, backend):
297 def test_compare_cherry_pick_commits_from_top(self, backend):
296 # repo1:
298 # repo1:
297 # commit0:
299 # commit0:
@@ -341,9 +343,9 b' class TestCompareController:'
341 repo_name=repo1.repo_name,
343 repo_name=repo1.repo_name,
342 source_ref_type="rev",
344 source_ref_type="rev",
343 # parent of commit3, not in source repo2
345 # parent of commit3, not in source repo2
344 source_ref=commit2.short_id,
346 source_ref=commit2.raw_id,
345 target_ref_type="rev",
347 target_ref_type="rev",
346 target_ref=commit5.short_id,
348 target_ref=commit5.raw_id,
347 merge='1',))
349 merge='1',))
348
350
349 response.mustcontain('%s@%s' % (repo1.repo_name, commit2.short_id))
351 response.mustcontain('%s@%s' % (repo1.repo_name, commit2.short_id))
@@ -64,8 +64,6 b' class TestPullrequestsController:'
64 assert response.status == '302 Found'
64 assert response.status == '302 Found'
65 assert redirect_url in response.location
65 assert redirect_url in response.location
66
66
67 @pytest.mark.xfail_backends(
68 "git", reason="Pending bugfix/feature, issue #6")
69 def test_create_pr_form_with_raw_commit_id(self, backend):
67 def test_create_pr_form_with_raw_commit_id(self, backend):
70 repo = backend.repo
68 repo = backend.repo
71
69
@@ -18,61 +18,205 b''
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 import time
21 import pytest
22 import pytest
22 import requests
23 from mock import Mock, patch
24
23
25 from rhodecode import events
24 from rhodecode import events
25 from rhodecode.tests.fixture import Fixture
26 from rhodecode.model.db import Session, Integration
26 from rhodecode.model.db import Session, Integration
27 from rhodecode.model.integration import IntegrationModel
27 from rhodecode.model.integration import IntegrationModel
28 from rhodecode.integrations.types.base import IntegrationTypeBase
28 from rhodecode.integrations.types.base import IntegrationTypeBase
29
29
30
30
31 class TestIntegrationType(IntegrationTypeBase):
31 class TestDeleteScopesDeletesIntegrations(object):
32 """ Test integration type class """
32 def test_delete_repo_with_integration_deletes_integration(self,
33
33 repo_integration_stub):
34 key = 'test-integration'
34 Session().delete(repo_integration_stub.repo)
35 display_name = 'Test integration type'
35 Session().commit()
36 Session().expire_all()
37 integration = Integration.get(repo_integration_stub.integration_id)
38 assert integration is None
36
39
37 def __init__(self, settings):
38 super(IntegrationTypeBase, self).__init__(settings)
39 self.sent_events = [] # for testing
40
40
41 def send_event(self, event):
41 def test_delete_repo_group_with_integration_deletes_integration(self,
42 self.sent_events.append(event)
42 repogroup_integration_stub):
43 Session().delete(repogroup_integration_stub.repo_group)
44 Session().commit()
45 Session().expire_all()
46 integration = Integration.get(repogroup_integration_stub.integration_id)
47 assert integration is None
43
48
44
49
45 @pytest.fixture
50 @pytest.fixture
46 def repo_integration_stub(request, repo_stub):
51 def integration_repos(request, StubIntegrationType, stub_integration_settings):
47 settings = {'test_key': 'test_value'}
52 """
48 integration = IntegrationModel().create(
53 Create repositories and integrations for testing, and destroy them after
49 TestIntegrationType, settings=settings, repo=repo_stub, enabled=True,
54
50 name='test repo integration')
55 Structure:
56 root_repo
57 parent_group/
58 parent_repo
59 child_group/
60 child_repo
61 other_group/
62 other_repo
63 """
64 fixture = Fixture()
65
66
67 parent_group_id = 'int_test_parent_group_%s' % time.time()
68 parent_group = fixture.create_repo_group(parent_group_id)
69
70 other_group_id = 'int_test_other_group_%s' % time.time()
71 other_group = fixture.create_repo_group(other_group_id)
72
73 child_group_id = (
74 parent_group_id + '/' + 'int_test_child_group_%s' % time.time())
75 child_group = fixture.create_repo_group(child_group_id)
76
77 parent_repo_id = 'int_test_parent_repo_%s' % time.time()
78 parent_repo = fixture.create_repo(parent_repo_id, repo_group=parent_group)
79
80 child_repo_id = 'int_test_child_repo_%s' % time.time()
81 child_repo = fixture.create_repo(child_repo_id, repo_group=child_group)
82
83 other_repo_id = 'int_test_other_repo_%s' % time.time()
84 other_repo = fixture.create_repo(other_repo_id, repo_group=other_group)
85
86 root_repo_id = 'int_test_repo_root_%s' % time.time()
87 root_repo = fixture.create_repo(root_repo_id)
51
88
52 @request.addfinalizer
89 integrations = {}
53 def cleanup():
90 for name, repo, repo_group, child_repos_only in [
54 IntegrationModel().delete(integration)
91 ('global', None, None, None),
92 ('root_repos', None, None, True),
93 ('parent_repo', parent_repo, None, None),
94 ('child_repo', child_repo, None, None),
95 ('other_repo', other_repo, None, None),
96 ('root_repo', root_repo, None, None),
97 ('parent_group', None, parent_group, True),
98 ('parent_group_recursive', None, parent_group, False),
99 ('child_group', None, child_group, True),
100 ('child_group_recursive', None, child_group, False),
101 ('other_group', None, other_group, True),
102 ('other_group_recursive', None, other_group, False),
103 ]:
104 integrations[name] = IntegrationModel().create(
105 StubIntegrationType, settings=stub_integration_settings,
106 enabled=True, name='test %s integration' % name,
107 repo=repo, repo_group=repo_group, child_repos_only=child_repos_only)
108
109 Session().commit()
55
110
56 return integration
111 def _cleanup():
112 for integration in integrations.values():
113 Session.delete(integration)
114
115 fixture.destroy_repo(root_repo)
116 fixture.destroy_repo(child_repo)
117 fixture.destroy_repo(parent_repo)
118 fixture.destroy_repo(other_repo)
119 fixture.destroy_repo_group(child_group)
120 fixture.destroy_repo_group(parent_group)
121 fixture.destroy_repo_group(other_group)
122
123 request.addfinalizer(_cleanup)
124
125 return {
126 'integrations': integrations,
127 'repos': {
128 'root_repo': root_repo,
129 'other_repo': other_repo,
130 'parent_repo': parent_repo,
131 'child_repo': child_repo,
132 }
133 }
57
134
58
135
59 @pytest.fixture
136 def test_enabled_integration_repo_scopes(integration_repos):
60 def global_integration_stub(request):
137 integrations = integration_repos['integrations']
61 settings = {'test_key': 'test_value'}
138 repos = integration_repos['repos']
62 integration = IntegrationModel().create(
139
63 TestIntegrationType, settings=settings, enabled=True,
140 triggered_integrations = IntegrationModel().get_for_event(
64 name='test global integration')
141 events.RepoEvent(repos['root_repo']))
65
142
66 @request.addfinalizer
143 assert triggered_integrations == [
67 def cleanup():
144 integrations['global'],
68 IntegrationModel().delete(integration)
145 integrations['root_repos'],
146 integrations['root_repo'],
147 ]
148
69
149
70 return integration
150 triggered_integrations = IntegrationModel().get_for_event(
151 events.RepoEvent(repos['other_repo']))
152
153 assert triggered_integrations == [
154 integrations['global'],
155 integrations['other_repo'],
156 integrations['other_group'],
157 integrations['other_group_recursive'],
158 ]
71
159
72
160
73 def test_delete_repo_with_integration_deletes_integration(repo_integration_stub):
161 triggered_integrations = IntegrationModel().get_for_event(
74 Session().delete(repo_integration_stub.repo)
162 events.RepoEvent(repos['parent_repo']))
163
164 assert triggered_integrations == [
165 integrations['global'],
166 integrations['parent_repo'],
167 integrations['parent_group'],
168 integrations['parent_group_recursive'],
169 ]
170
171 triggered_integrations = IntegrationModel().get_for_event(
172 events.RepoEvent(repos['child_repo']))
173
174 assert triggered_integrations == [
175 integrations['global'],
176 integrations['child_repo'],
177 integrations['parent_group_recursive'],
178 integrations['child_group'],
179 integrations['child_group_recursive'],
180 ]
181
182
183 def test_disabled_integration_repo_scopes(integration_repos):
184 integrations = integration_repos['integrations']
185 repos = integration_repos['repos']
186
187 for integration in integrations.values():
188 integration.enabled = False
75 Session().commit()
189 Session().commit()
76 Session().expire_all()
190
77 assert Integration.get(repo_integration_stub.integration_id) is None
191 triggered_integrations = IntegrationModel().get_for_event(
192 events.RepoEvent(repos['root_repo']))
193
194 assert triggered_integrations == []
195
196
197 triggered_integrations = IntegrationModel().get_for_event(
198 events.RepoEvent(repos['parent_repo']))
199
200 assert triggered_integrations == []
201
202
203 triggered_integrations = IntegrationModel().get_for_event(
204 events.RepoEvent(repos['child_repo']))
78
205
206 assert triggered_integrations == []
207
208
209 triggered_integrations = IntegrationModel().get_for_event(
210 events.RepoEvent(repos['other_repo']))
211
212 assert triggered_integrations == []
213
214
215
216 def test_enabled_non_repo_integrations(integration_repos):
217 integrations = integration_repos['integrations']
218
219 triggered_integrations = IntegrationModel().get_for_event(
220 events.UserPreCreate({}))
221
222 assert triggered_integrations == [integrations['global']]
@@ -78,6 +78,20 b' class TestSimpleSvn(object):'
78 assert name == repo.repo_name
78 assert name == repo.repo_name
79
79
80 def test_create_wsgi_app(self):
80 def test_create_wsgi_app(self):
81 with patch.object(SimpleSvn, '_is_svn_enabled') as mock_method:
82 mock_method.return_value = False
83 with patch('rhodecode.lib.middleware.simplesvn.DisabledSimpleSvnApp') as (
84 wsgi_app_mock):
85 config = Mock()
86 wsgi_app = self.app._create_wsgi_app(
87 repo_path='', repo_name='', config=config)
88
89 wsgi_app_mock.assert_called_once_with(config)
90 assert wsgi_app == wsgi_app_mock()
91
92 def test_create_wsgi_app_when_enabled(self):
93 with patch.object(SimpleSvn, '_is_svn_enabled') as mock_method:
94 mock_method.return_value = True
81 with patch('rhodecode.lib.middleware.simplesvn.SimpleSvnApp') as (
95 with patch('rhodecode.lib.middleware.simplesvn.SimpleSvnApp') as (
82 wsgi_app_mock):
96 wsgi_app_mock):
83 config = Mock()
97 config = Mock()
@@ -88,6 +102,7 b' class TestSimpleSvn(object):'
88 assert wsgi_app == wsgi_app_mock()
102 assert wsgi_app == wsgi_app_mock()
89
103
90
104
105
91 class TestSimpleSvnApp(object):
106 class TestSimpleSvnApp(object):
92 data = '<xml></xml>'
107 data = '<xml></xml>'
93 path = '/group/my-repo'
108 path = '/group/my-repo'
@@ -42,6 +42,10 b' class StubVCSController(simplevcs.Simple'
42 SCM = 'hg'
42 SCM = 'hg'
43 stub_response_body = tuple()
43 stub_response_body = tuple()
44
44
45 def __init__(self, *args, **kwargs):
46 super(StubVCSController, self).__init__(*args, **kwargs)
47 self.repo_name = HG_REPO
48
45 def _get_repository_name(self, environ):
49 def _get_repository_name(self, environ):
46 return HG_REPO
50 return HG_REPO
47
51
@@ -22,11 +22,15 b' from mock import patch, Mock'
22
22
23 import rhodecode
23 import rhodecode
24 from rhodecode.lib.middleware import vcs
24 from rhodecode.lib.middleware import vcs
25 from rhodecode.lib.middleware.simplesvn import (
26 SimpleSvn, DisabledSimpleSvnApp, SimpleSvnApp)
27 from rhodecode.tests import SVN_REPO
25
28
29 svn_repo_path = '/'+ SVN_REPO
26
30
27 def test_is_hg():
31 def test_is_hg():
28 environ = {
32 environ = {
29 'PATH_INFO': '/rhodecode-dev',
33 'PATH_INFO': svn_repo_path,
30 'QUERY_STRING': 'cmd=changegroup',
34 'QUERY_STRING': 'cmd=changegroup',
31 'HTTP_ACCEPT': 'application/mercurial'
35 'HTTP_ACCEPT': 'application/mercurial'
32 }
36 }
@@ -35,7 +39,7 b' def test_is_hg():'
35
39
36 def test_is_hg_no_cmd():
40 def test_is_hg_no_cmd():
37 environ = {
41 environ = {
38 'PATH_INFO': '/rhodecode-dev',
42 'PATH_INFO': svn_repo_path,
39 'QUERY_STRING': '',
43 'QUERY_STRING': '',
40 'HTTP_ACCEPT': 'application/mercurial'
44 'HTTP_ACCEPT': 'application/mercurial'
41 }
45 }
@@ -44,7 +48,7 b' def test_is_hg_no_cmd():'
44
48
45 def test_is_hg_empty_cmd():
49 def test_is_hg_empty_cmd():
46 environ = {
50 environ = {
47 'PATH_INFO': '/rhodecode-dev',
51 'PATH_INFO': svn_repo_path,
48 'QUERY_STRING': 'cmd=',
52 'QUERY_STRING': 'cmd=',
49 'HTTP_ACCEPT': 'application/mercurial'
53 'HTTP_ACCEPT': 'application/mercurial'
50 }
54 }
@@ -53,7 +57,7 b' def test_is_hg_empty_cmd():'
53
57
54 def test_is_svn_returns_true_if_subversion_is_in_a_dav_header():
58 def test_is_svn_returns_true_if_subversion_is_in_a_dav_header():
55 environ = {
59 environ = {
56 'PATH_INFO': '/rhodecode-dev',
60 'PATH_INFO': svn_repo_path,
57 'HTTP_DAV': 'http://subversion.tigris.org/xmlns/dav/svn/log-revprops'
61 'HTTP_DAV': 'http://subversion.tigris.org/xmlns/dav/svn/log-revprops'
58 }
62 }
59 assert vcs.is_svn(environ) is True
63 assert vcs.is_svn(environ) is True
@@ -61,7 +65,7 b' def test_is_svn_returns_true_if_subversi'
61
65
62 def test_is_svn_returns_false_if_subversion_is_not_in_a_dav_header():
66 def test_is_svn_returns_false_if_subversion_is_not_in_a_dav_header():
63 environ = {
67 environ = {
64 'PATH_INFO': '/rhodecode-dev',
68 'PATH_INFO': svn_repo_path,
65 'HTTP_DAV': 'http://stuff.tigris.org/xmlns/dav/svn/log-revprops'
69 'HTTP_DAV': 'http://stuff.tigris.org/xmlns/dav/svn/log-revprops'
66 }
70 }
67 assert vcs.is_svn(environ) is False
71 assert vcs.is_svn(environ) is False
@@ -69,7 +73,7 b' def test_is_svn_returns_false_if_subvers'
69
73
70 def test_is_svn_returns_false_if_no_dav_header():
74 def test_is_svn_returns_false_if_no_dav_header():
71 environ = {
75 environ = {
72 'PATH_INFO': '/rhodecode-dev',
76 'PATH_INFO': svn_repo_path,
73 }
77 }
74 assert vcs.is_svn(environ) is False
78 assert vcs.is_svn(environ) is False
75
79
@@ -95,42 +99,42 b' def test_is_svn_allows_to_configure_the_'
95
99
96
100
97 class TestVCSMiddleware(object):
101 class TestVCSMiddleware(object):
98 def test_get_handler_app_retuns_svn_app_when_proxy_enabled(self):
102 def test_get_handler_app_retuns_svn_app_when_proxy_enabled(self, app):
99 environ = {
103 environ = {
100 'PATH_INFO': 'rhodecode-dev',
104 'PATH_INFO': SVN_REPO,
101 'HTTP_DAV': 'http://subversion.tigris.org/xmlns/dav/svn/log'
105 'HTTP_DAV': 'http://subversion.tigris.org/xmlns/dav/svn/log'
102 }
106 }
103 app = Mock()
107 application = Mock()
104 config = Mock()
108 config = {'appenlight': False, 'vcs.backends': ['svn']}
105 registry = Mock()
109 registry = Mock()
106 middleware = vcs.VCSMiddleware(
110 middleware = vcs.VCSMiddleware(
107 app, config=config, appenlight_client=None, registry=registry)
111 application, config=config,
108 snv_patch = patch('rhodecode.lib.middleware.vcs.SimpleSvn')
112 appenlight_client=None, registry=registry)
109 settings_patch = patch.dict(
113 middleware.use_gzip = False
110 rhodecode.CONFIG,
111 {'rhodecode_proxy_subversion_http_requests': True})
112 with snv_patch as svn_mock, settings_patch:
113 svn_mock.return_value = None
114 middleware._get_handler_app(environ)
115
114
116 svn_mock.assert_called_once_with(app, config, registry)
115 with patch.object(SimpleSvn, '_is_svn_enabled') as mock_method:
116 mock_method.return_value = True
117 application = middleware._get_handler_app(environ)
118 assert isinstance(application, SimpleSvn)
119 assert isinstance(application._create_wsgi_app(
120 Mock(), Mock(), Mock()), SimpleSvnApp)
117
121
118 def test_get_handler_app_retuns_no_svn_app_when_proxy_disabled(self):
122 def test_get_handler_app_retuns_dummy_svn_app_when_proxy_disabled(self, app):
119 environ = {
123 environ = {
120 'PATH_INFO': 'rhodecode-dev',
124 'PATH_INFO': SVN_REPO,
121 'HTTP_DAV': 'http://subversion.tigris.org/xmlns/dav/svn/log'
125 'HTTP_DAV': 'http://subversion.tigris.org/xmlns/dav/svn/log'
122 }
126 }
123 app = Mock()
127 application = Mock()
124 config = Mock()
128 config = {'appenlight': False, 'vcs.backends': ['svn']}
125 registry = Mock()
129 registry = Mock()
126 middleware = vcs.VCSMiddleware(
130 middleware = vcs.VCSMiddleware(
127 app, config=config, appenlight_client=None, registry=registry)
131 application, config=config,
128 snv_patch = patch('rhodecode.lib.middleware.vcs.SimpleSvn')
132 appenlight_client=None, registry=registry)
129 settings_patch = patch.dict(
133 middleware.use_gzip = False
130 rhodecode.CONFIG,
131 {'rhodecode_proxy_subversion_http_requests': False})
132 with snv_patch as svn_mock, settings_patch:
133 app = middleware._get_handler_app(environ)
134
134
135 assert svn_mock.call_count == 0
135 with patch.object(SimpleSvn, '_is_svn_enabled') as mock_method:
136 assert app is None
136 mock_method.return_value = False
137 application = middleware._get_handler_app(environ)
138 assert isinstance(application, SimpleSvn)
139 assert isinstance(application._create_wsgi_app(
140 Mock(), Mock(), Mock()), DisabledSimpleSvnApp)
@@ -76,7 +76,7 b' def test_diffprocessor_as_html_with_comm'
76 expected_html = textwrap.dedent('''
76 expected_html = textwrap.dedent('''
77 <table class="code-difftable">
77 <table class="code-difftable">
78 <tr class="line context">
78 <tr class="line context">
79 <td class="add-comment-line"><span class="add-comment-content"></span></td>
79 <td class="add-comment-line"><span class="add-comment-content"></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
80 <td class="lineno old">...</td>
80 <td class="lineno old">...</td>
81 <td class="lineno new">...</td>
81 <td class="lineno new">...</td>
82 <td class="code no-comment">
82 <td class="code no-comment">
@@ -85,7 +85,7 b' def test_diffprocessor_as_html_with_comm'
85 </td>
85 </td>
86 </tr>
86 </tr>
87 <tr class="line unmod">
87 <tr class="line unmod">
88 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td>
88 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
89 <td id="setuppy_o2" class="lineno old"><a href="#setuppy_o2" class="tooltip"
89 <td id="setuppy_o2" class="lineno old"><a href="#setuppy_o2" class="tooltip"
90 title="Click to select line">2</a></td>
90 title="Click to select line">2</a></td>
91 <td id="setuppy_n2" class="lineno new"><a href="#setuppy_n2" class="tooltip"
91 <td id="setuppy_n2" class="lineno new"><a href="#setuppy_n2" class="tooltip"
@@ -96,7 +96,7 b' def test_diffprocessor_as_html_with_comm'
96 </td>
96 </td>
97 </tr>
97 </tr>
98 <tr class="line unmod">
98 <tr class="line unmod">
99 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td>
99 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
100 <td id="setuppy_o3" class="lineno old"><a href="#setuppy_o3" class="tooltip"
100 <td id="setuppy_o3" class="lineno old"><a href="#setuppy_o3" class="tooltip"
101 title="Click to select line">3</a></td>
101 title="Click to select line">3</a></td>
102 <td id="setuppy_n3" class="lineno new"><a href="#setuppy_n3" class="tooltip"
102 <td id="setuppy_n3" class="lineno new"><a href="#setuppy_n3" class="tooltip"
@@ -107,7 +107,7 b' def test_diffprocessor_as_html_with_comm'
107 </td>
107 </td>
108 </tr>
108 </tr>
109 <tr class="line unmod">
109 <tr class="line unmod">
110 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td>
110 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
111 <td id="setuppy_o4" class="lineno old"><a href="#setuppy_o4" class="tooltip"
111 <td id="setuppy_o4" class="lineno old"><a href="#setuppy_o4" class="tooltip"
112 title="Click to select line">4</a></td>
112 title="Click to select line">4</a></td>
113 <td id="setuppy_n4" class="lineno new"><a href="#setuppy_n4" class="tooltip"
113 <td id="setuppy_n4" class="lineno new"><a href="#setuppy_n4" class="tooltip"
@@ -118,7 +118,7 b' def test_diffprocessor_as_html_with_comm'
118 </td>
118 </td>
119 </tr>
119 </tr>
120 <tr class="line del">
120 <tr class="line del">
121 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td>
121 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
122 <td id="setuppy_o5" class="lineno old"><a href="#setuppy_o5" class="tooltip"
122 <td id="setuppy_o5" class="lineno old"><a href="#setuppy_o5" class="tooltip"
123 title="Click to select line">5</a></td>
123 title="Click to select line">5</a></td>
124 <td class="lineno new"><a href="#setuppy_n" class="tooltip"
124 <td class="lineno new"><a href="#setuppy_n" class="tooltip"
@@ -129,7 +129,7 b' def test_diffprocessor_as_html_with_comm'
129 </td>
129 </td>
130 </tr>
130 </tr>
131 <tr class="line add">
131 <tr class="line add">
132 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td>
132 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
133 <td class="lineno old"><a href="#setuppy_o" class="tooltip"
133 <td class="lineno old"><a href="#setuppy_o" class="tooltip"
134 title="Click to select line"></a></td>
134 title="Click to select line"></a></td>
135 <td id="setuppy_n5" class="lineno new"><a href="#setuppy_n5" class="tooltip"
135 <td id="setuppy_n5" class="lineno new"><a href="#setuppy_n5" class="tooltip"
@@ -140,7 +140,7 b' def test_diffprocessor_as_html_with_comm'
140 </td>
140 </td>
141 </tr>
141 </tr>
142 <tr class="line unmod">
142 <tr class="line unmod">
143 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td>
143 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
144 <td id="setuppy_o6" class="lineno old"><a href="#setuppy_o6" class="tooltip"
144 <td id="setuppy_o6" class="lineno old"><a href="#setuppy_o6" class="tooltip"
145 title="Click to select line">6</a></td>
145 title="Click to select line">6</a></td>
146 <td id="setuppy_n6" class="lineno new"><a href="#setuppy_n6" class="tooltip"
146 <td id="setuppy_n6" class="lineno new"><a href="#setuppy_n6" class="tooltip"
@@ -151,7 +151,7 b' def test_diffprocessor_as_html_with_comm'
151 </td>
151 </td>
152 </tr>
152 </tr>
153 <tr class="line unmod">
153 <tr class="line unmod">
154 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td>
154 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
155 <td id="setuppy_o7" class="lineno old"><a href="#setuppy_o7" class="tooltip"
155 <td id="setuppy_o7" class="lineno old"><a href="#setuppy_o7" class="tooltip"
156 title="Click to select line">7</a></td>
156 title="Click to select line">7</a></td>
157 <td id="setuppy_n7" class="lineno new"><a href="#setuppy_n7" class="tooltip"
157 <td id="setuppy_n7" class="lineno new"><a href="#setuppy_n7" class="tooltip"
@@ -162,7 +162,7 b' def test_diffprocessor_as_html_with_comm'
162 </td>
162 </td>
163 </tr>
163 </tr>
164 <tr class="line unmod">
164 <tr class="line unmod">
165 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td>
165 <td class="add-comment-line"><span class="add-comment-content"><a href="#"><span class="icon-comment-add"></span></a></span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>
166 <td id="setuppy_o8" class="lineno old"><a href="#setuppy_o8" class="tooltip"
166 <td id="setuppy_o8" class="lineno old"><a href="#setuppy_o8" class="tooltip"
167 title="Click to select line">8</a></td>
167 title="Click to select line">8</a></td>
168 <td id="setuppy_n8" class="lineno new"><a href="#setuppy_n8" class="tooltip"
168 <td id="setuppy_n8" class="lineno new"><a href="#setuppy_n8" class="tooltip"
@@ -177,37 +177,3 b' Auto status change to |new_status|'
177 renderer = RstTemplateRenderer()
177 renderer = RstTemplateRenderer()
178 rendered = renderer.render('auto_status_change.mako', **params)
178 rendered = renderer.render('auto_status_change.mako', **params)
179 assert expected == rendered
179 assert expected == rendered
180
181
182 @pytest.mark.parametrize(
183 "readmes, exts, order",
184 [
185 ([], [], []),
186
187 ([('readme1', 0), ('text1', 1)], [('.ext', 0), ('.txt', 1)],
188 ['readme1.ext', 'readme1.txt', 'text1.ext', 'text1.txt']),
189
190 ([('readme2', 0), ('text2', 1)], [('.ext', 2), ('.txt', 1)],
191 ['readme2.txt', 'readme2.ext', 'text2.txt', 'text2.ext']),
192
193 ([('readme3', 0), ('text3', 1)], [('.XXX', 1)],
194 ['readme3.XXX', 'text3.XXX']),
195 ])
196 def test_generate_readmes(readmes, exts, order):
197 assert order == MarkupRenderer.generate_readmes(readmes, exts)
198
199
200 @pytest.mark.parametrize(
201 "renderer, expected_order",
202 [
203 ('plain', ['readme', 'README', 'Readme']),
204 ('text', ['readme', 'README', 'Readme']),
205 ('markdown', MarkupRenderer.generate_readmes(
206 MarkupRenderer.ALL_READMES, MarkupRenderer.MARKDOWN_EXTS)),
207 ('rst', MarkupRenderer.generate_readmes(
208 MarkupRenderer.ALL_READMES, MarkupRenderer.RST_EXTS)),
209 ])
210 def test_order_of_readme_generation(renderer, expected_order):
211 mkd_renderer = MarkupRenderer()
212 assert expected_order == mkd_renderer.pick_readme_order(
213 renderer)[:len(expected_order)]
@@ -404,15 +404,6 b' class TestCreateRepoSvnSettings(object):'
404 assert exc_info.value.message == 'Repository is not specified'
404 assert exc_info.value.message == 'Repository is not specified'
405
405
406
406
407 class TestCreateGlobalSvnSettings(object):
408 def test_calls_create_svn_settings(self):
409 model = VcsSettingsModel()
410 with mock.patch.object(model, '_create_svn_settings') as create_mock:
411 model.create_global_svn_settings(SVN_FORM_DATA)
412 create_mock.assert_called_once_with(
413 model.global_settings, SVN_FORM_DATA)
414
415
416 class TestCreateSvnSettings(object):
407 class TestCreateSvnSettings(object):
417 def test_create(self, repo_stub):
408 def test_create(self, repo_stub):
418 model = VcsSettingsModel(repo=repo_stub.repo_name)
409 model = VcsSettingsModel(repo=repo_stub.repo_name)
@@ -33,6 +33,7 b' import uuid'
33 import mock
33 import mock
34 import pyramid.testing
34 import pyramid.testing
35 import pytest
35 import pytest
36 import colander
36 import requests
37 import requests
37 from webtest.app import TestApp
38 from webtest.app import TestApp
38
39
@@ -41,7 +42,7 b' from rhodecode.model.changeset_status im'
41 from rhodecode.model.comment import ChangesetCommentsModel
42 from rhodecode.model.comment import ChangesetCommentsModel
42 from rhodecode.model.db import (
43 from rhodecode.model.db import (
43 PullRequest, Repository, RhodeCodeSetting, ChangesetStatus, RepoGroup,
44 PullRequest, Repository, RhodeCodeSetting, ChangesetStatus, RepoGroup,
44 UserGroup, RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi)
45 UserGroup, RepoRhodeCodeUi, RepoRhodeCodeSetting, RhodeCodeUi, Integration)
45 from rhodecode.model.meta import Session
46 from rhodecode.model.meta import Session
46 from rhodecode.model.pull_request import PullRequestModel
47 from rhodecode.model.pull_request import PullRequestModel
47 from rhodecode.model.repo import RepoModel
48 from rhodecode.model.repo import RepoModel
@@ -49,6 +50,9 b' from rhodecode.model.repo_group import R'
49 from rhodecode.model.user import UserModel
50 from rhodecode.model.user import UserModel
50 from rhodecode.model.settings import VcsSettingsModel
51 from rhodecode.model.settings import VcsSettingsModel
51 from rhodecode.model.user_group import UserGroupModel
52 from rhodecode.model.user_group import UserGroupModel
53 from rhodecode.model.integration import IntegrationModel
54 from rhodecode.integrations import integration_type_registry
55 from rhodecode.integrations.types.base import IntegrationTypeBase
52 from rhodecode.lib.utils import repo2db_mapper
56 from rhodecode.lib.utils import repo2db_mapper
53 from rhodecode.lib.vcs import create_vcsserver_proxy
57 from rhodecode.lib.vcs import create_vcsserver_proxy
54 from rhodecode.lib.vcs.backends import get_backend
58 from rhodecode.lib.vcs.backends import get_backend
@@ -639,39 +643,10 b' class Backend(object):'
639 self._fixture.destroy_repo(repo_name)
643 self._fixture.destroy_repo(repo_name)
640
644
641 def _add_commits_to_repo(self, repo, commits):
645 def _add_commits_to_repo(self, repo, commits):
642 if not commits:
646 commit_ids = _add_commits_to_repo(repo, commits)
647 if not commit_ids:
643 return
648 return
644
649 self._commit_ids = commit_ids
645 imc = repo.in_memory_commit
646 commit = None
647 self._commit_ids = {}
648
649 for idx, commit in enumerate(commits):
650 message = unicode(commit.get('message', 'Commit %s' % idx))
651
652 for node in commit.get('added', []):
653 imc.add(FileNode(node.path, content=node.content))
654 for node in commit.get('changed', []):
655 imc.change(FileNode(node.path, content=node.content))
656 for node in commit.get('removed', []):
657 imc.remove(FileNode(node.path))
658
659 parents = [
660 repo.get_commit(commit_id=self._commit_ids[p])
661 for p in commit.get('parents', [])]
662
663 operations = ('added', 'changed', 'removed')
664 if not any((commit.get(o) for o in operations)):
665 imc.add(FileNode('file_%s' % idx, content=message))
666
667 commit = imc.commit(
668 message=message,
669 author=unicode(commit.get('author', 'Automatic')),
670 date=commit.get('date'),
671 branch=commit.get('branch'),
672 parents=parents)
673
674 self._commit_ids[commit.message] = commit.raw_id
675
650
676 # Creating refs for Git to allow fetching them from remote repository
651 # Creating refs for Git to allow fetching them from remote repository
677 if self.alias == 'git':
652 if self.alias == 'git':
@@ -683,8 +658,6 b' class Backend(object):'
683 refs[ref_name] = self._commit_ids[message]
658 refs[ref_name] = self._commit_ids[message]
684 self._create_refs(repo, refs)
659 self._create_refs(repo, refs)
685
660
686 return commit
687
688 def _create_refs(self, repo, refs):
661 def _create_refs(self, repo, refs):
689 for ref_name in refs:
662 for ref_name in refs:
690 repo.set_refs(ref_name, refs[ref_name])
663 repo.set_refs(ref_name, refs[ref_name])
@@ -746,6 +719,16 b' def vcsbackend_random(vcsbackend_git):'
746 return vcsbackend_git
719 return vcsbackend_git
747
720
748
721
722 @pytest.fixture
723 def vcsbackend_stub(vcsbackend_git):
724 """
725 Use this to express that your test just needs a stub of a vcsbackend.
726
727 Plan is to eventually implement an in-memory stub to speed tests up.
728 """
729 return vcsbackend_git
730
731
749 class VcsBackend(object):
732 class VcsBackend(object):
750 """
733 """
751 Represents the test configuration for one supported vcs backend.
734 Represents the test configuration for one supported vcs backend.
@@ -779,17 +762,20 b' class VcsBackend(object):'
779 """
762 """
780 return get_backend(self.alias)
763 return get_backend(self.alias)
781
764
782 def create_repo(self, number_of_commits=0, _clone_repo=None):
765 def create_repo(self, commits=None, number_of_commits=0, _clone_repo=None):
783 repo_name = self._next_repo_name()
766 repo_name = self._next_repo_name()
784 self._repo_path = get_new_dir(repo_name)
767 self._repo_path = get_new_dir(repo_name)
785 Repository = get_backend(self.alias)
768 repo_class = get_backend(self.alias)
786 src_url = None
769 src_url = None
787 if _clone_repo:
770 if _clone_repo:
788 src_url = _clone_repo.path
771 src_url = _clone_repo.path
789 repo = Repository(self._repo_path, create=True, src_url=src_url)
772 repo = repo_class(self._repo_path, create=True, src_url=src_url)
790 self._cleanup_repos.append(repo)
773 self._cleanup_repos.append(repo)
791 for idx in xrange(number_of_commits):
774
792 self.ensure_file(filename='file_%s' % idx, content=repo.name)
775 commits = commits or [
776 {'message': 'Commit %s of %s' % (x, repo_name)}
777 for x in xrange(number_of_commits)]
778 _add_commits_to_repo(repo, commits)
793 return repo
779 return repo
794
780
795 def clone_repo(self, repo):
781 def clone_repo(self, repo):
@@ -821,6 +807,44 b' class VcsBackend(object):'
821 self.add_file(self.repo, filename, content)
807 self.add_file(self.repo, filename, content)
822
808
823
809
810 def _add_commits_to_repo(vcs_repo, commits):
811 commit_ids = {}
812 if not commits:
813 return commit_ids
814
815 imc = vcs_repo.in_memory_commit
816 commit = None
817
818 for idx, commit in enumerate(commits):
819 message = unicode(commit.get('message', 'Commit %s' % idx))
820
821 for node in commit.get('added', []):
822 imc.add(FileNode(node.path, content=node.content))
823 for node in commit.get('changed', []):
824 imc.change(FileNode(node.path, content=node.content))
825 for node in commit.get('removed', []):
826 imc.remove(FileNode(node.path))
827
828 parents = [
829 vcs_repo.get_commit(commit_id=commit_ids[p])
830 for p in commit.get('parents', [])]
831
832 operations = ('added', 'changed', 'removed')
833 if not any((commit.get(o) for o in operations)):
834 imc.add(FileNode('file_%s' % idx, content=message))
835
836 commit = imc.commit(
837 message=message,
838 author=unicode(commit.get('author', 'Automatic')),
839 date=commit.get('date'),
840 branch=commit.get('branch'),
841 parents=parents)
842
843 commit_ids[commit.message] = commit.raw_id
844
845 return commit_ids
846
847
824 @pytest.fixture
848 @pytest.fixture
825 def reposerver(request):
849 def reposerver(request):
826 """
850 """
@@ -1636,3 +1660,120 b' def config_stub(request, request_stub):'
1636 pyramid.testing.tearDown()
1660 pyramid.testing.tearDown()
1637
1661
1638 return config
1662 return config
1663
1664
1665 @pytest.fixture
1666 def StubIntegrationType():
1667 class _StubIntegrationType(IntegrationTypeBase):
1668 """ Test integration type class """
1669
1670 key = 'test'
1671 display_name = 'Test integration type'
1672 description = 'A test integration type for testing'
1673 icon = 'test_icon_html_image'
1674
1675 def __init__(self, settings):
1676 super(_StubIntegrationType, self).__init__(settings)
1677 self.sent_events = [] # for testing
1678
1679 def send_event(self, event):
1680 self.sent_events.append(event)
1681
1682 def settings_schema(self):
1683 class SettingsSchema(colander.Schema):
1684 test_string_field = colander.SchemaNode(
1685 colander.String(),
1686 missing=colander.required,
1687 title='test string field',
1688 )
1689 test_int_field = colander.SchemaNode(
1690 colander.Int(),
1691 title='some integer setting',
1692 )
1693 return SettingsSchema()
1694
1695
1696 integration_type_registry.register_integration_type(_StubIntegrationType)
1697 return _StubIntegrationType
1698
1699 @pytest.fixture
1700 def stub_integration_settings():
1701 return {
1702 'test_string_field': 'some data',
1703 'test_int_field': 100,
1704 }
1705
1706
1707 @pytest.fixture
1708 def repo_integration_stub(request, repo_stub, StubIntegrationType,
1709 stub_integration_settings):
1710 integration = IntegrationModel().create(
1711 StubIntegrationType, settings=stub_integration_settings, enabled=True,
1712 name='test repo integration',
1713 repo=repo_stub, repo_group=None, child_repos_only=None)
1714
1715 @request.addfinalizer
1716 def cleanup():
1717 IntegrationModel().delete(integration)
1718
1719 return integration
1720
1721
1722 @pytest.fixture
1723 def repogroup_integration_stub(request, test_repo_group, StubIntegrationType,
1724 stub_integration_settings):
1725 integration = IntegrationModel().create(
1726 StubIntegrationType, settings=stub_integration_settings, enabled=True,
1727 name='test repogroup integration',
1728 repo=None, repo_group=test_repo_group, child_repos_only=True)
1729
1730 @request.addfinalizer
1731 def cleanup():
1732 IntegrationModel().delete(integration)
1733
1734 return integration
1735
1736
1737 @pytest.fixture
1738 def repogroup_recursive_integration_stub(request, test_repo_group,
1739 StubIntegrationType, stub_integration_settings):
1740 integration = IntegrationModel().create(
1741 StubIntegrationType, settings=stub_integration_settings, enabled=True,
1742 name='test recursive repogroup integration',
1743 repo=None, repo_group=test_repo_group, child_repos_only=False)
1744
1745 @request.addfinalizer
1746 def cleanup():
1747 IntegrationModel().delete(integration)
1748
1749 return integration
1750
1751
1752 @pytest.fixture
1753 def global_integration_stub(request, StubIntegrationType,
1754 stub_integration_settings):
1755 integration = IntegrationModel().create(
1756 StubIntegrationType, settings=stub_integration_settings, enabled=True,
1757 name='test global integration',
1758 repo=None, repo_group=None, child_repos_only=None)
1759
1760 @request.addfinalizer
1761 def cleanup():
1762 IntegrationModel().delete(integration)
1763
1764 return integration
1765
1766
1767 @pytest.fixture
1768 def root_repos_integration_stub(request, StubIntegrationType,
1769 stub_integration_settings):
1770 integration = IntegrationModel().create(
1771 StubIntegrationType, settings=stub_integration_settings, enabled=True,
1772 name='test global integration',
1773 repo=None, repo_group=None, child_repos_only=True)
1774
1775 @request.addfinalizer
1776 def cleanup():
1777 IntegrationModel().delete(integration)
1778
1779 return integration
@@ -325,8 +325,11 b' class TestCommits(BackendTestMixin):'
325 assert line_no == 1
325 assert line_no == 1
326 assert commit_id == file_added_commit.raw_id
326 assert commit_id == file_added_commit.raw_id
327 assert commit_loader() == file_added_commit
327 assert commit_loader() == file_added_commit
328
329 # git annotation is generated differently thus different results
328 if self.repo.alias == 'git':
330 if self.repo.alias == 'git':
329 pytest.xfail("TODO: Git returns wrong value in line")
331 assert line == '(Joe Doe 2010-01-03 08:00:00 +0000 1) Foobar 3'
332 else:
330 assert line == 'Foobar 3'
333 assert line == 'Foobar 3'
331
334
332 def test_get_file_annotate_does_not_exist(self):
335 def test_get_file_annotate_does_not_exist(self):
@@ -934,20 +934,34 b' class TestGitCommit(object):'
934 'vcs/nodes.py']
934 'vcs/nodes.py']
935 assert set(changed) == set([f.path for f in commit.changed])
935 assert set(changed) == set([f.path for f in commit.changed])
936
936
937 def test_unicode_refs(self):
937 def test_unicode_branch_refs(self):
938 unicode_branches = {
938 unicode_branches = {
939 'unicode': ['6c0ce52b229aa978889e91b38777f800e85f330b', 'H'],
939 'refs/heads/unicode': '6c0ce52b229aa978889e91b38777f800e85f330b',
940 u'uniçö∂e': ['ürl', 'H']
940 u'refs/heads/uniçö∂e': 'ürl',
941 }
941 }
942 with mock.patch(
942 with mock.patch(
943 ("rhodecode.lib.vcs.backends.git.repository"
943 ("rhodecode.lib.vcs.backends.git.repository"
944 ".GitRepository._parsed_refs"),
944 ".GitRepository._refs"),
945 unicode_branches):
945 unicode_branches):
946 branches = self.repo.branches
946 branches = self.repo.branches
947
947
948 assert 'unicode' in branches
948 assert 'unicode' in branches
949 assert u'uniçö∂e' in branches
949 assert u'uniçö∂e' in branches
950
950
951 def test_unicode_tag_refs(self):
952 unicode_tags = {
953 'refs/tags/unicode': '6c0ce52b229aa978889e91b38777f800e85f330b',
954 u'refs/tags/uniçö∂e': '6c0ce52b229aa978889e91b38777f800e85f330b',
955 }
956 with mock.patch(
957 ("rhodecode.lib.vcs.backends.git.repository"
958 ".GitRepository._refs"),
959 unicode_tags):
960 tags = self.repo.tags
961
962 assert 'unicode' in tags
963 assert u'uniçö∂e' in tags
964
951 def test_commit_message_is_unicode(self):
965 def test_commit_message_is_unicode(self):
952 for commit in self.repo:
966 for commit in self.repo:
953 assert type(commit.message) == unicode
967 assert type(commit.message) == unicode
@@ -1,130 +0,0 b''
1 .. _svn-http:
2
3 |svn| With Write Over HTTP
4 --------------------------
5
6 To use |svn| with read/write support over the |svn| protocol, you have to
7 configure HTTP |svn| backend.
8
9 Prerequisites
10 ^^^^^^^^^^^^^
11
12 - Enable HTTP support inside labs setting on your |RCE| instance,
13 see :ref:`lab-settings`.
14 - You need to install the following tools on the machine that is running an
15 instance of |RCE|:
16 ``Apache HTTP Server`` and
17 ``mod_dav_svn``.
18
19
20 Using Ubuntu Distribution as an example you can run:
21
22 .. code-block:: bash
23
24 $ sudo apt-get install apache2 libapache2-mod-svn
25
26 Once installed you need to enable ``dav_svn`` and ``anon``:
27
28 .. code-block:: bash
29
30 $ sudo a2enmod dav_svn
31 $ sudo a2enmod authn_anon
32
33
34 Configuring Apache Setup
35 ^^^^^^^^^^^^^^^^^^^^^^^^
36
37 .. tip::
38
39 It is recommended to run Apache on a port other than 80, due to possible
40 conflicts with other HTTP servers like nginx. To do this, set the
41 ``Listen`` parameter in the ``/etc/apache2/ports.conf`` file, for example
42 ``Listen 8090``.
43
44
45 .. warning::
46
47 Make sure your Apache instance which runs the mod_dav_svn module is
48 only accessible by RhodeCode. Otherwise everyone is able to browse
49 the repositories or run subversion operations (checkout/commit/etc.).
50
51 It is also recommended to run apache as the same user as |RCE|, otherwise
52 permission issues could occur. To do this edit the ``/etc/apache2/envvars``
53
54 .. code-block:: apache
55
56 export APACHE_RUN_USER=rhodecode
57 export APACHE_RUN_GROUP=rhodecode
58
59 1. To configure Apache, create and edit a virtual hosts file, for example
60 :file:`/etc/apache2/sites-available/default.conf`. Below is an example
61 how to use one with auto-generated config ```mod_dav_svn.conf```
62 from configured |RCE| instance.
63
64 .. code-block:: apache
65
66 <VirtualHost *:8080>
67 ServerAdmin rhodecode-admin@localhost
68 DocumentRoot /var/www/html
69 ErrorLog ${APACHE_LOG_DIR}/error.log
70 CustomLog ${APACHE_LOG_DIR}/access.log combined
71 Include /home/user/.rccontrol/enterprise-1/mod_dav_svn.conf
72 </VirtualHost>
73
74
75 2. Go to the :menuselection:`Admin --> Settings --> Labs` page, and
76 enable :guilabel:`Proxy Subversion HTTP requests`, and specify the
77 :guilabel:`Subversion HTTP Server URL`.
78
79 3. Open the |RCE| configuration file,
80 :file:`/home/{user}/.rccontrol/{instance-id}/rhodecode.ini`
81
82 4. Add the following configuration option in the ``[app:main]``
83 section if you don't have it yet.
84
85 This enable mapping of created |RCE| repo groups into special |svn| paths.
86 Each time a new repository group will be created the system will update
87 the template file, and create new mapping. Apache web server needs to be
88 reloaded to pick up the changes on this file.
89 It's recommended to add reload into a crontab so the changes can be picked
90 automatically once someone creates an repository group inside RhodeCode.
91
92
93 .. code-block:: ini
94
95 ##############################################
96 ### Subversion proxy support (mod_dav_svn) ###
97 ##############################################
98 ## Enable or disable the config file generation.
99 svn.proxy.generate_config = true
100 ## Generate config file with `SVNListParentPath` set to `On`.
101 svn.proxy.list_parent_path = true
102 ## Set location and file name of generated config file.
103 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
104 ## File system path to the directory containing the repositories served by
105 ## RhodeCode.
106 svn.proxy.parent_path_root = /path/to/repo_store
107 ## Used as a prefix to the <Location> block in the generated config file. In
108 ## most cases it should be set to `/`.
109 svn.proxy.location_root = /
110
111
112 This would create a special template file called ```mod_dav_svn.conf```. We
113 used that file path in the apache config above inside the Include statement.
114
115
116 Using |svn|
117 ^^^^^^^^^^^
118
119 Once |svn| has been enabled on your instance, you can use it using the
120 following examples. For more |svn| information, see the `Subversion Red Book`_
121
122 .. code-block:: bash
123
124 # To clone a repository
125 svn checkout http://my-svn-server.example.com/my-svn-repo
126
127 # svn commit
128 svn commit
129
130 .. _Subversion Red Book: http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.ref.svn
@@ -1,76 +0,0 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2015-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 """
22 Disable VCS pages when VCS Server is not available
23 """
24
25 import logging
26 import re
27 from pyramid.httpexceptions import HTTPBadGateway
28
29 log = logging.getLogger(__name__)
30
31
32 class VCSServerUnavailable(HTTPBadGateway):
33 """ HTTP Exception class for when VCS Server is unavailable """
34 code = 502
35 title = 'VCS Server Required'
36 explanation = 'A VCS Server is required for this action. There is currently no VCS Server configured.'
37
38 class DisableVCSPagesWrapper(object):
39 """
40 Pyramid view wrapper to disable all pages that require VCS Server to be
41 running, avoiding that errors explode to the user.
42
43 This Wrapper should be enabled only in case VCS Server is not available
44 for the instance.
45 """
46
47 VCS_NOT_REQUIRED = [
48 '^/$',
49 ('/_admin(?!/settings/mapping)(?!/my_account/repos)'
50 '(?!/create_repository)(?!/gists)(?!/notifications/)'
51 ),
52 ]
53 _REGEX_VCS_NOT_REQUIRED = [re.compile(path) for path in VCS_NOT_REQUIRED]
54
55 def _check_vcs_requirement(self, path_info):
56 """
57 Tries to match the current path to one of the safe URLs to be rendered.
58 Displays an error message in case
59 """
60 for regex in self._REGEX_VCS_NOT_REQUIRED:
61 safe_url = regex.match(path_info)
62 if safe_url:
63 return True
64
65 # Url is not safe to be rendered without VCS Server
66 log.debug('accessing: `%s` with VCS Server disabled', path_info)
67 return False
68
69 def __init__(self, handler):
70 self.handler = handler
71
72 def __call__(self, context, request):
73 if not self._check_vcs_requirement(request.path):
74 raise VCSServerUnavailable('VCS Server is not available')
75
76 return self.handler(context, request)
@@ -1,268 +0,0 b''
1 // Mix-ins
2 .borderRadius(@radius) {
3 -moz-border-radius: @radius;
4 -webkit-border-radius: @radius;
5 border-radius: @radius;
6 }
7
8 .boxShadow(@boxShadow) {
9 -moz-box-shadow: @boxShadow;
10 -webkit-box-shadow: @boxShadow;
11 box-shadow: @boxShadow;
12 }
13
14 .opacity(@opacity) {
15 @opacityPercent: @opacity * 100;
16 opacity: @opacity;
17 -ms-filter: ~"progid:DXImageTransform.Microsoft.Alpha(Opacity=@{opacityPercent})";
18 filter: ~"alpha(opacity=@{opacityPercent})";
19 }
20
21 .wordWrap(@wordWrap: break-word) {
22 -ms-word-wrap: @wordWrap;
23 word-wrap: @wordWrap;
24 }
25
26 // Variables
27 @black: #000000;
28 @grey: #999999;
29 @light-grey: #CCCCCC;
30 @white: #FFFFFF;
31 @near-black: #030303;
32 @green: #51A351;
33 @red: #BD362F;
34 @blue: #2F96B4;
35 @orange: #F89406;
36 @default-container-opacity: .8;
37
38 // Styles
39 .toast-title {
40 font-weight: bold;
41 }
42
43 .toast-message {
44 .wordWrap();
45
46 a,
47 label {
48 color: @near-black;
49 }
50
51 a:hover {
52 color: @light-grey;
53 text-decoration: none;
54 }
55 }
56
57 .toast-close-button {
58 position: relative;
59 right: -0.3em;
60 top: -0.3em;
61 float: right;
62 font-size: 20px;
63 font-weight: bold;
64 color: @black;
65 -webkit-text-shadow: 0 1px 0 rgba(255,255,255,1);
66 text-shadow: 0 1px 0 rgba(255,255,255,1);
67 .opacity(0.8);
68
69 &:hover,
70 &:focus {
71 color: @black;
72 text-decoration: none;
73 cursor: pointer;
74 .opacity(0.4);
75 }
76 }
77
78 /*Additional properties for button version
79 iOS requires the button element instead of an anchor tag.
80 If you want the anchor version, it requires `href="#"`.*/
81 button.toast-close-button {
82 padding: 0;
83 cursor: pointer;
84 background: transparent;
85 border: 0;
86 -webkit-appearance: none;
87 }
88
89 //#endregion
90
91 .toast-top-center {
92 top: 0;
93 right: 0;
94 width: 100%;
95 }
96
97 .toast-bottom-center {
98 bottom: 0;
99 right: 0;
100 width: 100%;
101 }
102
103 .toast-top-full-width {
104 top: 0;
105 right: 0;
106 width: 100%;
107 }
108
109 .toast-bottom-full-width {
110 bottom: 0;
111 right: 0;
112 width: 100%;
113 }
114
115 .toast-top-left {
116 top: 12px;
117 left: 12px;
118 }
119
120 .toast-top-right {
121 top: 12px;
122 right: 12px;
123 }
124
125 .toast-bottom-right {
126 right: 12px;
127 bottom: 12px;
128 }
129
130 .toast-bottom-left {
131 bottom: 12px;
132 left: 12px;
133 }
134
135 #toast-container {
136 position: fixed;
137 z-index: 999999;
138 // The container should not be clickable.
139 pointer-events: none;
140 * {
141 -moz-box-sizing: border-box;
142 -webkit-box-sizing: border-box;
143 box-sizing: border-box;
144 }
145
146 > div {
147 position: relative;
148 // The toast itself should be clickable.
149 pointer-events: auto;
150 overflow: hidden;
151 margin: 0 0 6px;
152 padding: 15px;
153 width: 300px;
154 .borderRadius(1px 1px 1px 1px);
155 background-position: 15px center;
156 background-repeat: no-repeat;
157 color: @near-black;
158 .opacity(@default-container-opacity);
159 }
160
161 > :hover {
162 .opacity(1);
163 cursor: pointer;
164 }
165
166 > .toast-info {
167 //background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important;
168 }
169
170 > .toast-error {
171 //background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important;
172 }
173
174 > .toast-success {
175 //background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important;
176 }
177
178 > .toast-warning {
179 //background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important;
180 }
181
182 /*overrides*/
183 &.toast-top-center > div,
184 &.toast-bottom-center > div {
185 width: 400px;
186 margin-left: auto;
187 margin-right: auto;
188 }
189
190 &.toast-top-full-width > div,
191 &.toast-bottom-full-width > div {
192 width: 96%;
193 margin-left: auto;
194 margin-right: auto;
195 }
196 }
197
198 .toast {
199 border-color: @near-black;
200 border-style: solid;
201 border-width: 2px 2px 2px 25px;
202 background-color: @white;
203 }
204
205 .toast-success {
206 border-color: @green;
207 }
208
209 .toast-error {
210 border-color: @red;
211 }
212
213 .toast-info {
214 border-color: @blue;
215 }
216
217 .toast-warning {
218 border-color: @orange;
219 }
220
221 .toast-progress {
222 position: absolute;
223 left: 0;
224 bottom: 0;
225 height: 4px;
226 background-color: @black;
227 .opacity(0.4);
228 }
229
230 /*Responsive Design*/
231
232 @media all and (max-width: 240px) {
233 #toast-container {
234
235 > div {
236 padding: 8px;
237 width: 11em;
238 }
239
240 & .toast-close-button {
241 right: -0.2em;
242 top: -0.2em;
243 }
244 }
245 }
246
247 @media all and (min-width: 241px) and (max-width: 480px) {
248 #toast-container {
249 > div {
250 padding: 8px;
251 width: 18em;
252 }
253
254 & .toast-close-button {
255 right: -0.2em;
256 top: -0.2em;
257 }
258 }
259 }
260
261 @media all and (min-width: 481px) and (max-width: 768px) {
262 #toast-container {
263 > div {
264 padding: 15px;
265 width: 25em;
266 }
267 }
268 }
@@ -1,435 +0,0 b''
1 /*
2 * Toastr
3 * Copyright 2012-2015
4 * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
5 * All Rights Reserved.
6 * Use, reproduction, distribution, and modification of this code is subject to the terms and
7 * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
8 *
9 * ARIA Support: Greta Krafsig
10 *
11 * Project: https://github.com/CodeSeven/toastr
12 */
13 /* global define */
14 (function (define) {
15 define(['jquery'], function ($) {
16 return (function () {
17 var $container;
18 var listener;
19 var toastId = 0;
20 var toastType = {
21 error: 'error',
22 info: 'info',
23 success: 'success',
24 warning: 'warning'
25 };
26
27 var toastr = {
28 clear: clear,
29 remove: remove,
30 error: error,
31 getContainer: getContainer,
32 info: info,
33 options: {},
34 subscribe: subscribe,
35 success: success,
36 version: '2.1.2',
37 warning: warning
38 };
39
40 var previousToast;
41
42 return toastr;
43
44 ////////////////
45
46 function error(message, title, optionsOverride) {
47 return notify({
48 type: toastType.error,
49 iconClass: getOptions().iconClasses.error,
50 message: message,
51 optionsOverride: optionsOverride,
52 title: title
53 });
54 }
55
56 function getContainer(options, create) {
57 if (!options) { options = getOptions(); }
58 $container = $('#' + options.containerId);
59 if ($container.length) {
60 return $container;
61 }
62 if (create) {
63 $container = createContainer(options);
64 }
65 return $container;
66 }
67
68 function info(message, title, optionsOverride) {
69 return notify({
70 type: toastType.info,
71 iconClass: getOptions().iconClasses.info,
72 message: message,
73 optionsOverride: optionsOverride,
74 title: title
75 });
76 }
77
78 function subscribe(callback) {
79 listener = callback;
80 }
81
82 function success(message, title, optionsOverride) {
83 return notify({
84 type: toastType.success,
85 iconClass: getOptions().iconClasses.success,
86 message: message,
87 optionsOverride: optionsOverride,
88 title: title
89 });
90 }
91
92 function warning(message, title, optionsOverride) {
93 return notify({
94 type: toastType.warning,
95 iconClass: getOptions().iconClasses.warning,
96 message: message,
97 optionsOverride: optionsOverride,
98 title: title
99 });
100 }
101
102 function clear($toastElement, clearOptions) {
103 var options = getOptions();
104 if (!$container) { getContainer(options); }
105 if (!clearToast($toastElement, options, clearOptions)) {
106 clearContainer(options);
107 }
108 }
109
110 function remove($toastElement) {
111 var options = getOptions();
112 if (!$container) { getContainer(options); }
113 if ($toastElement && $(':focus', $toastElement).length === 0) {
114 removeToast($toastElement);
115 return;
116 }
117 if ($container.children().length) {
118 $container.remove();
119 }
120 }
121
122 // internal functions
123
124 function clearContainer (options) {
125 var toastsToClear = $container.children();
126 for (var i = toastsToClear.length - 1; i >= 0; i--) {
127 clearToast($(toastsToClear[i]), options);
128 }
129 }
130
131 function clearToast ($toastElement, options, clearOptions) {
132 var force = clearOptions && clearOptions.force ? clearOptions.force : false;
133 if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
134 $toastElement[options.hideMethod]({
135 duration: options.hideDuration,
136 easing: options.hideEasing,
137 complete: function () { removeToast($toastElement); }
138 });
139 return true;
140 }
141 return false;
142 }
143
144 function createContainer(options) {
145 $container = $('<div/>')
146 .attr('id', options.containerId)
147 .addClass(options.positionClass)
148 .attr('aria-live', 'polite')
149 .attr('role', 'alert');
150
151 $container.appendTo($(options.target));
152 return $container;
153 }
154
155 function getDefaults() {
156 return {
157 tapToDismiss: true,
158 toastClass: 'toast',
159 containerId: 'toast-container',
160 debug: false,
161
162 showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
163 showDuration: 300,
164 showEasing: 'swing', //swing and linear are built into jQuery
165 onShown: undefined,
166 hideMethod: 'fadeOut',
167 hideDuration: 1000,
168 hideEasing: 'swing',
169 onHidden: undefined,
170 closeMethod: false,
171 closeDuration: false,
172 closeEasing: false,
173
174 extendedTimeOut: 1000,
175 iconClasses: {
176 error: 'toast-error',
177 info: 'toast-info',
178 success: 'toast-success',
179 warning: 'toast-warning'
180 },
181 iconClass: 'toast-info',
182 positionClass: 'toast-top-right',
183 timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
184 titleClass: 'toast-title',
185 messageClass: 'toast-message',
186 escapeHtml: false,
187 target: 'body',
188 closeHtml: '<button type="button">&times;</button>',
189 newestOnTop: true,
190 preventDuplicates: false,
191 progressBar: false
192 };
193 }
194
195 function publish(args) {
196 if (!listener) { return; }
197 listener(args);
198 }
199
200 function notify(map) {
201 var options = getOptions();
202 var iconClass = map.iconClass || options.iconClass;
203
204 if (typeof (map.optionsOverride) !== 'undefined') {
205 options = $.extend(options, map.optionsOverride);
206 iconClass = map.optionsOverride.iconClass || iconClass;
207 }
208
209 if (shouldExit(options, map)) { return; }
210
211 toastId++;
212
213 $container = getContainer(options, true);
214
215 var intervalId = null;
216 var $toastElement = $('<div/>');
217 var $titleElement = $('<div/>');
218 var $messageElement = $('<div/>');
219 var $progressElement = $('<div/>');
220 var $closeElement = $(options.closeHtml);
221 var progressBar = {
222 intervalId: null,
223 hideEta: null,
224 maxHideTime: null
225 };
226 var response = {
227 toastId: toastId,
228 state: 'visible',
229 startTime: new Date(),
230 options: options,
231 map: map
232 };
233
234 personalizeToast();
235
236 displayToast();
237
238 handleEvents();
239
240 publish(response);
241
242 if (options.debug && console) {
243 console.log(response);
244 }
245
246 return $toastElement;
247
248 function escapeHtml(source) {
249 if (source == null)
250 source = "";
251
252 return new String(source)
253 .replace(/&/g, '&amp;')
254 .replace(/"/g, '&quot;')
255 .replace(/'/g, '&#39;')
256 .replace(/</g, '&lt;')
257 .replace(/>/g, '&gt;');
258 }
259
260 function personalizeToast() {
261 setIcon();
262 setTitle();
263 setMessage();
264 setCloseButton();
265 setProgressBar();
266 setSequence();
267 }
268
269 function handleEvents() {
270 $toastElement.hover(stickAround, delayedHideToast);
271 if (!options.onclick && options.tapToDismiss) {
272 $toastElement.click(hideToast);
273 }
274
275 if (options.closeButton && $closeElement) {
276 $closeElement.click(function (event) {
277 if (event.stopPropagation) {
278 event.stopPropagation();
279 } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
280 event.cancelBubble = true;
281 }
282 hideToast(true);
283 });
284 }
285
286 if (options.onclick) {
287 $toastElement.click(function (event) {
288 options.onclick(event);
289 hideToast();
290 });
291 }
292 }
293
294 function displayToast() {
295 $toastElement.hide();
296
297 $toastElement[options.showMethod](
298 {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
299 );
300
301 if (options.timeOut > 0) {
302 intervalId = setTimeout(hideToast, options.timeOut);
303 progressBar.maxHideTime = parseFloat(options.timeOut);
304 progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
305 if (options.progressBar) {
306 progressBar.intervalId = setInterval(updateProgress, 10);
307 }
308 }
309 }
310
311 function setIcon() {
312 if (map.iconClass) {
313 $toastElement.addClass(options.toastClass).addClass(iconClass);
314 }
315 }
316
317 function setSequence() {
318 if (options.newestOnTop) {
319 $container.prepend($toastElement);
320 } else {
321 $container.append($toastElement);
322 }
323 }
324
325 function setTitle() {
326 if (map.title) {
327 $titleElement.append(!options.escapeHtml ? map.title : escapeHtml(map.title)).addClass(options.titleClass);
328 $toastElement.append($titleElement);
329 }
330 }
331
332 function setMessage() {
333 if (map.message) {
334 $messageElement.append(!options.escapeHtml ? map.message : escapeHtml(map.message)).addClass(options.messageClass);
335 $toastElement.append($messageElement);
336 }
337 }
338
339 function setCloseButton() {
340 if (options.closeButton) {
341 $closeElement.addClass('toast-close-button').attr('role', 'button');
342 $toastElement.prepend($closeElement);
343 }
344 }
345
346 function setProgressBar() {
347 if (options.progressBar) {
348 $progressElement.addClass('toast-progress');
349 $toastElement.prepend($progressElement);
350 }
351 }
352
353 function shouldExit(options, map) {
354 if (options.preventDuplicates) {
355 if (map.message === previousToast) {
356 return true;
357 } else {
358 previousToast = map.message;
359 }
360 }
361 return false;
362 }
363
364 function hideToast(override) {
365 var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
366 var duration = override && options.closeDuration !== false ?
367 options.closeDuration : options.hideDuration;
368 var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
369 if ($(':focus', $toastElement).length && !override) {
370 return;
371 }
372 clearTimeout(progressBar.intervalId);
373 return $toastElement[method]({
374 duration: duration,
375 easing: easing,
376 complete: function () {
377 removeToast($toastElement);
378 if (options.onHidden && response.state !== 'hidden') {
379 options.onHidden();
380 }
381 response.state = 'hidden';
382 response.endTime = new Date();
383 publish(response);
384 }
385 });
386 }
387
388 function delayedHideToast() {
389 if (options.timeOut > 0 || options.extendedTimeOut > 0) {
390 intervalId = setTimeout(hideToast, options.extendedTimeOut);
391 progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
392 progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
393 }
394 }
395
396 function stickAround() {
397 clearTimeout(intervalId);
398 progressBar.hideEta = 0;
399 $toastElement.stop(true, true)[options.showMethod](
400 {duration: options.showDuration, easing: options.showEasing}
401 );
402 }
403
404 function updateProgress() {
405 var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
406 $progressElement.width(percentage + '%');
407 }
408 }
409
410 function getOptions() {
411 return $.extend({}, getDefaults(), toastr.options);
412 }
413
414 function removeToast($toastElement) {
415 if (!$container) { $container = getContainer(); }
416 if ($toastElement.is(':visible')) {
417 return;
418 }
419 $toastElement.remove();
420 $toastElement = null;
421 if ($container.children().length === 0) {
422 $container.remove();
423 previousToast = undefined;
424 }
425 }
426
427 })();
428 });
429 }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
430 if (typeof module !== 'undefined' && module.exports) { //Node
431 module.exports = factory(require('jquery'));
432 } else {
433 window.toastr = factory(window.jQuery);
434 }
435 }));
@@ -1,219 +0,0 b''
1 "use strict";
2 /** leak object to top level scope **/
3 var ccLog = undefined;
4 // global code-mirror logger;, to enable run
5 // Logger.get('ConnectionController').setLevel(Logger.DEBUG)
6 ccLog = Logger.get('ConnectionController');
7 ccLog.setLevel(Logger.OFF);
8
9 var ConnectionController;
10 var connCtrlr;
11 var registerViewChannels;
12
13 (function () {
14 ConnectionController = function (webappUrl, serverUrl, urls) {
15 var self = this;
16
17 var channels = ['broadcast'];
18 this.state = {
19 open: false,
20 webappUrl: webappUrl,
21 serverUrl: serverUrl,
22 connId: null,
23 socket: null,
24 channels: channels,
25 heartbeat: null,
26 channelsInfo: {},
27 urls: urls
28 };
29 this.channelNameParsers = [];
30
31 this.addChannelNameParser = function (fn) {
32 if (this.channelNameParsers.indexOf(fn) === -1) {
33 this.channelNameParsers.push(fn);
34 }
35 };
36
37 this.listen = function () {
38 if (window.WebSocket) {
39 ccLog.debug('attempting to create socket');
40 var socket_url = self.state.serverUrl + "/ws?conn_id=" + self.state.connId;
41 var socket_conf = {
42 url: socket_url,
43 handleAs: 'json',
44 headers: {
45 "Accept": "application/json",
46 "Content-Type": "application/json"
47 }
48 };
49 self.state.socket = new WebSocket(socket_conf.url);
50
51 self.state.socket.onopen = function (event) {
52 ccLog.debug('open event', event);
53 if (self.state.heartbeat === null) {
54 self.state.heartbeat = setInterval(function () {
55 if (self.state.socket.readyState === WebSocket.OPEN) {
56 self.state.socket.send('heartbeat');
57 }
58 }, 10000)
59 }
60 };
61 self.state.socket.onmessage = function (event) {
62 var data = $.parseJSON(event.data);
63 for (var i = 0; i < data.length; i++) {
64 if (data[i].message.topic) {
65 ccLog.debug('publishing',
66 data[i].message.topic, data[i]);
67 $.Topic(data[i].message.topic).publish(data[i])
68 }
69 else {
70 ccLog.warn('unhandled message', data);
71 }
72 }
73 };
74 self.state.socket.onclose = function (event) {
75 ccLog.debug('closed event', event);
76 setTimeout(function () {
77 self.connect(true);
78 }, 5000);
79 };
80
81 self.state.socket.onerror = function (event) {
82 ccLog.debug('error event', event);
83 };
84 }
85 else {
86 ccLog.debug('attempting to create long polling connection');
87 var poolUrl = self.state.serverUrl + "/listen?conn_id=" + self.state.connId;
88 self.state.socket = $.ajax({
89 url: poolUrl
90 }).done(function (data) {
91 ccLog.debug('data', data);
92 var data = $.parseJSON(data);
93 for (var i = 0; i < data.length; i++) {
94 if (data[i].message.topic) {
95 ccLog.info('publishing',
96 data[i].message.topic, data[i]);
97 $.Topic(data[i].message.topic).publish(data[i])
98 }
99 else {
100 ccLog.warn('unhandled message', data);
101 }
102 }
103 self.listen();
104 }).fail(function () {
105 ccLog.debug('longpoll error');
106 setTimeout(function () {
107 self.connect(true);
108 }, 5000);
109 });
110 }
111
112 };
113
114 this.connect = function (create_new_socket) {
115 var connReq = {'channels': self.state.channels};
116 ccLog.debug('try obtaining connection info', connReq);
117 $.ajax({
118 url: self.state.urls.connect,
119 type: "POST",
120 contentType: "application/json",
121 data: JSON.stringify(connReq),
122 dataType: "json"
123 }).done(function (data) {
124 ccLog.debug('Got connection:', data.conn_id);
125 self.state.channels = data.channels;
126 self.state.channelsInfo = data.channels_info;
127 self.state.connId = data.conn_id;
128 if (create_new_socket) {
129 self.listen();
130 }
131 self.update();
132 }).fail(function () {
133 setTimeout(function () {
134 self.connect(create_new_socket);
135 }, 5000);
136 });
137 self.update();
138 };
139
140 this.subscribeToChannels = function (channels) {
141 var new_channels = [];
142 for (var i = 0; i < channels.length; i++) {
143 var channel = channels[i];
144 if (self.state.channels.indexOf(channel)) {
145 self.state.channels.push(channel);
146 new_channels.push(channel)
147 }
148 }
149 /**
150 * only execute the request if socket is present because subscribe
151 * can actually add channels before initial app connection
152 **/
153 if (new_channels && self.state.socket !== null) {
154 var connReq = {
155 'channels': self.state.channels,
156 'conn_id': self.state.connId
157 };
158 $.ajax({
159 url: self.state.urls.subscribe,
160 type: "POST",
161 contentType: "application/json",
162 data: JSON.stringify(connReq),
163 dataType: "json"
164 }).done(function (data) {
165 self.state.channels = data.channels;
166 self.state.channelsInfo = data.channels_info;
167 self.update();
168 });
169 }
170 self.update();
171 };
172
173 this.update = function () {
174 for (var key in this.state.channelsInfo) {
175 if (this.state.channelsInfo.hasOwnProperty(key)) {
176 // update channels with latest info
177 $.Topic('/connection_controller/channel_update').publish(
178 {channel: key, state: this.state.channelsInfo[key]});
179 }
180 }
181 /**
182 * checks current channel list in state and if channel is not present
183 * converts them into executable "commands" and pushes them on topics
184 */
185 for (var i = 0; i < this.state.channels.length; i++) {
186 var channel = this.state.channels[i];
187 for (var j = 0; j < this.channelNameParsers.length; j++) {
188 this.channelNameParsers[j](channel);
189 }
190 }
191 };
192
193 this.run = function () {
194 this.connect(true);
195 };
196
197 $.Topic('/connection_controller/subscribe').subscribe(
198 self.subscribeToChannels);
199 };
200
201 $.Topic('/plugins/__REGISTER__').subscribe(function (data) {
202 // enable chat controller
203 if (window.CHANNELSTREAM_SETTINGS && window.CHANNELSTREAM_SETTINGS.enabled) {
204 $(document).ready(function () {
205 connCtrlr.run();
206 });
207 }
208 });
209
210 registerViewChannels = function (){
211 // subscribe to PR repo channel for PR's'
212 if (templateContext.pull_request_data.pull_request_id) {
213 var channelName = '/repo$' + templateContext.repo_name + '$/pr/' +
214 String(templateContext.pull_request_data.pull_request_id);
215 connCtrlr.state.channels.push(channelName);
216 }
217 }
218
219 })();
@@ -1,60 +0,0 b''
1 "use strict";
2
3 toastr.options = {
4 "closeButton": true,
5 "debug": false,
6 "newestOnTop": false,
7 "progressBar": false,
8 "positionClass": "toast-top-center",
9 "preventDuplicates": false,
10 "onclick": null,
11 "showDuration": "300",
12 "hideDuration": "300",
13 "timeOut": "0",
14 "extendedTimeOut": "0",
15 "showEasing": "swing",
16 "hideEasing": "linear",
17 "showMethod": "fadeIn",
18 "hideMethod": "fadeOut"
19 };
20
21 function notifySystem(data) {
22 var notification = new Notification(data.message.level + ': ' + data.message.message);
23 };
24
25 function notifyToaster(data){
26 toastr[data.message.level](data.message.message);
27 }
28
29 function handleNotifications(data) {
30
31 if (!templateContext.rhodecode_user.notification_status && !data.testMessage) {
32 // do not act if notifications are disabled
33 return
34 }
35 // use only js notifications for now
36 var onlyJS = true;
37 if (!("Notification" in window) || onlyJS) {
38 // use legacy notificartion
39 notifyToaster(data);
40 }
41 else {
42 // Let's check whether notification permissions have already been granted
43 if (Notification.permission === "granted") {
44 notifySystem(data);
45 }
46 // Otherwise, we need to ask the user for permission
47 else if (Notification.permission !== 'denied') {
48 Notification.requestPermission(function (permission) {
49 if (permission === "granted") {
50 notifySystem(data);
51 }
52 });
53 }
54 else{
55 notifyToaster(data);
56 }
57 }
58 };
59
60 $.Topic('/notifications').subscribe(handleNotifications);
@@ -1,53 +0,0 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
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
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import pytest
22 from pyramid.response import Response
23 from pyramid.testing import DummyRequest
24 from rhodecode.lib.middleware.disable_vcs import (
25 DisableVCSPagesWrapper, VCSServerUnavailable)
26
27
28 @pytest.mark.parametrize('url, should_raise', [
29 ('/', False),
30 ('/_admin/settings', False),
31 ('/_admin/i_am_fine', False),
32 ('/_admin/settings/mappings', True),
33 ('/_admin/my_account/repos', True),
34 ('/_admin/create_repository', True),
35 ('/_admin/gists/1', True),
36 ('/_admin/notifications/1', True),
37 ])
38 def test_vcs_disabled(url, should_raise):
39 wrapped_view = DisableVCSPagesWrapper(pyramid_view)
40 request = DummyRequest(path=url)
41
42 if should_raise:
43 with pytest.raises(VCSServerUnavailable):
44 response = wrapped_view(None, request)
45 else:
46 response = wrapped_view(None, request)
47 assert response.status_int == 200
48
49 def pyramid_view(context, request):
50 """
51 A mock pyramid view to be used in the wrapper
52 """
53 return Response('success')
General Comments 0
You need to be logged in to leave comments. Login now