summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Timberman <joshua@opscode.com>2012-08-18 09:15:01 -0700
committerJoshua Timberman <joshua@opscode.com>2012-08-18 09:15:01 -0700
commit08906bf64fbd0247100149b1c594c8b46e50183f (patch)
tree9266b25a44a94255dd0b066b7160df7a7d1a98eb
parentcf583460671d5322b0cf492037ba17f614bfdf71 (diff)
parent3cf8f0b01214bb131fbfa16d75eafd6f052b4ac3 (diff)
downloadmixlib-shellout-08906bf64fbd0247100149b1c594c8b46e50183f.tar.gz
Merge pull request #6 from rarenerd/master
[COOK-1519] Add action to remove paths to windows_path
-rw-r--r--README.md6
-rw-r--r--providers/path.rb8
-rw-r--r--resources/path.rb2
3 files changed, 15 insertions, 1 deletions
diff --git a/README.md b/README.md
index b0541f9..9eab0f0 100644
--- a/README.md
+++ b/README.md
@@ -312,6 +312,7 @@ windows\_path
### Actions
- :add: Add an item to the system path
+- :remove: Remove an item from the system path
### Attribute Parameters
@@ -324,6 +325,11 @@ windows\_path
action :add
end
+ #Remove 7-Zip from the system path
+ windows_path 'C:\7-Zip' do
+ action :remove
+ end
+
windows\_zipfile
----------------
diff --git a/providers/path.rb b/providers/path.rb
index 7f4a97b..6ec9191 100644
--- a/providers/path.rb
+++ b/providers/path.rb
@@ -25,3 +25,11 @@ action :add do
value new_resource.path
end
end
+
+action :remove do
+ env "PATH" do
+ action :delete
+ delim ::File::PATH_SEPARATOR
+ value new_resource.path
+ end
+end \ No newline at end of file
diff --git a/resources/path.rb b/resources/path.rb
index 2d71ab0..f39aa8e 100644
--- a/resources/path.rb
+++ b/resources/path.rb
@@ -23,6 +23,6 @@ def initialize(name,run_context=nil)
@action = :add
end
-actions :add
+actions :add, :remove
attribute :path, :kind_of => String, :name_attribute => true