Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookstyle Bot Auto Corrections with Cookstyle 7.13.0 #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default[:wemux][:packages] = ['git', 'tmux']
default[:wemux][:packages] = %w(git tmux)
default[:wemux][:tmux][:config] = []
default[:wemux][:tmux][:control_key] = 'q'
default[:wemux][:tmux][:write] = true
30 changes: 15 additions & 15 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
node[:wemux][:packages].each do |pkg_name|
node['wemux']['packages'].each do |pkg_name|
package pkg_name
end

execute 'wemux update' do
command 'git pull'
cwd '/opt/wemux'
only_if{ File.exists?('/opt/wemux/wemux') }
only_if { ::File.exist?('/opt/wemux/wemux') }
end

execute 'wemux clone' do
Expand All @@ -27,29 +27,29 @@
end

file '/usr/local/etc/wemux.conf' do
content lazy{
node[:wemux][:config].map do |k,v|
if(v.is_a?(Array))
content lazy {
node['wemux']['config'].map do |k, v|
if v.is_a?(Array)
"#{k}=(#{v.join(' ')})"
else
"#{k}=\"#{v}\""
end
end.join("\n")
}
mode 0644
mode '644'
end

file '/etc/tmux.conf' do
content lazy{
content lazy {
[
"set -g prefix C-#{node[:wemux][:tmux][:control_key]}",
"unbind C-b",
"bind C-#{node[:wemux][:tmux][:control_key]} send-prefix",
"set-window-option -g allow-rename off",
"set-window-option -g automatic-rename off",
*node[:wemux][:tmux].fetch(:config, [])
"set -g prefix C-#{node['wemux']['tmux']['control_key']}",
'unbind C-b',
"bind C-#{node['wemux']['tmux']['control_key']} send-prefix",
'set-window-option -g allow-rename off',
'set-window-option -g automatic-rename off',
*node['wemux']['tmux'].fetch(:config, []),
].join("\n") << "\n"
}
mode 0644
only_if{ node[:wemux][:tmux][:write] }
mode '644'
only_if { node['wemux']['tmux']['write'] }
end
14 changes: 6 additions & 8 deletions recipes/users.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@

ruby_block 'Default ignored users' do
block do
node.default[:wemux][:users][:ignored] = node[:wemux][:config][:host_list]
node.default['wemux']['users'][:ignored] = node['wemux']['config']['host_list']
end
end

wemux_hosts = []

search(node[:wemux][:users][:data_bag], "id:*").each do |user|

search(node['wemux']['users']['data_bag'], 'id:*').each do |user|
user['wemux'] ||= {}
username = user.fetch('username', user['id'])
wemux_mode = user['wemux'].fetch('mode', 'mirror')
wemux_admin = user['wemux']['admin']

if(wemux_admin)
if wemux_admin
wemux_hosts.push(username).uniq!
end

file "/home/#{username}/.bashrc" do
content "wemux #{wemux_mode}; exit"
not_if{ node[:wemux][:users][:ignored].include?(username) }
mode 0644
not_if { node['wemux']['users']['ignored'].include?(username) }
mode '644'
end

end

node.set[:wemux][:config][:host_list] = wemux_hosts
node.normal['wemux']['config'][:host_list] = wemux_hosts