tele 0.1.0 → 0.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.
- data/README +4 -1
- data/bin/tele +19 -0
- data/tele.gemspec +1 -1
- data/test/tele.rb +31 -2
- metadata +5 -3
data/README
CHANGED
@@ -55,7 +55,7 @@ DESCRIPTION
|
|
55
55
|
The following options are available:
|
56
56
|
|
57
57
|
-h
|
58
|
-
|
58
|
+
Displays this help message.
|
59
59
|
|
60
60
|
-d path
|
61
61
|
Sets path as the directory where tele will search for scripts and
|
@@ -69,6 +69,9 @@ DESCRIPTION
|
|
69
69
|
Runs every recipe script on the servers declared in layout.json. The
|
70
70
|
exit code must be 0 if the command was successful.
|
71
71
|
|
72
|
+
tail
|
73
|
+
Displays standard output and standard error from each running recipe.
|
74
|
+
|
72
75
|
USAGE
|
73
76
|
To provision two servers called `server1` and `server2` with Redis,
|
74
77
|
starting from scratch:
|
data/bin/tele
CHANGED
@@ -20,6 +20,8 @@ def recipes_for(assigned_roles)
|
|
20
20
|
recipes.push(name)
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
recipes.uniq!
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
@@ -65,6 +67,10 @@ out = Module.new do
|
|
65
67
|
puts "\033[01;32mOK\033[00m"
|
66
68
|
end
|
67
69
|
|
70
|
+
def self.log(match)
|
71
|
+
puts "\033[1;30m#{match[:date]} \033[1;33m#{match[:who]}\033[00m #{match[:message]}"
|
72
|
+
end
|
73
|
+
|
68
74
|
def self.unknown
|
69
75
|
puts "?"
|
70
76
|
end
|
@@ -90,6 +96,19 @@ Clap.run commands,
|
|
90
96
|
%x{cp -r #{source} #{target}}
|
91
97
|
|
92
98
|
%x{find #{target} -name .empty -print0 | xargs rm}
|
99
|
+
},
|
100
|
+
|
101
|
+
"tail" => lambda {
|
102
|
+
$stdout.sync = true
|
103
|
+
|
104
|
+
parser = %r{^(?<date>.* \d\d:\d\d:\d\d) \w+ tele/(?<who>.*)\[\d+\]: (?<message>.*)$}
|
105
|
+
|
106
|
+
IO.popen("tail -0 -f /var/log/system.log /var/log/syslog 2>/dev/null") do |io|
|
107
|
+
while line = io.gets
|
108
|
+
next unless match = parser.match(line)
|
109
|
+
out.log(match)
|
110
|
+
end
|
111
|
+
end
|
93
112
|
}
|
94
113
|
|
95
114
|
unless File.directory?(path)
|
data/tele.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "tele"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.1"
|
4
4
|
s.summary = "Provisioning at a distance"
|
5
5
|
s.description = "Tele is a small provisioning framework that allows you to run bash scripts on remote servers over SSH."
|
6
6
|
s.authors = ["Damian Janowski", "Michel Martens"]
|
data/test/tele.rb
CHANGED
@@ -58,11 +58,17 @@ end
|
|
58
58
|
test "`tele deploy` runs recipes" do
|
59
59
|
out, err = tele("deploy", "-d", "test/.tele.simple")
|
60
60
|
|
61
|
-
assert out =~ /
|
61
|
+
assert out =~ /staging/
|
62
62
|
assert out =~ /cassandra: .*ERROR/
|
63
63
|
assert out =~ /redis: .*OK/
|
64
64
|
end
|
65
65
|
|
66
|
+
test "`tele deploy` doesn't run the same recipe twice in a single server" do
|
67
|
+
out, err = tele("deploy", "-d", "test/.tele.simple")
|
68
|
+
|
69
|
+
assert_equal File.read("/tmp/tele/touch-count").to_i, 1
|
70
|
+
end
|
71
|
+
|
66
72
|
test "`tele init`" do
|
67
73
|
`rm -rf test/tmp`
|
68
74
|
`mkdir test/tmp`
|
@@ -86,5 +92,28 @@ end
|
|
86
92
|
test "Logging to syslog" do
|
87
93
|
out, err = tele("status", "-d", "test/.tele.simple")
|
88
94
|
|
89
|
-
assert `tail -n 20 /var/log/syslog /var/log/system.log 2>/dev/null`[%r{tele/
|
95
|
+
assert `tail -n 20 /var/log/syslog /var/log/system.log 2>/dev/null`[%r{tele/staging/cassandra.*Can't find Cassandra}]
|
96
|
+
end
|
97
|
+
|
98
|
+
test "`tele tail` shows Tele logs" do
|
99
|
+
log = []
|
100
|
+
tailing = false
|
101
|
+
|
102
|
+
t = Thread.new do
|
103
|
+
Open3.popen3("#{root "bin/tele"} tail") do |_, out, _, _|
|
104
|
+
tailing = true
|
105
|
+
while line = out.gets
|
106
|
+
log << line
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
until tailing; end
|
112
|
+
|
113
|
+
tele("deploy", "-d", "test/.tele.simple")
|
114
|
+
|
115
|
+
t.kill
|
116
|
+
|
117
|
+
assert_equal log.size, 1
|
118
|
+
assert log[0] =~ %r{staging/cassandra.*Can't find Cassandra}
|
90
119
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: tele
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Damian Janowski
|
@@ -11,7 +11,8 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-06-22 00:00:00 -03:00
|
15
|
+
default_executable:
|
15
16
|
dependencies:
|
16
17
|
- !ruby/object:Gem::Dependency
|
17
18
|
name: clap
|
@@ -43,6 +44,7 @@ files:
|
|
43
44
|
- templates/.tele/ssh_config
|
44
45
|
- tele.gemspec
|
45
46
|
- test/tele.rb
|
47
|
+
has_rdoc: true
|
46
48
|
homepage: http://github.com/djanowski/tele
|
47
49
|
licenses: []
|
48
50
|
|
@@ -66,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
68
|
requirements: []
|
67
69
|
|
68
70
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.
|
71
|
+
rubygems_version: 1.6.2
|
70
72
|
signing_key:
|
71
73
|
specification_version: 3
|
72
74
|
summary: Provisioning at a distance
|