middleman-gh-pages 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -1
- data/lib/middleman-gh-pages/tasks/gh-pages.rake +20 -6
- data/lib/middleman-gh-pages/version.rb +1 -1
- metadata +2 -8
data/README.md
CHANGED
@@ -32,7 +32,12 @@ 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
|
-
Note that you cannot deploy your site if you have uncommitted changes.
|
35
|
+
Note that you cannot deploy your site if you have uncommitted changes. You can
|
36
|
+
override this with the `ALLOW_DIRTY` option:
|
37
|
+
|
38
|
+
```shell
|
39
|
+
bundle exec rake publish ALLOW_DIRTY=true
|
40
|
+
```
|
36
41
|
|
37
42
|
## Contributing
|
38
43
|
|
@@ -1,12 +1,17 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
-
|
3
|
+
PROJECT_ROOT = `git rev-parse --show-toplevel`.strip
|
4
|
+
BUILD_DIR = File.join(PROJECT_ROOT, "build")
|
4
5
|
GH_PAGES_REF = File.join(BUILD_DIR, ".git/refs/remotes/origin/gh-pages")
|
5
6
|
|
6
7
|
directory BUILD_DIR
|
7
8
|
|
8
9
|
file GH_PAGES_REF => BUILD_DIR do
|
9
|
-
repo_url =
|
10
|
+
repo_url = nil
|
11
|
+
|
12
|
+
cd PROJECT_ROOT do
|
13
|
+
repo_url = `git config --get remote.origin.url`.strip
|
14
|
+
end
|
10
15
|
|
11
16
|
cd BUILD_DIR do
|
12
17
|
sh "git init"
|
@@ -38,18 +43,27 @@ end
|
|
38
43
|
|
39
44
|
# Prevent accidental publishing before committing changes
|
40
45
|
task :not_dirty do
|
41
|
-
|
46
|
+
puts "***#{ENV['ALLOW_DIRTY']}***"
|
47
|
+
unless ENV['ALLOW_DIRTY']
|
48
|
+
fail "Directory not clean" if /nothing to commit/ !~ `git status`
|
49
|
+
end
|
42
50
|
end
|
43
51
|
|
44
52
|
desc "Compile all files into the build directory"
|
45
53
|
task :build do
|
46
|
-
|
54
|
+
cd PROJECT_ROOT do
|
55
|
+
sh "bundle exec middleman build --clean"
|
56
|
+
end
|
47
57
|
end
|
48
58
|
|
49
59
|
desc "Build and publish to Github Pages"
|
50
60
|
task :publish => [:not_dirty, :prepare_git_remote_in_build_dir, :sync, :build] do
|
51
|
-
|
52
|
-
|
61
|
+
message = nil
|
62
|
+
|
63
|
+
cd PROJECT_ROOT do
|
64
|
+
head = `git log --pretty="%h" -n1`.strip
|
65
|
+
message = "Site updated to #{head}"
|
66
|
+
end
|
53
67
|
|
54
68
|
cd BUILD_DIR do
|
55
69
|
sh 'git add --all'
|
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.2
|
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: 2012-11-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -55,18 +55,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
55
|
- - ! '>='
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
hash: 576739196795499365
|
61
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
59
|
none: false
|
63
60
|
requirements:
|
64
61
|
- - ! '>='
|
65
62
|
- !ruby/object:Gem::Version
|
66
63
|
version: '0'
|
67
|
-
segments:
|
68
|
-
- 0
|
69
|
-
hash: 576739196795499365
|
70
64
|
requirements: []
|
71
65
|
rubyforge_project:
|
72
66
|
rubygems_version: 1.8.24
|