Skip to content

Commit

Permalink
Update copyrights and resolve cookstyle warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Jul 18, 2016
1 parent 95c221b commit d6f66e4
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion attributes/default.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion libraries/chef_provider_package_rbenvrubygems.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion libraries/chef_rbenv_mixin.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
22 changes: 11 additions & 11 deletions libraries/chef_rbenv_recipe_helpers.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,11 +51,11 @@ def install_or_upgrade_rbenv(opts = {})
private

def git_deploy_rbenv(opts)
if opts[:upgrade_strategy] == 'none'
git_exec_action = :checkout
else
git_exec_action = :sync
end
git_exec_action = if opts[:upgrade_strategy] == 'none'
:checkout
else
:sync
end

git opts[:rbenv_prefix] do
repository opts[:git_url]
Expand Down Expand Up @@ -89,11 +89,11 @@ def git_deploy_rbenv(opts)
def initialize_rbenv(opts)
prefix = opts[:rbenv_prefix]

if opts[:user]
init_env = { 'USER' => opts[:user], 'HOME' => opts[:home_dir] }
else
init_env = {}
end
init_env = if opts[:user]
{ 'USER' => opts[:user], 'HOME' => opts[:home_dir] }
else
{}
end

bash "Initialize rbenv (#{opts[:user] || 'system'})" do
code %(PATH="#{prefix}/bin:$PATH" rbenv init -)
Expand Down
8 changes: 4 additions & 4 deletions libraries/chef_rbenv_script_helpers.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -62,16 +62,16 @@ def set_updated
end

# Execute the supplied block of code as the given user.
def run_as_user(username, &block)
def run_as_user(username)
if username
user = Etc.getpwnam(username)
Process.fork do
Process.uid = user.uid
block.call
yield
end
Process.wait
else
block.call
yield
end
end
end
Expand Down
4 changes: 3 additions & 1 deletion providers/ruby.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,8 @@
# limitations under the License.
#

use_inline_resources

provides :rbenv_ruby

include Chef::Rbenv::ScriptHelpers
Expand Down
5 changes: 3 additions & 2 deletions providers/script.rb
Expand Up @@ -70,11 +70,12 @@ def build_script_environment
script_env.merge!(new_resource.environment) if new_resource.environment

if new_resource.path
script_env.merge!('PATH' => "#{new_resource.path.join(':')}:#{ENV['PATH']}")
script_env['PATH'] = "#{new_resource.path.join(':')}:#{ENV['PATH']}"
end

if new_resource.user
script_env.merge!('USER' => new_resource.user, 'HOME' => user_home)
script_env['USER'] = new_resource.user
script_env['HOME'] = user_home
end

script_env
Expand Down
2 changes: 1 addition & 1 deletion recipes/default.rb
Expand Up @@ -2,7 +2,7 @@
# Cookbook Name:: ruby_rbenv
# Recipe:: default
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion recipes/system_install.rb
Expand Up @@ -2,7 +2,7 @@
# Cookbook Name:: ruby_rbenv
# Recipe:: system_install
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion recipes/user_install.rb
Expand Up @@ -2,7 +2,7 @@
# Cookbook Name:: ruby_rbenv
# Recipe:: user_install
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion resources/gem.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion resources/global.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion resources/rehash.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion resources/ruby.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion resources/script.rb
Expand Up @@ -4,7 +4,7 @@
#
# Author:: Fletcher Nichol <fnichol@nichol.ca>
#
# Copyright 2011, Fletcher Nichol
# Copyright 2011-2016, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down

0 comments on commit d6f66e4

Please sign in to comment.