middleman-deploy 0.0.1
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.
- data/.gitignore +1 -0
- data/COPYING +20 -0
- data/Gemfile +19 -0
- data/README.md +67 -0
- data/Rakefile +35 -0
- data/features/support/env.rb +4 -0
- data/lib/middleman-deploy.rb +8 -0
- data/lib/middleman-deploy/commands.rb +60 -0
- data/lib/middleman-deploy/extension.rb +57 -0
- data/lib/middleman-deploy/pkg-info.rb +6 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-deploy.gemspec +25 -0
- metadata +69 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
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,19 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in middleman-deploy.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem "rake", "~> 0.9.2"
|
10
|
+
gem "rdoc", "~> 3.9"
|
11
|
+
gem "yard", "~> 0.8.0"
|
12
|
+
end
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem "cucumber", "~> 1.2.0"
|
16
|
+
gem "fivemat"
|
17
|
+
gem "aruba", "~> 0.4.11"
|
18
|
+
gem "rspec", "~> 2.7"
|
19
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
Middleman Delpoy -- Deploy a [middleman](http://middlemanapp.com/) built site over rsync.
|
2
|
+
|
3
|
+
[](http://travis-ci.org/tvaughan/middleman-deploy)
|
4
|
+
|
5
|
+
===
|
6
|
+
|
7
|
+
## QUICK START
|
8
|
+
|
9
|
+
Be sure that `rsync` is installed.
|
10
|
+
|
11
|
+
### Step 1
|
12
|
+
|
13
|
+
gem install middleman-deploy
|
14
|
+
|
15
|
+
### Step 2
|
16
|
+
|
17
|
+
middleman init example-site
|
18
|
+
cd example-site
|
19
|
+
|
20
|
+
### Step 3
|
21
|
+
|
22
|
+
Edit `Gemfile`, and add:
|
23
|
+
|
24
|
+
gem "middleman-deploy"
|
25
|
+
|
26
|
+
Then run:
|
27
|
+
|
28
|
+
bundle install
|
29
|
+
|
30
|
+
### Step 4
|
31
|
+
|
32
|
+
#### These settings are required.
|
33
|
+
|
34
|
+
Edit `config.ru`, and add:
|
35
|
+
|
36
|
+
activate :deploy do |deploy|
|
37
|
+
deploy.user = "tvaughan"
|
38
|
+
deploy.host = "www.example.com"
|
39
|
+
deploy.path = "/srv/www/site"
|
40
|
+
end
|
41
|
+
|
42
|
+
Adjust these values accordingly.
|
43
|
+
|
44
|
+
### Step 4.1
|
45
|
+
|
46
|
+
#### These settings are optional.
|
47
|
+
|
48
|
+
To use a particular SSH port, add:
|
49
|
+
|
50
|
+
deploy.port = 5309
|
51
|
+
|
52
|
+
Default is `22`.
|
53
|
+
|
54
|
+
To pass the `--delete` option to rsync, add:
|
55
|
+
|
56
|
+
deploy.delete = true
|
57
|
+
|
58
|
+
Default is `false`.
|
59
|
+
|
60
|
+
### Step 5
|
61
|
+
|
62
|
+
middleman build
|
63
|
+
middleman deploy
|
64
|
+
|
65
|
+
### NOTES
|
66
|
+
|
67
|
+
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::Deploy::PACKAGE}"
|
17
|
+
VERSION = "#{Middleman::Deploy::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
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require "middleman-core/cli"
|
2
|
+
|
3
|
+
require "middleman-deploy/extension"
|
4
|
+
|
5
|
+
module Middleman
|
6
|
+
module Cli
|
7
|
+
|
8
|
+
# This class provides a "deploy" command for the middleman CLI.
|
9
|
+
class Deploy < Thor
|
10
|
+
include Thor::Actions
|
11
|
+
|
12
|
+
check_unknown_options!
|
13
|
+
|
14
|
+
namespace :deploy
|
15
|
+
|
16
|
+
# Tell Thor to exit with a nonzero exit code on failure
|
17
|
+
def self.exit_on_failure?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "deploy", "Deploy to a remote host over rsync"
|
22
|
+
method_option "clean",
|
23
|
+
:type => :boolean,
|
24
|
+
:aliases => "-c",
|
25
|
+
:desc => "Remove orphaned files or directories on the remote host"
|
26
|
+
def deploy
|
27
|
+
shared_inst = ::Middleman::Application.server.inst
|
28
|
+
|
29
|
+
host = shared_inst.options.host
|
30
|
+
port = shared_inst.options.port
|
31
|
+
user = shared_inst.options.user
|
32
|
+
path = shared_inst.options.path
|
33
|
+
|
34
|
+
# These only exists when the config.rb sets them!
|
35
|
+
if (!host || !user || !path)
|
36
|
+
raise Thor::Error.new "You need to activate the deploy extension in config.rb "
|
37
|
+
end
|
38
|
+
|
39
|
+
command = "rsync -avze '" + "ssh -p #{port}" + "' build/ #{user}@#{host}:#{path}"
|
40
|
+
|
41
|
+
if options.has_key? "clean"
|
42
|
+
clean = options.clean
|
43
|
+
else
|
44
|
+
clean = shared_inst.options.clean
|
45
|
+
end
|
46
|
+
|
47
|
+
if clean
|
48
|
+
command += "--delete"
|
49
|
+
end
|
50
|
+
|
51
|
+
run command
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
# Alias "d" to "deploy"
|
57
|
+
Base.map({ "d" => "deploy" })
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Require core library
|
2
|
+
require "middleman-core"
|
3
|
+
|
4
|
+
# Extension namespace
|
5
|
+
module Middleman
|
6
|
+
module Deploy
|
7
|
+
|
8
|
+
class Options < Struct.new(:host, :port, :user, :path, :clean); 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
|
+
|
23
|
+
@@options = options
|
24
|
+
|
25
|
+
app.send :include, Helpers
|
26
|
+
|
27
|
+
app.after_configuration do
|
28
|
+
if (!options.host || !options.user || !options.path)
|
29
|
+
raise <<EOF
|
30
|
+
|
31
|
+
|
32
|
+
ERROR: middleman-deploy is not setup correctly. host, user, and path
|
33
|
+
*must* be set in config.rb. For example:
|
34
|
+
|
35
|
+
activate :deploy do |deploy|
|
36
|
+
deploy.user = "tvaughan"
|
37
|
+
deploy.host = "www.example.com"
|
38
|
+
deploy.path = "/srv/www/site"
|
39
|
+
end
|
40
|
+
|
41
|
+
EOF
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
alias :included :registered
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
module Helpers
|
51
|
+
def options
|
52
|
+
::Middleman::Deploy.options
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "middleman-deploy"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "middleman-deploy/pkg-info"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = Middleman::Deploy::PACKAGE
|
7
|
+
s.version = Middleman::Deploy::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Tom Vaughan"]
|
10
|
+
s.email = ["thomas.david.vaughan@gmail.com"]
|
11
|
+
s.homepage = "http://flavors.me/tvaughan"
|
12
|
+
s.summary = %q{Deploy a middleman built site over rsync.}
|
13
|
+
s.description = %q{Deploy a middleman built site over rsync.}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
# The version of middleman-core your extension depends on
|
21
|
+
s.add_runtime_dependency("middleman-core", [">= 3.0.0"])
|
22
|
+
|
23
|
+
# Additional dependencies
|
24
|
+
# s.add_runtime_dependency("gem-name", "gem-version")
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-deploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tom Vaughan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: middleman-core
|
16
|
+
requirement: &11326800 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *11326800
|
25
|
+
description: Deploy a middleman built site over rsync.
|
26
|
+
email:
|
27
|
+
- thomas.david.vaughan@gmail.com
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- COPYING
|
34
|
+
- Gemfile
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- features/support/env.rb
|
38
|
+
- lib/middleman-deploy.rb
|
39
|
+
- lib/middleman-deploy/commands.rb
|
40
|
+
- lib/middleman-deploy/extension.rb
|
41
|
+
- lib/middleman-deploy/pkg-info.rb
|
42
|
+
- lib/middleman_extension.rb
|
43
|
+
- middleman-deploy.gemspec
|
44
|
+
homepage: http://flavors.me/tvaughan
|
45
|
+
licenses: []
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.8.11
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: Deploy a middleman built site over rsync.
|
68
|
+
test_files: []
|
69
|
+
has_rdoc:
|