Skip to content

Commit

Permalink
Implement rbenv_rehash LWRP.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnichol committed Dec 19, 2011
1 parent 902424b commit 554914a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
34 changes: 34 additions & 0 deletions providers/rehash.rb
@@ -0,0 +1,34 @@
#
# Cookbook Name:: rbenv
# Provider:: rehash
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include Chef::Rbenv::ShellHelpers

action :run do
command = %{rbenv rehash}

rbenv_shell "#{command} #{which_rbenv}" do
code command
user new_resource.user if new_resource.user
root_path new_resource.root_path if new_resource.root_path

action :nothing
end.run_action(:run)
end
5 changes: 3 additions & 2 deletions resources/rehash.rb
Expand Up @@ -21,8 +21,9 @@

actions :run

attribute :name, :kind_of => String, :name_attribute => true
attribute :user, :kind_of => String
attribute :name, :kind_of => String, :name_attribute => true
attribute :user, :kind_of => String
attribute :root_path, :kind_of => String

def initialize(*args)
super
Expand Down

0 comments on commit 554914a

Please sign in to comment.