middleman-rsync 0.1.0
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 +9 -0
- data/Gemfile +18 -0
- data/LICENSE +21 -0
- data/README.md +42 -0
- data/Rakefile +14 -0
- data/features/support/env.rb +4 -0
- data/lib/middleman-rsync.rb +7 -0
- data/lib/middleman-rsync/commands.rb +55 -0
- data/lib/middleman-rsync/extension.rb +17 -0
- data/middleman-rsync.gemspec +20 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0956901bb5a9162282ddec6f5025e496131b6142
|
4
|
+
data.tar.gz: e6d7ad4bdbd81725dd8cf98c28085590210ce091
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a83671b919d0fa61880a93514b4e52ee261d25c65769c9ee513d7cae769ae086cb843320d640ac2f6ae504868ff8df376a7d74bdea69840be28065d169799bd3
|
7
|
+
data.tar.gz: bc2f4774990785ad91b0ec6f73bf67ffb930666512c1dfd1620e2f91c087a8fb68e0531c4b621f933ce60fa4db3a0b89800399c1c7dccc6b528092309de77bc4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# If you do not have OpenSSL installed, update
|
2
|
+
# the following line to use "http://" instead
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in middleman-rsync.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rdoc'
|
11
|
+
gem 'yard'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem 'cucumber'
|
16
|
+
gem 'aruba'
|
17
|
+
gem 'rspec'
|
18
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Andrew Buntine, David Cristofaro
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# middleman-rsync
|
2
|
+
|
3
|
+
Deploy middleman sites via rsync.
|
4
|
+
|
5
|
+
The site is built locally and then the `./build` directory is transported to the server via rsync.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add it to your Gemfile:
|
10
|
+
```ruby
|
11
|
+
gem "middleman-rsync"
|
12
|
+
```
|
13
|
+
|
14
|
+
Bundle:
|
15
|
+
```
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Configure your environments in `config.rb`:
|
20
|
+
```ruby
|
21
|
+
activate :rsync do |rsync|
|
22
|
+
rsync.production_server = "myapp.com"
|
23
|
+
rsync.staging_server = "staging.myapp.com"
|
24
|
+
rsync.path = "/path/to/middleman/app/on/servers"
|
25
|
+
rsync.user = "rsync_user"
|
26
|
+
|
27
|
+
# Optional:
|
28
|
+
rsync.rsync_flags, "--compress --archive --delete -v"
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
Production:
|
35
|
+
```
|
36
|
+
$ middleman rsync production
|
37
|
+
```
|
38
|
+
|
39
|
+
Staging (optional):
|
40
|
+
```
|
41
|
+
$ middleman rsync staging
|
42
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
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'
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rake/clean'
|
11
|
+
|
12
|
+
task test: ['cucumber']
|
13
|
+
|
14
|
+
task default: :test
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "middleman-core/cli"
|
2
|
+
|
3
|
+
module Middleman
|
4
|
+
module Cli
|
5
|
+
class Rsync < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
check_unknown_options!
|
9
|
+
|
10
|
+
argument :environment, type: :string
|
11
|
+
|
12
|
+
class_option "build",
|
13
|
+
type: :boolean,
|
14
|
+
aliases: "-B",
|
15
|
+
default: true,
|
16
|
+
desc: "Build locally before deployment (default true)"
|
17
|
+
|
18
|
+
# Tell Thor to exit with a non-zero exit code on failure
|
19
|
+
def self.exit_on_failure?
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def rsync
|
24
|
+
unless environment == "staging" || environment == "production"
|
25
|
+
raise Thor::Error, "Unknown environment '#{environment}'. Use 'staging' or 'production'."
|
26
|
+
end
|
27
|
+
|
28
|
+
app = ::Middleman::Application.new
|
29
|
+
config = app.extensions[:rsync].options
|
30
|
+
server = config["#{environment}_server".to_sym]
|
31
|
+
|
32
|
+
if options[:build]
|
33
|
+
puts "Building locally..."
|
34
|
+
run("middleman build") || exit(1)
|
35
|
+
end
|
36
|
+
|
37
|
+
puts "\nReady for deployment to #{environment}: #{server}\n\n"
|
38
|
+
|
39
|
+
if not ["yes", "y"].include?(ask("OK? [Yes|y|Y|No|n|N] > ").downcase)
|
40
|
+
puts "\nExiting."
|
41
|
+
exit(1)
|
42
|
+
else
|
43
|
+
puts
|
44
|
+
end
|
45
|
+
|
46
|
+
puts "Running rsync..."
|
47
|
+
run("rsync #{config[:rsync_flags]} ./build/ #{config[:user]}@#{server}:#{config[:path]}")
|
48
|
+
|
49
|
+
puts "Complete."
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
Base.register(Middleman::Cli::Rsync, "rsync", "rsync [environment] [options]", "Deploy a middleman website via rsync")
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "middleman-core"
|
2
|
+
|
3
|
+
module Middleman
|
4
|
+
module Rsync
|
5
|
+
class Extension < Middleman::Extension
|
6
|
+
option :production_server, nil, "Domain name of production server"
|
7
|
+
option :staging_server, nil, "Domain name of staging server"
|
8
|
+
option :path, nil, "Path on server to sync files"
|
9
|
+
option :user, nil, "Remote user"
|
10
|
+
option :rsync_flags, "--compress --archive --delete -v", "Flags to pass to Rsync"
|
11
|
+
|
12
|
+
def initialize(app, options_hash={}, &block)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "middleman-rsync"
|
6
|
+
s.version = "0.1.0"
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Andrew Buntine", "David Cristofaro"]
|
9
|
+
s.email = ["info@bunts.io", "david@dtcristo.com"]
|
10
|
+
s.homepage = "https://github.com/hardhatdigital/middleman-rsync"
|
11
|
+
s.summary = %q{A Middleman extension to deploy via rsync}
|
12
|
+
s.license = "MIT"
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_runtime_dependency("middleman-core", ["~> 4.0"])
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-rsync
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Buntine
|
8
|
+
- David Cristofaro
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-12-21 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: '4.0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '4.0'
|
28
|
+
description:
|
29
|
+
email:
|
30
|
+
- info@bunts.io
|
31
|
+
- david@dtcristo.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- ".gitignore"
|
37
|
+
- Gemfile
|
38
|
+
- LICENSE
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- features/support/env.rb
|
42
|
+
- lib/middleman-rsync.rb
|
43
|
+
- lib/middleman-rsync/commands.rb
|
44
|
+
- lib/middleman-rsync/extension.rb
|
45
|
+
- middleman-rsync.gemspec
|
46
|
+
homepage: https://github.com/hardhatdigital/middleman-rsync
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata: {}
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 2.5.1
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: A Middleman extension to deploy via rsync
|
70
|
+
test_files: []
|