capistrano-rsync-local 1.1
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 +2 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +23 -0
- data/LICENSE +20 -0
- data/Makefile +16 -0
- data/README.md +129 -0
- data/Vagrantfile +13 -0
- data/capistrano-rsync-local.gemspec +34 -0
- data/lib/capistrano/rsync.rb +115 -0
- data/lib/capistrano/rsync/scm/base.rb +37 -0
- data/lib/capistrano/rsync/scm/git.rb +33 -0
- data/lib/capistrano/rsync/scm/svn.rb +45 -0
- data/lib/capistrano/rsync/version.rb +5 -0
- data/provision.sh +40 -0
- metadata +82 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: d8e113f8f3985d6de97d1781c7846e94a873334a
|
|
4
|
+
data.tar.gz: 5146c44c34e11c3d5430267b503d34efc591a545
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7af134741ddc04303887c0699fda9ab809059a5749b3a7ed5390b175299979081b418652d219ffaedcd5ba5a10590bb43f0b08eb3a5c2365b250690b93892893
|
|
7
|
+
data.tar.gz: 51d02b90070b9ae18dd76d9b79af7f89cd725521d271f52dc3c695ac71a7e1a847e42cb24ed8292f8778e90a88efe5496d8f7f77bebded33587eaa0c5745dd19
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.2.2
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
## 1.0.2 (Oct 13, 2013)
|
|
2
|
+
- Updates README and code comments.
|
|
3
|
+
|
|
4
|
+
## 1.0.1 (Sep 2, 2013)
|
|
5
|
+
- Updates README and adds implementation details to it.
|
|
6
|
+
|
|
7
|
+
## 1.0.0 (Sep 2, 2013)
|
|
8
|
+
- Makes the `rsync:stage` task public for extending and hooking.
|
|
9
|
+
- Renames `rsync:create_release` to `rsync:release`. Old name still works.
|
|
10
|
+
- Adds optional caching to `rsync_cache` directory on the server.
|
|
11
|
+
|
|
12
|
+
## 0.2.1 (Sep 1, 2013)
|
|
13
|
+
- Fixes starting with no previous local repository cache.
|
|
14
|
+
Note to self: Avoid writing code without integration tests.
|
|
15
|
+
|
|
16
|
+
## 0.2.0 (Sep 1, 2013)
|
|
17
|
+
- Passes user given in `role :app, "user@host"` to `rsync` if set.
|
|
18
|
+
|
|
19
|
+
## 0.1.338 (Sep 1, 2013)
|
|
20
|
+
- Adds gem dependency on Capistrano v3.
|
|
21
|
+
|
|
22
|
+
## 0.1.337 (Sep 1, 2013)
|
|
23
|
+
- First release. Let's get syncing!
|
data/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Capistrano::Rsync
|
|
2
|
+
Copyright (C) 2013 Andri Möll
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU Affero General Public License as published by the Free
|
|
6
|
+
Software Foundation, either version 3 of the License, or any later version.
|
|
7
|
+
|
|
8
|
+
Additional permission under the GNU Affero GPL version 3 section 7:
|
|
9
|
+
If you modify this Program, or any covered work, by linking or
|
|
10
|
+
combining it with other code, such other code is not for that reason
|
|
11
|
+
alone subject to any of the requirements of the GNU Affero GPL version 3.
|
|
12
|
+
|
|
13
|
+
In summary:
|
|
14
|
+
- You can use this program for no cost.
|
|
15
|
+
- You can use this program for both personal and commercial reasons.
|
|
16
|
+
- You do not have to share your own program's code which uses this program.
|
|
17
|
+
- You have to share modifications (e.g bug-fixes) you've made to this program.
|
|
18
|
+
|
|
19
|
+
For the full copy of the GNU Affero General Public License see:
|
|
20
|
+
http://www.gnu.org/licenses.
|
data/Makefile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Capistrano::Rsync for Capistrano v3
|
|
2
|
+
===================================
|
|
3
|
+
[![Gem version][gem-badge]](http://badge.fury.io/rb/capistrano-rsync)
|
|
4
|
+
[gem-badge]: https://badge.fury.io/rb/capistrano-rsync.png
|
|
5
|
+
|
|
6
|
+
**Deploy with Rsync** to your server from any local (or remote) repository when
|
|
7
|
+
using [**Capistrano**](http://www.capistranorb.com/). Saves you from having to
|
|
8
|
+
install Git on your production machine and allows you to customize which files
|
|
9
|
+
you want to deploy. Also allows you to easily precompile things on your local
|
|
10
|
+
machine before deploying.
|
|
11
|
+
|
|
12
|
+
### Tour
|
|
13
|
+
- Works with the new [**Capistrano v3**](http://www.capistranorb.com/) ([source
|
|
14
|
+
code](https://github.com/capistrano/capistrano)) versions `>= 3.0.0pre14` and
|
|
15
|
+
`< 4`.
|
|
16
|
+
- Suitable for deploying any apps, be it Ruby, Rails, Node.js or others.
|
|
17
|
+
- Exclude files from being deployed with Rsync's `--exclude` options.
|
|
18
|
+
- Precompile files or assets easily before deploying, like JavaScript or CSS.
|
|
19
|
+
- Caches your previously deployed code to speed up deployments ~1337%.
|
|
20
|
+
- Currently works only with Git (as does Capistrano v3), so please shout out
|
|
21
|
+
your interest in other SCMs.
|
|
22
|
+
|
|
23
|
+
Using [Mina](http://nadarei.co/mina/) instead of Capistrano? I've built
|
|
24
|
+
[Mina::Rsync](https://github.com/moll/mina-rsync) as well.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Using
|
|
28
|
+
-----
|
|
29
|
+
Install with:
|
|
30
|
+
```
|
|
31
|
+
gem install capistrano-rsync
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Require it at the top of your `Capfile` (or `config/deploy.rb`):
|
|
35
|
+
```ruby
|
|
36
|
+
require "capistrano/rsync"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Set some `rsync_options` to your liking:
|
|
40
|
+
```ruby
|
|
41
|
+
set :rsync_options, %w[--recursive --delete --delete-excluded --exclude .git*]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
And after setting regular Capistrano options, deploy as usual!
|
|
45
|
+
```
|
|
46
|
+
cap deploy
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Implementation
|
|
50
|
+
1. Clones and updates your repository to `rsync_stage` (defaults to
|
|
51
|
+
`tmp/deploy`) on your local machine.
|
|
52
|
+
2. Checks out the branch set in the `branch` variable (defaults to `master`).
|
|
53
|
+
3. If `rsync_cache` set (defaults to `shared/deploy`), rsyncs to that directory
|
|
54
|
+
on the server.
|
|
55
|
+
4. If `rsync_cache` set, copies the content of that directory to a new release
|
|
56
|
+
directory.
|
|
57
|
+
5. If `rsync_cache` is `nil`, rsyncs straight to a new release directory.
|
|
58
|
+
|
|
59
|
+
After that, Capistrano takes over and runs its usual tasks and symlinking.
|
|
60
|
+
|
|
61
|
+
### Exclude files from being deployed
|
|
62
|
+
If you don't want to deploy everything you've committed to your repository, pass
|
|
63
|
+
some `--exclude` options to Rsync:
|
|
64
|
+
```ruby
|
|
65
|
+
set :rsync_options, %w[
|
|
66
|
+
--recursive --delete --delete-excluded
|
|
67
|
+
--exclude .git*
|
|
68
|
+
--exclude .svn*
|
|
69
|
+
--exclude /config/database.yml
|
|
70
|
+
--exclude /test/***
|
|
71
|
+
]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Precompile assets before deploy
|
|
75
|
+
Capistrano::Rsync runs `rsync:stage` before rsyncing. Hook to that like this:
|
|
76
|
+
```ruby
|
|
77
|
+
task :precompile do
|
|
78
|
+
Dir.chdir fetch(:rsync_stage) do
|
|
79
|
+
system "rake", "assets:precompile"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
after "rsync:stage", "precompile"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Deploy release without symlinking the current directory
|
|
87
|
+
```
|
|
88
|
+
cap rsync:release
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
Configuration
|
|
93
|
+
-------------
|
|
94
|
+
Set Capistrano variables with `set name, value`.
|
|
95
|
+
|
|
96
|
+
Name | Default | Description
|
|
97
|
+
--------------|---------|------------
|
|
98
|
+
rsync_scm | `git` | Available options: `git`, `svn`.
|
|
99
|
+
rsync_scm_username | nil | Used for Svn (Optional).
|
|
100
|
+
rsync_scm_password | nil | Used for Svn (Optional).
|
|
101
|
+
repo_url | `.` | The path or URL to a SCM repository to clone from.
|
|
102
|
+
branch | `master` | The Git branch to checkout. This is ignored for Svn.
|
|
103
|
+
rsync_stage | `tmp/deploy` | Path where to clone your repository for staging, checkouting and rsyncing. Can be both relative or absolute.
|
|
104
|
+
rsync_cache | `shared/deploy` | Path where to cache your repository on the server to avoid rsyncing from scratch each time. Can be both relative or absolute.<br> Set to `nil` if you want to disable the cache.
|
|
105
|
+
rsync_options | `[]` | Array of options to pass to `rsync`.
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
License
|
|
109
|
+
-------
|
|
110
|
+
Capistrano::Rsync is released under a *Lesser GNU Affero General Public
|
|
111
|
+
License*, which in summary means:
|
|
112
|
+
|
|
113
|
+
- You **can** use this program for **no cost**.
|
|
114
|
+
- You **can** use this program for **both personal and commercial reasons**.
|
|
115
|
+
- You **do not have to share your own program's code** which uses this program.
|
|
116
|
+
- You **have to share modifications** (e.g bug-fixes) you've made to this
|
|
117
|
+
program.
|
|
118
|
+
|
|
119
|
+
For more convoluted language, see the `LICENSE` file.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
About
|
|
123
|
+
-----
|
|
124
|
+
**[Andri Möll](http://themoll.com)** made this happen.
|
|
125
|
+
[Monday Calendar](https://mondayapp.com) was the reason I needed this.
|
|
126
|
+
|
|
127
|
+
If you find Capistrano::Rsync needs improving, please don't hesitate to type to
|
|
128
|
+
me now at [andri@dot.ee](mailto:andri@dot.ee) or [create an issue
|
|
129
|
+
online](https://github.com/moll/capistrano-rsync/issues).
|
data/Vagrantfile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# -*- mode: ruby -*-
|
|
2
|
+
# vi: set ft=ruby :
|
|
3
|
+
|
|
4
|
+
Vagrant.configure(2) do |config|
|
|
5
|
+
config.ssh.insert_key = false
|
|
6
|
+
config.vm.box = 'box-cutter/ubuntu1504'
|
|
7
|
+
|
|
8
|
+
config.vm.provider 'virtualbox' do |vb|
|
|
9
|
+
vb.name = 'gem-capistrano-rsync'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
config.vm.provision :shell, path: 'provision.sh', privileged: false
|
|
13
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require File.expand_path('../lib/capistrano/rsync/version', __FILE__)
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |gem|
|
|
4
|
+
gem.name = 'capistrano-rsync-local'
|
|
5
|
+
gem.version = Capistrano::Rsync::VERSION
|
|
6
|
+
gem.homepage = 'https://github.com/tonkonogov/capistrano-rsync'
|
|
7
|
+
gem.summary = <<-end.strip.gsub(/\s*\n\s*/, " ")
|
|
8
|
+
Deploy with Rsync from any local (or remote) repository.
|
|
9
|
+
Capistrano v3 ready!
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
gem.description = <<-end.strip.gsub(/\s*?\n(\n?)\s*/, " \\1\\1")
|
|
13
|
+
Deploy with Rsync to your server from any local (or remote) repository.
|
|
14
|
+
|
|
15
|
+
Saves you the need to install Git on your production machine and deploy all
|
|
16
|
+
of your development files each time!
|
|
17
|
+
|
|
18
|
+
Works with the new Capistrano v3!
|
|
19
|
+
Suitable for deploying any apps, be it Ruby or Node.js.
|
|
20
|
+
Initially gem has been developed by Moll (https://github.com/moll/capistrano-rsync).
|
|
21
|
+
Scm support is introduced by Seantan (https://github.com/seantan/capistrano-rsync).
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
gem.author = 'Dmitry Tonkonogov'
|
|
25
|
+
gem.email = 'omun.spambox@gmail.com'
|
|
26
|
+
gem.license = "LAGPL"
|
|
27
|
+
|
|
28
|
+
gem.files = `git ls-files`.split($/)
|
|
29
|
+
gem.executables = gem.files.grep(/^bin\//).map(&File.method(:basename))
|
|
30
|
+
gem.test_files = gem.files.grep(/^spec\//)
|
|
31
|
+
gem.require_paths = ['lib']
|
|
32
|
+
|
|
33
|
+
gem.add_dependency 'capistrano', '>= 3.0.0.pre14', '< 4'
|
|
34
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
require File.expand_path("../rsync/version", __FILE__)
|
|
2
|
+
require File.expand_path("../rsync/scm/base", __FILE__)
|
|
3
|
+
require File.expand_path("../rsync/scm/git", __FILE__)
|
|
4
|
+
require File.expand_path("../rsync/scm/svn", __FILE__)
|
|
5
|
+
|
|
6
|
+
# NOTE: Please don't depend on tasks without a description (`desc`) as they
|
|
7
|
+
# might change between minor or patch version releases. They make up the
|
|
8
|
+
# private API and internals of Capistrano::Rsync. If you think something should
|
|
9
|
+
# be public for extending and hooking, please let me know!
|
|
10
|
+
|
|
11
|
+
rsync_cache = lambda do
|
|
12
|
+
cache = fetch(:rsync_cache)
|
|
13
|
+
cache = deploy_to + "/" + cache if cache && cache !~ /^\//
|
|
14
|
+
cache
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
scm_instance = lambda do
|
|
18
|
+
scm_class = Capistrano::Rsync::Scm.const_get(:"#{fetch(:rsync_scm).capitalize}")
|
|
19
|
+
scm_class.new(self)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
Rake::Task["load:defaults"].enhance ["rsync:defaults"]
|
|
23
|
+
Rake::Task["deploy:check"].enhance ["rsync:hook_scm"]
|
|
24
|
+
Rake::Task["deploy:updating"].enhance ["rsync:hook_scm"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
desc "Stage and rsync to the server (or its cache)."
|
|
28
|
+
task :rsync => %w[rsync:stage] do
|
|
29
|
+
roles(:all).each do |role|
|
|
30
|
+
user = role.user + "@" if !role.user.nil?
|
|
31
|
+
|
|
32
|
+
rsync = %w[rsync]
|
|
33
|
+
rsync.concat fetch(:rsync_options)
|
|
34
|
+
rsync << fetch(:rsync_stage) + "/"
|
|
35
|
+
rsync << "#{user}#{role.hostname}:#{rsync_cache.call || release_path}"
|
|
36
|
+
|
|
37
|
+
Kernel.system *rsync
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
namespace :rsync do
|
|
42
|
+
desc "Load rsync default options."
|
|
43
|
+
task :defaults do
|
|
44
|
+
set :rsync_options, []
|
|
45
|
+
set :rsync_copy, "rsync --archive --acls --xattrs"
|
|
46
|
+
|
|
47
|
+
# Scm to use.
|
|
48
|
+
set :rsync_scm, "git"
|
|
49
|
+
|
|
50
|
+
# Stage is used on your local machine for rsyncing from.
|
|
51
|
+
set :rsync_stage, "tmp/deploy"
|
|
52
|
+
|
|
53
|
+
# Cache is used on the server to copy files to from to the release directory.
|
|
54
|
+
# Saves you rsyncing your whole app folder each time. If you nil rsync_cache,
|
|
55
|
+
# Capistrano::Rsync will sync straight to the release path.
|
|
56
|
+
set :rsync_cache, "shared/deploy"
|
|
57
|
+
set :rsync_local_repo, false
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# internally needed by capistrano's "deploy.rake"
|
|
61
|
+
task :set_current_revision do
|
|
62
|
+
Dir.chdir fetch(:rsync_stage) do
|
|
63
|
+
cmd = scm_instance.call.get_current_revision_cmd
|
|
64
|
+
rev = `#{cmd}`
|
|
65
|
+
set :current_revision, rev
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
task :hook_scm do
|
|
70
|
+
Rake::Task.define_task("#{scm}:check") do
|
|
71
|
+
invoke "rsync:check"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
Rake::Task.define_task("#{scm}:create_release") do
|
|
75
|
+
invoke "rsync:release"
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
task :check do
|
|
80
|
+
# Everything's a-okay inherently!
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
desc "Create the stage repository in a local directory."
|
|
84
|
+
task :create_stage do
|
|
85
|
+
next if File.directory?(fetch(:rsync_stage)) || fetch(:rsync_local_repo)
|
|
86
|
+
scm_instance.call.create_stage_cmds.each do |cmd|
|
|
87
|
+
Kernel.system *cmd
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
desc "Update and freshen the stage repository."
|
|
92
|
+
task :stage => %w[create_stage] do
|
|
93
|
+
next if fetch(:rsync_local_repo)
|
|
94
|
+
Dir.chdir fetch(:rsync_stage) do
|
|
95
|
+
scm_instance.call.update_stage_cmds.each do |cmd|
|
|
96
|
+
Kernel.system *cmd
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
desc "Copy the code to the releases directory."
|
|
102
|
+
task :release => %w[rsync] do
|
|
103
|
+
# Skip copying if we've already synced straight to the release directory.
|
|
104
|
+
next if !fetch(:rsync_cache)
|
|
105
|
+
|
|
106
|
+
copy = %(#{fetch(:rsync_copy)} "#{rsync_cache.call}/" "#{release_path}/")
|
|
107
|
+
on roles(:all) do |host|
|
|
108
|
+
execute copy
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Matches the naming scheme of git tasks.
|
|
113
|
+
# Plus was part of the public API in Capistrano::Rsync <= v0.2.1.
|
|
114
|
+
task :create_release => %w[release]
|
|
115
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Capistrano
|
|
2
|
+
module Rsync
|
|
3
|
+
module Scm
|
|
4
|
+
|
|
5
|
+
# Abstract class to be inherited with the abstract methods to be implemented.
|
|
6
|
+
# Provides the capistrano context.
|
|
7
|
+
class Base
|
|
8
|
+
attr_reader :context
|
|
9
|
+
|
|
10
|
+
def initialize(context)
|
|
11
|
+
@context = context
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Returns command to obtain the current revision
|
|
15
|
+
def get_current_revision_cmd
|
|
16
|
+
throw NotImplementedError
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns array of commands required to create the stage respository.
|
|
20
|
+
# Skipped if rsync_stage directory already exists.
|
|
21
|
+
def create_stage_cmds
|
|
22
|
+
throw NotImplementedError
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Returns array of commands required to update the stage repository
|
|
26
|
+
# and prepare it to be ready to be rsynced to rsync_cache.
|
|
27
|
+
#
|
|
28
|
+
# Commands will be executed in the rsync_stage directory.
|
|
29
|
+
def update_stage_cmds
|
|
30
|
+
throw NotImplementedError
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Capistrano
|
|
2
|
+
module Rsync
|
|
3
|
+
module Scm
|
|
4
|
+
|
|
5
|
+
class Git < Capistrano::Rsync::Scm::Base
|
|
6
|
+
attr_reader :context
|
|
7
|
+
|
|
8
|
+
def get_current_revision_cmd
|
|
9
|
+
"git rev-parse HEAD"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create_stage_cmds
|
|
13
|
+
cmd = []
|
|
14
|
+
clone = %W[git clone]
|
|
15
|
+
clone << context.fetch(:repo_url, ".")
|
|
16
|
+
clone << context.fetch(:rsync_stage)
|
|
17
|
+
cmd << clone
|
|
18
|
+
cmd
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def update_stage_cmds
|
|
22
|
+
cmd = []
|
|
23
|
+
update = %W[git fetch --quiet --all --prune]
|
|
24
|
+
cmd << update
|
|
25
|
+
checkout = %W[git reset --hard origin/#{fetch(:branch)}]
|
|
26
|
+
cmd << checkout
|
|
27
|
+
cmd
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Capistrano
|
|
2
|
+
module Rsync
|
|
3
|
+
module Scm
|
|
4
|
+
|
|
5
|
+
class Svn < Capistrano::Rsync::Scm::Base
|
|
6
|
+
attr_reader :context
|
|
7
|
+
|
|
8
|
+
def get_current_revision_cmd
|
|
9
|
+
"svn info | grep '^Revision:' | sed -e 's/^Revision: //'"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create_stage_cmds
|
|
13
|
+
cmd = []
|
|
14
|
+
|
|
15
|
+
clone = %W[svn checkout]
|
|
16
|
+
clone << context.fetch(:repo_url, ".")
|
|
17
|
+
clone << context.fetch(:rsync_stage)
|
|
18
|
+
|
|
19
|
+
clone << %W[--username #{context.fetch(:rsync_scm_username)}] if context.fetch(:rsync_scm_username)
|
|
20
|
+
clone << %W[--password #{context.fetch(:rsync_scm_password)}] if context.fetch(:rsync_scm_password)
|
|
21
|
+
|
|
22
|
+
cmd << clone.flatten
|
|
23
|
+
|
|
24
|
+
cmd
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update_stage_cmds
|
|
28
|
+
cmd = []
|
|
29
|
+
|
|
30
|
+
update = %W[svn update]
|
|
31
|
+
update << %W[--username #{context.fetch(:rsync_scm_username)}] if context.fetch(:rsync_scm_username)
|
|
32
|
+
update << %W[--password #{context.fetch(:rsync_scm_password)}] if context.fetch(:rsync_scm_password)
|
|
33
|
+
|
|
34
|
+
cmd << update.flatten
|
|
35
|
+
|
|
36
|
+
checkout = %W[svn revert --recursive .]
|
|
37
|
+
cmd << checkout
|
|
38
|
+
|
|
39
|
+
cmd
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/provision.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
export LANGUAGE=en_US.UTF-8
|
|
3
|
+
export LANG=en_US.UTF-8
|
|
4
|
+
export LC_ALL=en_US.UTF-8
|
|
5
|
+
sudo locale-gen en_US.UTF-8
|
|
6
|
+
sudo dpkg-reconfigure locales
|
|
7
|
+
|
|
8
|
+
sudo update-rc.d -f apparmor remove
|
|
9
|
+
sudo apt-get remove -y apparmor apparmor-utils
|
|
10
|
+
|
|
11
|
+
sudo apt-get -y update
|
|
12
|
+
sudo /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::=\"--force-confnew\" --force-yes -fuy upgrade"
|
|
13
|
+
sudo apt-get install -y software-properties-common python-software-properties
|
|
14
|
+
sudo apt-get install ntp ntpdate -y
|
|
15
|
+
sudo apt-get install curl git-core g++ libssl-dev apache2-utils screen vim libsqlite3-dev -y
|
|
16
|
+
sudo apt-get install automake autoconf -y
|
|
17
|
+
|
|
18
|
+
curl https://gist.githubusercontent.com/turadg/840663/raw/46cceea5bc1f73098fcf5e099d91744b24dabdc7/rake.sh > ~/.rake_complete
|
|
19
|
+
|
|
20
|
+
cat >> ~/.bash_profile <<ENDOFFILE
|
|
21
|
+
source ~/.bashrc
|
|
22
|
+
|
|
23
|
+
export LANGUAGE=en_US.UTF-8
|
|
24
|
+
export LANG=en_US.UTF-8
|
|
25
|
+
export LC_ALL=en_US.UTF-8
|
|
26
|
+
export RUBY_VERSION=2.2.2
|
|
27
|
+
ENDOFFILE
|
|
28
|
+
|
|
29
|
+
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
|
|
30
|
+
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
|
|
31
|
+
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
|
|
32
|
+
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
|
|
33
|
+
|
|
34
|
+
source ~/.bash_profile
|
|
35
|
+
|
|
36
|
+
rbenv install ${RUBY_VERSION}
|
|
37
|
+
rbenv local ${RUBY_VERSION}
|
|
38
|
+
gem update --system
|
|
39
|
+
gem install bundler -N
|
|
40
|
+
rbenv local --unset
|
metadata
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: capistrano-rsync-local
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '1.1'
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Dmitry Tonkonogov
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: capistrano
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 3.0.0.pre14
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '4'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: 3.0.0.pre14
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '4'
|
|
33
|
+
description: "Deploy with Rsync to your server from any local (or remote) repository.
|
|
34
|
+
\n\nSaves you the need to install Git on your production machine and deploy all
|
|
35
|
+
of your development files each time! \n\nWorks with the new Capistrano v3! Suitable
|
|
36
|
+
for deploying any apps, be it Ruby or Node.js. Initially gem has been developed
|
|
37
|
+
by Moll (https://github.com/moll/capistrano-rsync). Scm support is introduced by
|
|
38
|
+
Seantan (https://github.com/seantan/capistrano-rsync)."
|
|
39
|
+
email: omun.spambox@gmail.com
|
|
40
|
+
executables: []
|
|
41
|
+
extensions: []
|
|
42
|
+
extra_rdoc_files: []
|
|
43
|
+
files:
|
|
44
|
+
- ".gitignore"
|
|
45
|
+
- ".ruby-version"
|
|
46
|
+
- CHANGELOG.md
|
|
47
|
+
- LICENSE
|
|
48
|
+
- Makefile
|
|
49
|
+
- README.md
|
|
50
|
+
- Vagrantfile
|
|
51
|
+
- capistrano-rsync-local.gemspec
|
|
52
|
+
- lib/capistrano/rsync.rb
|
|
53
|
+
- lib/capistrano/rsync/scm/base.rb
|
|
54
|
+
- lib/capistrano/rsync/scm/git.rb
|
|
55
|
+
- lib/capistrano/rsync/scm/svn.rb
|
|
56
|
+
- lib/capistrano/rsync/version.rb
|
|
57
|
+
- provision.sh
|
|
58
|
+
homepage: https://github.com/tonkonogov/capistrano-rsync
|
|
59
|
+
licenses:
|
|
60
|
+
- LAGPL
|
|
61
|
+
metadata: {}
|
|
62
|
+
post_install_message:
|
|
63
|
+
rdoc_options: []
|
|
64
|
+
require_paths:
|
|
65
|
+
- lib
|
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: '0'
|
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
requirements: []
|
|
77
|
+
rubyforge_project:
|
|
78
|
+
rubygems_version: 2.4.7
|
|
79
|
+
signing_key:
|
|
80
|
+
specification_version: 4
|
|
81
|
+
summary: Deploy with Rsync from any local (or remote) repository. Capistrano v3 ready!
|
|
82
|
+
test_files: []
|