From 738f8ed462466f2c58ea10b22dca470272ec6261 Mon Sep 17 00:00:00 2001
From: benjamin wil
Date: Mon, 6 Jun 2022 06:52:26 -0700
Subject: [PATCH] Start using Yarn to manage JavaScript dependencies (#1824)
* Start using `yarn` for vendor assets
Until this commit, Gollum has included JavaScript assets by committing
the source code to the `lib/gollum/public/gollum/javascript/` directory
and including them for compilation in the Sprockets asset manifest file
at `lib/gollum/public/gollum/javascript/app.js`. This has been a
reasonable way to deal with third-party JavaScript, but there are a few
downsides:
- It's a burden to find out if JavaScript dependencies have been
updated and require updating in Gollum.
- It doesn't give us good visibility into the JavaScript dependencies
required by our dependencies.
- It forces us to commit external code to our repository, which can
make our developer tools more difficult to configure or use. For
example: when I search for key words in the repository using
Ripgrep, I often get "garbage" results from minified JavaScript.
Managing JavaScript dependencies via a JS package manager can resolve
all of these issues.
This commit allows us to manage JavaScript dependencies using the Yarn
package manager for Node JS modules[1]. I chose Yarn over NPM for one
reason: Yarn is the JavaScript package manager that Rails uses by
default. So many Ruby developers will already be familiar with Yarn.
To demonstrate how this can change how we manage JS assets in Gollum,
I've configured Yarn and started to manage the `mousetrap` dependency
with it. I chose `mousetrap` to start because it's a smaller, mostly
uncomplicated dependency. I was easily able to manually test that
`mousetrap` is still working after re-compiling the assets.
Hopefully this gives anyone reading enough context to jump in and start
moving our third-party JS assets out of the codebase.
[1]: https://yarnpkg.com/
* Recompile assets
* Add dev environment setup info to CONTRIBUTING
Now that we require additional tooling to manage JavaScript
dependencies, it seemed reasonable to add more documentation around
setting up one's development environment.
* Don't compile assets without `yarn`-managed ones
If a developer compiled assets without first running `yarn install`, we
would get incomplete collection of up-to-date assets.
Let's ensure that the developer has all the required assets by enforcing
this in the precompile task they should be using to compile production
assets to begin with.
---
CONTRIBUTING.md | 103 ++++++++++++++++--
Rakefile | 31 +++++-
lib/gollum/assets.rb | 6 +-
...fest-160337b312f8e438181baac4aaa37319.json | 1 -
...fest-9ac24f50c124b745e80f4ecb2d86282b.json | 1 +
...b7c8e11c2b2d42640560b874f677c25f6e5.css.gz | Bin 38998 -> 38998 bytes
...c581f9d43fff778bdc78aa9fe53aaa2c927c8cc.js | 6 +
...1f9d43fff778bdc78aa9fe53aaa2c927c8cc.js.gz | Bin 0 -> 62469 bytes
...9d2a5028625664f62c2528e5989538537f3f4a8.js | 6 -
...a5028625664f62c2528e5989538537f3f4a8.js.gz | Bin 62396 -> 0 bytes
...68e3315a6b4a75da6cec48d21b8846905c4.css.gz | Bin 298 -> 298 bytes
...a40b78fab9863142b161d88f32a3f035378a.js.gz | Bin 206278 -> 206278 bytes
...89ae48380ec9fcbef948bd4e23b0b095bfb.css.gz | Bin 71 -> 71 bytes
lib/gollum/public/gollum/javascript/app.js | 5 +-
.../public/gollum/javascript/mousetrap.min.js | 11 --
package.json | 8 ++
yarn.lock | 8 ++
17 files changed, 151 insertions(+), 35 deletions(-)
delete mode 100644 lib/gollum/public/assets/.sprockets-manifest-160337b312f8e438181baac4aaa37319.json
create mode 100644 lib/gollum/public/assets/.sprockets-manifest-9ac24f50c124b745e80f4ecb2d86282b.json
create mode 100644 lib/gollum/public/assets/app-6bef6b19014c6620eab4daf7bc581f9d43fff778bdc78aa9fe53aaa2c927c8cc.js
create mode 100644 lib/gollum/public/assets/app-6bef6b19014c6620eab4daf7bc581f9d43fff778bdc78aa9fe53aaa2c927c8cc.js.gz
delete mode 100644 lib/gollum/public/assets/app-eb6effc9f708916af14718a5c9d2a5028625664f62c2528e5989538537f3f4a8.js
delete mode 100644 lib/gollum/public/assets/app-eb6effc9f708916af14718a5c9d2a5028625664f62c2528e5989538537f3f4a8.js.gz
delete mode 100644 lib/gollum/public/gollum/javascript/mousetrap.min.js
create mode 100644 package.json
create mode 100644 yarn.lock
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 758a0f84..c6c24718 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -29,14 +29,85 @@ Lastly, please **consider helping out** by opening a Pull Request!
You can triage issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to gollum on CodeTriage](https://www.codetriage.com/gollum/gollum).
+## Set up your development environment
+
+If you want to hack on Gollum, you'll need to set up a development
+environment.
+
+To get started, you'll need:
+
+ - A recent version of [Git][git]
+ - A recent version of [Ruby][rubylang].
+ - A recent version of [Node JS][nodejs].
+
+Refer to their installation instructions. Installation methods differ depending
+on your operating system.
+
+Once you have those:
+
+ - Install Bundler, the Ruby package manager. In a terminal:
+ ```sh
+ gem install bundler
+ ```
+ - Install Yarn, a JavaScript package manager. [See Yarn's install
+ guide][yarn-install].
+
+Now, you can start setting up Gollum to run locally:
+
+ 1. Clone the git repository. In a terminal:
+
+ ```sh
+ git clone https://github.com/gollum/gollum.git
+ ```
+ 2. Change directory into the cloned project:
+ ```sh
+ cd gollum
+ ```
+ 3. Bundle the project's Ruby dependencies using Bundler:
+ ```sh
+ [sudo] bundle install
+ ```
+ 4. Install the project's JavaScript dependencies using Yarn:
+ ```sh
+ yarn install
+ ```
+If all went well, you should now be able to run the test suite using the
+following command:
+
+```sh
+bundle exec rake
+```
+
+If you already have a Gollum wiki, you can also browse it via your local version
+of Gollum:
+
+```sh
+bundle exec gollum
+```
+
+Or you can clone an example wiki and browse that:
+
+```sh
+git clone test/examples/lotr.git ~/lotr-wiki
+bundle exec gollum ~/lotr-wiki
+```
+
+With this, you're ready to start contributing and open your first [pull
+request](#opening-a-pull-request).
+
+[git]: https://git-scm.com/downloads
+[nodejs]: https://nodejs.org
+[rubylang]: https://www.ruby-lang.org
+[yarn-install]: https://yarnpkg.com/getting-started/install
## Opening a Pull Request
Pull Requests fixing bugs, implementing new features, or updating documentation and dependencies are all very welcome! If you would like to help out with the project, you can pick an open issue from the issue tracker. We're more than happy to help you get started! Here's how you can proceed:
-1. Fork and clone Gollum.
+1. Fork and clone Gollum. See [Set up your development
+ environment](#set-up-your-development-environment).
2. Create a thoughtfully named topic branch to contain your changes.
-3. If you haven't installed dependencies yet, navigate to your clone and execute:
+3. If you haven't installed dependencies yet, navigate to your clone and execute:
```
[sudo] bundle install
```
@@ -47,23 +118,32 @@ Pull Requests fixing bugs, implementing new features, or updating documentation
8. Push the branch to your fork on GitHub.
9. Create a pull request for Gollum.
-**Notes:**
-* Do not change Gollum's version numbers, we will do that on our own.
+Do not change Gollum's version number, we will do that on our own.
### Running tests
1. Install [Bundler](http://bundler.io/).
2. Navigate to the cloned source of Gollum.
-3. Install dependencies:
+3. Install dependencies:
```
[sudo] bundle install
```
-4. Run the tests:
+4. Run the tests:
```
bundle exec rake test
```
-
-To profile slow tests, you can use `bundle exec rake test TESTOPTS="--verbose"`.
+
+To profile slow tests, you can use the `--verbose` flag:
+
+```sh
+bundle exec rake test TESTOPTS="--verbose"
+```
+
+You can also run a single test file with the following command:
+
+```sh
+bundle exec ruby
+```
### Working with test repositories
@@ -82,7 +162,12 @@ git push ../lotr.git/ master
## Updating static assets
-This is necessary whenever changes have been made to the assets in `lib/gollum/public/gollum/javascript` (mostly SASS, CSS, and JS files), to ensure the changes are also present in the [released](#releasing-the-gem) version of the gem. Steps:
+This is necessary whenever changes have been made to the assets in
+`lib/gollum/public/gollum/javascript` (mostly SASS, CSS, and JS files), to
+ensure the changes are also present in the [released](#releasing-the-gem)
+version of the gem.
+
+Steps:
1. `git rm -r lib/gollum/public/assets`
1. `bundle exec rake precompile`
diff --git a/Rakefile b/Rakefile
index 1e6f4822..affb4977 100644
--- a/Rakefile
+++ b/Rakefile
@@ -190,10 +190,10 @@ task :changelog do
exit!
end
end
-
+
latest_changes = File.open(latest_changes_file)
version_pattern = "# #{version}"
-
+
if !`grep "#{version_pattern}" #{history_file}`.empty?
puts "#{version} is already described in #{history_file}"
exit!
@@ -208,13 +208,13 @@ task :changelog do
puts "#{latest_changes_file} is empty!"
exit!
end
-
+
body = latest_changes.read
body.scan(/\s*#\s+\d\.\d.*/) do |match|
puts "#{latest_changes_file} may not contain multiple markdown headers!"
exit!
end
-
+
temp = Tempfile.new
temp.puts("#{version_pattern} / #{date}\n#{body}\n")
temp.close
@@ -224,11 +224,29 @@ end
desc 'Precompile assets'
task :precompile do
+ # Attempt to install JavaScript dependencies managed by Yarn via the
+ # `package.json` file in Gollum's project root. If it fails, raise an error
+ # and exit the task early.
+ puts "\n Installing `yarn`-managed JavaScript dependencies... \n\n"
+ system "yarn install"
+ unless $?.success?
+ raise "This task tried to run `yarn install` to get up-to-date " \
+ "JavaScript dependencies before precompilation. But it failed. Please " \
+ "run `yarn install` manually from your shell and resolve any issues. " \
+ "It's possible that you just need to install `yarn` on your system."
+ end
+
require './lib/gollum/app.rb'
+
+ # Next, configure the Sprockets asset pipeline and precompile production-
+ # ready assets.
Precious::App.set(:environment, :production)
+
env = Precious::Assets.sprockets
- path = ENV.fetch('GOLLUM_ASSETS_PATH', ::File.join(File.dirname(__FILE__), 'lib/gollum/public/assets'))
+ path = ENV.fetch 'GOLLUM_ASSETS_PATH',
+ File.join(File.dirname(__FILE__), 'lib/gollum/public/assets')
manifest = Sprockets::Manifest.new(env, path)
+
Sprockets::Helpers.configure do |config|
config.environment = env
config.prefix = Precious::Assets::ASSET_URL
@@ -236,6 +254,7 @@ task :precompile do
config.public_path = path
config.manifest = manifest
end
- puts "Precompiling assets to #{path}..."
+
+ puts "\n Precompiling assets to #{path}... \n\n"
manifest.compile(Precious::Assets::MANIFEST)
end
diff --git a/lib/gollum/assets.rb b/lib/gollum/assets.rb
index c53a2347..f6736b10 100644
--- a/lib/gollum/assets.rb
+++ b/lib/gollum/assets.rb
@@ -7,8 +7,12 @@ module Precious
def self.sprockets(dir = File.dirname(File.expand_path(__FILE__)))
env = Sprockets::Environment.new
- env.append_path ::File.join(dir, 'public/gollum/stylesheets/')
+
+ env.append_path ::File.join(dir, '../../node_modules')
+
env.append_path ::File.join(dir, 'public/gollum/javascript')
+ env.append_path ::File.join(dir, 'public/gollum/stylesheets/')
+
env.append_path ::File.join(dir, 'public/gollum/images')
env.append_path ::File.join(dir, 'public/gollum/fonts')
diff --git a/lib/gollum/public/assets/.sprockets-manifest-160337b312f8e438181baac4aaa37319.json b/lib/gollum/public/assets/.sprockets-manifest-160337b312f8e438181baac4aaa37319.json
deleted file mode 100644
index 596e2121..00000000
--- a/lib/gollum/public/assets/.sprockets-manifest-160337b312f8e438181baac4aaa37319.json
+++ /dev/null
@@ -1 +0,0 @@
-{"files":{"app-f05401ee374f0c7f48fc2bc08e30b4f4db705861fd5895ed70998683b383bfb5.js":{"logical_path":"app.js","mtime":"2021-11-15T20:08:30-08:00","size":136040,"digest":"f05401ee374f0c7f48fc2bc08e30b4f4db705861fd5895ed70998683b383bfb5","integrity":"sha256-8FQB7jdPDH9I/CvAjjC09NtwWGH9WJXtcJmGg7ODv7U="},"editor-9881d0c7ae663293f0e3a7e72729eec7e940fa613185c076709b76d292f5703a.js":{"logical_path":"editor.js","mtime":"2021-11-15T20:08:30-08:00","size":744886,"digest":"9881d0c7ae663293f0e3a7e72729eec7e940fa613185c076709b76d292f5703a","integrity":"sha256-mIHQx65mMpPw46fnJynux+lA+mExhcB2cJt20pL1cDo="},"app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css":{"logical_path":"app.css","mtime":"2022-05-26T12:13:37+02:00","size":396731,"digest":"309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5","integrity":"sha256-MJvgMjlueDsTpH31jzibfI4RwrLUJkBWC4dPZ3wl9uU="},"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css":{"logical_path":"criticmarkup.css","mtime":"2020-03-29T22:28:51+02:00","size":646,"digest":"31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4","integrity":"sha256-Ma5dMoK7uOe3w8mRfp+2jjMVprSnXabOxI0huIRpBcQ="},"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css":{"logical_path":"print.css","mtime":"2020-03-30T11:12:22+02:00","size":75,"digest":"512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb","integrity":"sha256-USSYw2i+DT+xuhBd+oQomuSDgOyfy++Ui9TiOwsJW/s="},"app-eb6effc9f708916af14718a5c9d2a5028625664f62c2528e5989538537f3f4a8.js":{"logical_path":"app.js","mtime":"2022-05-26T13:00:46+02:00","size":188288,"digest":"eb6effc9f708916af14718a5c9d2a5028625664f62c2528e5989538537f3f4a8","integrity":"sha256-627/yfcIkWrxRxilydKlAoYlZk9iwlKOWYlThTfz9Kg="},"editor-ebdf534a0063fe3b05a7e7daaf7aa40b78fab9863142b161d88f32a3f035378a.js":{"logical_path":"editor.js","mtime":"2022-05-26T13:00:46+02:00","size":745160,"digest":"ebdf534a0063fe3b05a7e7daaf7aa40b78fab9863142b161d88f32a3f035378a","integrity":"sha256-699TSgBj/jsFp+far3qkC3j6uYYxQrFh2I8yo/A1N4o="}},"assets":{"app.js":"app-eb6effc9f708916af14718a5c9d2a5028625664f62c2528e5989538537f3f4a8.js","editor.js":"editor-ebdf534a0063fe3b05a7e7daaf7aa40b78fab9863142b161d88f32a3f035378a.js","app.css":"app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css","criticmarkup.css":"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css","print.css":"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css"}}
\ No newline at end of file
diff --git a/lib/gollum/public/assets/.sprockets-manifest-9ac24f50c124b745e80f4ecb2d86282b.json b/lib/gollum/public/assets/.sprockets-manifest-9ac24f50c124b745e80f4ecb2d86282b.json
new file mode 100644
index 00000000..4599e6f4
--- /dev/null
+++ b/lib/gollum/public/assets/.sprockets-manifest-9ac24f50c124b745e80f4ecb2d86282b.json
@@ -0,0 +1 @@
+{"files":{"app-6bef6b19014c6620eab4daf7bc581f9d43fff778bdc78aa9fe53aaa2c927c8cc.js":{"logical_path":"app.js","mtime":"2022-06-03T19:51:43-07:00","size":188397,"digest":"6bef6b19014c6620eab4daf7bc581f9d43fff778bdc78aa9fe53aaa2c927c8cc","integrity":"sha256-a+9rGQFMZiDqtNr3vFgfnUP/93i9x4qp/lOqosknyMw="},"editor-ebdf534a0063fe3b05a7e7daaf7aa40b78fab9863142b161d88f32a3f035378a.js":{"logical_path":"editor.js","mtime":"2022-06-03T19:51:43-07:00","size":745160,"digest":"ebdf534a0063fe3b05a7e7daaf7aa40b78fab9863142b161d88f32a3f035378a","integrity":"sha256-699TSgBj/jsFp+far3qkC3j6uYYxQrFh2I8yo/A1N4o="},"app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css":{"logical_path":"app.css","mtime":"2022-06-03T19:51:43-07:00","size":396731,"digest":"309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5","integrity":"sha256-MJvgMjlueDsTpH31jzibfI4RwrLUJkBWC4dPZ3wl9uU="},"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css":{"logical_path":"criticmarkup.css","mtime":"2021-02-24T23:16:14-08:00","size":646,"digest":"31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4","integrity":"sha256-Ma5dMoK7uOe3w8mRfp+2jjMVprSnXabOxI0huIRpBcQ="},"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css":{"logical_path":"print.css","mtime":"2021-02-24T23:16:14-08:00","size":75,"digest":"512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb","integrity":"sha256-USSYw2i+DT+xuhBd+oQomuSDgOyfy++Ui9TiOwsJW/s="}},"assets":{"app.js":"app-6bef6b19014c6620eab4daf7bc581f9d43fff778bdc78aa9fe53aaa2c927c8cc.js","editor.js":"editor-ebdf534a0063fe3b05a7e7daaf7aa40b78fab9863142b161d88f32a3f035378a.js","app.css":"app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css","criticmarkup.css":"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css","print.css":"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css"}}
\ No newline at end of file
diff --git a/lib/gollum/public/assets/app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css.gz b/lib/gollum/public/assets/app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css.gz
index 572565729a2e1bc8d6e7247b1dfed3bf4046dfc5..a4a3408613e5bc8dde8db16ac9d131ef66a4d082 100644
GIT binary patch
delta 18
acmcb%f$7=?CU*I54u<_FW^H8mp8)_#iwBAT
delta 18
acmcb%f$7=?CU*I54u*?C{Ttc+X8-_44hI_m
diff --git a/lib/gollum/public/assets/app-6bef6b19014c6620eab4daf7bc581f9d43fff778bdc78aa9fe53aaa2c927c8cc.js b/lib/gollum/public/assets/app-6bef6b19014c6620eab4daf7bc581f9d43fff778bdc78aa9fe53aaa2c927c8cc.js
new file mode 100644
index 00000000..d2450fca
--- /dev/null
+++ b/lib/gollum/public/assets/app-6bef6b19014c6620eab4daf7bc581f9d43fff778bdc78aa9fe53aaa2c927c8cc.js
@@ -0,0 +1,6 @@
+function brokenAvatarImage(e){return e.onerror="",e.src='data:image/svg+xml;utf8,',!0}function routePath(e){return path=gollumRoutes[e],prefixBaseUrl(path)}function prefixBaseUrl(e){if(baseUrl==undefined)console.log("Gollum error: baseUrl undefined");else{if(e!=undefined)return""==baseUrl?e:("/"==baseUrl.charAt(baseUrl.length-1)?result=baseUrl+e:result=baseUrl+"/"+e,result.replace(/\/{2}/g,"/"));console.log("Could not find route with name: "+name)}}function cleanPath(e){return("/"+e.replace(/\/$/,"")).replace(/\/{2}/g,"/")}function pageName(){return"undefined"==typeof pageFullPath?undefined:(name=pageFullPath.split("/").pop(),name.substring(0,name.lastIndexOf(".")))}function pagePath(){return"undefined"==typeof pageFullPath?undefined:pageFullPath.split("/").slice(0,-1).join("/")}function htmlEscape(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function abspath(e,t){"/"!=t[0]&&(t="/"+t,e&&(t="/"+e+t));var n=t.split("/");return[n.slice(0,-1).join("/"),n.pop()]}function setTextDirection(){$(".markdown-body p, .markdown-body span, .markdown-body pre, .markdown-body table").attr("dir","auto")}function preparePage(){setTextDirection(),"true"==criticMarkup&&($("#wiki-content").addClass("criticmarkup"),$("ins.break").unwrap(),$("span.critic.comment").wrap(''),$("span.critic.comment").filter(function(){return""!=$(this).text()}).before("‡"))}function getLocalTime(e,t){return t===undefined&&(t="Y-m-d %H:%M:%S O"),new Date(e).format(t)}function flashNotice(e,t,n,r,i){nested_button_html="",void 0!==n&&void 0!==r&&(i=void 0!==i&&"danger"==i?" btn-danger":"",nested_button_html='"),html='
").append(n.replace(Qe,"")).find(i):n)),r&&a.each(r,[n,t,e])}}),this},serialize:function(){return A.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?A.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||et.test(this.nodeName)||Ge.test(this.type))}).map(function(e,t){var n=A(this).val();return null==n?null:A.isArray(n)?A.map(n,function(e){return{name:t.name,value:e.replace(Ue,"\r\n")}}):{name:t.name,value:n.replace(Ue,"\r\n")}}).get()}}),A.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){A.fn[t]=function(e){return this.on(t,e)}}),A.each(["get","post"],function(e,i){A[i]=function(e,t,n,r){return A.isFunction(t)&&(r=r||n,n=t,t=F),A.ajax({type:i,url:e,data:t,success:n,dataType:r})}}),A.extend({getScript:function(e,t){return A.get(e,F,t,"script")},getJSON:function(e,t,n){return A.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?r(e,A.ajaxSettings):(t=e,e=A.ajaxSettings),r(e,t),e},ajaxSettings:{url:Re,isLocal:Ve.test(We[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":st},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":O.String,"text html":!0,"text json":A.parseJSON,"text xml":A.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:i(ot),ajaxTransport:i(at),ajax:function(e,t){function n(e,t,n,r){if(2!==x){x=2,p&&clearTimeout(p),h=F,f=r||"",D.readyState=0=s.duration+this.startTime){for(t in this.now=this.end,this.pos=this.state=1,this.update(),s.animatedProperties[this.prop]=!0,s.animatedProperties)!0!==s.animatedProperties[t]&&(o=!1);if(o){if(null!=s.overflow&&!A.support.shrinkWrapBlocks&&A.each(["","X","Y"],function(e,t){a.style["overflow"+t]=s.overflow[e]}),s.hide&&A(a).hide(),s.hide||s.show)for(t in s.animatedProperties)A.style(a,t,s.orig[t]),A.removeData(a,"fxshow"+t,!0),A.removeData(a,"toggle"+t,!0);(r=s.complete)&&(s.complete=!1,r.call(a))}return!1}return s.duration==Infinity?this.now=i:(n=i-this.startTime,this.state=n/s.duration,this.pos=A.easing[s.animatedProperties[this.prop]](this.state,n,0,1,s.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},A.extend(A.fx,{tick:function(){for(var e,t=A.timers,n=0;n=r[u]?r[s]:Math.max(e.body[u],r[u],e.body[l],r[l]):n===F?(o=A.css(e,t),a=parseFloat(o),A.isNumeric(a)?a:o):void A(e).css(t,n)},n,e,arguments.length,null)}}),O.jQuery=O.$=A,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return A})}(window),function(){var e;e="undefined"!=typeof module&&"undefined"!=typeof module.exports?require("./pnglib"):window.PNGlib;var t=function(e,t,n){if("string"!=typeof e||e.length<15)throw"A hash of at least 15 characters is required.";this.defaults={background:[240,240,240,255],margin:.08,size:64,saturation:.7,brightness:.5,format:"png"},this.options="object"==typeof t?t:this.defaults,"number"==typeof t&&(this.options.size=t),n&&(this.options.margin=n),this.hash=e,this.background=this.options.background||this.defaults.background,this.size=this.options.size||this.defaults.size,this.format=this.options.format||this.defaults.format,this.margin=this.options.margin!==undefined?this.options.margin:this.defaults.margin;var r=parseInt(this.hash.substr(-7),16)/268435455,i=this.options.saturation||this.defaults.saturation,o=this.options.brightness||this.defaults.brightness;this.foreground=this.options.foreground||this.hsl2rgb(r,i,o)};t.prototype={background:null,foreground:null,hash:null,margin:null,size:null,format:null,image:function(){return this.isSvg()?new n(this.size,this.foreground,this.background):new e(this.size,this.size,256)},render:function(){var e,t,n=this.image(),r=this.size,i=Math.floor(r*this.margin),o=Math.floor((r-2*i)/5),a=Math.floor((r-5*o)/2),s=n.color.apply(n,this.background),u=n.color.apply(n,this.foreground);for(e=0;e<15;e++)t=parseInt(this.hash.charAt(e),16)%2?s:u,e<5?this.rectangle(2*o+a,e*o+a,o,o,t,n):e<10?(this.rectangle(1*o+a,(e-5)*o+a,o,o,t,n),this.rectangle(3*o+a,(e-5)*o+a,o,o,t,n)):e<15&&(this.rectangle(0*o+a,(e-10)*o+a,o,o,t,n),this.rectangle(4*o+a,(e-10)*o+a,o,o,t,n));return n},rectangle:function(e,t,n,r,i,o){var a,s;if(this.isSvg())o.rectangles.push({x:e,y:t,w:n,h:r,color:i});else for(a=e;a",e=0;e");return t+=""},getBase64:function(){if("function"==typeof btoa)return btoa(this.getDump());if(Buffer)return new Buffer(this.getDump(),"binary").toString("base64");throw"Cannot generate base64 output"}},"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=t:window.Identicon=t}(),function(){var o=Date,a=Date.CultureStrings?Date.CultureStrings.lang:null,r={},i={getFromKey:function(e,t){var n;return n=Date.CultureStrings&&Date.CultureStrings[t]&&Date.CultureStrings[t][e]?Date.CultureStrings[t][e]:i.buildFromDefault(e),"/"===e.charAt(0)&&(n=i.buildFromRegex(e,t)),n},getFromObjectValues:function(e,t){var n,r={};for(n in e)e.hasOwnProperty(n)&&(r[n]=i.getFromKey(e[n],t));return r},getFromObjectKeys:function(e,t){var n,r={};for(n in e)e.hasOwnProperty(n)&&(r[i.getFromKey(n,t)]=e[n]);return r},getFromArray:function(e,t){for(var n=[],r=0;r=e.getTime()&&this.getTime()<=t.getTime()},e.isAfter=function(e){return 1===this.compareTo(e||new Date)},e.isBefore=function(e){return-1===this.compareTo(e||new Date)},e.isToday=e.isSameDay=function(e){return this.clone().clearTime().equals((e||new Date).clone().clearTime())},e.addMilliseconds=function(e){return e&&this.setTime(this.getTime()+1*e),this},e.addSeconds=function(e){return e?this.addMilliseconds(1e3*e):this},e.addMinutes=function(e){return e?this.addMilliseconds(6e4*e):this},e.addHours=function(e){return e?this.addMilliseconds(36e5*e):this},e.addDays=function(e){return e&&this.setDate(this.getDate()+1*e),this},e.addWeekdays=function(e){if(!e)return this;var t=this.getDay(),n=Math.ceil(Math.abs(e)/7);if((0===t||6===t)&&0o.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");return e=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond),this.year<100&&e.setFullYear(this.year),this.timezone?e.set({timezone:this.timezone}):this.timezoneOffset&&e.set({timezoneOffset:this.timezoneOffset}),e},finish:function(e){var t,n,r;if(0===(e=e instanceof Array?a(e):[e]).length)return null;for(t=0;t/"+uploadDest+"/[filename]",action:routePath("upload_file")}],OK:function(){$("#wiki-content").addClass("uploading");var e=new FormData($("#upload").get(0)),t=$("#upload").attr("action");$.ajax({url:t,type:"POST",data:e,processData:!1,contentType:!1,success:function(){$("#wiki-content").removeClass("uploading"),flashNotice("success","Your file was successfully uploaded.")},error:function(e,t,n){$("#wiki-content").removeClass("uploading"),409==e.status?flashNotice("error","The file you tried to upload already exists. Please rename the file and try again."):flashNotice("error","Error uploading file: "+t+" "+n)}})}}),$("#gollum-dialog-action-ok").attr("disabled",!0),$("input:file").on("change",function(){$(this).val()&&(filename=$("input[type=file]").val().split("\\").pop(),upload_path="/"+uploadDest+"/"+filename,clipboard_button='',news="Your uploaded file will be accessible at "+clipboard_button+" "+upload_path,$(".context").html(news),$("#gollum-dialog-action-ok").attr("disabled",!1))})})),$(".minibutton-rename-page").length&&($(".minibutton-rename-page").parent().removeClass("jaws"),$(".minibutton-rename-page").click(function(e){e.preventDefault();var a=decodeURI(pagePath()),s=decodeURI(pageName()),t="Renamed page will be under "+htmlEscape(cleanPath(a))+" unless an absolute path is given.";$.GollumDialog.init({title:"Rename Page",fields:[{id:"name",name:"Rename to",type:"text",defaultValue:s||"",context:t}],OK:function(e){var t="Rename Page";e.name&&(t=e.name);var n=abspath(a,t),r=n[0],i="/"+a==r?"Renamed "+s+" to "+t:"Renamed "+s+" to "+n.join("/"),o=$("form[name=rename]");o.children("input[name=rename]").val(n.join("/")),o.children("input[name=message]").val(i),o.submit()}})})),$(".minibutton-new-page").length&&($(".minibutton-new-page").parent().removeClass("jaws"),$(".minibutton-new-page").click(function(e){e.preventDefault();var o=pagePath();o===undefined&&0!=$("#file-browser").length&&(o=window.location.pathname.replace(routePath("overview"),""));var t="Page will be created under "+htmlEscape(cleanPath(o))+" unless an absolute path is given.";$.GollumDialog.init({title:"Create New Page",fields:[{id:"name",name:"Page Name",type:"text",defaultValue:"",context:t}],OK:function(e){var t="New Page";e.name&&(t=e.name);for(var n=[],r=abspath(o,t).join("/").split("/"),i=0;i").attr({type:"hidden",id:$(e).val(),name:"versions[]",value:$(e).val()}).appendTo($("#selection-form")),i()},u=function(e){$("#selection-form #"+$(e).val()).remove(),$(e).closest("li").removeClass(a.join(" ")),i()},l=function(){$("#version-form input").on("change",function(){this.checked?s(this):u(this)})};l(),i();var c=function(e){e.preventDefault(),$(this).hasClass("disabled")||$.ajax({url:$(this).attr("href"),type:"GET",success:function(e){var t=$("#page-history-list",e),n=$("#pagination",e);["#next","#prev"].forEach(function(e){old_btn=$("#pagination "+e),new_btn=n.find(e),old_btn.attr("href",new_btn.attr("href")),new_btn.hasClass("disabled")?old_btn.addClass("disabled"):old_btn.removeClass("disabled")}),$("#page-history-list").replaceWith(t),l(),i()},error:function(e,t,n){console.log("something went wrong: "+t+n)}}),this.blur()};$("#pagination #next, #pagination #prev").each(function(e,t){$(t).on("click",c)})}if($("#last-edit").length&&$("#page-info-toggle").click(function(){$.ajax({url:routePath("last_commit_info"),data:{path:$("#page-info-toggle").data("pagepath")},success:function(e){var t=showLocalTime?getLocalTime(e.date):e.date;$("#last-edit").next(".dotted-spinner").toggleClass("hidden"),$("#last-edit-in-progress").html("Last edited by "+e.author+", "+t)}}),$("#last-edit").next(".dotted-spinner").toggleClass("hidden"),$("#page-info-toggle").before(' Getting commit info...').remove()}),$("#wiki-wrapper.create").length&&($("#gollum-editor-submit").click(function(){window.onbeforeunload=null}),$("#gollum-editor-body").one("change",function(){window.onbeforeunload=function(){return"Leaving will not create a new page!"}}),$.GollumEditor({NewFile:!0,MarkupType:default_markup,commands:r})),$("#search-results").length){$(".toggle-context").each(function(){var e=$(this).parent().next("div.search-context").find("li:hidden");e.length?$(this).click(function(){e.toggle(),$(this).toggle()}):$(this).toggle()});var d=new RegExp(searchTerms.join("|"),"gi");$("div.search-context li span").each(function(){var e=$(this).html().replace(/"/g,""").replace(/'/g,"'").replace(d,function(e){return''+e+""});$(this).html(e)})}if($(".markdown-body").length&&(preparePage(),(match=new RegExp(/[?&]redirected\_from=([^?]*)/).exec(window.location.href))&&(notice="The page you requested was renamed or moved. You've been successfully redirected to its new location.",flashNotice("success",notice)),Mousetrap.bind(["e"],function(e){return e.preventDefault(),window.location=routePath("edit")+"/"+pageFullPath,!1}),$.markupSupportsEditableSections(pageFormat)&&$("a.anchor").each(function(e,t){if(header=$(t).closest(":header"),header.hasClass("editable")){var n=routePath("edit")+"/"+pageFullPath+$(t).attr("href");$(t).clone().addClass("edit").attr("href",n).appendTo(header)}})),$("#wiki-history").length||$("#page-history").length){var f={format:"svg",background:[255,255,255,255]};$("img.identicon").each(function(e,t){var n=$(t),r=n.data("identicon"),i=new Identicon(r,f).toString();i="data:image/svg+xml;base64,"+i,n.attr("src",i)})}}),function(r){var i={debugOn:!1,markupCreated:!1,markup:"",currentAspect:function(){return window.innerWidth<480?"small-mobile":"fixed"==r("#gollum-dialog-dialog").css("position")?"large-mobile":"desktop"},attachEvents:function(t){r("#gollum-dialog-action-ok").click(function(e){i.eventOK(e,t)}),r("#gollum-dialog-action-cancel").click(i.eventCancel),r('#gollum-dialog-dialog input[type="text"]').keydown(function(e){13==e.keyCode&&i.eventOK(e,t)})},detachEvents:function(){r("#gollum-dialog-action-ok").unbind("click"),r("#gollum-dialog-action-cancel").unbind("click")},createFieldMarkup:function(e){for(var t="