middleman-deploy 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -42,10 +42,10 @@ following to `config.rb`:
42
42
  ```ruby
43
43
  activate :deploy do |deploy|
44
44
  deploy.method = :rsync
45
- deploy.user = "tvaughan"
46
45
  deploy.host = "www.example.com"
47
46
  deploy.path = "/srv/www/site"
48
47
  # Optional Settings
48
+ # deploy.user = "tvaughan" # no default
49
49
  # deploy.port = 5309 # ssh port, default: 22
50
50
  # deploy.clean = true # remove orphaned files on remote host, default: false
51
51
  end
@@ -3,9 +3,6 @@ require "middleman-core/cli"
3
3
  require "middleman-deploy/extension"
4
4
  require "middleman-deploy/pkg-info"
5
5
 
6
- PACKAGE = "#{Middleman::Deploy::PACKAGE}"
7
- VERSION = "#{Middleman::Deploy::VERSION}"
8
-
9
6
  module Middleman
10
7
  module Cli
11
8
 
@@ -52,10 +49,13 @@ extension in config.rb.
52
49
  # To deploy the build directory to a remote host via rsync:
53
50
  activate :deploy do |deploy|
54
51
  deploy.method = :rsync
55
- # host, user, and path *must* be set
56
- deploy.user = "tvaughan"
52
+ # host and path *must* be set
57
53
  deploy.host = "www.example.com"
58
54
  deploy.path = "/srv/www/site"
55
+ # user is optional (no default)
56
+ deploy.user = "tvaughan"
57
+ # port is optional (default is 22)
58
+ deploy.port = 5309
59
59
  # clean is optional (default is false)
60
60
  deploy.clean = true
61
61
  end
@@ -112,8 +112,8 @@ EOF
112
112
 
113
113
  case options.method
114
114
  when :rsync
115
- if (!options.host || !options.user || !options.path)
116
- print_usage_and_die "The rsync deploy method requires host, user, and path to be set."
115
+ if (!options.host || !options.path)
116
+ print_usage_and_die "The rsync deploy method requires host and path to be set."
117
117
  end
118
118
  when :ftp, :sftp
119
119
  if (!options.host || !options.user || !options.password || !options.path)
@@ -127,12 +127,17 @@ EOF
127
127
  def deploy_rsync
128
128
  host = self.deploy_options.host
129
129
  port = self.deploy_options.port
130
- user = self.deploy_options.user
131
130
  path = self.deploy_options.path
132
131
 
133
- puts "## Deploying via rsync to #{user}@#{host}:#{path} port=#{port}"
132
+ # Append "@" to user if provided.
133
+ user = self.deploy_options.user
134
+ user = "#{user}@" if user && !user.empty?
135
+
136
+ dest_url = "#{user}#{host}:#{path}"
137
+
138
+ puts "## Deploying via rsync to #{dest_url} port=#{port}"
134
139
 
135
- command = "rsync -avze '" + "ssh -p #{port}" + "' #{self.inst.build_dir}/ #{user}@#{host}:#{path}"
140
+ command = "rsync -avze '" + "ssh -p #{port}" + "' #{self.inst.build_dir}/ #{dest_url}"
136
141
 
137
142
  if self.deploy_options.clean
138
143
  command += " --delete"
@@ -178,7 +183,7 @@ EOF
178
183
  end
179
184
 
180
185
  `git add -A`
181
- `git commit --allow-empty -am 'Automated commit at #{Time.now.utc} by #{PACKAGE} #{VERSION}'`
186
+ `git commit --allow-empty -am 'Automated commit at #{Time.now.utc} by #{Middleman::Deploy::PACKAGE} #{Middleman::Deploy::VERSION}'`
182
187
  `git push -f origin #{branch}`
183
188
  end
184
189
  end
@@ -17,8 +17,11 @@ module Middleman
17
17
  options = Options.new(options_hash)
18
18
  yield options if block_given?
19
19
 
20
+ # Default options for the rsync method.
20
21
  options.port ||= 22
21
22
  options.clean ||= false
23
+
24
+ # Default options for the git method.
22
25
  options.remote ||= "origin"
23
26
  options.branch ||= "gh-pages"
24
27
 
@@ -1,7 +1,7 @@
1
1
  module Middleman
2
2
  module Deploy
3
3
  PACKAGE = "middleman-deploy"
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  TAGLINE = "Deploy a middleman built site over rsync, ftp, sftp, or git (e.g. gh-pages on github)."
6
6
  end
7
7
  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: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-29 00:00:00.000000000 Z
12
+ date: 2013-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core
@@ -92,18 +92,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
92
  - - ! '>='
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
- segments:
96
- - 0
97
- hash: 1810602657871223633
98
95
  required_rubygems_version: !ruby/object:Gem::Requirement
99
96
  none: false
100
97
  requirements:
101
98
  - - ! '>='
102
99
  - !ruby/object:Gem::Version
103
100
  version: '0'
104
- segments:
105
- - 0
106
- hash: 1810602657871223633
107
101
  requirements: []
108
102
  rubyforge_project:
109
103
  rubygems_version: 1.8.23