arctic-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.circleci/config.yml +36 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +98 -0
- data/LICENSE.txt +21 -0
- data/README.md +28 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/core-api.gemspec +41 -0
- data/documentation/.editorconfig +15 -0
- data/documentation/.gitignore +24 -0
- data/documentation/.travis.yml +10 -0
- data/documentation/CHANGELOG.md +137 -0
- data/documentation/CODE_OF_CONDUCT.md +46 -0
- data/documentation/Gemfile +11 -0
- data/documentation/Gemfile.lock +129 -0
- data/documentation/LICENSE +13 -0
- data/documentation/Procfile +1 -0
- data/documentation/README.md +118 -0
- data/documentation/config.rb +57 -0
- data/documentation/deploy.sh +215 -0
- data/documentation/font-selection.json +148 -0
- data/documentation/lib/multilang.rb +16 -0
- data/documentation/lib/nesting_unique_head.rb +22 -0
- data/documentation/lib/toc_data.rb +30 -0
- data/documentation/lib/unique_head.rb +24 -0
- data/documentation/source/fonts/slate.eot +0 -0
- data/documentation/source/fonts/slate.svg +14 -0
- data/documentation/source/fonts/slate.ttf +0 -0
- data/documentation/source/fonts/slate.woff +0 -0
- data/documentation/source/fonts/slate.woff2 +0 -0
- data/documentation/source/images/logo.png +0 -0
- data/documentation/source/images/navbar.png +0 -0
- data/documentation/source/includes/_errors.md +17 -0
- data/documentation/source/index.html.md +179 -0
- data/documentation/source/javascripts/all.js +2 -0
- data/documentation/source/javascripts/all_nosearch.js +16 -0
- data/documentation/source/javascripts/app/_lang.js +164 -0
- data/documentation/source/javascripts/app/_search.js +98 -0
- data/documentation/source/javascripts/app/_toc.js +114 -0
- data/documentation/source/javascripts/lib/_energize.js +169 -0
- data/documentation/source/javascripts/lib/_imagesloaded.min.js +7 -0
- data/documentation/source/javascripts/lib/_jquery.highlight.js +108 -0
- data/documentation/source/javascripts/lib/_jquery.js +9831 -0
- data/documentation/source/javascripts/lib/_lunr.js +1910 -0
- data/documentation/source/layouts/layout.erb +116 -0
- data/documentation/source/stylesheets/_icon-font.scss +38 -0
- data/documentation/source/stylesheets/_normalize.scss +427 -0
- data/documentation/source/stylesheets/_rtl.scss +140 -0
- data/documentation/source/stylesheets/_variables.scss +103 -0
- data/documentation/source/stylesheets/_variables2.scss +147 -0
- data/documentation/source/stylesheets/print.css.scss +148 -0
- data/documentation/source/stylesheets/screen.css.scss +707 -0
- data/lib/arctic/ui.rb +21 -0
- data/lib/arctic/ui/api.rb +69 -0
- data/lib/arctic/ui/configuration.rb +26 -0
- data/lib/arctic/ui/version.rb +5 -0
- metadata +288 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
10
|
+
|
11
|
+
* Using welcoming and inclusive language
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
13
|
+
* Gracefully accepting constructive criticism
|
14
|
+
* Focusing on what is best for the community
|
15
|
+
* Showing empathy towards other community members
|
16
|
+
|
17
|
+
Examples of unacceptable behavior by participants include:
|
18
|
+
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21
|
+
* Public or private harassment
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24
|
+
|
25
|
+
## Our Responsibilities
|
26
|
+
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28
|
+
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30
|
+
|
31
|
+
## Scope
|
32
|
+
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34
|
+
|
35
|
+
## Enforcement
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@lord.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38
|
+
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40
|
+
|
41
|
+
## Attribution
|
42
|
+
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44
|
+
|
45
|
+
[homepage]: http://contributor-covenant.org
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
@@ -0,0 +1,11 @@
|
|
1
|
+
ruby '>=2.3.1'
|
2
|
+
source 'https://rubygems.org'
|
3
|
+
|
4
|
+
# Middleman
|
5
|
+
gem 'middleman', '~>4.2.1'
|
6
|
+
gem 'middleman-syntax', '~> 3.0.0'
|
7
|
+
gem 'middleman-autoprefixer', '~> 2.7.0'
|
8
|
+
gem "middleman-sprockets", "~> 4.1.0"
|
9
|
+
gem 'rouge', '~> 2.0.5'
|
10
|
+
gem 'redcarpet', '~> 3.4.0'
|
11
|
+
gem 'nokogiri', '~> 1.6.8'
|
@@ -0,0 +1,129 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (5.0.1)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
+
i18n (~> 0.7)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
tzinfo (~> 1.1)
|
9
|
+
addressable (2.5.0)
|
10
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
11
|
+
autoprefixer-rails (6.6.1)
|
12
|
+
execjs
|
13
|
+
backports (3.6.8)
|
14
|
+
coffee-script (2.4.1)
|
15
|
+
coffee-script-source
|
16
|
+
execjs
|
17
|
+
coffee-script-source (1.12.2)
|
18
|
+
compass-import-once (1.0.5)
|
19
|
+
sass (>= 3.2, < 3.5)
|
20
|
+
concurrent-ruby (1.0.4)
|
21
|
+
contracts (0.13.0)
|
22
|
+
dotenv (2.2.0)
|
23
|
+
erubis (2.7.0)
|
24
|
+
execjs (2.7.0)
|
25
|
+
fast_blank (1.0.0)
|
26
|
+
fastimage (2.0.1)
|
27
|
+
addressable (~> 2)
|
28
|
+
ffi (1.9.17)
|
29
|
+
haml (4.0.7)
|
30
|
+
tilt
|
31
|
+
hamster (3.0.0)
|
32
|
+
concurrent-ruby (~> 1.0)
|
33
|
+
hashie (3.5.1)
|
34
|
+
i18n (0.7.0)
|
35
|
+
kramdown (1.13.2)
|
36
|
+
listen (3.0.8)
|
37
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
38
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
39
|
+
memoist (0.15.0)
|
40
|
+
middleman (4.2.1)
|
41
|
+
coffee-script (~> 2.2)
|
42
|
+
compass-import-once (= 1.0.5)
|
43
|
+
haml (>= 4.0.5)
|
44
|
+
kramdown (~> 1.2)
|
45
|
+
middleman-cli (= 4.2.1)
|
46
|
+
middleman-core (= 4.2.1)
|
47
|
+
sass (>= 3.4.0, < 4.0)
|
48
|
+
middleman-autoprefixer (2.7.1)
|
49
|
+
autoprefixer-rails (>= 6.5.2, < 7.0.0)
|
50
|
+
middleman-core (>= 3.3.3)
|
51
|
+
middleman-cli (4.2.1)
|
52
|
+
thor (>= 0.17.0, < 2.0)
|
53
|
+
middleman-core (4.2.1)
|
54
|
+
activesupport (>= 4.2, < 5.1)
|
55
|
+
addressable (~> 2.3)
|
56
|
+
backports (~> 3.6)
|
57
|
+
bundler (~> 1.1)
|
58
|
+
contracts (~> 0.13.0)
|
59
|
+
dotenv
|
60
|
+
erubis
|
61
|
+
execjs (~> 2.0)
|
62
|
+
fast_blank
|
63
|
+
fastimage (~> 2.0)
|
64
|
+
hamster (~> 3.0)
|
65
|
+
hashie (~> 3.4)
|
66
|
+
i18n (~> 0.7.0)
|
67
|
+
listen (~> 3.0.0)
|
68
|
+
memoist (~> 0.14)
|
69
|
+
padrino-helpers (~> 0.13.0)
|
70
|
+
parallel
|
71
|
+
rack (>= 1.4.5, < 3)
|
72
|
+
sass (>= 3.4)
|
73
|
+
servolux
|
74
|
+
tilt (~> 2.0)
|
75
|
+
uglifier (~> 3.0)
|
76
|
+
middleman-sprockets (4.1.0)
|
77
|
+
middleman-core (~> 4.0)
|
78
|
+
sprockets (>= 3.0)
|
79
|
+
middleman-syntax (3.0.0)
|
80
|
+
middleman-core (>= 3.2)
|
81
|
+
rouge (~> 2.0)
|
82
|
+
mini_portile2 (2.1.0)
|
83
|
+
minitest (5.10.1)
|
84
|
+
nokogiri (1.6.8.1)
|
85
|
+
mini_portile2 (~> 2.1.0)
|
86
|
+
padrino-helpers (0.13.3.3)
|
87
|
+
i18n (~> 0.6, >= 0.6.7)
|
88
|
+
padrino-support (= 0.13.3.3)
|
89
|
+
tilt (>= 1.4.1, < 3)
|
90
|
+
padrino-support (0.13.3.3)
|
91
|
+
activesupport (>= 3.1)
|
92
|
+
parallel (1.10.0)
|
93
|
+
public_suffix (2.0.5)
|
94
|
+
rack (2.0.1)
|
95
|
+
rb-fsevent (0.9.8)
|
96
|
+
rb-inotify (0.9.8)
|
97
|
+
ffi (>= 0.5.0)
|
98
|
+
redcarpet (3.4.0)
|
99
|
+
rouge (2.0.7)
|
100
|
+
sass (3.4.23)
|
101
|
+
servolux (0.12.0)
|
102
|
+
sprockets (3.7.1)
|
103
|
+
concurrent-ruby (~> 1.0)
|
104
|
+
rack (> 1, < 3)
|
105
|
+
thor (0.19.4)
|
106
|
+
thread_safe (0.3.5)
|
107
|
+
tilt (2.0.6)
|
108
|
+
tzinfo (1.2.2)
|
109
|
+
thread_safe (~> 0.1)
|
110
|
+
uglifier (3.0.4)
|
111
|
+
execjs (>= 0.3.0, < 3)
|
112
|
+
|
113
|
+
PLATFORMS
|
114
|
+
ruby
|
115
|
+
|
116
|
+
DEPENDENCIES
|
117
|
+
middleman (~> 4.2.1)
|
118
|
+
middleman-autoprefixer (~> 2.7.0)
|
119
|
+
middleman-sprockets (~> 4.1.0)
|
120
|
+
middleman-syntax (~> 3.0.0)
|
121
|
+
nokogiri (~> 1.6.8)
|
122
|
+
redcarpet (~> 3.4.0)
|
123
|
+
rouge (~> 2.0.5)
|
124
|
+
|
125
|
+
RUBY VERSION
|
126
|
+
ruby 2.3.3p222
|
127
|
+
|
128
|
+
BUNDLED WITH
|
129
|
+
1.14.5
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2008-2013 Concur Technologies, Inc.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
4
|
+
not use this file except in compliance with the License. You may obtain
|
5
|
+
a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12
|
+
License for the specific language governing permissions and limitations
|
13
|
+
under the License.
|
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec middleman server -p $PORT
|
@@ -0,0 +1,118 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="https://raw.githubusercontent.com/lord/img/master/logo-slate.png" alt="Slate: API Documentation Generator" width="226">
|
3
|
+
<br>
|
4
|
+
<a href="https://travis-ci.org/lord/slate"><img src="https://travis-ci.org/lord/slate.svg?branch=master" alt="Build Status"></a>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<p align="center">Slate helps you create beautiful, intelligent, responsive API documentation.</p>
|
8
|
+
|
9
|
+
<p align="center"><img src="https://raw.githubusercontent.com/lord/img/master/screenshot-slate.png" width=700 alt="Screenshot of Example Documentation created with Slate"></p>
|
10
|
+
|
11
|
+
<p align="center"><em>The example above was created with Slate. Check it out at <a href="https://lord.github.io/slate">lord.github.io/slate</a>.</em></p>
|
12
|
+
|
13
|
+
Features
|
14
|
+
------------
|
15
|
+
|
16
|
+
* **Clean, intuitive design** — With Slate, the description of your API is on the left side of your documentation, and all the code examples are on the right side. Inspired by [Stripe's](https://stripe.com/docs/api) and [PayPal's](https://developer.paypal.com/webapps/developer/docs/api/) API docs. Slate is responsive, so it looks great on tablets, phones, and even in print.
|
17
|
+
|
18
|
+
* **Everything on a single page** — Gone are the days when your users had to search through a million pages to find what they wanted. Slate puts the entire documentation on a single page. We haven't sacrificed linkability, though. As you scroll, your browser's hash will update to the nearest header, so linking to a particular point in the documentation is still natural and easy.
|
19
|
+
|
20
|
+
* **Slate is just Markdown** — When you write docs with Slate, you're just writing Markdown, which makes it simple to edit and understand. Everything is written in Markdown — even the code samples are just Markdown code blocks.
|
21
|
+
|
22
|
+
* **Write code samples in multiple languages** — If your API has bindings in multiple programming languages, you can easily put in tabs to switch between them. In your document, you'll distinguish different languages by specifying the language name at the top of each code block, just like with GitHub Flavored Markdown.
|
23
|
+
|
24
|
+
* **Out-of-the-box syntax highlighting** for [over 100 languages](https://github.com/jneen/rouge/wiki/List-of-supported-languages-and-lexers), no configuration required.
|
25
|
+
|
26
|
+
* **Automatic, smoothly scrolling table of contents** on the far left of the page. As you scroll, it displays your current position in the document. It's fast, too. We're using Slate at TripIt to build documentation for our new API, where our table of contents has over 180 entries. We've made sure that the performance remains excellent, even for larger documents.
|
27
|
+
|
28
|
+
* **Let your users update your documentation for you** — By default, your Slate-generated documentation is hosted in a public GitHub repository. Not only does this mean you get free hosting for your docs with GitHub Pages, but it also makes it simple for other developers to make pull requests to your docs if they find typos or other problems. Of course, if you don't want to use GitHub, you're also welcome to host your docs elsewhere.
|
29
|
+
|
30
|
+
* **RTL Support** Full right-to-left layout for RTL languages such as Arabic, Persian (Farsi), Hebrew etc.
|
31
|
+
|
32
|
+
Getting started with Slate is super easy! Simply fork this repository and follow the instructions below. Or, if you'd like to check out what Slate is capable of, take a look at the [sample docs](http://lord.github.io/slate).
|
33
|
+
|
34
|
+
Getting Started with Slate
|
35
|
+
------------------------------
|
36
|
+
|
37
|
+
### Prerequisites
|
38
|
+
|
39
|
+
You're going to need:
|
40
|
+
|
41
|
+
- **Linux or OS X** — Windows may work, but is unsupported.
|
42
|
+
- **Ruby, version 2.3.1 or newer**
|
43
|
+
- **Bundler** — If Ruby is already installed, but the `bundle` command doesn't work, just run `gem install bundler` in a terminal.
|
44
|
+
|
45
|
+
### Getting Set Up
|
46
|
+
|
47
|
+
1. Fork this repository on GitHub.
|
48
|
+
2. Clone *your forked repository* (not our original one) to your hard drive with `git clone https://github.com/YOURUSERNAME/slate.git`
|
49
|
+
3. `cd slate`
|
50
|
+
4. Initialize and start Slate. You can either do this locally, or with Vagrant:
|
51
|
+
|
52
|
+
```shell
|
53
|
+
# either run this to run locally
|
54
|
+
bundle install
|
55
|
+
bundle exec middleman server
|
56
|
+
|
57
|
+
# OR run this to run with vagrant
|
58
|
+
vagrant up
|
59
|
+
```
|
60
|
+
|
61
|
+
You can now see the docs at http://localhost:4567. Whoa! That was fast!
|
62
|
+
|
63
|
+
Now that Slate is all set up on your machine, you'll probably want to learn more about [editing Slate markdown](https://github.com/lord/slate/wiki/Markdown-Syntax), or [how to publish your docs](https://github.com/lord/slate/wiki/Deploying-Slate).
|
64
|
+
|
65
|
+
If you'd prefer to use Docker, instructions are available [in the wiki](https://github.com/lord/slate/wiki/Docker).
|
66
|
+
|
67
|
+
### Note on JavaScript Runtime
|
68
|
+
|
69
|
+
For those who don't have JavaScript runtime or are experiencing JavaScript runtime issues with ExecJS, it is recommended to add the [rubyracer gem](https://github.com/cowboyd/therubyracer) to your gemfile and run `bundle` again.
|
70
|
+
|
71
|
+
Companies Using Slate
|
72
|
+
---------------------------------
|
73
|
+
|
74
|
+
* [NASA](https://api.nasa.gov)
|
75
|
+
* [IBM](https://docs.cloudant.com/api.html)
|
76
|
+
* [Sony](http://developers.cimediacloud.com)
|
77
|
+
* [Best Buy](https://bestbuyapis.github.io/api-documentation/)
|
78
|
+
* [Travis-CI](https://docs.travis-ci.com/api/)
|
79
|
+
* [Greenhouse](https://developers.greenhouse.io/harvest.html)
|
80
|
+
* [Woocommerce](http://woocommerce.github.io/woocommerce-rest-api-docs/)
|
81
|
+
* [Appium](http://appium.io/slate/en/master)
|
82
|
+
* [Dwolla](https://docs.dwolla.com/)
|
83
|
+
* [Clearbit](https://clearbit.com/docs)
|
84
|
+
* [Coinbase](https://developers.coinbase.com/api)
|
85
|
+
* [Parrot Drones](http://developer.parrot.com/docs/bebop/)
|
86
|
+
* [Fidor Bank](http://docs.fidor.de/)
|
87
|
+
* [Scale](https://docs.scaleapi.com/)
|
88
|
+
|
89
|
+
You can view more in [the list on the wiki](https://github.com/lord/slate/wiki/Slate-in-the-Wild).
|
90
|
+
|
91
|
+
Questions? Need Help? Found a bug?
|
92
|
+
--------------------
|
93
|
+
|
94
|
+
If you've got questions about setup, deploying, special feature implementation in your fork, or just want to chat with the developer, please feel free to [start a thread in our Spectrum community](https://spectrum.chat/slate)!
|
95
|
+
|
96
|
+
Found a bug with upstream Slate? Go ahead and [submit an issue](https://github.com/lord/slate/issues). And, of course, feel free to submit pull requests with bug fixes or changes to the `dev` branch.
|
97
|
+
|
98
|
+
Contributors
|
99
|
+
--------------------
|
100
|
+
|
101
|
+
Slate was built by [Robert Lord](https://lord.io) while interning at [TripIt](https://www.tripit.com/).
|
102
|
+
|
103
|
+
Thanks to the following people who have submitted major pull requests:
|
104
|
+
|
105
|
+
- [@chrissrogers](https://github.com/chrissrogers)
|
106
|
+
- [@bootstraponline](https://github.com/bootstraponline)
|
107
|
+
- [@realityking](https://github.com/realityking)
|
108
|
+
- [@cvkef](https://github.com/cvkef)
|
109
|
+
|
110
|
+
Also, thanks to [Sauce Labs](http://saucelabs.com) for sponsoring the development of the responsive styles.
|
111
|
+
|
112
|
+
Special Thanks
|
113
|
+
--------------------
|
114
|
+
- [Middleman](https://github.com/middleman/middleman)
|
115
|
+
- [jquery.tocify.js](https://github.com/gfranko/jquery.tocify.js)
|
116
|
+
- [middleman-syntax](https://github.com/middleman/middleman-syntax)
|
117
|
+
- [middleman-gh-pages](https://github.com/edgecase/middleman-gh-pages)
|
118
|
+
- [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Unique header generation
|
2
|
+
require './lib/unique_head.rb'
|
3
|
+
|
4
|
+
# Markdown
|
5
|
+
set :markdown_engine, :redcarpet
|
6
|
+
set :markdown,
|
7
|
+
fenced_code_blocks: true,
|
8
|
+
smartypants: true,
|
9
|
+
disable_indented_code_blocks: true,
|
10
|
+
prettify: true,
|
11
|
+
tables: true,
|
12
|
+
with_toc_data: true,
|
13
|
+
no_intra_emphasis: true,
|
14
|
+
renderer: UniqueHeadCounter
|
15
|
+
|
16
|
+
# Assets
|
17
|
+
set :css_dir, 'stylesheets'
|
18
|
+
set :js_dir, 'javascripts'
|
19
|
+
set :images_dir, 'images'
|
20
|
+
set :fonts_dir, 'fonts'
|
21
|
+
|
22
|
+
# Activate the syntax highlighter
|
23
|
+
activate :syntax
|
24
|
+
ready do
|
25
|
+
require './lib/multilang.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
activate :sprockets
|
29
|
+
|
30
|
+
activate :autoprefixer do |config|
|
31
|
+
config.browsers = ['last 2 version', 'Firefox ESR']
|
32
|
+
config.cascade = false
|
33
|
+
config.inline = true
|
34
|
+
end
|
35
|
+
|
36
|
+
# Github pages require relative links
|
37
|
+
activate :relative_assets
|
38
|
+
set :relative_links, true
|
39
|
+
|
40
|
+
# Build Configuration
|
41
|
+
configure :build do
|
42
|
+
# If you're having trouble with Middleman hanging, commenting
|
43
|
+
# out the following two lines has been known to help
|
44
|
+
activate :minify_css
|
45
|
+
activate :minify_javascript
|
46
|
+
# activate :relative_assets
|
47
|
+
# activate :asset_hash
|
48
|
+
# activate :gzip
|
49
|
+
end
|
50
|
+
|
51
|
+
# Deploy Configuration
|
52
|
+
# If you want Middleman to listen on a different port, you can set that below
|
53
|
+
set :port, 4567
|
54
|
+
|
55
|
+
helpers do
|
56
|
+
require './lib/toc_data.rb'
|
57
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -o errexit #abort if any command fails
|
3
|
+
me=$(basename "$0")
|
4
|
+
|
5
|
+
help_message="\
|
6
|
+
Usage: $me [-c FILE] [<options>]
|
7
|
+
Deploy generated files to a git branch.
|
8
|
+
|
9
|
+
Options:
|
10
|
+
|
11
|
+
-h, --help Show this help information.
|
12
|
+
-v, --verbose Increase verbosity. Useful for debugging.
|
13
|
+
-e, --allow-empty Allow deployment of an empty directory.
|
14
|
+
-m, --message MESSAGE Specify the message used when committing on the
|
15
|
+
deploy branch.
|
16
|
+
-n, --no-hash Don't append the source commit's hash to the deploy
|
17
|
+
commit's message.
|
18
|
+
--source-only Only build but not push
|
19
|
+
--push-only Only push but not build
|
20
|
+
"
|
21
|
+
|
22
|
+
|
23
|
+
run_build() {
|
24
|
+
bundle exec middleman build --clean
|
25
|
+
}
|
26
|
+
|
27
|
+
parse_args() {
|
28
|
+
# Set args from a local environment file.
|
29
|
+
if [ -e ".env" ]; then
|
30
|
+
source .env
|
31
|
+
fi
|
32
|
+
|
33
|
+
# Parse arg flags
|
34
|
+
# If something is exposed as an environment variable, set/overwrite it
|
35
|
+
# here. Otherwise, set/overwrite the internal variable instead.
|
36
|
+
while : ; do
|
37
|
+
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
38
|
+
echo "$help_message"
|
39
|
+
return 0
|
40
|
+
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
41
|
+
verbose=true
|
42
|
+
shift
|
43
|
+
elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then
|
44
|
+
allow_empty=true
|
45
|
+
shift
|
46
|
+
elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then
|
47
|
+
commit_message=$2
|
48
|
+
shift 2
|
49
|
+
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
|
50
|
+
GIT_DEPLOY_APPEND_HASH=false
|
51
|
+
shift
|
52
|
+
else
|
53
|
+
break
|
54
|
+
fi
|
55
|
+
done
|
56
|
+
|
57
|
+
# Set internal option vars from the environment and arg flags. All internal
|
58
|
+
# vars should be declared here, with sane defaults if applicable.
|
59
|
+
|
60
|
+
# Source directory & target branch.
|
61
|
+
deploy_directory=build
|
62
|
+
deploy_branch=gh-pages
|
63
|
+
|
64
|
+
#if no user identity is already set in the current git environment, use this:
|
65
|
+
default_username=${GIT_DEPLOY_USERNAME:-deploy.sh}
|
66
|
+
default_email=${GIT_DEPLOY_EMAIL:-}
|
67
|
+
|
68
|
+
#repository to deploy to. must be readable and writable.
|
69
|
+
repo=origin
|
70
|
+
|
71
|
+
#append commit hash to the end of message by default
|
72
|
+
append_hash=${GIT_DEPLOY_APPEND_HASH:-true}
|
73
|
+
}
|
74
|
+
|
75
|
+
main() {
|
76
|
+
parse_args "$@"
|
77
|
+
|
78
|
+
enable_expanded_output
|
79
|
+
|
80
|
+
if ! git diff --exit-code --quiet --cached; then
|
81
|
+
echo Aborting due to uncommitted changes in the index >&2
|
82
|
+
return 1
|
83
|
+
fi
|
84
|
+
|
85
|
+
commit_title=`git log -n 1 --format="%s" HEAD`
|
86
|
+
commit_hash=` git log -n 1 --format="%H" HEAD`
|
87
|
+
|
88
|
+
#default commit message uses last title if a custom one is not supplied
|
89
|
+
if [[ -z $commit_message ]]; then
|
90
|
+
commit_message="publish: $commit_title"
|
91
|
+
fi
|
92
|
+
|
93
|
+
#append hash to commit message unless no hash flag was found
|
94
|
+
if [ $append_hash = true ]; then
|
95
|
+
commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
|
96
|
+
fi
|
97
|
+
|
98
|
+
previous_branch=`git rev-parse --abbrev-ref HEAD`
|
99
|
+
|
100
|
+
if [ ! -d "$deploy_directory" ]; then
|
101
|
+
echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
|
102
|
+
return 1
|
103
|
+
fi
|
104
|
+
|
105
|
+
# must use short form of flag in ls for compatibility with OS X and BSD
|
106
|
+
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
|
107
|
+
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
|
108
|
+
return 1
|
109
|
+
fi
|
110
|
+
|
111
|
+
if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
|
112
|
+
# deploy_branch exists in $repo; make sure we have the latest version
|
113
|
+
|
114
|
+
disable_expanded_output
|
115
|
+
git fetch --force $repo $deploy_branch:$deploy_branch
|
116
|
+
enable_expanded_output
|
117
|
+
fi
|
118
|
+
|
119
|
+
# check if deploy_branch exists locally
|
120
|
+
if git show-ref --verify --quiet "refs/heads/$deploy_branch"
|
121
|
+
then incremental_deploy
|
122
|
+
else initial_deploy
|
123
|
+
fi
|
124
|
+
|
125
|
+
restore_head
|
126
|
+
}
|
127
|
+
|
128
|
+
initial_deploy() {
|
129
|
+
git --work-tree "$deploy_directory" checkout --orphan $deploy_branch
|
130
|
+
git --work-tree "$deploy_directory" add --all
|
131
|
+
commit+push
|
132
|
+
}
|
133
|
+
|
134
|
+
incremental_deploy() {
|
135
|
+
#make deploy_branch the current branch
|
136
|
+
git symbolic-ref HEAD refs/heads/$deploy_branch
|
137
|
+
#put the previously committed contents of deploy_branch into the index
|
138
|
+
git --work-tree "$deploy_directory" reset --mixed --quiet
|
139
|
+
git --work-tree "$deploy_directory" add --all
|
140
|
+
|
141
|
+
set +o errexit
|
142
|
+
diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$?
|
143
|
+
set -o errexit
|
144
|
+
case $diff in
|
145
|
+
0) echo No changes to files in $deploy_directory. Skipping commit.;;
|
146
|
+
1) commit+push;;
|
147
|
+
*)
|
148
|
+
echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to master, use: git symbolic-ref HEAD refs/heads/master && git reset --mixed >&2
|
149
|
+
return $diff
|
150
|
+
;;
|
151
|
+
esac
|
152
|
+
}
|
153
|
+
|
154
|
+
commit+push() {
|
155
|
+
set_user_id
|
156
|
+
git --work-tree "$deploy_directory" commit -m "$commit_message"
|
157
|
+
|
158
|
+
disable_expanded_output
|
159
|
+
#--quiet is important here to avoid outputting the repo URL, which may contain a secret token
|
160
|
+
git push --quiet $repo $deploy_branch
|
161
|
+
enable_expanded_output
|
162
|
+
}
|
163
|
+
|
164
|
+
#echo expanded commands as they are executed (for debugging)
|
165
|
+
enable_expanded_output() {
|
166
|
+
if [ $verbose ]; then
|
167
|
+
set -o xtrace
|
168
|
+
set +o verbose
|
169
|
+
fi
|
170
|
+
}
|
171
|
+
|
172
|
+
#this is used to avoid outputting the repo URL, which may contain a secret token
|
173
|
+
disable_expanded_output() {
|
174
|
+
if [ $verbose ]; then
|
175
|
+
set +o xtrace
|
176
|
+
set -o verbose
|
177
|
+
fi
|
178
|
+
}
|
179
|
+
|
180
|
+
set_user_id() {
|
181
|
+
if [[ -z `git config user.name` ]]; then
|
182
|
+
git config user.name "$default_username"
|
183
|
+
fi
|
184
|
+
if [[ -z `git config user.email` ]]; then
|
185
|
+
git config user.email "$default_email"
|
186
|
+
fi
|
187
|
+
}
|
188
|
+
|
189
|
+
restore_head() {
|
190
|
+
if [[ $previous_branch = "HEAD" ]]; then
|
191
|
+
#we weren't on any branch before, so just set HEAD back to the commit it was on
|
192
|
+
git update-ref --no-deref HEAD $commit_hash $deploy_branch
|
193
|
+
else
|
194
|
+
git symbolic-ref HEAD refs/heads/$previous_branch
|
195
|
+
fi
|
196
|
+
|
197
|
+
git reset --mixed
|
198
|
+
}
|
199
|
+
|
200
|
+
filter() {
|
201
|
+
sed -e "s|$repo|\$repo|g"
|
202
|
+
}
|
203
|
+
|
204
|
+
sanitize() {
|
205
|
+
"$@" 2> >(filter 1>&2) | filter
|
206
|
+
}
|
207
|
+
|
208
|
+
if [[ $1 = --source-only ]]; then
|
209
|
+
run_build
|
210
|
+
elif [[ $1 = --push-only ]]; then
|
211
|
+
main "$@"
|
212
|
+
else
|
213
|
+
run_build
|
214
|
+
main "$@"
|
215
|
+
fi
|