fabric 0.4.1 → 0.4.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fabric}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sam Phillips"]
12
- s.date = %q{2010-03-24}
12
+ s.date = %q{2010-03-29}
13
13
  s.default_executable = %q{fab}
14
14
  s.description = %q{Fabric is a small ruby app to perform tasks on servers via SSH. Built around net/ssh and taking heavy inspiration from Capistrano, it allows you to create policies for server management and perform sysadmin tasks without the need for a process/daemon/dependency or even ruby being installed on the remote server.}
15
15
  s.email = %q{sam.phillips@setfiremedia.com}
@@ -23,9 +23,7 @@ class Account
23
23
  end
24
24
 
25
25
  def add_to_groups
26
- self.user.groups.each do |group|
27
- self.server.execute_command("sudo /usr/sbin/usermod -G#{group.name} #{self.user.name}")
28
- end
26
+ self.server.execute_command("sudo /usr/sbin/usermod -a -G #{self.user.groups.collect(&:name).join(',')} #{self.user.name}")
29
27
  end
30
28
 
31
29
  protected
@@ -29,22 +29,47 @@ describe Account do
29
29
  end
30
30
  end
31
31
 
32
- describe "with a user in a group" do
32
+ describe "with", User do
33
33
  before(:each) do
34
34
  @account.add_user
35
- @user.groups.new(:name => TEST_GROUP)
36
- @server.execute_command("sudo /usr/sbin/groupadd #{TEST_GROUP}")
37
35
  end
38
36
 
39
- after(:each) do
40
- @server.execute_command("sudo /usr/sbin/groupdel #{TEST_GROUP}")
41
- end
37
+ describe "with a primary group" do
38
+ before(:each) do
39
+ @user.groups.new(:name => TEST_GROUP)
40
+ @server.execute_command("sudo /usr/sbin/groupadd #{TEST_GROUP}")
41
+ end
42
+
43
+ after(:each) do
44
+ @server.execute_command("sudo /usr/sbin/groupdel #{TEST_GROUP}")
45
+ end
42
46
 
43
- it "should add the user to that group" do
44
- @account.add_to_groups
47
+ it "should add the user to that group only" do
48
+ @account.add_to_groups
45
49
 
46
- @server.execute_command("groups #{@user.name}")
47
- @server.output.should =~ / ?#{TEST_GROUP} ?/
50
+ @server.execute_command("groups #{@user.name}")
51
+ @server.output.should =~ / ?#{TEST_GROUP} ?/
52
+ @server.output.should_not =~ / ?#{TEST_SECONDARY_GROUP} ?/
53
+ end
54
+
55
+ describe "and a secondary group" do
56
+ before(:each) do
57
+ @user.groups.new(:name => TEST_SECONDARY_GROUP)
58
+ @server.execute_command("sudo /usr/sbin/groupadd #{TEST_SECONDARY_GROUP}")
59
+ end
60
+
61
+ after(:each) do
62
+ @server.execute_command("sudo /usr/sbin/groupdel #{TEST_SECONDARY_GROUP}")
63
+ end
64
+
65
+ it "should add the user to those groups" do
66
+ @account.add_to_groups
67
+
68
+ @server.execute_command("groups #{@user.name}")
69
+ @server.output.should =~ / ?#{TEST_GROUP} ?/
70
+ @server.output.should =~ / ?#{TEST_SECONDARY_GROUP} ?/
71
+ end
72
+ end
48
73
  end
49
74
  end
50
75
 
@@ -14,6 +14,7 @@ TEST_RUNNER = Fabric::Test.settings['runner']
14
14
  TEST_USER = Fabric::Test.settings['user']
15
15
  TEST_DOOMED_USER = Fabric::Test.settings['doomed_user']
16
16
  TEST_GROUP = Fabric::Test.settings['group']
17
+ TEST_SECONDARY_GROUP = Fabric::Test.settings['secondary_group']
17
18
 
18
19
  Spec::Runner.configure do |config|
19
20
  config.before(:suite) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fabric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Phillips
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-24 00:00:00 +00:00
12
+ date: 2010-03-29 00:00:00 +01:00
13
13
  default_executable: fab
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency