Skip to content

Commit

Permalink
Fix inconsistent indents
Browse files Browse the repository at this point in the history
  • Loading branch information
tas50 committed Oct 12, 2015
1 parent c032c1a commit 66d1f91
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 90 deletions.
2 changes: 0 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ Style/FormatString:
Enabled: false
Style/RegexpLiteral:
Enabled: false
SingleSpaceBeforeFirstArg:
Enabled: false
2 changes: 1 addition & 1 deletion Guardfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
guard :rspec, spec_paths: ['test/unit'] do
watch(%r{^test/unit/.+_spec\.rb$})
watch(%r{^(libraries|providers|recipes|resources)/(.+)\.rb$}) { |m| "test/unit/#{m[1]}/#{m[2]}_spec.rb" }
watch('test/unit/spec_helper.rb') { 'test/unit' }
watch('test/unit/spec_helper.rb') { 'test/unit' }
end
24 changes: 12 additions & 12 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@

case node['platform_family']
when 'rhel', 'fedora'
default['rbenv']['install_pkgs'] = %w(git grep)
default['rbenv']['user_home_root'] = '/home'
default['rbenv']['install_pkgs'] = %w(git grep)
default['rbenv']['user_home_root'] = '/home'
when 'debian', 'suse'
default['rbenv']['install_pkgs'] = %w(git-core grep)
default['rbenv']['user_home_root'] = '/home'
default['rbenv']['install_pkgs'] = %w(git-core grep)
default['rbenv']['user_home_root'] = '/home'
when 'mac_os_x'
default['rbenv']['install_pkgs'] = %w(git)
default['rbenv']['user_home_root'] = '/Users'
default['rbenv']['install_pkgs'] = %w(git)
default['rbenv']['user_home_root'] = '/Users'
when 'freebsd'
default['rbenv']['install_pkgs'] = %w(git)
default['rbenv']['user_home_root'] = '/usr/home'
default['rbenv']['install_pkgs'] = %w(git)
default['rbenv']['user_home_root'] = '/usr/home'
when 'gentoo'
default['rbenv']['install_pkgs'] = %w(git)
default['rbenv']['user_home_root'] = '/home'
default['rbenv']['install_pkgs'] = %w(git)
default['rbenv']['user_home_root'] = '/home'
when 'arch'
default['rbenv']['install_pkgs'] = %w(git grep)
default['rbenv']['user_home_root'] = '/home'
default['rbenv']['install_pkgs'] = %w(git grep)
default['rbenv']['user_home_root'] = '/home'
end
32 changes: 16 additions & 16 deletions libraries/chef_rbenv_recipe_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,36 @@ def git_deploy_rbenv(opts)
end

git opts[:rbenv_prefix] do
repository opts[:git_url]
reference opts[:git_ref]
user opts[:user] if opts[:user]
group opts[:group] if opts[:group]
action git_exec_action
repository opts[:git_url]
reference opts[:git_ref]
user opts[:user] if opts[:user]
group opts[:group] if opts[:group]
action git_exec_action
end

directory "#{opts[:rbenv_prefix]}/plugins" do
owner opts[:user].nil? ? 'root' : opts[:user]
mode '0755'
owner opts[:user].nil? ? 'root' : opts[:user]
mode '0755'
end

Array(opts[:rbenv_plugins]).each do |plugin|
revision = plugin['revision'].nil? ? 'master' : plugin['revision']
plugin_path = "#{opts[:rbenv_prefix]}/plugins/#{plugin['name']}"

git "Install rbenv plugin - #{plugin['name']}" do
repository plugin['git_url']
repository plugin['git_url']
destination plugin_path
reference revision
user opts[:user] if opts[:user]
group opts[:group] if opts[:group]
action :sync
reference revision
user opts[:user] if opts[:user]
group opts[:group] if opts[:group]
action :sync
end
log "Installed rbenv plugin - #{plugin['name']}"
end
end

def initialize_rbenv(opts)
prefix = opts[:rbenv_prefix]
prefix = opts[:rbenv_prefix]

if opts[:user]
init_env = { 'USER' => opts[:user], 'HOME' => opts[:home_dir] }
Expand All @@ -96,10 +96,10 @@ def initialize_rbenv(opts)
end

bash "Initialize rbenv (#{opts[:user] || 'system'})" do
code %(PATH="#{prefix}/bin:$PATH" rbenv init -)
code %(PATH="#{prefix}/bin:$PATH" rbenv init -)
environment({ 'RBENV_ROOT' => prefix }.merge(init_env))
user opts[:user] if opts[:user]
group opts[:group] if opts[:group]
user opts[:user] if opts[:user]
group opts[:group] if opts[:group]
end

log "rbenv-post-init-#{opts[:user] || 'system'}"
Expand Down
14 changes: 7 additions & 7 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name 'rbenv'
maintainer 'Fletcher Nichol'
name 'rbenv'
maintainer 'Fletcher Nichol'
maintainer_email '[email protected]'
license 'Apache 2.0'
description 'Manages rbenv and its installed rubies. Several LWRPs are also defined.'
license 'Apache 2.0'
description 'Manages rbenv and its installed rubies. Several LWRPs are also defined.'
long_description "Please refer to README.md (it's long)."
version '0.8.1'
version '0.8.1'

depends 'ruby_build' # if using the rbenv LWRP, ruby-build must be installed
recommends 'java', '> 1.4.0' # if using jruby, java is required on system
depends 'ruby_build' # if using the rbenv LWRP, ruby-build must be installed
recommends 'java', '> 1.4.0' # if using jruby, java is required on system

supports 'ubuntu'
supports 'linuxmint'
Expand Down
10 changes: 5 additions & 5 deletions recipes/system_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
mode '0755'
end

install_or_upgrade_rbenv rbenv_prefix: rbenv_prefix,
git_url: git_url,
git_ref: git_ref,
upgrade_strategy: upgrade_strategy,
rbenv_plugins: rbenv_plugins
install_or_upgrade_rbenv rbenv_prefix: rbenv_prefix,
git_url: git_url,
git_ref: git_ref,
upgrade_strategy: upgrade_strategy,
rbenv_plugins: rbenv_plugins
36 changes: 18 additions & 18 deletions recipes/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,46 @@

plugins.each do |plugin|
rbenv_plugin plugin['name'] do
git_url plugin['git_url']
git_ref plugin['git_ref'] if plugin['git_ref']
user rbenv_user['user']
git_url plugin['git_url']
git_ref plugin['git_ref'] if plugin['git_ref']
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
end
end

rubies.each do |rubie|
if rubie.is_a?(Hash)
rbenv_ruby "#{rubie['name']} (#{rbenv_user['user']})" do
definition rubie['name']
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
definition rubie['name']
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
environment rubie['environment'] if rubie['environment']
patch_url rubie['patch_url'] if rubie['patch_url']
patch_file rubie['patch_file'] if rubie['patch_file']
patch_url rubie['patch_url'] if rubie['patch_url']
patch_file rubie['patch_file'] if rubie['patch_file']
end
else
rbenv_ruby "#{rubie} (#{rbenv_user['user']})" do
definition rubie
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
definition rubie
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
end
end
end

rbenv_global "#{rbenv_user['global']} (#{rbenv_user['user']})" do
rbenv_version rbenv_user['global']
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
only_if { rbenv_user['global'] }
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
only_if { rbenv_user['global'] }
end

gem_hash.each_pair do |rubie, gems|
Array(gems).each do |gem|
rbenv_gem "#{gem['name']} (#{rbenv_user['user']})" do
package_name gem['name']
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
rbenv_version rubie
package_name gem['name']
user rbenv_user['user']
root_path rbenv_user['root_path'] if rbenv_user['root_path']
rbenv_version rubie

%w(version action options source).each do |attr|
send(attr, gem[attr]) if gem[attr]
Expand Down
22 changes: 11 additions & 11 deletions recipes/user_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
install_rbenv_pkg_prereqs

template '/etc/profile.d/rbenv.sh' do
source 'rbenv.sh.erb'
owner 'root'
mode '0755'
source 'rbenv.sh.erb'
owner 'root'
mode '0755'
only_if { node['rbenv']['create_profiled'] }
end

Expand All @@ -37,12 +37,12 @@
rbenv_prefix = rb_user['root_path'] || ::File.join(home_dir, '.rbenv')
rbenv_plugins = rb_user['plugins'] || []

install_or_upgrade_rbenv rbenv_prefix: rbenv_prefix,
home_dir: home_dir,
git_url: git_url,
git_ref: git_ref,
upgrade_strategy: upgrade_strategy,
user: rb_user['user'],
group: rb_user['group'],
rbenv_plugins: rbenv_plugins
install_or_upgrade_rbenv rbenv_prefix: rbenv_prefix,
home_dir: home_dir,
git_url: git_url,
git_ref: git_ref,
upgrade_strategy: upgrade_strategy,
user: rb_user['user'],
group: rb_user['group'],
rbenv_plugins: rbenv_plugins
end
4 changes: 2 additions & 2 deletions resources/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
actions :install, :reinstall
default_action :install

