tele 0.1.4 → 0.1.5

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.
Files changed (4) hide show
  1. data/bin/tele +8 -4
  2. data/tele.gemspec +3 -1
  3. data/test/tele.rb +7 -0
  4. metadata +4 -4
data/bin/tele CHANGED
@@ -30,7 +30,7 @@ def path(*parts)
30
30
  end
31
31
 
32
32
  def ssh(server, options = [])
33
- "ssh #{options.join(" ")} #{server}"
33
+ ["ssh", *options, server]
34
34
  end
35
35
 
36
36
  def layout
@@ -51,7 +51,7 @@ def run(server, recipe, script)
51
51
  if script.nil?
52
52
  $out.unknown
53
53
  print "\n"
54
- return
54
+ return true
55
55
  end
56
56
 
57
57
  result = execute(server, script) do |line|
@@ -67,10 +67,12 @@ def run(server, recipe, script)
67
67
  end
68
68
 
69
69
  print "\n"
70
+
71
+ result == 0
70
72
  end
71
73
 
72
74
  def execute(server, script)
73
- IO.popen(ssh(server, SSH_OPTIONS), "r+") do |io|
75
+ IO.popen([*ssh(server, SSH_OPTIONS), err: [:child, :out]], "r+") do |io|
74
76
  io.puts(script)
75
77
  io.close_write
76
78
 
@@ -161,7 +163,9 @@ commands = Clap.run commands,
161
163
  recipes_for(assigned_roles).each do |recipe|
162
164
  script = path("recipes", "#{recipe}.sh")
163
165
 
164
- run(server, recipe, (File.read(script) if File.exist?(script)))
166
+ result = run(server, recipe, (File.read(script) if File.exist?(script)))
167
+
168
+ break unless result
165
169
  end
166
170
  end
167
171
  }
@@ -1,6 +1,8 @@
1
+ require File.expand_path("lib/tele/version", File.dirname(__FILE__))
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = "tele"
3
- s.version = "0.1.4"
5
+ s.version = Tele::VERSION
4
6
  s.summary = "Provisioning at a distance"
5
7
  s.description = "Tele is a small provisioning framework that allows you to run bash scripts on remote servers over SSH."
6
8
  s.authors = ["Damian Janowski", "Michel Martens"]
@@ -55,6 +55,7 @@ end
55
55
  test "`tele deploy` runs recipes" do
56
56
  out, err = tele("deploy", "-d", "test/.tele.simple")
57
57
 
58
+ assert out =~ %r[^staging/cassandra.* .*Can't find Cassandra]
58
59
  assert out =~ %r[^staging/cassandra.* .*ERROR]
59
60
  assert out =~ %r[^staging/redis.* Installed]
60
61
  assert out =~ %r[^staging/redis.* .*OK]
@@ -69,6 +70,12 @@ test "`tele deploy -s production` runs only production recipes" do
69
70
  assert out =~ %r[production/redis.*: .*OK]
70
71
  end
71
72
 
73
+ test "`tele deploy` halts deploy if a recipe fails" do
74
+ out, err = tele("deploy", "-d", "test/.tele.error")
75
+
76
+ assert out =~ %r[db-1/cassandra.*: .*ERROR]
77
+ assert out !~ %r[db-1/no-run]
78
+ end
72
79
 
73
80
  test "`tele deploy` doesn't run the same recipe twice in a single server" do
74
81
  out, err = tele("deploy", "-d", "test/.tele.simple")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tele
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-17 00:00:00.000000000 Z
13
+ date: 2012-01-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: clap
17
- requirement: &70350700960560 !ruby/object:Gem::Requirement
17
+ requirement: &70215095440960 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70350700960560
25
+ version_requirements: *70215095440960
26
26
  description: Tele is a small provisioning framework that allows you to run bash scripts
27
27
  on remote servers over SSH.
28
28
  email: