middleman-gh-pages-win 0.0.3
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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +77 -0
- data/Rakefile +1 -0
- data/lib/middleman-gh-pages.rb +5 -0
- data/lib/middleman-gh-pages/tasks/gh-pages.rake +82 -0
- data/lib/middleman-gh-pages/version.rb +5 -0
- data/middleman-gh-pages.gemspec +21 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 500265ee9487ecd4f0a4c5ac912ef214ca4d06ff
|
4
|
+
data.tar.gz: 6f6ea8b805048ffbdcb847cb0432d7b53e266c2d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8e6548741599acb10dd9b4b582e09106c6b65dfd89f57252a74a5a7156704f3a9cdb8b63ae23296fc84b6740a5466e04a7c93d890d28f5a7e1ff487e80bcbf4e
|
7
|
+
data.tar.gz: bcc75c69ae670c0ce3ce9d014b873a15770db794a094cb9edf95a13aa2d817e59f53352f7ea8fe63c4fb839bf6af596ebf6485f121503de70ee969fac193d19a
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Adam McCrea
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Middleman Github Pages
|
2
|
+
|
3
|
+
[Middleman](http://middlemanapp.com) makes creating static sites a joy, [Github
|
4
|
+
Pages](http://pages.github.com) hosts static sites for free, Middleman Github
|
5
|
+
Pages brings the two together. Middleman Github Pages is just a few rake tasks
|
6
|
+
that automate the process of deploying a Middleman site to Github Pages.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'middleman-gh-pages'
|
14
|
+
```
|
15
|
+
|
16
|
+
You'll also need to require the gem in your Rakefile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
require 'middleman-gh-pages'
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Middleman Github Pages provides the following rake tasks:
|
25
|
+
|
26
|
+
```shell
|
27
|
+
rake build # Compile all files into the build directory
|
28
|
+
rake publish # Build and publish to Github Pages
|
29
|
+
```
|
30
|
+
|
31
|
+
The only assumption is that you are deploying to a gh-pages branch in the same
|
32
|
+
remote as the source. `rake publish` will create this branch for you if it
|
33
|
+
doesn't exist.
|
34
|
+
|
35
|
+
## Options
|
36
|
+
|
37
|
+
You cannot deploy your site if you have uncommitted changes. You can
|
38
|
+
override this with the `ALLOW_DIRTY` option:
|
39
|
+
|
40
|
+
```shell
|
41
|
+
bundle exec rake publish ALLOW_DIRTY=true
|
42
|
+
```
|
43
|
+
|
44
|
+
You can append a custom suffix to commit messages on the build branch:
|
45
|
+
|
46
|
+
```shell
|
47
|
+
bundle exec rake publish COMMIT_MESSAGE_SUFFIX="--skip-ci"
|
48
|
+
```
|
49
|
+
|
50
|
+
You can change the remote that you deploy to:
|
51
|
+
|
52
|
+
```shell
|
53
|
+
bundle exec rake publish REMOTE_NAME=upstream
|
54
|
+
```
|
55
|
+
|
56
|
+
## Custom Domain
|
57
|
+
|
58
|
+
To set up a custom domain, you can follow the [GitHub help page](https://help.github.com/articles/setting-up-a-custom-domain-with-pages).
|
59
|
+
|
60
|
+
__NOTE__ You will need to put your CNAME file in the `source` directory of your middleman project, NOT in its root directory. This will result in the CNAME file being in the root of the generated static site in your gh-pages branch.
|
61
|
+
|
62
|
+
## Project Page Path Issues
|
63
|
+
|
64
|
+
Since project pages deploy to a subdirectory, assets and page paths are relative to the organization or user that owns the repo. If you're treating the project pages as a standalone site, you can tell Middleman to generate relative paths for assets and links with these settings in the build configuration in `config.rb`
|
65
|
+
|
66
|
+
activate :relative_assets
|
67
|
+
set :relative_links, true
|
68
|
+
|
69
|
+
__NOTE__ This only affects sites being accessed at the `username.github.io/projectname` URL, not when accessed at a custom CNAME.
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
1. Fork it
|
74
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
def remote_name
|
4
|
+
ENV.fetch("REMOTE_NAME", "origin")
|
5
|
+
end
|
6
|
+
|
7
|
+
PROJECT_ROOT = `git rev-parse --show-toplevel`.strip
|
8
|
+
BUILD_DIR = File.join(PROJECT_ROOT, "build")
|
9
|
+
GH_PAGES_REF = File.join(BUILD_DIR, ".git/refs/remotes/#{remote_name}/gh-pages")
|
10
|
+
|
11
|
+
directory BUILD_DIR
|
12
|
+
|
13
|
+
file GH_PAGES_REF => BUILD_DIR do
|
14
|
+
repo_url = nil
|
15
|
+
|
16
|
+
cd PROJECT_ROOT do
|
17
|
+
repo_url = `git config --get remote.#{remote_name}.url`.strip
|
18
|
+
end
|
19
|
+
|
20
|
+
cd BUILD_DIR do
|
21
|
+
sh "git init"
|
22
|
+
sh "git remote add #{remote_name} #{repo_url}"
|
23
|
+
sh "git fetch #{remote_name}"
|
24
|
+
|
25
|
+
if `git branch -r` =~ /gh-pages/
|
26
|
+
sh "git checkout gh-pages"
|
27
|
+
else
|
28
|
+
sh "git checkout --orphan gh-pages"
|
29
|
+
sh "touch index.html"
|
30
|
+
sh "git add ."
|
31
|
+
sh "git commit -m" + "initial gh-pages commit"
|
32
|
+
sh "git push #{remote_name} gh-pages"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Alias to something meaningful
|
38
|
+
task :prepare_git_remote_in_build_dir => GH_PAGES_REF
|
39
|
+
|
40
|
+
# Fetch upstream changes on gh-pages branch
|
41
|
+
task :sync do
|
42
|
+
cd BUILD_DIR do
|
43
|
+
sh "git fetch #{remote_name}"
|
44
|
+
sh "git reset --hard #{remote_name}/gh-pages"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Prevent accidental publishing before committing changes
|
49
|
+
task :not_dirty do
|
50
|
+
puts "***#{ENV['ALLOW_DIRTY']}***"
|
51
|
+
unless ENV['ALLOW_DIRTY']
|
52
|
+
fail "Directory not clean" if /nothing to commit/ !~ `git status`
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "Compile all files into the build directory"
|
57
|
+
task :build do
|
58
|
+
cd PROJECT_ROOT do
|
59
|
+
sh "bundle exec middleman build --clean"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Build and publish to Github Pages"
|
64
|
+
task :publish => [:not_dirty, :prepare_git_remote_in_build_dir, :sync, :build] do
|
65
|
+
message = nil
|
66
|
+
suffix = ENV["COMMIT_MESSAGE_SUFFIX"]
|
67
|
+
|
68
|
+
cd PROJECT_ROOT do
|
69
|
+
head = `git log --pretty="%h" -n1`.strip
|
70
|
+
message = ["Site updated to #{head}", suffix].compact.join("\n\n")
|
71
|
+
end
|
72
|
+
|
73
|
+
cd BUILD_DIR do
|
74
|
+
sh 'git add --all'
|
75
|
+
if /nothing to commit/ =~ `git status`
|
76
|
+
puts "No changes to commit."
|
77
|
+
else
|
78
|
+
sh "git commit -m \"#{message}\""
|
79
|
+
end
|
80
|
+
sh "git push #{remote_name} gh-pages"
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'middleman-gh-pages/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "middleman-gh-pages-win"
|
8
|
+
gem.version = Middleman::GithubPages::VERSION
|
9
|
+
gem.authors = ["Adam McCrea", "Jona Hugger"]
|
10
|
+
gem.email = ["adam@adamlogic.com", "jona@schisma.co"]
|
11
|
+
gem.description = %q{Easy deployment of Middleman sites to Github Pages}
|
12
|
+
gem.summary = %q{Easy deployment of Middleman sites to Github Pages}
|
13
|
+
gem.homepage = "http://github.com/schisma/middleman-gh-pages"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'rake', '> 0.9.3'
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-gh-pages-win
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam McCrea
|
8
|
+
- Jona Hugger
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.9.3
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.9.3
|
28
|
+
description: Easy deployment of Middleman sites to Github Pages
|
29
|
+
email:
|
30
|
+
- adam@adamlogic.com
|
31
|
+
- jona@schisma.co
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- ".gitignore"
|
37
|
+
- Gemfile
|
38
|
+
- LICENSE.txt
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- lib/middleman-gh-pages.rb
|
42
|
+
- lib/middleman-gh-pages/tasks/gh-pages.rake
|
43
|
+
- lib/middleman-gh-pages/version.rb
|
44
|
+
- middleman-gh-pages.gemspec
|
45
|
+
homepage: http://github.com/schisma/middleman-gh-pages
|
46
|
+
licenses: []
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.2.2
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: Easy deployment of Middleman sites to Github Pages
|
68
|
+
test_files: []
|