middleman-gh-pages 0.0.2 → 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.
- data/README.md +31 -2
- data/lib/middleman-gh-pages/tasks/gh-pages.rake +15 -9
- data/lib/middleman-gh-pages/version.rb +1 -1
- metadata +4 -3
data/README.md
CHANGED
@@ -9,7 +9,7 @@ that automate the process of deploying a Middleman site to Github Pages.
|
|
9
9
|
|
10
10
|
Add this line to your Gemfile:
|
11
11
|
|
12
|
-
```
|
12
|
+
```ruby
|
13
13
|
gem 'middleman-gh-pages'
|
14
14
|
```
|
15
15
|
|
@@ -32,13 +32,42 @@ The only assumption is that you are deploying to a gh-pages branch in the same
|
|
32
32
|
remote as the source. `rake publish` will create this branch for you if it
|
33
33
|
doesn't exist.
|
34
34
|
|
35
|
-
|
35
|
+
## Options
|
36
|
+
|
37
|
+
You cannot deploy your site if you have uncommitted changes. You can
|
36
38
|
override this with the `ALLOW_DIRTY` option:
|
37
39
|
|
38
40
|
```shell
|
39
41
|
bundle exec rake publish ALLOW_DIRTY=true
|
40
42
|
```
|
41
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
|
+
|
42
71
|
## Contributing
|
43
72
|
|
44
73
|
1. Fork it
|
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
+
def remote_name
|
4
|
+
ENV.fetch("REMOTE_NAME", "origin")
|
5
|
+
end
|
6
|
+
|
3
7
|
PROJECT_ROOT = `git rev-parse --show-toplevel`.strip
|
4
8
|
BUILD_DIR = File.join(PROJECT_ROOT, "build")
|
5
|
-
GH_PAGES_REF = File.join(BUILD_DIR, ".git/refs/remotes/
|
9
|
+
GH_PAGES_REF = File.join(BUILD_DIR, ".git/refs/remotes/#{remote_name}/gh-pages")
|
6
10
|
|
7
11
|
directory BUILD_DIR
|
8
12
|
|
@@ -10,13 +14,14 @@ file GH_PAGES_REF => BUILD_DIR do
|
|
10
14
|
repo_url = nil
|
11
15
|
|
12
16
|
cd PROJECT_ROOT do
|
13
|
-
repo_url = `git config --get remote.
|
17
|
+
repo_url = `git config --get remote.#{remote_name}.url`.strip
|
14
18
|
end
|
15
19
|
|
16
20
|
cd BUILD_DIR do
|
17
21
|
sh "git init"
|
18
|
-
sh "git remote add
|
19
|
-
sh "git fetch
|
22
|
+
sh "git remote add #{remote_name} #{repo_url}"
|
23
|
+
sh "git fetch #{remote_name}"
|
24
|
+
sh "git checkout master"
|
20
25
|
|
21
26
|
if `git branch -r` =~ /gh-pages/
|
22
27
|
sh "git checkout gh-pages"
|
@@ -25,7 +30,7 @@ file GH_PAGES_REF => BUILD_DIR do
|
|
25
30
|
sh "touch index.html"
|
26
31
|
sh "git add ."
|
27
32
|
sh "git commit -m 'initial gh-pages commit'"
|
28
|
-
sh "git push
|
33
|
+
sh "git push #{remote_name} gh-pages"
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
@@ -36,8 +41,8 @@ task :prepare_git_remote_in_build_dir => GH_PAGES_REF
|
|
36
41
|
# Fetch upstream changes on gh-pages branch
|
37
42
|
task :sync do
|
38
43
|
cd BUILD_DIR do
|
39
|
-
sh "git fetch
|
40
|
-
sh "git reset --hard
|
44
|
+
sh "git fetch #{remote_name}"
|
45
|
+
sh "git reset --hard #{remote_name}/gh-pages"
|
41
46
|
end
|
42
47
|
end
|
43
48
|
|
@@ -59,10 +64,11 @@ end
|
|
59
64
|
desc "Build and publish to Github Pages"
|
60
65
|
task :publish => [:not_dirty, :prepare_git_remote_in_build_dir, :sync, :build] do
|
61
66
|
message = nil
|
67
|
+
suffix = ENV["COMMIT_MESSAGE_SUFFIX"]
|
62
68
|
|
63
69
|
cd PROJECT_ROOT do
|
64
70
|
head = `git log --pretty="%h" -n1`.strip
|
65
|
-
message = "Site updated to #{head}"
|
71
|
+
message = ["Site updated to #{head}", suffix].compact.join("\n\n")
|
66
72
|
end
|
67
73
|
|
68
74
|
cd BUILD_DIR do
|
@@ -72,6 +78,6 @@ task :publish => [:not_dirty, :prepare_git_remote_in_build_dir, :sync, :build] d
|
|
72
78
|
else
|
73
79
|
sh "git commit -m \"#{message}\""
|
74
80
|
end
|
75
|
-
sh "git push
|
81
|
+
sh "git push #{remote_name} gh-pages"
|
76
82
|
end
|
77
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-gh-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -63,8 +63,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubyforge_project:
|
66
|
-
rubygems_version: 1.8.
|
66
|
+
rubygems_version: 1.8.23
|
67
67
|
signing_key:
|
68
68
|
specification_version: 3
|
69
69
|
summary: Easy deployment of Middleman sites to Github Pages
|
70
70
|
test_files: []
|
71
|
+
has_rdoc:
|