middleman-deploy 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -7
- data/lib/middleman-deploy/commands.rb +51 -14
- data/lib/middleman-deploy/extension.rb +1 -22
- data/lib/middleman-deploy/pkg-info.rb +1 -1
- metadata +6 -6
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Middleman Delpoy -- Deploy a [middleman](http://middlemanapp.com/) built site over rsync.
|
1
|
+
Middleman Delpoy -- Deploy a [middleman](http://middlemanapp.com/) built site over rsync or to github pages.
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/tvaughan/middleman-deploy.png)](http://travis-ci.org/tvaughan/middleman-deploy)
|
4
4
|
|
@@ -21,7 +21,7 @@ If deploying through `rsync`, be sure it is installed.
|
|
21
21
|
|
22
22
|
Edit `Gemfile`, and add:
|
23
23
|
|
24
|
-
gem "middleman-deploy"
|
24
|
+
gem "middleman-deploy", "~>0.0.1"
|
25
25
|
|
26
26
|
Then run:
|
27
27
|
|
@@ -35,9 +35,9 @@ Edit `config.rb`, and add:
|
|
35
35
|
|
36
36
|
activate :deploy do |deploy|
|
37
37
|
deploy.method = :rsync
|
38
|
-
deploy.user
|
39
|
-
deploy.host
|
40
|
-
deploy.path
|
38
|
+
deploy.user = "tvaughan"
|
39
|
+
deploy.host = "www.example.com"
|
40
|
+
deploy.path = "/srv/www/site"
|
41
41
|
end
|
42
42
|
|
43
43
|
Adjust these values accordingly.
|
@@ -56,7 +56,7 @@ To remove orphaned files or directories on the remote host, add:
|
|
56
56
|
|
57
57
|
Default is `false`.
|
58
58
|
|
59
|
-
### Step 4b -
|
59
|
+
### Step 4b - GitHub Pages setup
|
60
60
|
|
61
61
|
Edit `config.rb`, and add:
|
62
62
|
|
@@ -69,7 +69,7 @@ github set up as `origin` and a working `gh-pages` branch already in place.
|
|
69
69
|
|
70
70
|
### Step 5
|
71
71
|
|
72
|
-
middleman build
|
72
|
+
middleman build [--clean]
|
73
73
|
middleman deploy
|
74
74
|
|
75
75
|
### NOTES
|
@@ -26,32 +26,69 @@ module Middleman
|
|
26
26
|
:aliases => "-c",
|
27
27
|
:desc => "Remove orphaned files or directories on the remote host"
|
28
28
|
def deploy
|
29
|
-
send("deploy_#{self.
|
29
|
+
send("deploy_#{self.deploy_options.method}")
|
30
30
|
end
|
31
31
|
|
32
32
|
protected
|
33
33
|
|
34
|
-
def
|
35
|
-
|
34
|
+
def print_usage_and_die(message)
|
35
|
+
raise Error, "ERROR: " + message + "\n" + <<EOF
|
36
|
+
|
37
|
+
You should follow one of the two examples below to setup the deploy
|
38
|
+
extension in config.rb.
|
39
|
+
|
40
|
+
# To copy the build directory to a remote host:
|
41
|
+
activate :deploy do |deploy|
|
42
|
+
deploy.method = :rsync
|
43
|
+
# host, user, and path *must* be set
|
44
|
+
deploy.user = "tvaughan"
|
45
|
+
deploy.host = "www.example.com"
|
46
|
+
deploy.path = "/srv/www/site"
|
47
|
+
# clean is optional (default is false).
|
48
|
+
deploy.clean = true
|
49
|
+
end
|
50
|
+
|
51
|
+
# To push to a remote gh-pages branch on GitHub:
|
52
|
+
activate :deploy do |deploy|
|
53
|
+
deploy.method = :git
|
54
|
+
end
|
55
|
+
EOF
|
36
56
|
end
|
37
57
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
58
|
+
def deploy_options
|
59
|
+
options = nil
|
60
|
+
|
61
|
+
begin
|
62
|
+
options = ::Middleman::Application.server.inst.options
|
63
|
+
rescue
|
64
|
+
print_usage_and_die "You need to activate the deploy extension in config.rb"
|
65
|
+
end
|
66
|
+
|
67
|
+
if (!options.method)
|
68
|
+
print_usage_and_die "The deploy extension requires you to set a method"
|
47
69
|
end
|
48
70
|
|
71
|
+
if (options.method == :rsync)
|
72
|
+
if (!options.host || !options.user || !options.path)
|
73
|
+
print_usage_and_die "The rsync deploy method requires host, user, and path to be set"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
options
|
78
|
+
end
|
79
|
+
|
80
|
+
def deploy_rsync
|
81
|
+
host = self.deploy_options.host
|
82
|
+
port = self.deploy_options.port
|
83
|
+
user = self.deploy_options.user
|
84
|
+
path = self.deploy_options.path
|
85
|
+
|
49
86
|
command = "rsync -avze '" + "ssh -p #{port}" + "' build/ #{user}@#{host}:#{path}"
|
50
87
|
|
51
88
|
if options.has_key? "clean"
|
52
89
|
clean = options.clean
|
53
90
|
else
|
54
|
-
clean =
|
91
|
+
clean = self.deploy_options.clean
|
55
92
|
end
|
56
93
|
|
57
94
|
if clean
|
@@ -62,7 +99,7 @@ module Middleman
|
|
62
99
|
end
|
63
100
|
|
64
101
|
def deploy_git
|
65
|
-
puts "## Deploying to
|
102
|
+
puts "## Deploying to GitHub Pages"
|
66
103
|
Dir.mktmpdir do |tmp|
|
67
104
|
# clone ./ with branch gh-pages to tmp
|
68
105
|
repo = Git.clone(ENV['MM_ROOT'], tmp)
|
@@ -5,7 +5,7 @@ require "middleman-core"
|
|
5
5
|
module Middleman
|
6
6
|
module Deploy
|
7
7
|
|
8
|
-
class Options < Struct.new(:method, :host, :port, :user, :path, :clean); end
|
8
|
+
class Options < Struct.new(:whatisthis, :method, :host, :port, :user, :path, :clean); end
|
9
9
|
|
10
10
|
class << self
|
11
11
|
|
@@ -17,33 +17,12 @@ module Middleman
|
|
17
17
|
options = Options.new(options_hash)
|
18
18
|
yield options if block_given?
|
19
19
|
|
20
|
-
options.method ||= :rsync
|
21
20
|
options.port ||= 22
|
22
21
|
options.clean ||= false
|
23
22
|
|
24
23
|
@@options = options
|
25
24
|
|
26
25
|
app.send :include, Helpers
|
27
|
-
|
28
|
-
app.after_configuration do
|
29
|
-
if (options.method == :rsync)
|
30
|
-
if (!options.host || !options.user || !options.path)
|
31
|
-
raise <<EOF
|
32
|
-
|
33
|
-
|
34
|
-
ERROR: middleman-deploy is not setup correctly. host, user, and path
|
35
|
-
*must* be set in config.rb. For example:
|
36
|
-
|
37
|
-
activate :deploy do |deploy|
|
38
|
-
deploy.user = "tvaughan"
|
39
|
-
deploy.host = "www.example.com"
|
40
|
-
deploy.path = "/srv/www/site"
|
41
|
-
end
|
42
|
-
|
43
|
-
EOF
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
26
|
end
|
48
27
|
|
49
28
|
alias :included :registered
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: middleman-core
|
17
|
-
requirement: &
|
17
|
+
requirement: &9045080 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *9045080
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: git
|
28
|
-
requirement: &
|
28
|
+
requirement: &9057240 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 1.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *9057240
|
37
37
|
description: Deploy a middleman built site over rsync or to github pages.
|
38
38
|
email:
|
39
39
|
- thomas.david.vaughan@gmail.com
|