deb_deploy 1.0.0 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/lib/deb_deploy.rb +55 -4
- metadata +20 -39
data/README.md
CHANGED
@@ -33,6 +33,10 @@ the directory containing your debian packages that will be rsynced to the server
|
|
33
33
|
|
34
34
|
the temp directory on the target machine to hold the packages before installing.
|
35
35
|
|
36
|
+
set :debian_package_manager, 'dpkg'
|
37
|
+
|
38
|
+
the debian package manager to use (one of [dpkg, apt]).
|
39
|
+
|
36
40
|
set :debian_stream_log, false
|
37
41
|
|
38
42
|
determines whether to stream the command output.
|
data/lib/deb_deploy.rb
CHANGED
@@ -9,6 +9,44 @@ Capistrano::Configuration.instance.load do
|
|
9
9
|
set :debian_package_manager, 'dpkg'
|
10
10
|
set :debian_stream_log, false
|
11
11
|
|
12
|
+
namespace :bootstrap do
|
13
|
+
desc "prepares remote hosts for debian deployment based on selected package manager (dpkg or apt)"
|
14
|
+
task :default do
|
15
|
+
case debian_package_manager
|
16
|
+
when "dpkg"
|
17
|
+
dpkg
|
18
|
+
when "apt"
|
19
|
+
apt
|
20
|
+
else
|
21
|
+
raise "#{debian_package_manager} is an unsupported package manager. Only dpkg and apt are supported"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "creates directories and installs dependencies"
|
26
|
+
task :dpkg do
|
27
|
+
run "mkdir -p #{debian_target}"
|
28
|
+
sudo "apt-get update"
|
29
|
+
sudo "apt-get install -y rsync"
|
30
|
+
logger.debug "Dependencies installed"
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "creates local debian repository for apt-get"
|
34
|
+
task :apt do
|
35
|
+
run "mkdir -p #{debian_target}"
|
36
|
+
|
37
|
+
sudo "apt-get update"
|
38
|
+
sudo "apt-get install -y rsync dpkg-dev gzip"
|
39
|
+
|
40
|
+
logger.debug "Dependencies installed"
|
41
|
+
|
42
|
+
run "echo 'deb file:#{debian_target} ./' > #{debian_target}/deb_deploy.list"
|
43
|
+
sudo "mv #{debian_target}/deb_deploy.list /etc/apt/sources.list.d/deb_deploy.list"
|
44
|
+
|
45
|
+
logger.debug "Set up local debian repository"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
12
50
|
desc "copies debian packages to the server"
|
13
51
|
task :copy_packages do
|
14
52
|
targets = find_servers_for_task(current_task)
|
@@ -37,9 +75,23 @@ Capistrano::Configuration.instance.load do
|
|
37
75
|
end
|
38
76
|
|
39
77
|
begin
|
40
|
-
|
41
|
-
|
42
|
-
|
78
|
+
list_packages_cmd = "zcat #{debian_target}/Packages.gz | grep Package | cut -d ' ' -f2 | sed ':a;N;$!ba;s/\n/ /g'"
|
79
|
+
case debian_package_manager
|
80
|
+
when "dpkg"
|
81
|
+
sudo "dpkg -R -i #{debian_target}" do |channel, stream, data|
|
82
|
+
log.collect(channel[:host], data)
|
83
|
+
end
|
84
|
+
when "apt"
|
85
|
+
sudo "dpkg-scanpackages #{debian_target} /dev/null | gzip -9c > #{debian_target}/Packages.gz"
|
86
|
+
sudo "apt-get update"
|
87
|
+
|
88
|
+
run "#{list_packages_cmd} | xargs #{sudo} apt-get -y --allow-unauthenticated install" do |channel, stream, data|
|
89
|
+
log.collect(channel[:host], data)
|
90
|
+
end
|
91
|
+
else
|
92
|
+
raise "#{debian_package_manager} is an unsupported package manager. Only dpkg and apt are supported"
|
93
|
+
end
|
94
|
+
|
43
95
|
logger.debug "Package installation complete."
|
44
96
|
ensure
|
45
97
|
log.collected
|
@@ -48,7 +100,6 @@ Capistrano::Configuration.instance.load do
|
|
48
100
|
|
49
101
|
desc "copies and installs debian packages to the server"
|
50
102
|
task :deploy do
|
51
|
-
run "mkdir -p #{debian_target}"
|
52
103
|
copy_packages
|
53
104
|
install_packages
|
54
105
|
end
|
metadata
CHANGED
@@ -1,33 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: deb_deploy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.3
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Jeroen Rosenberg
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2012-04-18 00:00:00 +02:00
|
18
|
-
default_executable:
|
12
|
+
date: 2012-05-02 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
14
|
description: See http://github.com/jeroenr/deb_deploy
|
22
|
-
email:
|
15
|
+
email:
|
23
16
|
- jeroen.rosenberg@gmail.com
|
24
17
|
executables: []
|
25
|
-
|
26
18
|
extensions: []
|
27
|
-
|
28
19
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
20
|
+
files:
|
31
21
|
- README.md
|
32
22
|
- Rakefile
|
33
23
|
- lib/deb_deploy.rb
|
@@ -35,37 +25,28 @@ files:
|
|
35
25
|
- lib/deb_deploy/scp.rb
|
36
26
|
- lib/deb_deploy/logger/batch.rb
|
37
27
|
- lib/deb_deploy/logger/stream.rb
|
38
|
-
has_rdoc: true
|
39
28
|
homepage: http://github.com/jeroenr/deb_deploy
|
40
29
|
licenses: []
|
41
|
-
|
42
30
|
post_install_message:
|
43
31
|
rdoc_options: []
|
44
|
-
|
45
|
-
require_paths:
|
32
|
+
require_paths:
|
46
33
|
- lib
|
47
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
35
|
none: false
|
49
|
-
requirements:
|
50
|
-
- -
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
|
53
|
-
|
54
|
-
version: "0"
|
55
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
41
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
- 0
|
62
|
-
version: "0"
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
63
46
|
requirements: []
|
64
|
-
|
65
47
|
rubyforge_project:
|
66
|
-
rubygems_version: 1.
|
48
|
+
rubygems_version: 1.8.23
|
67
49
|
signing_key:
|
68
50
|
specification_version: 3
|
69
51
|
summary: Masterless puppet with capistrano
|
70
52
|
test_files: []
|
71
|
-
|