├── Thorfile ├── attributes └── ohmyzsh.rb ├── .gitignore ├── Cheffile ├── Gemfile ├── metadata.rb ├── .kitchen.yml ├── data_bags └── users │ └── test.json ├── recipes ├── shared.rb └── default.rb ├── README.rdoc └── templates └── default └── zshrc.erb /Thorfile: -------------------------------------------------------------------------------- 1 | require 'emeril/thor' 2 | -------------------------------------------------------------------------------- /attributes/ohmyzsh.rb: -------------------------------------------------------------------------------- 1 | default[:ohmyzsh][:theme] = "afowler" 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | .cache 3 | bin 4 | .vagrant 5 | .kitchen/ 6 | .kitchen.local.yml 7 | Berksfile.lock 8 | Gemfile.lock 9 | vendor 10 | tmp 11 | .librarian 12 | Cheffile.lock 13 | -------------------------------------------------------------------------------- /Cheffile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | site 'http://community.opscode.com/api/v1' 4 | 5 | cookbook 'apt' 6 | cookbook 'yum' 7 | cookbook 'chef-solo-search' 8 | cookbook 'oh-my-zsh', path: '.' 9 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | source 'https://rubygems.org' 4 | 5 | gem 'emeril', :group => :release 6 | 7 | group :test do 8 | gem 'test-kitchen', git: 'git@github.com:opscode/test-kitchen.git' 9 | gem 'kitchen-vagrant' 10 | gem 'librarian-chef' 11 | end 12 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name "oh-my-zsh" 2 | maintainer "Heavy Water Ops, LLC" 3 | maintainer_email "support@hw-ops.com" 4 | license "Apache 2.0" 5 | description "Installs/Configures oh-my-zsh" 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) 7 | version "0.4.4" 8 | 9 | depends "git" 10 | depends "zsh" 11 | depends "users" 12 | 13 | %w( ubuntu debian 14 | centos redhat fedora ).each do |os| 15 | supports os 16 | end 17 | -------------------------------------------------------------------------------- /.kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver_plugin: vagrant 3 | driver_config: 4 | require_chef_omnibus: true 5 | 6 | platforms: 7 | - name: ubuntu-12.04 8 | run_list: 9 | - recipe[apt] 10 | - name: ubuntu-10.04 11 | run_list: 12 | - recipe[apt] 13 | - name: centos-6.4 14 | run_list: 15 | - recipe[yum] 16 | - name: centos-5.9 17 | run_list: 18 | - recipe[yum] 19 | 20 | suites: 21 | - name: default 22 | run_list: 23 | - recipe[chef-solo-search] 24 | - recipe[users::sysadmins] 25 | - recipe[oh-my-zsh] 26 | attributes: {} 27 | -------------------------------------------------------------------------------- /data_bags/users/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": "A Test User", 3 | "groups": "sysadmin", 4 | "ssh_keys": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7HWholLnWMEN1fceFYIxeB+ujQPPwQKMJ+XrPMartqgNsgNgUDmCfJxwwuy8U2GxshVRBf2DyMy8ndxLjChLuRMJWxVigXshVRBf2DyMy8ndxLjChLuRMJWxVigXshVRBf2DyMy8ndxLjChLuRMJWxVigXshVRBf2DyMy8ndxLjChLuRMJWxVigXshVRBf2DyMy8ndxLjChLuRMJWxVigXshVRBf2DyMy8ndxLjChLuRMJWxVigXshVRBf2DyMy8ndxLjChLuRMJWxVigXshVRBf2DyMy8ndxLjChLuRMJWxVigXshVRBf2DyMy8ndxLjChLuRMJWxVigX/7ohpzngKJRAKBoVUo4wYjMhMxeKkXEn4bKpW2YXqdQ== testuser@machine", 5 | "uid": 1337, 6 | "id": "kitchen", 7 | "shell": "/bin/zsh" 8 | } 9 | -------------------------------------------------------------------------------- /recipes/shared.rb: -------------------------------------------------------------------------------- 1 | git "/usr/src/oh-my-zsh" do 2 | repository "https://github.com/robbyrussell/oh-my-zsh.git" 3 | reference "master" 4 | action :sync 5 | end 6 | 7 | search( :users, "shell:*zsh" ).each do |u| 8 | user_id = u["id"] 9 | 10 | theme = data_bag_item( "users", user_id )["oh-my-zsh-theme"] 11 | 12 | link "/home/#{user_id}/.oh-my-zsh" do 13 | to "/usr/src/oh-my-zsh" 14 | not_if "test -d /home/#{user_id}/.oh-my-zsh" 15 | end 16 | 17 | template "/home/#{user_id}/.zshrc" do 18 | source "zshrc.erb" 19 | owner user_id 20 | group user_id 21 | variables( :theme => ( theme || node[:ohmyzsh][:theme] )) 22 | action :create_if_missing 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | = DESCRIPTION: 2 | 3 | A cookbook that installs and configures oh-my-zsh! 4 | 5 | https://github.com/robbyrussell/oh-my-zsh 6 | 7 | = REQUIREMENTS: 8 | 9 | == Platform: 10 | 11 | Tested on Ubuntu 10.04, but should work on most Debian and Red Hat derivatives. 12 | 13 | == Cookbooks: 14 | 15 | Depends on users, git and zsh. 16 | 17 | = ATTRIBUTES: 18 | 19 | * +ohmyzsh[:theme]+ sets the default oh-my-zsh theme. 20 | 21 | = USAGE: 22 | 23 | Any user data bag item with a shell set to zsh will have this recipe applied. 24 | Per-user themes are set by including an +oh-my-zsh-theme+ entry in a user data bag item. 25 | 26 | The default recipe clones a copy of the git repository in each home directory once. 27 | The "shared" recipe clones a single copy, links from each home directory 28 | and syncs it each time chef runs. 29 | -------------------------------------------------------------------------------- /templates/default/zshrc.erb: -------------------------------------------------------------------------------- 1 | # Path to your oh-my-zsh configuration. 2 | export ZSH=$HOME/.oh-my-zsh 3 | 4 | # Set to the name theme to load. 5 | # Look in ~/.oh-my-zsh/themes/ 6 | export ZSH_THEME="<%= @theme %>" 7 | 8 | # Set to this to use case-sensitive completion 9 | # export CASE_SENSITIVE="true" 10 | 11 | # Comment this out to disable weekly auto-update checks 12 | # export DISABLE_AUTO_UPDATE="true" 13 | 14 | # Uncomment following line if you want to disable colors in ls 15 | # export DISABLE_LS_COLORS="true" 16 | 17 | # Uncomment following line if you want to disable autosetting terminal title. 18 | # export DISABLE_AUTO_TITLE="true" 19 | 20 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 21 | # Example format: plugins=(rails git textmate ruby lighthouse) 22 | plugins=(git) 23 | 24 | source $ZSH/oh-my-zsh.sh 25 | 26 | # Customize to your needs... 27 | -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: oh-my-zsh 3 | # Recipe:: default 4 | # 5 | # Copyright 2011, Heavy Water Software Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | include_recipe "git" 21 | include_recipe "zsh" 22 | 23 | search( :users, "shell:*zsh AND NOT action:remove" ).each do |u| 24 | user_id = u["id"] 25 | next unless File.exists? "/home/#{user_id}" 26 | 27 | git "/home/#{user_id}/.oh-my-zsh" do 28 | repository "https://github.com/robbyrussell/oh-my-zsh.git" 29 | reference "master" 30 | user user_id 31 | group user_id 32 | action :checkout 33 | not_if "test -d /home/#{user_id}/.oh-my-zsh" 34 | end 35 | 36 | theme = data_bag_item( "users", user_id )["oh-my-zsh-theme"] 37 | 38 | template "/home/#{user_id}/.zshrc" do 39 | source "zshrc.erb" 40 | owner user_id 41 | group user_id 42 | variables( :theme => ( theme || node[:ohmyzsh][:theme] )) 43 | action :create_if_missing 44 | end 45 | end 46 | --------------------------------------------------------------------------------