chef-sudo 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
- = chef-sudo
1
+ = chef sudo resource
2
2
 
3
- Description goes here.
3
+ A chef resource which allows executing commands with sudo.
4
4
 
5
5
  == Note on Patches/Pull Requests
6
6
 
@@ -14,4 +14,4 @@ Description goes here.
14
14
 
15
15
  == Copyright
16
16
 
17
- Copyright (c) 2010 Mariusz Pietrzyk. See LICENSE for details.
17
+ Copyright (c) 2010 Mariusz Pietrzyk wijet at wijet dot pl. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
data/chef-sudo.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{chef-sudo}
8
- s.version = "0.0.1"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mariusz Pietrzyk"]
data/lib/chef-sudo.rb CHANGED
@@ -41,6 +41,22 @@ class Chef
41
41
  :kind_of => [ TrueClass, FalseClass ]
42
42
  )
43
43
  end
44
+
45
+ def cwd(arg=nil)
46
+ set_or_return(
47
+ :cwd,
48
+ arg,
49
+ :kind_of => [ String ]
50
+ )
51
+ end
52
+
53
+ def environment(arg=nil)
54
+ set_or_return(
55
+ :environment,
56
+ arg,
57
+ :kind_of => [ Hash ]
58
+ )
59
+ end
44
60
  end
45
61
  end
46
62
  end
@@ -57,11 +73,14 @@ class Chef
57
73
  command << "-g #{@new_resource.group}" if @new_resource.group
58
74
  command << "-i" if @new_resource.simulate_initial_login
59
75
  command << @new_resource.command
60
-
61
- Chef::Mixin::Command.run_command(:command => command.join(' '))
76
+
77
+ options = {:command => command.join(' ')}
78
+ options[:cwd] = @new_resource.cwd if @new_resource.cwd
79
+ options[:environment] = @new_resource.environment if @new_resource.environment
80
+
81
+ Chef::Mixin::Command.run_command(options)
62
82
  Chef::Log.info "Ran sudo [#{@new_resource.name}]"
63
83
  end
64
84
  end
65
85
  end
66
86
  end
67
-
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 0
8
7
  - 1
9
- version: 0.0.1
8
+ - 0
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mariusz Pietrzyk