Commit 225d9deac5ebc1ee4db7da59a1a4a70dcc9a27f6

Authored by Jianwei Han
1 parent fd662c9d34
Exists in master

Use puppet-dotfiles to manage configs

Showing 6 changed files with 72 additions and 194 deletions Inline Diff

# This file manages Puppet module dependencies. 1 1 # This file manages Puppet module dependencies.
# 2 2 #
# It works a lot like Bundler. We provide some core modules by 3 3 # It works a lot like Bundler. We provide some core modules by
# default. This ensures at least the ability to construct a basic 4 4 # default. This ensures at least the ability to construct a basic
# environment. 5 5 # environment.
6 6
# Shortcut for a module from GitHub's boxen organization 7 7 # Shortcut for a module from GitHub's boxen organization
def github(name, *args) 8 8 def github(name, *args)
options ||= if args.last.is_a? Hash 9 9 options ||= if args.last.is_a? Hash
args.last 10 10 args.last
else 11 11 else
{} 12 12 {}
end 13 13 end
14 14
if path = options.delete(:path) 15 15 if path = options.delete(:path)
mod name, :path => path 16 16 mod name, :path => path
else 17 17 else
version = args.first 18 18 version = args.first
options[:repo] ||= "boxen/puppet-#{name}" 19 19 options[:repo] ||= "boxen/puppet-#{name}"
mod name, version, :github_tarball => options[:repo] 20 20 mod name, version, :github_tarball => options[:repo]
end 21 21 end
end 22 22 end
23 23
# Shortcut for a module under development 24 24 # Shortcut for a module under development
def dev(name, *args) 25 25 def dev(name, *args)
mod name, :path => "#{ENV['HOME']}/src/boxen/puppet-#{name}" 26 26 mod name, :path => "#{ENV['HOME']}/src/boxen/puppet-#{name}"
end 27 27 end
28 28
# Includes many of our custom types and providers, as well as global 29 29 # Includes many of our custom types and providers, as well as global
# config. Required. 30 30 # config. Required.
31 31
github "boxen", "3.6.1" 32 32 github "boxen", "3.6.1"
33 33
# Support for default hiera data in modules 34 34 # Support for default hiera data in modules
35 35
github "module-data", "0.0.3", :repo => "ripienaar/puppet-module-data" 36 36 github "module-data", "0.0.3", :repo => "ripienaar/puppet-module-data"
37 37
# Core modules for a basic development environment. You can replace 38 38 # Core modules for a basic development environment. You can replace
# some/most of these if you want, but it's not recommended. 39 39 # some/most of these if you want, but it's not recommended.
40 40
github "dnsmasq", "1.0.1" 41 41 github "dnsmasq", "1.0.1"
github "gcc", "2.0.101" 42 42 github "gcc", "2.0.101"
github "git", "2.4.0" 43 43 github "git", "2.4.0"
github "homebrew", "1.9.4.rc", :repo => "hanjianwei/puppet-homebrew" 44 44 github "homebrew", "1.9.4"
github "hub", "1.3.0" 45 45 github "hub", "1.3.0"
github "inifile", "1.0.3", :repo => "puppetlabs/puppetlabs-inifile" 46 46 github "inifile", "1.0.3", :repo => "puppetlabs/puppetlabs-inifile"
github "nginx", "1.4.3" 47 47 github "nginx", "1.4.3"
github "nodejs", "3.7.0" 48 48 github "nodejs", "3.7.0"
github "openssl", "1.0.0" 49 49 github "openssl", "1.0.0"
github "pkgconfig", "1.0.0" 50 50 github "pkgconfig", "1.0.0"
github "repository", "2.3.0" 51 51 github "repository", "2.3.0"
github "ruby", "8.0.4" 52 52 github "ruby", "8.0.4"
github "stdlib", "4.2.1", :repo => "puppetlabs/puppetlabs-stdlib" 53 53 github "stdlib", "4.2.1", :repo => "puppetlabs/puppetlabs-stdlib"
GITHUBTARBALL 1 1 GITHUBTARBALL
remote: boxen/puppet-boxen 2 2 remote: boxen/puppet-boxen
specs: 3 3 specs:
boxen (3.6.1) 4 4 boxen (3.6.1)
5 5
GITHUBTARBALL 6 6 GITHUBTARBALL
remote: boxen/puppet-dnsmasq 7 7 remote: boxen/puppet-dnsmasq
specs: 8 8 specs:
dnsmasq (1.0.1) 9 9 dnsmasq (1.0.1)
10 10
GITHUBTARBALL 11 11 GITHUBTARBALL
remote: boxen/puppet-gcc 12 12 remote: boxen/puppet-gcc
specs: 13 13 specs:
gcc (2.0.101) 14 14 gcc (2.0.101)
15 15
GITHUBTARBALL 16 16 GITHUBTARBALL
remote: boxen/puppet-git 17 17 remote: boxen/puppet-git
specs: 18 18 specs:
git (2.4.0) 19 19 git (2.4.0)
20 20
GITHUBTARBALL 21 21 GITHUBTARBALL
22 remote: boxen/puppet-homebrew
23 specs:
24 homebrew (1.9.4)
25
26 GITHUBTARBALL
remote: boxen/puppet-hub 22 27 remote: boxen/puppet-hub
specs: 23 28 specs:
hub (1.3.0) 24 29 hub (1.3.0)
25 30
GITHUBTARBALL 26 31 GITHUBTARBALL
remote: boxen/puppet-nginx 27 32 remote: boxen/puppet-nginx
specs: 28 33 specs:
nginx (1.4.3) 29 34 nginx (1.4.3)
30 35
GITHUBTARBALL 31 36 GITHUBTARBALL
remote: boxen/puppet-nodejs 32 37 remote: boxen/puppet-nodejs
specs: 33 38 specs:
nodejs (3.7.0) 34 39 nodejs (3.7.0)
35 40
GITHUBTARBALL 36 41 GITHUBTARBALL
remote: boxen/puppet-openssl 37 42 remote: boxen/puppet-openssl
specs: 38 43 specs:
openssl (1.0.0) 39 44 openssl (1.0.0)
40 45
GITHUBTARBALL 41 46 GITHUBTARBALL
remote: boxen/puppet-osx 42 47 remote: boxen/puppet-osx
specs: 43 48 specs:
osx (2.7.0) 44 49 osx (2.7.0)
45 50
GITHUBTARBALL 46 51 GITHUBTARBALL
remote: boxen/puppet-pkgconfig 47 52 remote: boxen/puppet-pkgconfig
specs: 48 53 specs:
pkgconfig (1.0.0) 49 54 pkgconfig (1.0.0)
50 55
GITHUBTARBALL 51 56 GITHUBTARBALL
remote: boxen/puppet-repository 52 57 remote: boxen/puppet-repository
specs: 53 58 specs:
repository (2.3.0) 54 59 repository (2.3.0)
55 60
GITHUBTARBALL 56 61 GITHUBTARBALL
remote: boxen/puppet-ruby 57 62 remote: boxen/puppet-ruby
specs: 58 63 specs:
ruby (8.0.4) 59 64 ruby (8.0.4)
60 65
GITHUBTARBALL 61 66 GITHUBTARBALL
remote: boxen/puppet-sudo 62 67 remote: boxen/puppet-sudo
specs: 63 68 specs:
sudo (1.0.0) 64 69 sudo (1.0.0)
65 70
GITHUBTARBALL 66 71 GITHUBTARBALL
remote: boxen/puppet-xquartz 67 72 remote: boxen/puppet-xquartz
specs: 68 73 specs:
xquartz (1.1.1) 69 74 xquartz (1.1.1)
70 75
GITHUBTARBALL 71 76 GITHUBTARBALL
remote: glarizza/puppet-property_list_key 72 77 remote: glarizza/puppet-property_list_key
specs: 73 78 specs:
property_list_key (0.2.1) 74 79 property_list_key (0.2.1)
75 80
GITHUBTARBALL 76 81 GITHUBTARBALL
remote: hanjianwei/puppet-brewcask 77 82 remote: hanjianwei/puppet-brewcask
specs: 78 83 specs:
brewcask (0.0.4.rc2) 79 84 brewcask (0.0.4.rc2)
80 85
GITHUBTARBALL 81 86 GITHUBTARBALL
remote: hanjianwei/puppet-homebrew 82 87 remote: hanjianwei/puppet-dotfiles
specs: 83 88 specs:
homebrew (1.9.4.rc) 84 89 dotfiles (0.0.2)
85 90
GITHUBTARBALL 86 91 GITHUBTARBALL
remote: puppetlabs/puppetlabs-inifile 87 92 remote: puppetlabs/puppetlabs-inifile
specs: 88 93 specs:
inifile (1.0.3) 89 94 inifile (1.0.3)
90 95
GITHUBTARBALL 91 96 GITHUBTARBALL
remote: puppetlabs/puppetlabs-stdlib 92 97 remote: puppetlabs/puppetlabs-stdlib
specs: 93 98 specs:
stdlib (4.2.1) 94 99 stdlib (4.2.1)
95 100
GITHUBTARBALL 96 101 GITHUBTARBALL
remote: ripienaar/puppet-module-data 97 102 remote: ripienaar/puppet-module-data
specs: 98 103 specs:
module-data (0.0.3) 99 104 module-data (0.0.3)
100 105
DEPENDENCIES 101 106 DEPENDENCIES
boxen (= 3.6.1) 102 107 boxen (= 3.6.1)
brewcask (= 0.0.4.rc2) 103 108 brewcask (= 0.0.4.rc2)
dnsmasq (= 1.0.1) 104 109 dnsmasq (= 1.0.1)
110 dotfiles (= 0.0.2)
modules/people/manifests/hanjianwei/applications.pp
class people::hanjianwei::applications( 1 1 class people::hanjianwei::applications {
$home = $people::hanjianwei::config::home, 2
$dotfiles = $people::hanjianwei::config::dotfiles 3
) { 4
5 2
# Declare all Homebrew packages 6 3 # Declare all Homebrew packages
package { 7 4 package { ['wget',
[ 8 5 'qt5',
'wget', 9 6 'tmux',
'qt5', 10 7 'vim']:
'tmux', 11
'vim' 12
]: 13
} 14 8 }
15 9
homebrew::tap { 'homebrew/science': } 16 10 homebrew::tap { 'homebrew/science': }
-> 17 11 ->
package { 'opencv': } 18 12 package { 'opencv': }
19 13
# Declare all Hombrew Cask packages 20 14 # Declare all Hombrew Cask packages
include brewcask 21 15 include brewcask
22 16
package { 23 17 package { ['acorn',
[ 24 18 'alfred',
'acorn', 25 19 'atom',
'alfred', 26 20 'bettertouchtool',
'atom', 27 21 'caffeine',
'bettertouchtool', 28 22 'cleanmymac',
'caffeine', 29 23 'dropbox',
'cleanmymac', 30 24 'evernote',
'dropbox', 31 25 'fantastical',
'evernote', 32 26 'firefox',
'fantastical', 33 27 'google-chrome',
'firefox', 34 28 'hazel',
'google-chrome', 35 29 'iterm2',
'hazel', 36 30 'keyboard-maestro',
'iterm2', 37 31 'keyremap4macbook',
'keyboard-maestro', 38 32 'mactex',
'keyremap4macbook', 39 33 'omnifocus',
'mactex', 40 34 'onepassword',
'omnifocus', 41 35 'parallels',
'onepassword', 42 36 'pycharm-ce',
'parallels', 43 37 'scapple',
'pycharm-ce', 44 38 'screenflow',
'scapple', 45 39 'scrivener',
'screenflow', 46 40 'seil',
'scrivener', 47 41 'shiori',
'seil', 48 42 'trim-enabler',
'shiori', 49 43 'qq',
'trim-enabler', 50 44 'qt-creator',
'qq', 51 45 'vagrant',
'qt-creator', 52 46 'virtualbox',
'vagrant', 53 47 'welly',
'virtualbox', 54 48 'xmind']:
'welly', 55 49 provider => 'brewcask'
'xmind' 56
]: 57
provider => 'brewcask' 58
} 59 50 }
60 51
# Taps 61 52 # Taps
homebrew::tap { 'caskroom/fonts': } 62 53 homebrew::tap { 'caskroom/fonts': }
-> 63 54 ->
package { 'font-inconsolata-for-powerline': 64 55 package { 'font-inconsolata-for-powerline':
provider => 'brewcask' 65 56 provider => 'brewcask'
} 66 57 }
67 58
homebrew::tap { 'caskroom/versions': } 68 59 homebrew::tap { 'caskroom/versions': }
-> 69 60 ->
package { 'intellij-idea-ultimate12': 70 61 package { 'intellij-idea-ultimate12':
provider => 'brewcask' 71 62 provider => 'brewcask'
} 72 63 }
73 64
homebrew::tap { 'railwaycat/emacsmacport': } 74 65 homebrew::tap { 'railwaycat/emacsmacport': }
-> 75 66 ->
package { 'emacs-mac': 76 67 package { 'emacs-mac':
provider => 'brewcask' 77 68 provider => 'brewcask'
} 78 69 }
79 70
# tmux 80 71 # Apps configuration
Package['tmux'] 81 72 class { 'dotfiles::tmux':
-> 82 73 require => Package['tmux'],
file { "${home}/.tmux.conf": 83
ensure => link, 84
target => "${dotfiles}/tmux/tmux.conf", 85
require => Repository["${dotfiles}"] 86
} 87 74 }
88 75
# Vim 89 76 class { 'dotfiles::vim':
Package['vim'] 90 77 require => Package['vim'],
-> 91
file { "${home}/.vimrc": 92
ensure => link, 93
target => "${dotfiles}/Vim/vimrc", 94
require => Repository["${dotfiles}"] 95
} 96 78 }
-> 97 79
file { ["${home}/.vim", "${home}/.vim/bundle"]: 98 80 class { 'dotfiles::emacs':
ensure => directory 99 81 require => Package['emacs-mac'],
} 100 82 }
-> 101 83
repository { "${home}/.vim/bundle/Vundle.vim": 102 84 class { 'dotfiles::vimperator':
source => 'gmarik/Vundle.vim' 103 85 require => Package['firefox'],
} 104 86 }
-> 105
exec { 'vim +BundleInstall +BundleClean +qall': } 106
107 87
88 class { 'dotfiles::keyremap4macbook':
89 require => Package['keyremap4macbook'],
90 }
108 91
# Emacs mac port 109 92 class { 'dotfiles::seil':
Package['emacs-mac'] 110 93 require => Package['seil']
-> 111
file { "${home}/.emacs.d": 112
ensure => directory 113
} 114 94 }
-> 115
file { "${home}/.emacs.d/init.el": 116
ensure => link, 117
target => "${dotfiles}/Emacs/init.el", 118
require => Repository["${dotfiles}"] 119
} 120
-> 121
repository { "${home}/.emacs.d/snippets": 122
source => 'hanjianwei/yasnippet-snippets' 123
} 124
125 95
# Firefox 126 96 osx_chsh { $boxen_user:
Package['firefox'] 127 97 shell => '/bin/zsh'
-> 128
file { "${home}/.vimperatorrc": 129
target => "${dotfiles}/Vimperator/vimperatorrc", 130
require => Repository["${dotfiles}"] 131
} 132 98 }
133 99
# KeyRemap4Macbook 134 100 include dotfiles::git
# include keyremap4macbook 135 101 include dotfiles::zsh
# include keyremap4macbook::login_item 136 102 include dotfiles::rubygems
# keyremap4macbook::remap { 'private.f19_to_hyper': } 137
# keyremap4macbook::private_xml { 'private.xml': 138
# source => "${dotfiles}/KeyRemap4MacBook/private.xml", 139
# require => Repository["${dotfiles}"] 140
# } 141
142
# Seil 143
#include seil 144
#include seil::login_item 145
#seil::bind { 'keyboard bindings': 146
#mappings => { 'capslock' => 80 } 147
#} 148
149
# Vagrant 150
#include vagrant 151
#vagrant::plugin { 'vagrant-vbguest': } 152
} 153 103 }
154 104
modules/people/manifests/hanjianwei/mirrors.pp
class people::hanjianwei::mirrors( 1 File was deleted
$home = $people::hanjianwei::config::home, 2
$dotfiles = $people::hanjianwei::config::dotfiles 3
) { 4
include boxen::gemrc 5
6
File <| title == "${home}/.gemrc" |> { 7
source => "${dotfiles}/Gem/gemrc", 8
require => Repository["${dotfiles}"] 9
} 10
modules/people/manifests/hanjianwei/osx.pp
class people::hanjianwei::osx( 1 1 class people::hanjianwei::osx {
$home = $people::hanjianwei::config::home, 2
$dotfiles = $people::hanjianwei::config::dotfiles 3
) { 4
# Zsh 5
osx_chsh { $boxen_user: 6
shell => '/bin/zsh' 7
} 8
9
repository { "${home}/.zprezto": 10
source => 'sorin-ionescu/prezto' 11
} 12
-> 13
file { "${home}/.zshrc": 14
ensure => link, 15
target => "${dotfiles}/Zsh/zshrc", 16
require => Repository["${dotfiles}"] 17
} 18
-> 19
file { "${home}/.zshenv": 20
ensure => link, 21
target => "${dotfiles}/Zsh/zshenv", 22
require => Repository["${dotfiles}"] 23
} 24
-> 25
file { "${home}/.zpreztorc": 26
ensure => link, 27
target => "${dotfiles}/Zsh/zpreztorc", 28
require => Repository["${dotfiles}"] 29
} 30
-> 31
file { "${home}/.zlogin": 32
ensure => link, 33
target => "${dotfiles}/Zsh/zlogin", 34
require => Repository["${dotfiles}"] 35
} 36
-> 37
file { "${home}/.zlogout": 38
ensure => link, 39
target => "${dotfiles}/Zsh/zlogout", 40
require => Repository["${dotfiles}"] 41
} 42
file { "${home}/.activate.sh": 43
ensure => link, 44
target => "${dotfiles}/Zsh/activate.sh", 45
require => Repository["${dotfiles}"] 46
} 47
48
# Setup mirrors 49
include people::hanjianwei::mirrors 50
51
# OSX settings 52 2 # OSX settings
include 'osx::global::expand_save_dialog' 53 3 include 'osx::global::expand_save_dialog'
include 'osx::global::tap_to_click' 54 4 include 'osx::global::tap_to_click'
include 'osx::disable_app_quarantine' 55 5 include 'osx::disable_app_quarantine'
include 'osx::finder::show_all_on_desktop' 56 6 include 'osx::finder::show_all_on_desktop'
modules/people/manifests/hanjianwei/repositories.pp
class people::hanjianwei::repositories( 1 1 class people::hanjianwei::repositories {
$home = $people::hanjianwei::config::home, 2
$dotfiles = $people::hanjianwei::config::dotfiles, 3
$srcdir = $people::hanjianwei::config::srcdir 4
) { 5
6 2
# Git 7
file { "${home}/.gitconfig": 8
target => "${dotfiles}/Git/gitconfig", 9
require => Repository["${dotfiles}"] 10
} 11
12
# Repos 13
repository { "${dotfiles}": 14
source => 'hanjianwei/dotfiles' 15
} 16
17
repository { "${srcdir}/diyao/web": 18
source => 'hanjianwei/diyao-web' 19