chef-sudo 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.
- data/.gitignore +3 -21
- data/Gemfile +3 -0
- data/Gemfile.lock +56 -0
- data/README.rdoc +7 -1
- data/Rakefile +2 -53
- data/chef-sudo.gemspec +16 -47
- data/lib/chef-sudo.rb +14 -15
- data/test/helper.rb +3 -9
- metadata +45 -22
- data/.document +0 -5
- data/VERSION +0 -1
- data/test/test_chef-sudo.rb +0 -7
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
chef-sudo (0.2.0)
|
5
|
+
chef
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
abstract (1.0.0)
|
11
|
+
bunny (0.6.0)
|
12
|
+
chef (0.9.8)
|
13
|
+
bunny (>= 0.6.0)
|
14
|
+
erubis
|
15
|
+
extlib
|
16
|
+
highline
|
17
|
+
json (<= 1.4.2)
|
18
|
+
mixlib-authentication (>= 1.1.0)
|
19
|
+
mixlib-cli (>= 1.1.0)
|
20
|
+
mixlib-config (>= 1.1.0)
|
21
|
+
mixlib-log (>= 1.1.0)
|
22
|
+
moneta
|
23
|
+
ohai (>= 0.5.6)
|
24
|
+
rest-client (>= 1.0.4, <= 1.5.1)
|
25
|
+
uuidtools
|
26
|
+
erubis (2.6.6)
|
27
|
+
abstract (>= 1.0.0)
|
28
|
+
extlib (0.9.15)
|
29
|
+
highline (1.6.1)
|
30
|
+
json (1.4.2)
|
31
|
+
mime-types (1.16)
|
32
|
+
mixlib-authentication (1.1.4)
|
33
|
+
mixlib-log
|
34
|
+
mixlib-cli (1.2.0)
|
35
|
+
mixlib-config (1.1.2)
|
36
|
+
mixlib-log (1.1.0)
|
37
|
+
moneta (0.6.0)
|
38
|
+
ohai (0.5.6)
|
39
|
+
extlib
|
40
|
+
json (<= 1.4.2)
|
41
|
+
mixlib-cli
|
42
|
+
mixlib-config
|
43
|
+
mixlib-log
|
44
|
+
systemu
|
45
|
+
rest-client (1.5.1)
|
46
|
+
mime-types (>= 1.16)
|
47
|
+
systemu (1.2.0)
|
48
|
+
uuidtools (2.1.1)
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
bundler (>= 1.0.0)
|
55
|
+
chef
|
56
|
+
chef-sudo!
|
data/README.rdoc
CHANGED
@@ -2,8 +2,14 @@
|
|
2
2
|
|
3
3
|
A chef resource which allows executing commands with sudo.
|
4
4
|
|
5
|
+
== Compatibility
|
6
|
+
|
7
|
+
0.1.x gem version is compatible with chef 0.8.x
|
8
|
+
|
9
|
+
0.2.x gem version is compatible with chef 0.9.x
|
10
|
+
|
5
11
|
== Note on Patches/Pull Requests
|
6
|
-
|
12
|
+
|
7
13
|
* Fork the project.
|
8
14
|
* Make your feature addition or bug fix.
|
9
15
|
* Add tests for it. This is important so I don't break it in a
|
data/Rakefile
CHANGED
@@ -1,53 +1,2 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "chef-sudo"
|
8
|
-
gem.summary = %Q{chef sudo resource}
|
9
|
-
gem.description = %Q{Provides chef sudo resource for executing commands with sudo}
|
10
|
-
gem.email = "wijet@wijet.pl"
|
11
|
-
gem.homepage = "http://github.com/wijet/chef-sudo"
|
12
|
-
gem.authors = ["Mariusz Pietrzyk"]
|
13
|
-
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'rake/testtask'
|
22
|
-
Rake::TestTask.new(:test) do |test|
|
23
|
-
test.libs << 'lib' << 'test'
|
24
|
-
test.pattern = 'test/**/test_*.rb'
|
25
|
-
test.verbose = true
|
26
|
-
end
|
27
|
-
|
28
|
-
begin
|
29
|
-
require 'rcov/rcovtask'
|
30
|
-
Rcov::RcovTask.new do |test|
|
31
|
-
test.libs << 'test'
|
32
|
-
test.pattern = 'test/**/test_*.rb'
|
33
|
-
test.verbose = true
|
34
|
-
end
|
35
|
-
rescue LoadError
|
36
|
-
task :rcov do
|
37
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
task :test => :check_dependencies
|
42
|
-
|
43
|
-
task :default => :test
|
44
|
-
|
45
|
-
require 'rake/rdoctask'
|
46
|
-
Rake::RDocTask.new do |rdoc|
|
47
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
-
|
49
|
-
rdoc.rdoc_dir = 'rdoc'
|
50
|
-
rdoc.title = "chef-sudo #{version}"
|
51
|
-
rdoc.rdoc_files.include('README*')
|
52
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
data/chef-sudo.gemspec
CHANGED
@@ -1,54 +1,23 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
# require File.expand_path("../lib/chef-sudo/version", __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
5
|
+
s.name = "chef-sudo"
|
6
|
+
s.version = "0.2.0"
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Mariusz Pietrzyk"]
|
9
|
+
s.email = ["wijet@wijet.pl"]
|
10
|
+
s.homepage = "http://github.com/wijet/chef-sudo"
|
11
|
+
s.summary = %Q{chef sudo resource}
|
12
|
+
s.description = %Q{Provides chef sudo resource for executing commands with sudo}
|
9
13
|
|
10
|
-
s.required_rubygems_version =
|
11
|
-
s.
|
12
|
-
s.date = %q{2010-04-02}
|
13
|
-
s.description = %q{Provides chef sudo resource for executing commands with sudo}
|
14
|
-
s.email = %q{wijet@wijet.pl}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"chef-sudo.gemspec",
|
27
|
-
"lib/chef-sudo.rb",
|
28
|
-
"test/helper.rb",
|
29
|
-
"test/test_chef-sudo.rb"
|
30
|
-
]
|
31
|
-
s.homepage = %q{http://github.com/wijet/chef-sudo}
|
32
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
-
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.6}
|
35
|
-
s.summary = %q{chef sudo resource}
|
36
|
-
s.test_files = [
|
37
|
-
"test/helper.rb",
|
38
|
-
"test/test_chef-sudo.rb"
|
39
|
-
]
|
14
|
+
s.required_rubygems_version = ">= 1.3.6"
|
15
|
+
s.rubyforge_project = "chef-sudo"
|
40
16
|
|
41
|
-
|
42
|
-
|
43
|
-
s.specification_version = 3
|
17
|
+
s.add_dependency "chef"
|
18
|
+
s.add_development_dependency "bundler", ">= 1.0.0"
|
44
19
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
49
|
-
end
|
50
|
-
else
|
51
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
52
|
-
end
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
22
|
+
s.require_path = 'lib'
|
53
23
|
end
|
54
|
-
|
data/lib/chef-sudo.rb
CHANGED
@@ -3,21 +3,21 @@ require 'chef/resource'
|
|
3
3
|
class Chef
|
4
4
|
class Resource
|
5
5
|
class Sudo < Chef::Resource
|
6
|
-
def initialize(name,
|
7
|
-
super(name,
|
6
|
+
def initialize(name, run_context=nil)
|
7
|
+
super(name, run_context)
|
8
8
|
@resource_name = :sudo
|
9
|
-
@action =
|
9
|
+
@action = "execute"
|
10
10
|
@allowed_actions.push(:execute)
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def command(arg=nil)
|
14
14
|
set_or_return(
|
15
|
-
:command,
|
16
|
-
arg,
|
15
|
+
:command,
|
16
|
+
arg,
|
17
17
|
:kind_of => [ String ]
|
18
18
|
)
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def user(arg=nil)
|
22
22
|
set_or_return(
|
23
23
|
:user,
|
@@ -25,7 +25,7 @@ class Chef
|
|
25
25
|
:kind_of => [ String ]
|
26
26
|
)
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def group(arg=nil)
|
30
30
|
set_or_return(
|
31
31
|
:group,
|
@@ -33,7 +33,7 @@ class Chef
|
|
33
33
|
:kind_of => [ String ]
|
34
34
|
)
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def simulate_initial_login(arg=nil)
|
38
38
|
set_or_return(
|
39
39
|
:simulate_initial_login,
|
@@ -41,7 +41,7 @@ class Chef
|
|
41
41
|
:kind_of => [ TrueClass, FalseClass ]
|
42
42
|
)
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def cwd(arg=nil)
|
46
46
|
set_or_return(
|
47
47
|
:cwd,
|
@@ -49,7 +49,7 @@ class Chef
|
|
49
49
|
:kind_of => [ String ]
|
50
50
|
)
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def environment(arg=nil)
|
54
54
|
set_or_return(
|
55
55
|
:environment,
|
@@ -66,7 +66,7 @@ class Chef
|
|
66
66
|
class Sudo < Chef::Provider
|
67
67
|
def load_current_resource
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
def action_execute
|
71
71
|
command = ["sudo"]
|
72
72
|
command << "-u #{@new_resource.user}" if @new_resource.user
|
@@ -74,9 +74,9 @@ class Chef
|
|
74
74
|
command << "-i" if @new_resource.simulate_initial_login
|
75
75
|
|
76
76
|
if @new_resource.cwd
|
77
|
-
command <<
|
77
|
+
command << %Q{ -- "cd #{@new_resource.cwd} && #{@new_resource.command}"}
|
78
78
|
else
|
79
|
-
command <<
|
79
|
+
command << %Q{ -- "#{@new_resource.command}"}
|
80
80
|
end
|
81
81
|
|
82
82
|
options = {:command => command.join(' ')}
|
@@ -88,4 +88,3 @@ class Chef
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
data/test/helper.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require 'shoulda'
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
4
3
|
|
5
|
-
|
6
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
-
require 'chef-sudo'
|
8
|
-
|
9
|
-
class Test::Unit::TestCase
|
10
|
-
end
|
4
|
+
Bundler.require
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-sudo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Mariusz Pietrzyk
|
@@ -14,71 +15,93 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-30 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
22
|
+
name: chef
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
30
|
-
type: :
|
33
|
+
type: :runtime
|
31
34
|
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: bundler
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 23
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 0
|
47
|
+
- 0
|
48
|
+
version: 1.0.0
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
32
51
|
description: Provides chef sudo resource for executing commands with sudo
|
33
|
-
email:
|
52
|
+
email:
|
53
|
+
- wijet@wijet.pl
|
34
54
|
executables: []
|
35
55
|
|
36
56
|
extensions: []
|
37
57
|
|
38
|
-
extra_rdoc_files:
|
39
|
-
|
40
|
-
- README.rdoc
|
58
|
+
extra_rdoc_files: []
|
59
|
+
|
41
60
|
files:
|
42
|
-
- .document
|
43
61
|
- .gitignore
|
62
|
+
- Gemfile
|
63
|
+
- Gemfile.lock
|
44
64
|
- LICENSE
|
45
65
|
- README.rdoc
|
46
66
|
- Rakefile
|
47
|
-
- VERSION
|
48
67
|
- chef-sudo.gemspec
|
49
68
|
- lib/chef-sudo.rb
|
50
69
|
- test/helper.rb
|
51
|
-
- test/test_chef-sudo.rb
|
52
70
|
has_rdoc: true
|
53
71
|
homepage: http://github.com/wijet/chef-sudo
|
54
72
|
licenses: []
|
55
73
|
|
56
74
|
post_install_message:
|
57
|
-
rdoc_options:
|
58
|
-
|
75
|
+
rdoc_options: []
|
76
|
+
|
59
77
|
require_paths:
|
60
78
|
- lib
|
61
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
62
81
|
requirements:
|
63
82
|
- - ">="
|
64
83
|
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
65
85
|
segments:
|
66
86
|
- 0
|
67
87
|
version: "0"
|
68
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
69
90
|
requirements:
|
70
91
|
- - ">="
|
71
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 23
|
72
94
|
segments:
|
73
|
-
-
|
74
|
-
|
95
|
+
- 1
|
96
|
+
- 3
|
97
|
+
- 6
|
98
|
+
version: 1.3.6
|
75
99
|
requirements: []
|
76
100
|
|
77
|
-
rubyforge_project:
|
78
|
-
rubygems_version: 1.3.
|
101
|
+
rubyforge_project: chef-sudo
|
102
|
+
rubygems_version: 1.3.7
|
79
103
|
signing_key:
|
80
104
|
specification_version: 3
|
81
105
|
summary: chef sudo resource
|
82
|
-
test_files:
|
83
|
-
|
84
|
-
- test/test_chef-sudo.rb
|
106
|
+
test_files: []
|
107
|
+
|
data/.document
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.1
|