rsync-deploy 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +129 -13
- data/lib/deploy/environment.rb +17 -13
- data/lib/deploy/version.rb +1 -1
- data/rsync-deploy.gemspec +2 -2
- metadata +5 -11
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MmRmZGVkYWUwMzkwNTE2YzA2Yjc4YTQ3NTQ0NWRjMDQ3OTY0MTgyMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmRmMTBkOGNjNjQxZTAxYjE1ZGRhNTU4MTdmZTkzN2JjMWVkYjMyZg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NmU2MGE1MjQyOTA2ZGVjNjQ3Nzc5YWFhMmY3NmJiYzRhYTlhYzc1YjljMDFm
|
10
|
+
NDA5NmQwMjUwMDRhODcxOGQzZmNjZDJmYmQ4OGUzZWJiZGIwN2ZiYzg2MTg5
|
11
|
+
MGUxZWJmZWEyZmM0YTQ3YTM1YjAxMzU1NTA4NzI3MDkyMjg0ZjU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjQxNTNkY2YzZDlhZDRjZTIwNTIyMzEwMGQzOTdlODc1MmEyNTZmNDYyZjhk
|
14
|
+
YjZkMDBjODI0NGYzMTM5ZDJlZjM1MDRiYWMyZjMyMmVmNmY0Y2FjMGY1YTFh
|
15
|
+
ZGEwMjNhNTUyMjAyMDc5NjU4Y2Q5OGE4NDdlN2M0NjIxNDU0ZDI=
|
data/README.md
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
**_Note: This tool is still in development and likely will not work in many cases._**
|
2
|
-
|
3
1
|
# Deploy
|
4
2
|
|
5
3
|
**Deploy is an rsync deployment tool built using Ruby**
|
@@ -14,6 +12,31 @@ To install just run:
|
|
14
12
|
gem install rsync-deploy
|
15
13
|
```
|
16
14
|
|
15
|
+
Once you've installed the gem, just navigate to your project directory and run:
|
16
|
+
|
17
|
+
```
|
18
|
+
deploy install
|
19
|
+
```
|
20
|
+
|
21
|
+
This will create a `deploy.yml` file that controls how the deployment should take place.
|
22
|
+
|
23
|
+
Fill in your server details. For example:
|
24
|
+
|
25
|
+
```
|
26
|
+
# Server
|
27
|
+
server_name:
|
28
|
+
host: "server.com"
|
29
|
+
user: "user"
|
30
|
+
path:
|
31
|
+
local: "deploy/"
|
32
|
+
remote: "www/"
|
33
|
+
```
|
34
|
+
|
35
|
+
Once your `deploy.yml` is set up, simply deploy by running:
|
36
|
+
|
37
|
+
```
|
38
|
+
deploy
|
39
|
+
```
|
17
40
|
|
18
41
|
## Commands
|
19
42
|
|
@@ -35,30 +58,123 @@ Or to multiple servers, like this:
|
|
35
58
|
deploy dev staging production
|
36
59
|
```
|
37
60
|
|
38
|
-
|
61
|
+
#### deploy help
|
62
|
+
|
63
|
+
Will output a list of all commands
|
64
|
+
|
39
65
|
|
40
|
-
|
66
|
+
## Config
|
41
67
|
|
42
|
-
|
68
|
+
Configuration options are specified in a YAML file called `deploy.yml` created by running `deploy install` in your project directory.
|
69
|
+
|
70
|
+
Example:
|
71
|
+
|
72
|
+
```
|
73
|
+
server_name:
|
74
|
+
host: "example.com"
|
75
|
+
user: "username"
|
76
|
+
sync: true
|
77
|
+
verbose: false
|
78
|
+
path:
|
79
|
+
local: "/"
|
80
|
+
remote: "www/
|
81
|
+
excludes:
|
82
|
+
- ".DS_Store"
|
83
|
+
- "resources/"
|
84
|
+
- "deploy.yml"
|
43
85
|
|
44
86
|
```
|
87
|
+
|
88
|
+
Below is a list of all available configuration options.
|
89
|
+
|
90
|
+
### host
|
91
|
+
|
92
|
+
- Type: `String`
|
93
|
+
- Default: `none`
|
94
|
+
- Required: `Yes`
|
95
|
+
|
96
|
+
The server that the files should be deployed to.
|
97
|
+
|
98
|
+
### user
|
99
|
+
|
100
|
+
- Type: `String`
|
101
|
+
- Default: `none`
|
102
|
+
|
103
|
+
The username to login to the server. If no username is set, your computer account username will be used. Passwords will need to be typed in manually, however, SSH keys will be used if available.
|
104
|
+
|
105
|
+
### sync
|
106
|
+
|
107
|
+
- Type: `Boolean`
|
108
|
+
- Default: `true`
|
109
|
+
|
110
|
+
Whether or not to delete files on the server that aren't present locally.
|
111
|
+
|
112
|
+
### verbose
|
113
|
+
|
114
|
+
- Type: `Boolean`
|
115
|
+
- Default: `false`
|
116
|
+
|
117
|
+
Whether or not to run the uploads verbosely.
|
118
|
+
|
119
|
+
### path.local
|
120
|
+
|
121
|
+
- Type: `String`
|
122
|
+
- Default: `none`
|
123
|
+
|
124
|
+
The local folder that you want to upload to the server. If you don't set anything, the entire folder of your project will be uploaded.
|
125
|
+
|
126
|
+
### path.remote
|
127
|
+
|
128
|
+
- Type: `String`
|
129
|
+
- Default: `none`
|
130
|
+
|
131
|
+
The remote folder where your files will be uploaded. If you don't set anything, your files will be uploaded to the user root of your server. Setting this is **highly recommended!**
|
132
|
+
|
133
|
+
### exclude
|
134
|
+
|
135
|
+
- Type: `Array`
|
136
|
+
- Default: `none`
|
137
|
+
|
138
|
+
Exclude files that you don't want on your server. You can target files, directories and file types.
|
139
|
+
|
140
|
+
Individual files: `exclude: ["README.md", "package.json", "path/to/file.js"]`
|
141
|
+
Directories: `exclude: ["resources/", "test/", "path/to/dir/"]`
|
142
|
+
File types: `exclude: ["*.yml", "*.json", "path/to/*.txt"]`
|
143
|
+
|
144
|
+
## Deploying to multiple servers/locations
|
145
|
+
|
146
|
+
You can create as many different deploy locations as you'd like by adding them to the `deploy.yml` file. For example:
|
147
|
+
|
148
|
+
```
|
149
|
+
# Development server
|
150
|
+
staging:
|
151
|
+
host: "staging.example.com"
|
152
|
+
user: "staging-username"
|
153
|
+
path:
|
154
|
+
local: "build/"
|
155
|
+
remote: "www/staging.server.com/"
|
156
|
+
|
157
|
+
# Production server
|
45
158
|
production:
|
46
|
-
host: "
|
47
|
-
user: "username"
|
159
|
+
host: "example.com"
|
160
|
+
user: "prod-username"
|
48
161
|
path:
|
49
|
-
local: "
|
50
|
-
remote: "
|
162
|
+
local: "build/"
|
163
|
+
remote: "www/server.com"
|
51
164
|
```
|
52
165
|
|
53
|
-
|
166
|
+
You can deploy them by setting the environment(s) that you want to upload to:
|
54
167
|
|
55
168
|
```
|
56
|
-
deploy production
|
169
|
+
deploy staging production
|
57
170
|
```
|
58
171
|
|
59
|
-
|
172
|
+
If you don't specify an environment, it's assumed that the first environment in `deploy.yml` should be used. So, with the above configuration, running `deploy` would upload to `staging` by default.
|
173
|
+
|
174
|
+
|
175
|
+
## Mentions
|
60
176
|
|
61
|
-
Deploy is almost identical to [DPLOY](https://github.com/LeanMeanFightingMachine/dploy), which was in turn inspired by [dandelion](https://github.com/scttnlsn/dandelion). However, Deploy
|
177
|
+
Deploy is almost identical to [DPLOY](https://github.com/LeanMeanFightingMachine/dploy), which was in turn inspired by [dandelion](https://github.com/scttnlsn/dandelion). However, Deploy doesn't require that you use git (or any version control for that matter). Separating deployments and version control helps avoid littering your commit history with messages like `bug fix` and `dang, forgot to adjust the config` and `another typo` and so on.
|
62
178
|
|
63
179
|
|
64
180
|
## Uninstall
|
data/lib/deploy/environment.rb
CHANGED
@@ -16,8 +16,8 @@ module Deploy
|
|
16
16
|
@options = { :verbose => false, :sync => true }
|
17
17
|
|
18
18
|
@config[:host] = hash['host']
|
19
|
-
@config[:user] = hash['user']
|
20
|
-
@config[:pass] = hash['pass']
|
19
|
+
@config[:user] = hash['user'] || ''
|
20
|
+
@config[:pass] = hash['pass'] || ''
|
21
21
|
|
22
22
|
@config[:local] = hash['path']['local'].gsub(/\s+/, "")
|
23
23
|
@config[:remote] = hash['path']['remote'].gsub(/\s+/, "")
|
@@ -52,21 +52,26 @@ module Deploy
|
|
52
52
|
@config[:excludes].each do |ex|
|
53
53
|
tmp_exclude.puts ex
|
54
54
|
end
|
55
|
+
# Don't upload the deploy configuration file
|
56
|
+
tmp_exclude.puts Deploy::CONFIG_PATH
|
55
57
|
tmp_exclude.close
|
56
58
|
end
|
57
59
|
|
58
|
-
rsync_cmd = 'rsync -a'
|
59
|
-
rsync_cmd += 'v' if @options[:verbose]
|
60
|
-
rsync_cmd += 'z'
|
60
|
+
rsync_cmd = 'rsync -a' # Always keep permissions
|
61
|
+
rsync_cmd += 'v' if @options[:verbose] # Verbose if requested
|
62
|
+
rsync_cmd += 'z' # Always zip files
|
61
63
|
|
62
|
-
rsync_cmd += ' --progress'
|
63
|
-
rsync_cmd += ' --force --delete' unless
|
64
|
-
rsync_cmd += " --exclude-from=#{tmp_exclude.path}"
|
64
|
+
rsync_cmd += ' --progress' # Always show progress
|
65
|
+
rsync_cmd += ' --force --delete' unless @options[:sync] == false # Sync unless explicitly requested
|
66
|
+
rsync_cmd += " --exclude-from=#{tmp_exclude.path}" unless @config[:excludes].empty? # Include exclude file if it exists
|
65
67
|
rsync_cmd += " -e \"ssh -p22\""
|
66
68
|
|
67
|
-
rsync_cmd += " " + `pwd`.gsub(/\s+/, "") + "#{@config[:local]}"
|
68
|
-
|
69
|
-
rsync_cmd += "
|
69
|
+
rsync_cmd += " " + `pwd`.gsub(/\s+/, "") + "#{@config[:local]}" # The local path from the current directory
|
70
|
+
|
71
|
+
rsync_cmd += " " # Adding a space here means we don't need an if/else statement
|
72
|
+
rsync_cmd += "#{@config[:user]}@" unless @config[:user].empty? # Only add user if not empty
|
73
|
+
rsync_cmd += "#{@config[:host]}:" # Add host
|
74
|
+
rsync_cmd += "~#{@config[:remote]}" # Add remote
|
70
75
|
|
71
76
|
# Run the command
|
72
77
|
# puts rsync_cmd
|
@@ -81,9 +86,8 @@ module Deploy
|
|
81
86
|
|
82
87
|
def validate
|
83
88
|
|
84
|
-
# Fail without hostname
|
89
|
+
# Fail without hostname (user/password are optional)
|
85
90
|
raise "Error: no hostname set for #{@name}" if @config[:host].empty?
|
86
|
-
raise "Error: no user set for #{@name}" if @config[:user].empty?
|
87
91
|
|
88
92
|
# Fail if local/remote paths not set (because they should be in initialize
|
89
93
|
# even if they're not set in the yml config file.
|
data/lib/deploy/version.rb
CHANGED
data/rsync-deploy.gemspec
CHANGED
@@ -15,9 +15,9 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.authors = ["Ross Zurowski"]
|
16
16
|
s.email = 'ross@rosszurowski.com'
|
17
17
|
s.homepage = 'https://github.com/rosszurowski/deploy'
|
18
|
-
s.license = '
|
18
|
+
s.license = 'MIT'
|
19
19
|
|
20
|
-
s.require_paths = [
|
20
|
+
s.require_paths = ['lib']
|
21
21
|
|
22
22
|
s.add_development_dependency "bundler", "~> 1.3"
|
23
23
|
s.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsync-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.11
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ross Zurowski
|
@@ -14,7 +13,6 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -62,27 +57,26 @@ files:
|
|
62
57
|
- rsync-deploy.gemspec
|
63
58
|
homepage: https://github.com/rosszurowski/deploy
|
64
59
|
licenses:
|
65
|
-
-
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
66
62
|
post_install_message:
|
67
63
|
rdoc_options: []
|
68
64
|
require_paths:
|
69
65
|
- lib
|
70
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
67
|
requirements:
|
73
68
|
- - ! '>='
|
74
69
|
- !ruby/object:Gem::Version
|
75
70
|
version: '0'
|
76
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
72
|
requirements:
|
79
73
|
- - ! '>='
|
80
74
|
- !ruby/object:Gem::Version
|
81
75
|
version: '0'
|
82
76
|
requirements: []
|
83
77
|
rubyforge_project:
|
84
|
-
rubygems_version: 1.
|
78
|
+
rubygems_version: 2.1.11
|
85
79
|
signing_key:
|
86
|
-
specification_version:
|
80
|
+
specification_version: 4
|
87
81
|
summary: Deployments based on rsync
|
88
82
|
test_files: []
|