middleman-deploy 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -0
- data/THANKS +4 -0
- data/lib/middleman-deploy/commands.rb +59 -1
- data/lib/middleman-deploy/extension.rb +7 -1
- data/lib/middleman-deploy/pkg-info.rb +1 -1
- data/middleman-deploy.gemspec +4 -3
- metadata +34 -8
data/README.md
CHANGED
@@ -95,11 +95,37 @@ To use a particular branch, add:
|
|
95
95
|
Default is `gh-pages`. Run `git branch -a` to see a list of possible
|
96
96
|
branches.
|
97
97
|
|
98
|
+
### Step 4c - FTP setup
|
99
|
+
|
100
|
+
#### These settings are required.
|
101
|
+
|
102
|
+
Edit `config.rb`, and add:
|
103
|
+
|
104
|
+
activate :deploy do |deploy|
|
105
|
+
deploy.method = :ftp
|
106
|
+
deploy.host = "ftp.example.com"
|
107
|
+
deploy.user = "tvaughan"
|
108
|
+
deploy.password = "secret"
|
109
|
+
deploy.path = "/srv/www/site"
|
110
|
+
end
|
111
|
+
|
112
|
+
Adjust these values accordingly.
|
113
|
+
|
98
114
|
### Step 5
|
99
115
|
|
100
116
|
middleman build [--clean]
|
101
117
|
middleman deploy [--clean]
|
102
118
|
|
119
|
+
To automatically run middleman-deploy after `middleman build`, add:
|
120
|
+
|
121
|
+
deploy.after_build = true
|
122
|
+
|
123
|
+
Default is `false`.
|
124
|
+
|
125
|
+
Please note that if the `--clean` or `--no-clean` option is passed to
|
126
|
+
`middleman build` it will not be passed to `middleman deploy`. For now
|
127
|
+
only the value of `deploy.clean` in `config.rb` will be used.
|
128
|
+
|
103
129
|
### NOTES
|
104
130
|
|
105
131
|
Inspired by the rsync task in [Octopress](https://github.com/imathis/octopress).
|
data/THANKS
ADDED
@@ -38,7 +38,7 @@ module Middleman
|
|
38
38
|
def print_usage_and_die(message)
|
39
39
|
raise Error, "ERROR: " + message + "\n" + <<EOF
|
40
40
|
|
41
|
-
You should follow one of the
|
41
|
+
You should follow one of the three examples below to setup the deploy
|
42
42
|
extension in config.rb.
|
43
43
|
|
44
44
|
# To deploy the build directory to a remote host via rsync:
|
@@ -62,6 +62,16 @@ activate :deploy do |deploy|
|
|
62
62
|
# run `git branch -a` to see a list of possible branches
|
63
63
|
deploy.branch = "some-other-branch-name"
|
64
64
|
end
|
65
|
+
|
66
|
+
# To deploy the build directory to a remote host via ftp:
|
67
|
+
activate :deploy do |deploy|
|
68
|
+
deploy.method = :ftp
|
69
|
+
# host, user, passwword and path *must* be set
|
70
|
+
deploy.host = "ftp.example.com"
|
71
|
+
deploy.user = "tvaughan"
|
72
|
+
deploy.password = "secret"
|
73
|
+
deploy.path = "/srv/www/site"
|
74
|
+
end
|
65
75
|
EOF
|
66
76
|
end
|
67
77
|
|
@@ -140,6 +150,54 @@ EOF
|
|
140
150
|
orig.remote(remote).fetch
|
141
151
|
end
|
142
152
|
|
153
|
+
def deploy_ftp
|
154
|
+
require 'net/ftp'
|
155
|
+
require 'ptools'
|
156
|
+
|
157
|
+
host = self.deploy_options.host
|
158
|
+
user = self.deploy_options.user
|
159
|
+
pass = self.deploy_options.password
|
160
|
+
path = self.deploy_options.path
|
161
|
+
|
162
|
+
puts "## Deploying via ftp to #{user}@#{host}:#{path}"
|
163
|
+
|
164
|
+
ftp = Net::FTP.new(host)
|
165
|
+
ftp.login(user, pass)
|
166
|
+
ftp.chdir(path)
|
167
|
+
ftp.passive = true
|
168
|
+
|
169
|
+
Dir.chdir('build/') do
|
170
|
+
Dir['**/*'].each do |f|
|
171
|
+
if File.directory?(f)
|
172
|
+
begin
|
173
|
+
ftp.mkdir(f)
|
174
|
+
rescue
|
175
|
+
puts "Folder '#{f}' exists. skipping..."
|
176
|
+
end
|
177
|
+
else
|
178
|
+
begin
|
179
|
+
if File.binary?(f)
|
180
|
+
ftp.putbinaryfile(f, f)
|
181
|
+
else
|
182
|
+
ftp.puttextfile(f, f)
|
183
|
+
end
|
184
|
+
rescue Exception => e
|
185
|
+
reply = e.message
|
186
|
+
err_code = reply[0,3].to_i
|
187
|
+
if err_code == 550
|
188
|
+
if File.binary?(f)
|
189
|
+
ftp.putbinaryfile(f, f)
|
190
|
+
else
|
191
|
+
ftp.puttextfile(f, f)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
ftp.close
|
199
|
+
end
|
200
|
+
|
143
201
|
end
|
144
202
|
|
145
203
|
# Alias "d" to "deploy"
|
@@ -5,7 +5,7 @@ require "middleman-core"
|
|
5
5
|
module Middleman
|
6
6
|
module Deploy
|
7
7
|
|
8
|
-
class Options < Struct.new(:whatisthis, :method, :host, :port, :user, :path, :clean, :remote, :branch); end
|
8
|
+
class Options < Struct.new(:whatisthis, :method, :host, :port, :user, :password, :path, :clean, :remote, :branch, :after_build); end
|
9
9
|
|
10
10
|
class << self
|
11
11
|
|
@@ -22,6 +22,12 @@ module Middleman
|
|
22
22
|
options.remote ||= "origin"
|
23
23
|
options.branch ||= "gh-pages"
|
24
24
|
|
25
|
+
options.after_build ||= false
|
26
|
+
|
27
|
+
app.after_build do |builder|
|
28
|
+
::Middleman::Cli::Deploy.new.deploy if options.after_build
|
29
|
+
end
|
30
|
+
|
25
31
|
@@options = options
|
26
32
|
|
27
33
|
app.send :include, Helpers
|
data/middleman-deploy.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = Middleman::Deploy::PACKAGE
|
7
7
|
s.version = Middleman::Deploy::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Tom Vaughan"
|
9
|
+
s.authors = ["Tom Vaughan"]
|
10
10
|
s.email = ["thomas.david.vaughan@gmail.com"]
|
11
11
|
s.homepage = "http://tvaughan.github.com/middleman-deploy/"
|
12
12
|
s.summary = %q{Deploy a middleman built site over rsync or via git (e.g. gh-pages on github).}
|
@@ -16,10 +16,11 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
|
-
|
19
|
+
|
20
20
|
# The version of middleman-core your extension depends on
|
21
21
|
s.add_runtime_dependency("middleman-core", [">= 3.0.0"])
|
22
|
-
|
22
|
+
|
23
23
|
# Additional dependencies
|
24
24
|
s.add_runtime_dependency("git", "~> 1.2.0")
|
25
|
+
s.add_runtime_dependency("ptools")
|
25
26
|
end
|
metadata
CHANGED
@@ -1,20 +1,19 @@
|
|
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.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tom Vaughan
|
9
|
-
- Ben Cates
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2012-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: middleman-core
|
17
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
@@ -22,10 +21,15 @@ dependencies:
|
|
22
21
|
version: 3.0.0
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
26
30
|
- !ruby/object:Gem::Dependency
|
27
31
|
name: git
|
28
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
29
33
|
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
@@ -33,7 +37,28 @@ dependencies:
|
|
33
37
|
version: 1.2.0
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.2.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: ptools
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
37
62
|
description: Deploy a middleman built site over rsync or via git (e.g. gh-pages on
|
38
63
|
github).
|
39
64
|
email:
|
@@ -47,6 +72,7 @@ files:
|
|
47
72
|
- Gemfile
|
48
73
|
- README.md
|
49
74
|
- Rakefile
|
75
|
+
- THANKS
|
50
76
|
- features/support/env.rb
|
51
77
|
- lib/middleman-deploy.rb
|
52
78
|
- lib/middleman-deploy/commands.rb
|
@@ -74,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
100
|
version: '0'
|
75
101
|
requirements: []
|
76
102
|
rubyforge_project:
|
77
|
-
rubygems_version: 1.8.
|
103
|
+
rubygems_version: 1.8.23
|
78
104
|
signing_key:
|
79
105
|
specification_version: 3
|
80
106
|
summary: Deploy a middleman built site over rsync or via git (e.g. gh-pages on github).
|