attribute :definition, kind_of: String, name_attribute: true
attribute :definition, kind_of: String, name_attribute: true
attribute :definition_file, kind_of: String
attribute :root_path, kind_of: String
attribute :user, kind_of: String
attribute :environment, kind_of: Hash
attribute :patch_url, kind_of: String
attribute :patch_file, kind_of: String
attribute :rbenv_action, kind_of: String, default: 'install'
attribute :rbenv_action, kind_of: String, default: 'install'

def initialize(*args)
super
Expand Down
4 changes: 2 additions & 2 deletions test/unit/fixtures/recipes/rbenv_global_full.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rbenv_global '9.1.2' do
user 'claire'
user 'claire'
root_path '/mnt/roobies'
action :create
action :create
end
12 changes: 6 additions & 6 deletions test/unit/fixtures/recipes/rbenv_script_full.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
rbenv_script 'all-the-things' do
code 'rake doit:all'
code 'rake doit:all'
rbenv_version 'thebest'
user 'lockwood'
group 'inventor'
user 'lockwood'
group 'inventor'
creates '/opt/success'
cwd '/usr/dir'
path ['/opt/bin']
cwd '/usr/dir'
path ['/opt/bin']
returns [0, 255]
timeout 600
umask 0221
umask 0221
environment('FRUIT' => 'strawberry')
end
4 changes: 2 additions & 2 deletions test/unit/providers/global_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:node) { runner.node }

context 'with a fully configured resource' do
let(:chef_run) { runner.converge('fixtures::rbenv_global_full') }
let(:chef_run) { runner.converge('fixtures::rbenv_global_full') }

it 'runs an rbenv_script' do
expect(chef_run).to run_rbenv_script('rbenv global 9.1.2 (claire)').with(
Expand All @@ -17,7 +17,7 @@
end

context 'with a default configured resource' do
let(:chef_run) { runner.converge('fixtures::rbenv_global_defaults') }
let(:chef_run) { runner.converge('fixtures::rbenv_global_defaults') }

it 'runs an rbenv_script' do
expect(chef_run).to run_rbenv_script('rbenv global 1.6.5 (system)').with(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/providers/plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
end

context 'with a minimally configured resource' do
let(:chef_run) { runner.converge('fixtures::rbenv_plugin_defaults') }
let(:chef_run) { runner.converge('fixtures::rbenv_plugin_defaults') }

before { node.set['rbenv']['root_path'] = '/ohyeah' }

Expand Down
4 changes: 2 additions & 2 deletions test/unit/providers/rehash_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:node) { runner.node }

context 'with a fully configured resource' do
let(:chef_run) { runner.converge('fixtures::rbenv_rehash_full') }
let(:chef_run) { runner.converge('fixtures::rbenv_rehash_full') }

it 'runs an rbenv_script' do
expect(chef_run).to run_rbenv_script('rbenv rehash (jdoe)').with(
Expand All @@ -17,7 +17,7 @@
end

context 'with a defaults configured resource' do
let(:chef_run) { runner.converge('fixtures::rbenv_rehash_defaults') }
let(:chef_run) { runner.converge('fixtures::rbenv_rehash_defaults') }

it 'runs an rbenv_script' do
expect(chef_run).to run_rbenv_script('rbenv rehash (system)').with(
Expand Down
6 changes: 3 additions & 3 deletions test/unit/providers/script_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:node) { runner.node }

context 'with a fully configured resource' do
let(:chef_run) { runner.converge('fixtures::rbenv_script_full') }
let(:chef_run) { runner.converge('fixtures::rbenv_script_full') }

before do
user = double(dir: '/mnt/lockwood')
Expand Down Expand Up @@ -44,7 +44,7 @@
end

context 'with a default configured resource' do
let(:chef_run) { runner.converge('fixtures::rbenv_script_defaults') }
let(:chef_run) { runner.converge('fixtures::rbenv_script_defaults') }

before do
node.set['rbenv']['root_path'] = '/zz'
Expand All @@ -57,7 +57,7 @@
eval "$(rbenv init -)"
rake nadda
CODE
environment = { 'RBENV_ROOT' => '/zz' }
environment = { 'RBENV_ROOT' => '/zz' }

expect(chef_run).to run_script('not-much').with(
interpreter: 'bash',
Expand Down

0 comments on commit 66d1f91

Please sign in to comment.