rsync-deploy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -8
- data/bin/deploy +2 -2
- data/lib/deploy/environment.rb +7 -18
- data/lib/deploy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80aa81ee9aefde54415bb913a4a152f65b0d91bb
|
4
|
+
data.tar.gz: 363a12926ca9645270994c1f22ac01f04b8bc1d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aeec1046f5cf4df6f2cf883c95b3141aecb9902b1150b916331ffc5f4130388b7dc612d599c2fb391e4aa1366fd6199abe6e3832778560efffedeb55252766b
|
7
|
+
data.tar.gz: 210c97cc4bef39212a225ffd1508633f4fcc63fbd6d5d132ebc296f8ae309cc827a0d53233103d801683bbc4f33fb6d22204c6b34195cd0252f161c9d3694f0f
|
data/README.md
CHANGED
@@ -132,13 +132,6 @@ The port that the connection should happen over
|
|
132
132
|
|
133
133
|
The username to login to the server. If no username is set, your computer account username will be used.
|
134
134
|
|
135
|
-
### pass
|
136
|
-
|
137
|
-
- Type: `String`
|
138
|
-
- Default: `none`
|
139
|
-
|
140
|
-
The password to login to the server. If SSH keys aren't available, then the `pass` option will be used. If neither SSH keys nor `pass` are set, a prompt will be given.
|
141
|
-
|
142
135
|
### privateKey
|
143
136
|
|
144
137
|
- Type: `String`
|
@@ -245,7 +238,7 @@ Deploy is almost identical to [DPLOY](https://github.com/LeanMeanFightingMachine
|
|
245
238
|
|
246
239
|
## Uninstall
|
247
240
|
|
248
|
-
To uninstall Deploy,
|
241
|
+
To uninstall Deploy, just run:
|
249
242
|
|
250
243
|
```
|
251
244
|
gem uninstall rsync-deploy
|
data/bin/deploy
CHANGED
@@ -59,7 +59,7 @@ def install
|
|
59
59
|
|
60
60
|
if(answer == 'y')
|
61
61
|
File.open(Deploy::CONFIG_PATH, 'w+') do |file|
|
62
|
-
file.puts 'server_name:',' host: ""',' user: ""','
|
62
|
+
file.puts 'server_name:',' host: ""',' user: ""',' path:',' local: "/"',' remote: "/public_html/"'
|
63
63
|
end
|
64
64
|
puts "Configuration file `#{Deploy::CONFIG_PATH}` created."
|
65
65
|
else
|
@@ -69,7 +69,7 @@ def install
|
|
69
69
|
else
|
70
70
|
|
71
71
|
File.open(Deploy::CONFIG_PATH, 'w+') do |file|
|
72
|
-
file.puts 'server_name:',' host: ""',' user: ""','
|
72
|
+
file.puts 'server_name:',' host: ""',' user: ""',' path:',' local: "/"',' remote: "/public_html/"'
|
73
73
|
end
|
74
74
|
puts "Configuration file `#{Deploy::CONFIG_PATH}` created."
|
75
75
|
|
data/lib/deploy/environment.rb
CHANGED
@@ -12,14 +12,13 @@ module Deploy
|
|
12
12
|
def initialize(name, hash)
|
13
13
|
|
14
14
|
@name = name
|
15
|
-
@config = { :host => '', :port => '', :user => '', :
|
15
|
+
@config = { :host => '', :port => '', :user => '', :private_key => '', :local => '', :remote => '' }
|
16
16
|
@options = { :verbose => false, :sync => true }
|
17
17
|
|
18
18
|
@config[:host] = hash['host']
|
19
19
|
@config[:port] = hash['port'] || '22'
|
20
20
|
|
21
21
|
@config[:user] = hash['user'] || ''
|
22
|
-
@config[:pass] = hash['pass'] || ''
|
23
22
|
@config[:private_key] = hash['privateKey'] || ''
|
24
23
|
|
25
24
|
@config[:local] = hash['path']['local'].gsub(/\s+/, "")
|
@@ -58,15 +57,10 @@ module Deploy
|
|
58
57
|
end
|
59
58
|
# Don't upload the deploy configuration file
|
60
59
|
tmp_exclude.puts Deploy::CONFIG_PATH
|
60
|
+
tmp_exclude.puts ".git" # Never sync git files
|
61
61
|
tmp_exclude.close
|
62
62
|
end
|
63
63
|
|
64
|
-
unless @config[:pass].empty?
|
65
|
-
tmp_pass = Tempfile.new(['pass','.txt'])
|
66
|
-
tmp_pass.puts @config[:pass]
|
67
|
-
tmp_pass.close
|
68
|
-
end
|
69
|
-
|
70
64
|
rsync_cmd = 'rsync -a' # Always keep permissions
|
71
65
|
rsync_cmd += 'v' if @options[:verbose] # Verbose if requested
|
72
66
|
rsync_cmd += 'z' # Always zip files
|
@@ -77,14 +71,10 @@ module Deploy
|
|
77
71
|
rsync_cmd += ' --force --delete --delete-excluded' # Sync unless explicitly requested or downloading
|
78
72
|
end
|
79
73
|
rsync_cmd += " --exclude-from=#{tmp_exclude.path}" unless @config[:excludes].empty? # Include exclude file if it exists
|
80
|
-
rsync_cmd += " --password-file=#{tmp_pass.path}" unless @config[:pass].empty? # Include password file if it exists
|
81
|
-
rsync_cmd += " -e \"ssh "
|
82
74
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
rsync_cmd += "-p#{@config[:port]}\" " # Choose port if specified
|
75
|
+
rsync_cmd += " -e \"ssh " # Pass custom ssh options
|
76
|
+
rsync_cmd += " -i #{@config[:private_key]} " unless @config[:private_key].empty? # Include a custom private key if requested
|
77
|
+
rsync_cmd += "-p #{@config[:port]}\" " # Choose port if specified
|
88
78
|
|
89
79
|
unless @options[:reverse]
|
90
80
|
rsync_cmd += `pwd`.gsub(/\s+/, "") + "#{@config[:local]} " # The local path from the current directory
|
@@ -102,9 +92,8 @@ module Deploy
|
|
102
92
|
# puts rsync_cmd
|
103
93
|
system(rsync_cmd)
|
104
94
|
|
105
|
-
# Remove excludes
|
95
|
+
# Remove excludes file if needed
|
106
96
|
tmp_exclude.unlink unless @config[:excludes].empty?
|
107
|
-
tmp_pass.unlink unless @config[:pass].empty?
|
108
97
|
|
109
98
|
end
|
110
99
|
|
@@ -112,7 +101,7 @@ module Deploy
|
|
112
101
|
|
113
102
|
def validate
|
114
103
|
|
115
|
-
# Fail without hostname (
|
104
|
+
# Fail without hostname (username is optional)
|
116
105
|
(puts "Error: no hostname set for `#{@name}`"; exit;) if @config[:host].empty?
|
117
106
|
|
118
107
|
# Fail if local/remote paths not set (because they should be in initialize
|
data/lib/deploy/version.rb
CHANGED