delta-capistrano 0.1.1 → 0.2.0

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.
@@ -1,6 +1,28 @@
1
1
  = delta-capistrano
2
2
 
3
- Description goes here.
3
+ Extends the capistrano DSL allowing one to run commands as a specified user as if in a shell.
4
+ Just require delta-capistrano in your deploy and you are good to go.
5
+
6
+
7
+ single command:
8
+
9
+ in_a_shell_as("u", "from argument")
10
+
11
+ # would be equivalent of
12
+ sudo "sh -c 'from argument'", :as => "u"
13
+
14
+
15
+ multiple commands in a block:
16
+
17
+ in_a_shell_as("u") do |shell|
18
+ shell.run "from block once"
19
+ shell.run "from block twice"
20
+ end
21
+
22
+ # would be equivalent of
23
+ sudo "sh -c 'from block once; from block twice'", :as => "u"
24
+
25
+
4
26
 
5
27
  == Note on Patches/Pull Requests
6
28
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{delta-capistrano}
8
- s.version = "0.1.1"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Robin Spainhour"]
12
- s.date = %q{2010-10-30}
12
+ s.date = %q{2010-11-09}
13
13
  s.description = %q{Extra DSLs for capistrano}
14
14
  s.email = %q{robin.spainhour@deltaprojects.se}
15
15
  s.extra_rdoc_files = [
@@ -12,7 +12,7 @@ module DeltaCapistrano
12
12
 
13
13
  yield command_array if block_given?
14
14
 
15
- sudo "sh -c '#{command_array.joined_by_semi_colon}'", :as => user
15
+ sudo "su - #{user} sh -c '#{command_array.joined_by_semi_colon}'"
16
16
  end
17
17
 
18
18
  private
@@ -6,10 +6,10 @@ describe DeltaCapistrano::Configuration::Actions::RunInShell do
6
6
  Class.new { include DeltaCapistrano::Configuration::Actions::RunInShell }.new
7
7
  end
8
8
 
9
- it "should sudo to the supplied user" do
9
+ it "should su to the supplied user" do
10
10
  user = "the_user"
11
- config.should_receive(:sudo).with do |cmd, sudo_conf|
12
- sudo_conf.should == {:as => user}
11
+ config.should_receive(:sudo).with do |cmd|
12
+ cmd.should =~ /^su - the_user/
13
13
  end
14
14
 
15
15
  config.in_a_shell_as(user)
@@ -18,8 +18,8 @@ describe DeltaCapistrano::Configuration::Actions::RunInShell do
18
18
  it "should exec command in a new shell" do
19
19
  expected_command = "a command"
20
20
 
21
- config.should_receive(:sudo).with do |cmd, sudo_conf|
22
- cmd.should == "sh -c '#{expected_command}'"
21
+ config.should_receive(:sudo).with do |cmd|
22
+ cmd.should == "su - user sh -c '#{expected_command}'"
23
23
  end
24
24
 
25
25
  config.in_a_shell_as("user", expected_command)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delta-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Robin Spainhour
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-30 00:00:00 +02:00
18
+ date: 2010-11-09 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency