middleman-gh-pages 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e0d79113909c3b269d4b1ebd04e5753bf7c4430
4
- data.tar.gz: e56c32ff8116c180d9c2bf33b7a80df63211b17f
3
+ metadata.gz: 1f29f5382e9666ebf6c1917a1875f5ff3e200075
4
+ data.tar.gz: 12f1f870fb7b8810628cd997908ba1f48f9a57b5
5
5
  SHA512:
6
- metadata.gz: f96911891076c34bfb013c89dce3b55d3fe3ab35b38bdc385ecc0988882051d2fb03a6a6ca1a4014d422c2b1cc1f3a14cb4602dc551f0a3991b5cf24742b5777
7
- data.tar.gz: 74f962062a72aa1b9cd650edac9b076791d08b053af510b0ed4c14c491dc6ee738e2269c646f49dc284622cd25fcebe9c37404f3b0fadb368e5e4261b386d56c
6
+ metadata.gz: d8e3cf04aec8c079224eeaa9791e5ff397cfeaea7254dea60e820deb6747d5be6185156f7b272e2d02382a103f9e8cc801a6e9bc90bbfc0652eb4dc546ec5d27
7
+ data.tar.gz: df54a775f2ff4ee3a44d46cfa9b178e32da211934bde43dc0562e995a60e5d8f2566ee83b2565bf3e789b736950e88d3216deeb776c77f94a954da84a6ff6947
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Middleman Github Pages
2
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
3
+ [![Gem Version](https://img.shields.io/gem/v/middleman-gh-pages.svg)](https://rubygems.org/gems/middleman-gh-pages)
4
+
5
+ [Middleman](https://middlemanapp.com/) makes creating static sites a joy, [Github
6
+ Pages](https://pages.github.com/) hosts static sites for free, Middleman Github
5
7
  Pages brings the two together. Middleman Github Pages is just a few rake tasks
6
8
  that automate the process of deploying a Middleman site to Github Pages.
7
9
 
@@ -32,36 +34,78 @@ The only assumption is that you are deploying to a gh-pages branch in the same
32
34
  remote as the source. `rake publish` will create this branch for you if it
33
35
  doesn't exist.
34
36
 
35
- ## Options
37
+ ## Environment Variable Options
36
38
 
37
- You cannot deploy your site if you have uncommitted changes. You can
38
- override this with the `ALLOW_DIRTY` option:
39
+ ### `ALLOW_DIRTY`
39
40
 
40
- ```shell
41
+ You cannot deploy your site if you have uncommitted changes, but you can
42
+ override this (default: `nil`):
43
+
44
+ ```
41
45
  bundle exec rake publish ALLOW_DIRTY=true
42
46
  ```
43
47
 
44
- You can append a custom suffix to commit messages on the build branch:
48
+ ### `COMMIT_MESSAGE_SUFFIX`
45
49
 
46
- ```shell
50
+ You can append a custom suffix to commit messages on the build branch
51
+ (default: `nil`):
52
+
53
+ ```
47
54
  bundle exec rake publish COMMIT_MESSAGE_SUFFIX="[skip-ci]"
48
55
  ```
49
56
 
50
- You can change the remote that you deploy to:
57
+ ### `REMOTE_NAME`
51
58
 
52
- ```shell
59
+ You can change the remote that you deploy to (default: `origin`):
60
+
61
+ ```
53
62
  bundle exec rake publish REMOTE_NAME=upstream
54
63
  ```
55
64
 
56
- If you're publishing a personal or organization page, you may want to use the branch `master` instead of `gh-pages`:
65
+ ### `BRANCH_NAME`
57
66
 
58
- ```shell
67
+ If you're publishing a personal or organization page, you may want to use the
68
+ branch `master` instead of `gh-pages` (default: `gh-pages`):
69
+
70
+ ```
59
71
  bundle exec rake publish BRANCH_NAME=master
60
72
  ```
61
73
 
74
+ ### `PROJECT_ROOT`
75
+
76
+ If your middleman project isn't at the root of your repository, you will
77
+ likely need to change this (default: _root of git repository_):
78
+
79
+ ```
80
+ bundle exec rake publish PROJECT_ROOT=/Users/me/projects/repo/www
81
+ ```
82
+
83
+ ### `BUILD_DIR`
84
+
85
+ If you override the default middlemant `:build_dir` setting, you will likely
86
+ also need to set this variable (default: `<PROJECT_ROOT>/build`):
87
+
88
+ ```
89
+ bundle exec rake publish BUILD_DIR=/some/custom/path/to/public
90
+ ```
91
+
92
+ ### Setting ENV variables from your Rakefile
93
+
94
+ Of course, for more permanent settings, you can always set these environment
95
+ variables directly in your `Rakefile` instead of from the command line.
96
+
97
+ ```ruby
98
+ require "middleman-gh-pages"
99
+
100
+ # Ensure builds are skipped when publishing to the gh-pages branch
101
+ ENV["COMMIT_MESSAGE_SUFFIX"] = "[skip ci]"
102
+ # Ignore errors about dirty builds (not recommended)
103
+ ENV["ALLOW_DIRTY"] = "true"
104
+ ```
105
+
62
106
  ## Custom Domain
63
107
 
64
- 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).
108
+ To set up a custom domain, you can follow the [GitHub help page](https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages/).
65
109
 
66
110
  __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.
67
111
 
@@ -69,8 +113,10 @@ __NOTE__ You will need to put your CNAME file in the `source` directory of your
69
113
 
70
114
  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`
71
115
 
72
- activate :relative_assets
73
- set :relative_links, true
116
+ ``` ruby
117
+ activate :relative_assets
118
+ set :relative_links, true
119
+ ```
74
120
 
75
121
  __NOTE__ This only affects sites being accessed at the `username.github.io/projectname` URL, not when accessed at a custom CNAME.
76
122
 
@@ -14,7 +14,8 @@ def uncommitted_changes?
14
14
  end
15
15
 
16
16
  def backup_and_restore(dir, file, &block)
17
- yield unless File.exist?(File.join(dir, file))
17
+ return yield unless File.exist?(File.join(dir, file))
18
+
18
19
  Dir.mktmpdir do |tmpdir|
19
20
  mv File.join(dir, file), tmpdir
20
21
  yield
@@ -38,7 +39,7 @@ file GH_PAGES_REF => BUILD_DIR do
38
39
  cd BUILD_DIR do
39
40
  sh "git init"
40
41
  sh "git remote add #{remote_name} #{repo_url}"
41
- sh "git fetch #{remote_name}"
42
+ sh "git fetch --depth 1 #{remote_name} #{branch_name}"
42
43
 
43
44
  if `git branch -r` =~ /#{branch_name}/
44
45
  sh "git checkout #{branch_name}"
@@ -58,7 +59,7 @@ task :prepare_build_dir => GH_PAGES_REF
58
59
  # Fetch upstream changes on gh-pages branch
59
60
  task :sync_build_dir => :prepare_build_dir do
60
61
  cd BUILD_DIR do
61
- sh "git fetch #{remote_name}"
62
+ sh "git fetch --depth 1 #{remote_name} #{branch_name}"
62
63
  sh "git reset --hard #{remote_name}/#{branch_name}"
63
64
  end
64
65
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module GithubPages
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-gh-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam McCrea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-16 00:00:00.000000000 Z
11
+ date: 2016-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake