middleman-deploy 1.0.0 → 2.0.0.pre.alpha
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 +4 -4
- data/.rubocop.yml +5 -18
- data/.travis.yml +3 -1
- data/CHANGELOG.md +8 -0
- data/README.md +19 -19
- data/lib/middleman-deploy.rb +1 -1
- data/lib/middleman-deploy/commands.rb +48 -18
- data/lib/middleman-deploy/extension.rb +26 -17
- data/lib/middleman-deploy/methods/base.rb +5 -1
- data/lib/middleman-deploy/methods/ftp.rb +8 -10
- data/lib/middleman-deploy/methods/git.rb +3 -3
- data/lib/middleman-deploy/methods/rsync.rb +5 -7
- data/lib/middleman-deploy/methods/sftp.rb +8 -10
- data/lib/middleman-deploy/pkg-info.rb +2 -2
- data/lib/middleman-deploy/strategies/git/base.rb +9 -8
- data/lib/middleman-deploy/strategies/git/force_push.rb +5 -5
- data/lib/middleman-deploy/strategies/git/submodule.rb +5 -5
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d42767ad0d84aed0ec0ad021cd05cff6fe9e99b8
|
4
|
+
data.tar.gz: 6bbfd715ec34d9d4e198fb9f6dfebf0b0bc4cc08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaf9c90270e352e49cd9ae2abae7d36d579205de1d494e33811fc265ca1f48f3952ecf4ca02d63bf7aa6a77cc14b66f0b145045b03a5882ae0d2607be34663cd
|
7
|
+
data.tar.gz: d9c4847d6d783c9662825756de62cb6258356dff007e73ca9c16c998a6ed91e4cf34ae3b60ac02a9137b225fb112c292e717c4fabd939fef2b2327dbb9eb3ec1
|
data/.rubocop.yml
CHANGED
@@ -1,24 +1,11 @@
|
|
1
1
|
AllCops:
|
2
2
|
Include:
|
3
|
-
-
|
4
|
-
- Gemfile
|
3
|
+
- 'Gemfile'
|
5
4
|
Exclude:
|
6
|
-
- script/**/*
|
7
|
-
- vendor/**/*
|
8
|
-
- bin/**/*
|
9
|
-
LineLength:
|
10
|
-
Enabled: false
|
11
|
-
MethodLength:
|
12
|
-
Enabled: false
|
13
|
-
ClassLength:
|
14
|
-
Enabled: false
|
5
|
+
- 'script/**/*'
|
6
|
+
- 'vendor/**/*'
|
7
|
+
- 'bin/**/*'
|
15
8
|
Documentation:
|
16
9
|
Enabled: false
|
17
|
-
|
18
|
-
Enabled: false
|
19
|
-
Blocks:
|
20
|
-
Enabled: false
|
21
|
-
AlignParameters:
|
10
|
+
ClassAndModuleChildren:
|
22
11
|
Enabled: false
|
23
|
-
HashSyntax:
|
24
|
-
EnforcedStyle: ruby19
|
data/.travis.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
2
3
|
cache: bundler
|
3
4
|
bundler_args: --without development
|
4
5
|
rvm:
|
@@ -10,6 +11,7 @@ rvm:
|
|
10
11
|
- 2.0.0
|
11
12
|
- 1.9.3
|
12
13
|
- rbx-2
|
14
|
+
before_script: bundle update
|
13
15
|
matrix:
|
14
16
|
fast_finish: true
|
15
17
|
allow_failures:
|
@@ -21,4 +23,4 @@ matrix:
|
|
21
23
|
notifications:
|
22
24
|
email: false
|
23
25
|
env:
|
24
|
-
- CODECLIMATE_REPO_TOKEN=5eee8e8624962f963a52a1d2313dc7407e3b8006291e3704346c786642cc073b
|
26
|
+
- CODECLIMATE_REPO_TOKEN=5eee8e8624962f963a52a1d2313dc7407e3b8006291e3704346c786642cc073b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -26,9 +26,9 @@ following to `config.rb`:
|
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
activate :deploy do |deploy|
|
29
|
-
deploy.
|
30
|
-
deploy.host
|
31
|
-
deploy.path
|
29
|
+
deploy.deploy_method = :rsync
|
30
|
+
deploy.host = 'www.example.com'
|
31
|
+
deploy.path = '/srv/www/site'
|
32
32
|
# Optional Settings
|
33
33
|
# deploy.user = 'tvaughan' # no default
|
34
34
|
# deploy.port = 5309 # ssh port, default: 22
|
@@ -44,7 +44,7 @@ following to `config.rb`:
|
|
44
44
|
|
45
45
|
```ruby
|
46
46
|
activate :deploy do |deploy|
|
47
|
-
deploy.
|
47
|
+
deploy.deploy_method = :git
|
48
48
|
# Optional Settings
|
49
49
|
# deploy.remote = 'custom-remote' # remote name or git url, default: origin
|
50
50
|
# deploy.branch = 'custom-branch' # default: gh-pages
|
@@ -70,11 +70,11 @@ Activate the extension by adding the following to `config.rb`:
|
|
70
70
|
|
71
71
|
```ruby
|
72
72
|
activate :deploy do |deploy|
|
73
|
-
deploy.
|
74
|
-
deploy.host
|
75
|
-
deploy.path
|
76
|
-
deploy.user
|
77
|
-
deploy.password
|
73
|
+
deploy.deploy_method = :ftp
|
74
|
+
deploy.host = 'ftp.example.com'
|
75
|
+
deploy.path = '/srv/www/site'
|
76
|
+
deploy.user = 'tvaughan'
|
77
|
+
deploy.password = 'secret'
|
78
78
|
end
|
79
79
|
```
|
80
80
|
|
@@ -84,10 +84,10 @@ Activate the extension by adding the following to `config.rb`:
|
|
84
84
|
|
85
85
|
```ruby
|
86
86
|
activate :deploy do |deploy|
|
87
|
-
deploy.
|
88
|
-
deploy.host
|
89
|
-
deploy.port
|
90
|
-
deploy.path
|
87
|
+
deploy.deploy_method = :sftp
|
88
|
+
deploy.host = 'sftp.example.com'
|
89
|
+
deploy.port = 22
|
90
|
+
deploy.path = '/srv/www/site'
|
91
91
|
# Optional Settings
|
92
92
|
# deploy.user = 'tvaughan' # no default
|
93
93
|
# deploy.password = 'secret' # no default
|
@@ -115,15 +115,15 @@ Deploy your site to more than one configuration using environment variables.
|
|
115
115
|
case ENV['TARGET'].to_s.downcase
|
116
116
|
when 'production'
|
117
117
|
activate :deploy do |deploy|
|
118
|
-
deploy.
|
119
|
-
deploy.host
|
120
|
-
deploy.path
|
118
|
+
deploy.deploy_method = :rsync
|
119
|
+
deploy.host = 'www.example.com'
|
120
|
+
deploy.path = '/srv/www/production-site'
|
121
121
|
end
|
122
122
|
else
|
123
123
|
activate :deploy do |deploy|
|
124
|
-
deploy.
|
125
|
-
deploy.host
|
126
|
-
deploy.path
|
124
|
+
deploy.deploy_method = :rsync
|
125
|
+
deploy.host = 'staging.example.com'
|
126
|
+
deploy.path = '/srv/www/staging-site'
|
127
127
|
end
|
128
128
|
end
|
129
129
|
```
|
data/lib/middleman-deploy.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'middleman-core/cli'
|
2
|
-
|
2
|
+
require 'middleman-core/rack' if Middleman::VERSION.to_i > 3
|
3
3
|
require 'middleman-deploy/pkg-info'
|
4
4
|
require 'middleman-deploy/extension'
|
5
5
|
require 'middleman-deploy/methods'
|
@@ -8,24 +8,52 @@ require 'middleman-deploy/strategies'
|
|
8
8
|
module Middleman
|
9
9
|
module Cli
|
10
10
|
# This class provides a "deploy" command for the middleman CLI.
|
11
|
-
class Deploy < Thor
|
11
|
+
class Deploy < Thor::Group
|
12
12
|
include Thor::Actions
|
13
13
|
|
14
14
|
check_unknown_options!
|
15
15
|
|
16
16
|
namespace :deploy
|
17
17
|
|
18
|
+
class_option :environment,
|
19
|
+
aliases: '-e',
|
20
|
+
default: ENV['MM_ENV'] || ENV['RACK_ENV'] || 'production',
|
21
|
+
desc: 'The environment Middleman will run under'
|
22
|
+
|
23
|
+
class_option :verbose,
|
24
|
+
type: :boolean,
|
25
|
+
default: false,
|
26
|
+
desc: 'Print debug messages'
|
27
|
+
|
28
|
+
class_option :instrument,
|
29
|
+
type: :string,
|
30
|
+
default: false,
|
31
|
+
desc: 'Print instrument messages'
|
32
|
+
|
33
|
+
class_option :build_before,
|
34
|
+
type: :boolean,
|
35
|
+
aliases: '-b',
|
36
|
+
desc: 'Run `middleman build` before the deploy step'
|
37
|
+
|
38
|
+
def self.subcommand_help(_options)
|
39
|
+
# TODO
|
40
|
+
end
|
41
|
+
|
18
42
|
# Tell Thor to exit with a nonzero exit code on failure
|
19
43
|
def self.exit_on_failure?
|
20
44
|
true
|
21
45
|
end
|
22
46
|
|
23
|
-
desc 'deploy [options]', Middleman::Deploy::TAGLINE
|
24
|
-
method_option 'build_before',
|
25
|
-
type: :boolean,
|
26
|
-
aliases: '-b',
|
27
|
-
desc: 'Run `middleman build` before the deploy step'
|
28
47
|
def deploy
|
48
|
+
env = options['environment'] ? :production : options['environment'].to_s.to_sym
|
49
|
+
verbose = options['verbose'] ? 0 : 1
|
50
|
+
instrument = options['instrument']
|
51
|
+
|
52
|
+
@app = ::Middleman::Application.new do
|
53
|
+
config[:mode] = :build
|
54
|
+
config[:environment] = env
|
55
|
+
::Middleman::Logger.singleton(verbose, instrument)
|
56
|
+
end
|
29
57
|
build_before(options)
|
30
58
|
process
|
31
59
|
end
|
@@ -33,24 +61,23 @@ module Middleman
|
|
33
61
|
protected
|
34
62
|
|
35
63
|
def build_before(options = {})
|
36
|
-
build_enabled = options.fetch('build_before',
|
64
|
+
build_enabled = options.fetch('build_before', deploy_options.build_before)
|
37
65
|
|
38
66
|
if build_enabled
|
39
67
|
# http://forum.middlemanapp.com/t/problem-with-the-build-task-in-an-extension
|
40
|
-
run(
|
68
|
+
run("middleman build -e #{options['environment']}") || exit(1)
|
41
69
|
end
|
42
70
|
end
|
43
71
|
|
44
72
|
def print_usage_and_die(message)
|
45
|
-
|
73
|
+
fail StandardError, "ERROR: #{message}\n#{Middleman::Deploy::README}"
|
46
74
|
end
|
47
75
|
|
48
76
|
def process
|
49
|
-
server_instance =
|
50
|
-
|
51
|
-
camelized_method = self.deploy_options.method.to_s.split('_').map { |word| word.capitalize}.join
|
77
|
+
server_instance = @app
|
78
|
+
camelized_method = deploy_options.deploy_method.to_s.split('_').map(&:capitalize).join
|
52
79
|
method_class_name = "Middleman::Deploy::Methods::#{camelized_method}"
|
53
|
-
method_instance = method_class_name.constantize.new(server_instance,
|
80
|
+
method_instance = method_class_name.constantize.new(server_instance, deploy_options)
|
54
81
|
|
55
82
|
method_instance.process
|
56
83
|
end
|
@@ -59,19 +86,19 @@ module Middleman
|
|
59
86
|
options = nil
|
60
87
|
|
61
88
|
begin
|
62
|
-
options = ::Middleman::
|
89
|
+
options = ::Middleman::Deploy.options
|
63
90
|
rescue NoMethodError
|
64
91
|
print_usage_and_die 'You need to activate the deploy extension in config.rb.'
|
65
92
|
end
|
66
93
|
|
67
|
-
unless options.
|
94
|
+
unless options.deploy_method
|
68
95
|
print_usage_and_die 'The deploy extension requires you to set a method.'
|
69
96
|
end
|
70
97
|
|
71
|
-
case options.
|
98
|
+
case options.deploy_method
|
72
99
|
when :rsync, :sftp
|
73
100
|
unless options.host && options.path
|
74
|
-
print_usage_and_die "The #{options.
|
101
|
+
print_usage_and_die "The #{options.deploy_method} method requires host and path to be set."
|
75
102
|
end
|
76
103
|
when :ftp
|
77
104
|
unless options.host && options.user && options.password && options.path
|
@@ -83,6 +110,9 @@ module Middleman
|
|
83
110
|
end
|
84
111
|
end
|
85
112
|
|
113
|
+
# Add to CLI
|
114
|
+
Base.register(Middleman::Cli::Deploy, 'deploy', 'deploy [options]', Middleman::Deploy::TAGLINE)
|
115
|
+
|
86
116
|
# Alias "d" to "deploy"
|
87
117
|
Base.map('d' => 'deploy')
|
88
118
|
end
|
@@ -4,15 +4,32 @@ require 'middleman-core'
|
|
4
4
|
# Extension namespace
|
5
5
|
module Middleman
|
6
6
|
module Deploy
|
7
|
-
|
7
|
+
@options
|
8
8
|
|
9
9
|
class << self
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
attr_reader :options
|
11
|
+
|
12
|
+
attr_writer :options
|
13
|
+
end
|
14
|
+
|
15
|
+
class Extension < Extension
|
16
|
+
option :deploy_method, nil
|
17
|
+
option :host, nil
|
18
|
+
option :port, nil
|
19
|
+
option :user, nil
|
20
|
+
option :password, nil
|
21
|
+
option :path, nil
|
22
|
+
option :clean, nil
|
23
|
+
option :remote, nil
|
24
|
+
option :branch, nil
|
25
|
+
option :strategy, nil
|
26
|
+
option :build_before, nil
|
27
|
+
option :flags, nil
|
28
|
+
option :commit_message, nil
|
29
|
+
|
30
|
+
def initialize(app, options_hash = {}, &block)
|
31
|
+
super
|
13
32
|
|
14
|
-
def registered(app, options_hash = {}, &block)
|
15
|
-
options = Options.new(options_hash)
|
16
33
|
yield options if block_given?
|
17
34
|
|
18
35
|
# Default options for the rsync method.
|
@@ -23,21 +40,13 @@ module Middleman
|
|
23
40
|
options.remote ||= 'origin'
|
24
41
|
options.branch ||= 'gh-pages'
|
25
42
|
options.strategy ||= :force_push
|
26
|
-
options.commit_message
|
43
|
+
options.commit_message ||= nil
|
27
44
|
|
28
45
|
options.build_before ||= false
|
29
|
-
|
30
|
-
@@options = options
|
31
|
-
|
32
|
-
app.send :include, Helpers
|
33
46
|
end
|
34
47
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
module Helpers
|
39
|
-
def options
|
40
|
-
::Middleman::Deploy.options
|
48
|
+
def after_configuration
|
49
|
+
::Middleman::Deploy.options = options
|
41
50
|
end
|
42
51
|
end
|
43
52
|
end
|
@@ -18,11 +18,11 @@ module Middleman
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def process
|
21
|
-
puts "## Deploying via ftp to #{
|
21
|
+
puts "## Deploying via ftp to #{user}@#{host}:#{path}"
|
22
22
|
|
23
23
|
ftp = open_connection
|
24
24
|
|
25
|
-
Dir.chdir(
|
25
|
+
Dir.chdir(build_dir) do
|
26
26
|
filtered_files.each do |filename|
|
27
27
|
if File.directory?(filename)
|
28
28
|
upload_directory(ftp, filename)
|
@@ -57,9 +57,9 @@ module Middleman
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def open_connection
|
60
|
-
ftp = Net::FTP.new(
|
61
|
-
ftp.login(
|
62
|
-
ftp.chdir(
|
60
|
+
ftp = Net::FTP.new(host)
|
61
|
+
ftp.login(user, pass)
|
62
|
+
ftp.chdir(path)
|
63
63
|
ftp.passive = true
|
64
64
|
|
65
65
|
ftp
|
@@ -76,11 +76,9 @@ module Middleman
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def upload_directory(ftp, filename)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
rescue
|
83
|
-
end
|
79
|
+
ftp.mkdir(filename)
|
80
|
+
puts "Created directory #{filename}"
|
81
|
+
rescue
|
84
82
|
end
|
85
83
|
end
|
86
84
|
end
|
@@ -3,11 +3,11 @@ module Middleman
|
|
3
3
|
module Methods
|
4
4
|
class Git < Base
|
5
5
|
def process
|
6
|
-
puts "## Deploying via git to remote=\"#{
|
6
|
+
puts "## Deploying via git to remote=\"#{options.remote}\" and branch=\"#{options.branch}\""
|
7
7
|
|
8
|
-
camelized_strategy =
|
8
|
+
camelized_strategy = options.strategy.to_s.split('_').map(&:capitalize).join
|
9
9
|
strategy_class_name = "Middleman::Deploy::Strategies::Git::#{camelized_strategy}"
|
10
|
-
strategy_instance = strategy_class_name.constantize.new(
|
10
|
+
strategy_instance = strategy_class_name.constantize.new(build_dir, options.remote, options.branch, options.commit_message)
|
11
11
|
|
12
12
|
strategy_instance.process
|
13
13
|
end
|
@@ -17,17 +17,15 @@ module Middleman
|
|
17
17
|
|
18
18
|
def process
|
19
19
|
# Append "@" to user if provided.
|
20
|
-
user = "#{self.user}@" if
|
20
|
+
user = "#{self.user}@" if user && !user.empty?
|
21
21
|
|
22
|
-
dest_url = "#{user}#{
|
22
|
+
dest_url = "#{user}#{host}:#{path}"
|
23
23
|
flags = self.flags || '-avz'
|
24
|
-
command = "rsync #{flags} '-e ssh -p #{
|
24
|
+
command = "rsync #{flags} '-e ssh -p #{port}' #{build_dir}/ #{dest_url}"
|
25
25
|
|
26
|
-
if
|
27
|
-
command += ' --delete'
|
28
|
-
end
|
26
|
+
command += ' --delete' if clean
|
29
27
|
|
30
|
-
puts "## Deploying via rsync to #{dest_url} port=#{
|
28
|
+
puts "## Deploying via rsync to #{dest_url} port=#{port}"
|
31
29
|
exec command
|
32
30
|
end
|
33
31
|
end
|
@@ -6,13 +6,13 @@ module Middleman
|
|
6
6
|
module Methods
|
7
7
|
class Sftp < Ftp
|
8
8
|
def process
|
9
|
-
puts "## Deploying via sftp to #{
|
9
|
+
puts "## Deploying via sftp to #{user}@#{host}:#{path}"
|
10
10
|
|
11
11
|
# `nil` is a valid value for user and/or pass.
|
12
|
-
Net::SFTP.start(
|
13
|
-
sftp.mkdir(
|
12
|
+
Net::SFTP.start(host, user, password: pass, port: port) do |sftp|
|
13
|
+
sftp.mkdir(path)
|
14
14
|
|
15
|
-
Dir.chdir(
|
15
|
+
Dir.chdir(build_dir) do
|
16
16
|
filtered_files.each do |filename|
|
17
17
|
if File.directory?(filename)
|
18
18
|
upload_directory(sftp, filename)
|
@@ -26,17 +26,15 @@ module Middleman
|
|
26
26
|
|
27
27
|
protected
|
28
28
|
|
29
|
-
def handle_exception(exception,filename, file_path)
|
29
|
+
def handle_exception(exception, filename, file_path)
|
30
30
|
reply = exception.message
|
31
31
|
err_code = reply[0, 3].to_i
|
32
32
|
|
33
|
-
if err_code == 550
|
34
|
-
sftp.upload(filename, file_path)
|
35
|
-
end
|
33
|
+
sftp.upload(filename, file_path) if err_code == 550
|
36
34
|
end
|
37
35
|
|
38
36
|
def upload_directory(sftp, filename)
|
39
|
-
file_path = "#{
|
37
|
+
file_path = "#{path}/#{filename}"
|
40
38
|
|
41
39
|
begin
|
42
40
|
sftp.mkdir(file_path)
|
@@ -46,7 +44,7 @@ module Middleman
|
|
46
44
|
end
|
47
45
|
|
48
46
|
def upload_file(sftp, filename)
|
49
|
-
file_path = "#{
|
47
|
+
file_path = "#{path}/#{filename}"
|
50
48
|
|
51
49
|
begin
|
52
50
|
sftp.upload(filename, file_path)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Middleman
|
2
2
|
module Deploy
|
3
3
|
PACKAGE = 'middleman-deploy'
|
4
|
-
VERSION = '
|
4
|
+
VERSION = '2.0.0-alpha'
|
5
5
|
TAGLINE = 'Deploy a middleman built site over rsync, ftp, sftp, or git (e.g. gh-pages on github).'
|
6
|
-
README = %
|
6
|
+
README = %{
|
7
7
|
You should follow one of the four examples below to setup the deploy
|
8
8
|
extension in config.rb.
|
9
9
|
|
@@ -15,7 +15,7 @@ module Middleman
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def process
|
18
|
-
|
18
|
+
fail NotImplementedError
|
19
19
|
end
|
20
20
|
|
21
21
|
protected
|
@@ -29,24 +29,25 @@ module Middleman
|
|
29
29
|
|
30
30
|
def checkout_branch
|
31
31
|
# if there is a branch with that name, switch to it, otherwise create a new one and switch to it
|
32
|
-
if `git branch`.split("\n").any? { |b| b =~ /#{
|
33
|
-
`git checkout #{
|
32
|
+
if `git branch`.split("\n").any? { |b| b =~ /#{branch}/i }
|
33
|
+
`git checkout #{branch}`
|
34
34
|
else
|
35
|
-
`git checkout -b #{
|
35
|
+
`git checkout -b #{branch}`
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
def commit_branch(options = '')
|
40
|
-
message =
|
40
|
+
message = commit_message ? commit_message : add_signature_to_commit_message('Automated commit')
|
41
41
|
|
42
|
-
run_or_fail(
|
42
|
+
run_or_fail('git add -A')
|
43
43
|
run_or_fail("git commit --allow-empty -am \"#{message}\"")
|
44
|
-
run_or_fail("git push #{options} origin #{
|
44
|
+
run_or_fail("git push #{options} origin #{branch}")
|
45
45
|
end
|
46
46
|
|
47
47
|
private
|
48
|
+
|
48
49
|
def run_or_fail(command)
|
49
|
-
system(command) ||
|
50
|
+
system(command) || fail("ERROR running: #{command}")
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|
@@ -4,7 +4,7 @@ module Middleman
|
|
4
4
|
module Git
|
5
5
|
class ForcePush < Base
|
6
6
|
def process
|
7
|
-
Dir.chdir(
|
7
|
+
Dir.chdir(build_dir) do
|
8
8
|
add_remote_url
|
9
9
|
checkout_branch
|
10
10
|
commit_branch('-f')
|
@@ -19,8 +19,8 @@ module Middleman
|
|
19
19
|
unless File.exist?('.git')
|
20
20
|
`git init`
|
21
21
|
`git remote add origin #{url}`
|
22
|
-
`git config user.name "#{
|
23
|
-
`git config user.
|
22
|
+
`git config user.name "#{user_name}"`
|
23
|
+
`git config user.email "#{user_email}"`
|
24
24
|
else
|
25
25
|
# check if the remote repo has changed
|
26
26
|
unless url == `git config --get remote.origin.url`.chop
|
@@ -28,9 +28,9 @@ module Middleman
|
|
28
28
|
`git remote add origin #{url}`
|
29
29
|
end
|
30
30
|
# check if the user name has changed
|
31
|
-
`git config user.name "#{
|
31
|
+
`git config user.name "#{user_name}"` unless user_name == `git config --get user.name`
|
32
32
|
# check if the user email has changed
|
33
|
-
`git config user.email "#{
|
33
|
+
`git config user.email "#{user_email}"` unless user_email == `git config --get user.email`
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -4,7 +4,7 @@ module Middleman
|
|
4
4
|
module Git
|
5
5
|
class Submodule < Base
|
6
6
|
def process
|
7
|
-
Dir.chdir(
|
7
|
+
Dir.chdir(build_dir) do
|
8
8
|
checkout_branch
|
9
9
|
pull_submodule
|
10
10
|
commit_branch
|
@@ -19,7 +19,7 @@ module Middleman
|
|
19
19
|
current_branch = `git rev-parse --abbrev-ref HEAD`
|
20
20
|
message = add_signature_to_commit_message('Deployed')
|
21
21
|
|
22
|
-
`git add #{
|
22
|
+
`git add #{build_dir}`
|
23
23
|
`git commit --allow-empty -m "#{message}"`
|
24
24
|
`git push origin #{current_branch}`
|
25
25
|
end
|
@@ -27,11 +27,11 @@ module Middleman
|
|
27
27
|
def pull_submodule
|
28
28
|
`git fetch`
|
29
29
|
`git stash`
|
30
|
-
`git rebase #{
|
30
|
+
`git rebase #{remote}/#{branch}`
|
31
31
|
`git stash pop`
|
32
32
|
|
33
|
-
if
|
34
|
-
puts "Can't deploy! Please resolve conflicts. Then process to manual commit and push on #{
|
33
|
+
if $CHILD_STATUS.exitstatus == 1
|
34
|
+
puts "Can't deploy! Please resolve conflicts. Then process to manual commit and push on #{branch} branch."
|
35
35
|
exit
|
36
36
|
end
|
37
37
|
end
|
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:
|
4
|
+
version: 2.0.0.pre.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Vaughan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|
@@ -192,12 +192,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: 1.9.3
|
193
193
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
194
|
requirements:
|
195
|
-
- - "
|
195
|
+
- - ">"
|
196
196
|
- !ruby/object:Gem::Version
|
197
|
-
version:
|
197
|
+
version: 1.3.1
|
198
198
|
requirements: []
|
199
199
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.
|
200
|
+
rubygems_version: 2.4.5
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: Deploy a middleman built site over rsync, ftp, sftp, or git (e.g. gh-pages
|