middleman-deploy-with-notifications 0.0.30
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.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/COPYING +20 -0
- data/Gemfile +18 -0
- data/README.md +122 -0
- data/Rakefile +35 -0
- data/THANKS +4 -0
- data/features/support/env.rb +6 -0
- data/lib/middleman-deploy-with-notifications.rb +9 -0
- data/lib/middleman-deploy-with-notifications/commands.rb +283 -0
- data/lib/middleman-deploy-with-notifications/extension.rb +47 -0
- data/lib/middleman-deploy-with-notifications/pkg-info.rb +6 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-deploy-with-notifications.gemspec +29 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6bb21ad698e22b91a8b1930291fe5d88f5fd5607
|
4
|
+
data.tar.gz: 1742203e9541ac3f9db5506b5e47687962ed511a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 68d7a9d039a590179b9bf0d81ff860f9ac171045efcf2fd9fa46ddfdb35b28a5816d304e05d086bcbb6d6391af5122661464d61c38d219422e4050469b54ad1c
|
7
|
+
data.tar.gz: aafc196453206172c4156284ccde8f95e0fdc97dd64c18cbeb4af05da421906ed62fb99f40a36dfa202f9a721934393e547661128f6cf40b7e098b12dd40de57
|
data/.gitignore
ADDED
data/COPYING
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Tom Vaughan <thomas.david.vaughan@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included
|
12
|
+
in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in middleman-deploy.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem "rake", "~> 0.9.2"
|
8
|
+
gem "rdoc", "~> 3.9"
|
9
|
+
gem "yard", "~> 0.8.0"
|
10
|
+
end
|
11
|
+
|
12
|
+
group :test do
|
13
|
+
gem "cucumber", "~> 1.2.0"
|
14
|
+
gem "fivemat"
|
15
|
+
gem "aruba", "~> 0.4.11"
|
16
|
+
gem "rspec", "~> 2.7"
|
17
|
+
gem "simplecov"
|
18
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
Middleman Deploy - Deploy a [middleman](http://middlemanapp.com/) built site over rsync, git (e.g. gh-pages on github) or via ftp.
|
2
|
+
|
3
|
+
[](http://travis-ci.org/tvaughan/middleman-deploy)
|
4
|
+
|
5
|
+
===
|
6
|
+
|
7
|
+
## QUICK START
|
8
|
+
|
9
|
+
### Step 1
|
10
|
+
|
11
|
+
gem install middleman-deploy
|
12
|
+
|
13
|
+
### Step 2
|
14
|
+
|
15
|
+
middleman init example-site
|
16
|
+
cd example-site
|
17
|
+
|
18
|
+
### Step 3
|
19
|
+
|
20
|
+
Edit `Gemfile`, and add:
|
21
|
+
|
22
|
+
gem "middleman-deploy", "~> 0.0.11"
|
23
|
+
|
24
|
+
Then run:
|
25
|
+
|
26
|
+
bundle install
|
27
|
+
|
28
|
+
### Step 4a - Rsync setup
|
29
|
+
|
30
|
+
First be sure that `rsync` is installed.
|
31
|
+
|
32
|
+
#### These settings are required.
|
33
|
+
|
34
|
+
Edit `config.rb`, and add:
|
35
|
+
|
36
|
+
activate :deploy do |deploy|
|
37
|
+
deploy.method = :rsync
|
38
|
+
deploy.user = "tvaughan"
|
39
|
+
deploy.host = "www.example.com"
|
40
|
+
deploy.path = "/srv/www/site"
|
41
|
+
end
|
42
|
+
|
43
|
+
Adjust these values accordingly.
|
44
|
+
|
45
|
+
#### These settings are optional.
|
46
|
+
|
47
|
+
To use a particular SSH port, add:
|
48
|
+
|
49
|
+
deploy.port = 5309
|
50
|
+
|
51
|
+
Default is `22`.
|
52
|
+
|
53
|
+
To remove orphaned files or directories on the remote host, add:
|
54
|
+
|
55
|
+
deploy.clean = true
|
56
|
+
|
57
|
+
Default is `false`.
|
58
|
+
|
59
|
+
### Step 4b - Git setup
|
60
|
+
|
61
|
+
Edit `config.rb`, and add:
|
62
|
+
|
63
|
+
activate :deploy do |deploy|
|
64
|
+
deploy.method = :git
|
65
|
+
end
|
66
|
+
|
67
|
+
By default this will deploy to the `gh-pages` branch on the `origin`
|
68
|
+
remote. The `build` directory will become a git repo.
|
69
|
+
|
70
|
+
#### These settings are optional.
|
71
|
+
|
72
|
+
To use a particular remote, add:
|
73
|
+
|
74
|
+
deploy.remote = "some-other-remote-name"
|
75
|
+
|
76
|
+
Default is `origin`. This can be a remote name or a git url.
|
77
|
+
|
78
|
+
If you use a remote name, you must first add it using `git remote
|
79
|
+
add`. Run `git remote -v` to see a list of possible remote names. If
|
80
|
+
you use a git url, it must end with '.git'.
|
81
|
+
|
82
|
+
To use a particular branch, add:
|
83
|
+
|
84
|
+
deploy.branch = "some-other-branch-name"
|
85
|
+
|
86
|
+
Default is `gh-pages`. This branch will be created on the remote if it
|
87
|
+
doesn't already exist.
|
88
|
+
|
89
|
+
### Step 4c - FTP setup
|
90
|
+
|
91
|
+
#### These settings are required.
|
92
|
+
|
93
|
+
Edit `config.rb`, and add:
|
94
|
+
|
95
|
+
activate :deploy do |deploy|
|
96
|
+
deploy.method = :ftp
|
97
|
+
deploy.host = "ftp.example.com"
|
98
|
+
deploy.user = "tvaughan"
|
99
|
+
deploy.password = "secret"
|
100
|
+
deploy.path = "/srv/www/site"
|
101
|
+
end
|
102
|
+
|
103
|
+
Adjust these values accordingly.
|
104
|
+
|
105
|
+
### Step 5
|
106
|
+
|
107
|
+
middleman build [--clean]
|
108
|
+
middleman deploy [--clean]
|
109
|
+
|
110
|
+
To automatically run middleman-deploy after `middleman build`, add:
|
111
|
+
|
112
|
+
deploy.after_build = true
|
113
|
+
|
114
|
+
Default is `false`.
|
115
|
+
|
116
|
+
Please note that if the `--clean` or `--no-clean` option is passed to
|
117
|
+
`middleman build` it will not be passed to `middleman deploy`. For now
|
118
|
+
only the value of `deploy.clean` in `config.rb` will be used.
|
119
|
+
|
120
|
+
### NOTES
|
121
|
+
|
122
|
+
Inspired by the rsync task in [Octopress](https://github.com/imathis/octopress).
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'cucumber/rake/task'
|
5
|
+
|
6
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
7
|
+
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rake/clean'
|
11
|
+
|
12
|
+
task :test => ["cucumber"]
|
13
|
+
|
14
|
+
require "middleman-deploy/pkg-info"
|
15
|
+
|
16
|
+
PACKAGE = "#{Middleman::DeployWithNotifications::PACKAGE}"
|
17
|
+
VERSION = "#{Middleman::DeployWithNotifications::VERSION}"
|
18
|
+
|
19
|
+
task :package do
|
20
|
+
system "gem build #{PACKAGE}.gemspec"
|
21
|
+
end
|
22
|
+
|
23
|
+
task :install => :package do
|
24
|
+
Dir.chdir("pkg") do
|
25
|
+
system "gem install #{PACKAGE}-#{VERSION}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
task :release => :package do
|
30
|
+
Dir.chdir("pkg") do
|
31
|
+
system "gem push #{PACKAGE}-#{VERSION}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
data/THANKS
ADDED
@@ -0,0 +1,283 @@
|
|
1
|
+
require "middleman-core/cli"
|
2
|
+
|
3
|
+
require "middleman-deploy-with-notifications/extension"
|
4
|
+
require "middleman-deploy-with-notifications/pkg-info"
|
5
|
+
|
6
|
+
# for hipchat notifications
|
7
|
+
require "net/http"
|
8
|
+
require "uri"
|
9
|
+
|
10
|
+
PACKAGE = "#{Middleman::DeployWithNotifications::PACKAGE}"
|
11
|
+
VERSION = "#{Middleman::DeployWithNotifications::VERSION}"
|
12
|
+
|
13
|
+
module Middleman
|
14
|
+
module Cli
|
15
|
+
|
16
|
+
# This class provides a "deploy" command for the middleman CLI.
|
17
|
+
class DeployWithNotifications < Thor
|
18
|
+
include Thor::Actions
|
19
|
+
|
20
|
+
check_unknown_options!
|
21
|
+
|
22
|
+
namespace :deploy
|
23
|
+
|
24
|
+
# Tell Thor to exit with a nonzero exit code on failure
|
25
|
+
def self.exit_on_failure?
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "deploy", "Deploy build directory to a remote host via rsync or git"
|
30
|
+
method_option "clean",
|
31
|
+
:type => :boolean,
|
32
|
+
:aliases => "-c",
|
33
|
+
:desc => "Remove orphaned files or directories on the remote host"
|
34
|
+
def deploy
|
35
|
+
send("deploy_#{self.deploy_options.method}")
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def print_usage_and_die(message)
|
41
|
+
raise Error, "ERROR: " + message + "\n" + <<EOF
|
42
|
+
|
43
|
+
You should follow one of the three examples below to setup the deploy
|
44
|
+
extension in config.rb.
|
45
|
+
|
46
|
+
# To deploy the build directory to a remote host via rsync:
|
47
|
+
activate :deploy do |deploy|
|
48
|
+
deploy.method = :rsync
|
49
|
+
# host, user, and path *must* be set
|
50
|
+
deploy.user = "tvaughan"
|
51
|
+
deploy.host = "www.example.com"
|
52
|
+
deploy.path = "/srv/www/site"
|
53
|
+
# clean is optional (default is false)
|
54
|
+
deploy.clean = true
|
55
|
+
end
|
56
|
+
|
57
|
+
# To deploy to a remote branch via git (e.g. gh-pages on github):
|
58
|
+
activate :deploy do |deploy|
|
59
|
+
deploy.method = :git
|
60
|
+
# remote is optional (default is "origin")
|
61
|
+
# run `git remote -v` to see a list of possible remotes
|
62
|
+
deploy.remote = "some-other-remote-name"
|
63
|
+
# branch is optional (default is "gh-pages")
|
64
|
+
# run `git branch -a` to see a list of possible branches
|
65
|
+
deploy.branch = "some-other-branch-name"
|
66
|
+
end
|
67
|
+
|
68
|
+
# To deploy the build directory to a remote host via ftp:
|
69
|
+
activate :deploy do |deploy|
|
70
|
+
deploy.method = :ftp
|
71
|
+
# host, user, passwword and path *must* be set
|
72
|
+
deploy.host = "ftp.example.com"
|
73
|
+
deploy.user = "tvaughan"
|
74
|
+
deploy.password = "secret"
|
75
|
+
deploy.path = "/srv/www/site"
|
76
|
+
end
|
77
|
+
EOF
|
78
|
+
end
|
79
|
+
|
80
|
+
def deploy_options
|
81
|
+
options = nil
|
82
|
+
|
83
|
+
begin
|
84
|
+
options = ::Middleman::Application.server.inst.options
|
85
|
+
rescue
|
86
|
+
print_usage_and_die "You need to activate the deploy extension in config.rb."
|
87
|
+
end
|
88
|
+
|
89
|
+
if (!options.method)
|
90
|
+
print_usage_and_die "The deploy extension requires you to set a method."
|
91
|
+
end
|
92
|
+
|
93
|
+
if (options.method == :rsync)
|
94
|
+
if (!options.host || !options.user || !options.path)
|
95
|
+
print_usage_and_die "The rsync deploy method requires host, user, and path to be set."
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if (options.method == :ftp)
|
100
|
+
if (!options.host || !options.user || !options.password || !options.path)
|
101
|
+
print_usage_and_die "The ftp deploy method requires host, user, password, and path to be set."
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
options
|
106
|
+
end
|
107
|
+
|
108
|
+
def send_hc_mesg(mesg, fmt = "text")
|
109
|
+
uri = uri || URI.parse( "http://api.hipchat.com/v1/rooms/message" )
|
110
|
+
hipchat_token = "66975dc754b5e7a0800e627708d61a"
|
111
|
+
hipchat_rooms = [26057,39979] # Engineering + BAP hc rooms
|
112
|
+
|
113
|
+
hipchat_rooms.each do |room|
|
114
|
+
Net::HTTP.post_form( uri, {
|
115
|
+
"format" => "json",
|
116
|
+
"color" => "random",
|
117
|
+
"auth_token" => hipchat_token,
|
118
|
+
"room_id" => room,
|
119
|
+
"from" => "280 Deploy",
|
120
|
+
"message" => mesg,
|
121
|
+
"message_format" => fmt || "text"}
|
122
|
+
)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def hipchat_start(who, github_project)
|
127
|
+
send_hc_mesg( "Yo yo! @#{who} is deploying #{github_project}:" )
|
128
|
+
end
|
129
|
+
|
130
|
+
def hipchat_complete(who, github_project, github_user, rev, comment)
|
131
|
+
puts "Notifying hipchat room(s)".yellow
|
132
|
+
|
133
|
+
message = "<a href='http://github.com/#{github_user}/#{github_project}/commit/#{rev}'>#{rev}</a> (#{comment}) is now live on <b><a href='http://#{github_project}'>production</a></b>."
|
134
|
+
send_hc_mesg(message, "html")
|
135
|
+
end
|
136
|
+
|
137
|
+
remove_task :send_hc_mesg, :hipchat_start, :hipchat_complete
|
138
|
+
|
139
|
+
def deploy_rsync
|
140
|
+
host = self.deploy_options.host
|
141
|
+
port = self.deploy_options.port
|
142
|
+
user = self.deploy_options.user
|
143
|
+
path = self.deploy_options.path
|
144
|
+
|
145
|
+
airbrake_api_key = self.deploy_options.airbrake_api_key
|
146
|
+
hipchat_rooms = self.deploy_options.hipchat_rooms
|
147
|
+
hipchat_token = self.deploy_options.hipchat_token
|
148
|
+
|
149
|
+
github_user, github_project = `git remote -v | grep "/" | head -n1`.gsub( /.*:([\w_-]+)\/([\w_\.-]+).git.*/, '\1/\2' ).split( "/" )
|
150
|
+
github_project.chomp!
|
151
|
+
|
152
|
+
who = `git config --get github.user`.chomp
|
153
|
+
rev = `git rev-parse --short HEAD`.gsub( /\s*$/, '' ).chomp
|
154
|
+
branch = `git rev-parse --abbrev-ref HEAD`.gsub( /\s*/, '' ).chomp
|
155
|
+
comment = `git log -1 --pretty=%B`.gsub( /\s*$/, '' ).chomp
|
156
|
+
|
157
|
+
if self.deploy_options.airbrake_api_key
|
158
|
+
puts "Recording a timestamped deploy in Airbrake: #{rev}".green
|
159
|
+
url = "api_key=#{airbrake_api_key}&deploy[rails_env]=production&deploy[local_username]=#{who}&deploy[scm_repository]=git://github.com/140proof/280.140proof.com&deploy[scm_revision]=#{rev}"
|
160
|
+
`curl -d "#{url}" http://airbrake.io/deploys &> /dev/null`
|
161
|
+
end
|
162
|
+
|
163
|
+
hipchat_start(who, github_project)
|
164
|
+
|
165
|
+
puts "Deploying via rsync to #{user}@#{host}".red
|
166
|
+
|
167
|
+
command = "rsync -avze '" + "ssh -p #{port}" + "' build/ #{user}@#{host}:#{path}"
|
168
|
+
|
169
|
+
if options.has_key? "clean"
|
170
|
+
clean = options.clean
|
171
|
+
else
|
172
|
+
clean = self.deploy_options.clean
|
173
|
+
end
|
174
|
+
|
175
|
+
if clean
|
176
|
+
command += " --delete"
|
177
|
+
end
|
178
|
+
|
179
|
+
run command
|
180
|
+
|
181
|
+
hipchat_complete(who, github_project, github_user, rev, comment)
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
def deploy_git
|
186
|
+
remote = self.deploy_options.remote
|
187
|
+
branch = self.deploy_options.branch
|
188
|
+
|
189
|
+
puts "## Deploying via git to remote=\"#{remote}\" and branch=\"#{branch}\""
|
190
|
+
|
191
|
+
#check if remote is not a git url
|
192
|
+
unless remote =~ /\.git$/
|
193
|
+
remote = `git config --get remote.#{remote}.url`.chop
|
194
|
+
end
|
195
|
+
|
196
|
+
#if the remote name doesn't exist in the main repo
|
197
|
+
if remote == ''
|
198
|
+
puts "Can't deploy! Please add a remote with the name '#{self.deploy_options.remote}' to your repo."
|
199
|
+
exit
|
200
|
+
end
|
201
|
+
|
202
|
+
Dir.chdir('build') do
|
203
|
+
unless File.exists?('.git')
|
204
|
+
`git init`
|
205
|
+
`git remote add origin #{remote}`
|
206
|
+
else
|
207
|
+
#check if the remote repo has changed
|
208
|
+
unless remote == `git config --get remote.origin.url`.chop
|
209
|
+
`git remote rm origin`
|
210
|
+
`git remote add origin #{remote}`
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
#if there is a branch with that name, switch to it, otherwise create a new one and switch to it
|
215
|
+
if `git branch`.split("\n").delete_if{ |r| r =~ Regexp.new(branch,true) }.count == 0
|
216
|
+
`git checkout #{branch}`
|
217
|
+
else
|
218
|
+
`git checkout -b #{branch}`
|
219
|
+
end
|
220
|
+
|
221
|
+
`git add -A`
|
222
|
+
`git commit --allow-empty -am 'Automated commit at #{Time.now.utc} by #{PACKAGE} #{VERSION}'`
|
223
|
+
`git push -f origin #{branch}`
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def deploy_ftp
|
228
|
+
require 'net/ftp'
|
229
|
+
require 'ptools'
|
230
|
+
|
231
|
+
host = self.deploy_options.host
|
232
|
+
user = self.deploy_options.user
|
233
|
+
pass = self.deploy_options.password
|
234
|
+
path = self.deploy_options.path
|
235
|
+
|
236
|
+
puts "## Deploying via ftp to #{user}@#{host}:#{path}"
|
237
|
+
|
238
|
+
ftp = Net::FTP.new(host)
|
239
|
+
ftp.login(user, pass)
|
240
|
+
ftp.chdir(path)
|
241
|
+
ftp.passive = true
|
242
|
+
|
243
|
+
Dir.chdir('build/') do
|
244
|
+
files = Dir.glob('**/*', File::FNM_DOTMATCH)
|
245
|
+
files.reject { |a| a =~ Regexp.new('\.$') }.each do |f|
|
246
|
+
if File.directory?(f)
|
247
|
+
begin
|
248
|
+
ftp.mkdir(f)
|
249
|
+
puts "Created directory #{f}"
|
250
|
+
rescue
|
251
|
+
end
|
252
|
+
else
|
253
|
+
begin
|
254
|
+
if File.binary?(f)
|
255
|
+
ftp.putbinaryfile(f, f)
|
256
|
+
else
|
257
|
+
ftp.puttextfile(f, f)
|
258
|
+
end
|
259
|
+
rescue Exception => e
|
260
|
+
reply = e.message
|
261
|
+
err_code = reply[0,3].to_i
|
262
|
+
if err_code == 550
|
263
|
+
if File.binary?(f)
|
264
|
+
ftp.putbinaryfile(f, f)
|
265
|
+
else
|
266
|
+
ftp.puttextfile(f, f)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
puts "Copied #{f}"
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
ftp.close
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|
278
|
+
|
279
|
+
# Alias "d" to "deploy"
|
280
|
+
Base.map({ "d" => "deploy" })
|
281
|
+
|
282
|
+
end
|
283
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Require core library
|
2
|
+
require "middleman-core"
|
3
|
+
|
4
|
+
# Extension namespace
|
5
|
+
module Middleman
|
6
|
+
module DeployWithNotifications
|
7
|
+
|
8
|
+
class Options < Struct.new(:whatisthis, :method, :host, :port, :user, :password, :path, :clean, :remote, :branch, :after_build, :airbrake_api_key, :hipchat_rooms, :hipchat_token); end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
def options
|
13
|
+
@@options
|
14
|
+
end
|
15
|
+
|
16
|
+
def registered(app, options_hash={}, &block)
|
17
|
+
options = Options.new(options_hash)
|
18
|
+
yield options if block_given?
|
19
|
+
|
20
|
+
options.port ||= 22
|
21
|
+
options.clean ||= false
|
22
|
+
options.remote ||= "origin"
|
23
|
+
options.branch ||= "gh-pages"
|
24
|
+
|
25
|
+
options.after_build ||= false
|
26
|
+
|
27
|
+
app.after_build do |builder|
|
28
|
+
::Middleman::Cli::DeployWithNotifications.new.deploy if options.after_build
|
29
|
+
end
|
30
|
+
|
31
|
+
@@options = options
|
32
|
+
|
33
|
+
app.send :include, Helpers
|
34
|
+
end
|
35
|
+
|
36
|
+
alias :included :registered
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
module Helpers
|
41
|
+
def options
|
42
|
+
::Middleman::DeployWithNotifications.options
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "middleman-deploy-with-extensions"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "middleman-deploy-with-notifications/pkg-info"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = Middleman::DeployWithNotifications::PACKAGE
|
7
|
+
s.version = Middleman::DeployWithNotifications::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["John Manoogian III", "Tom Vaughan"]
|
10
|
+
s.email = ["jm3+gems@140proof.com"]
|
11
|
+
s.license = "MIT"
|
12
|
+
s.homepage = "http://github.com/jm3/middleman-deploy/"
|
13
|
+
s.summary = %q{Deploy a middleman built site over rsync or via git (e.g. gh-pages on github).}
|
14
|
+
s.description = %q{Deploy a middleman-built site over rsync or via git with airbrake + hipchat notifications.}
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# The version of middleman-core your extension depends on
|
22
|
+
s.add_runtime_dependency("middleman-core", [">= 3.0.0"])
|
23
|
+
|
24
|
+
# Additional dependencies
|
25
|
+
s.add_runtime_dependency("airbrake")
|
26
|
+
s.add_runtime_dependency("colorize")
|
27
|
+
s.add_runtime_dependency("hipchat")
|
28
|
+
s.add_runtime_dependency("ptools")
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-deploy-with-notifications
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.30
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Manoogian III
|
8
|
+
- Tom Vaughan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: middleman-core
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 3.0.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 3.0.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: airbrake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: colorize
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: hipchat
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: ptools
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
description: Deploy a middleman-built site over rsync or via git with airbrake + hipchat
|
85
|
+
notifications.
|
86
|
+
email:
|
87
|
+
- jm3+gems@140proof.com
|
88
|
+
executables: []
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- .gitignore
|
93
|
+
- COPYING
|
94
|
+
- Gemfile
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- THANKS
|
98
|
+
- features/support/env.rb
|
99
|
+
- lib/middleman-deploy-with-notifications.rb
|
100
|
+
- lib/middleman-deploy-with-notifications/commands.rb
|
101
|
+
- lib/middleman-deploy-with-notifications/extension.rb
|
102
|
+
- lib/middleman-deploy-with-notifications/pkg-info.rb
|
103
|
+
- lib/middleman_extension.rb
|
104
|
+
- middleman-deploy-with-notifications.gemspec
|
105
|
+
homepage: http://github.com/jm3/middleman-deploy/
|
106
|
+
licenses:
|
107
|
+
- MIT
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.0.3
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Deploy a middleman built site over rsync or via git (e.g. gh-pages on github).
|
129
|
+
test_files:
|
130
|
+
- features/support/env.rb
|