Commit fd662c9d34ebbcbb721b50605083a51e139397d6

Authored by Jianwei Han
1 parent d7ba16de2b
Exists in master

Try to avoid inherits

Showing 5 changed files with 29 additions and 8 deletions Inline Diff

modules/people/manifests/hanjianwei.pp
class people::hanjianwei { 1 1 class people::hanjianwei (
2 $home = $people::hanjianwei::config::home,
3 $dotfiles = $people::hanjianwei::config::dotfiles,
4 $srcdir = $people::hanjianwei::config::srcdir
5 ) inherits people::hanjianwei::config {
include people::hanjianwei::osx 2 6 include people::hanjianwei::osx
include people::hanjianwei::repositories 3 7 include people::hanjianwei::repositories
include people::hanjianwei::applications 4 8 include people::hanjianwei::applications
} 5 9 }
6 10
modules/people/manifests/hanjianwei/applications.pp
class people::hanjianwei::applications inherits people::hanjianwei::config { 1 1 class people::hanjianwei::applications(
notify { "${homebrew::config::cachedir}": } 2 2 $home = $people::hanjianwei::config::home,
3 $dotfiles = $people::hanjianwei::config::dotfiles
4 ) {
3 5
# Declare all Homebrew packages 4 6 # Declare all Homebrew packages
package { 5 7 package {
[ 6 8 [
'wget', 7 9 'wget',
'qt5', 8 10 'qt5',
'tmux', 9 11 'tmux',
'vim' 10 12 'vim'
]: 11 13 ]:
} 12 14 }
13 15
homebrew::tap { 'homebrew/science': } 14 16 homebrew::tap { 'homebrew/science': }
-> 15 17 ->
package { 'opencv': } 16 18 package { 'opencv': }
17 19
# Declare all Hombrew Cask packages 18 20 # Declare all Hombrew Cask packages
include brewcask 19 21 include brewcask
20 22
package { 21 23 package {
[ 22 24 [
'acorn', 23 25 'acorn',
'alfred', 24 26 'alfred',
'atom', 25 27 'atom',
'bettertouchtool', 26 28 'bettertouchtool',
'caffeine', 27 29 'caffeine',
'cleanmymac', 28 30 'cleanmymac',
'dropbox', 29 31 'dropbox',
'evernote', 30 32 'evernote',
'fantastical', 31 33 'fantastical',
'firefox', 32 34 'firefox',
'google-chrome', 33 35 'google-chrome',
'hazel', 34 36 'hazel',
'iterm2', 35 37 'iterm2',
'keyboard-maestro', 36 38 'keyboard-maestro',
'keyremap4macbook', 37 39 'keyremap4macbook',
'mactex', 38 40 'mactex',
'omnifocus', 39 41 'omnifocus',
'onepassword', 40 42 'onepassword',
'parallels', 41 43 'parallels',
'pycharm-ce', 42 44 'pycharm-ce',
'scapple', 43 45 'scapple',
'screenflow', 44 46 'screenflow',
'scrivener', 45 47 'scrivener',
'seil', 46 48 'seil',
'shiori', 47 49 'shiori',
'trim-enabler', 48 50 'trim-enabler',
'qq', 49 51 'qq',
'qt-creator', 50 52 'qt-creator',
'vagrant', 51 53 'vagrant',
'virtualbox', 52 54 'virtualbox',
'welly', 53 55 'welly',
'xmind' 54 56 'xmind'
]: 55 57 ]:
provider => 'brewcask' 56 58 provider => 'brewcask'
} 57 59 }
58 60
# Taps 59 61 # Taps
homebrew::tap { 'caskroom/fonts': } 60 62 homebrew::tap { 'caskroom/fonts': }
-> 61 63 ->
package { 'font-inconsolata-for-powerline': 62 64 package { 'font-inconsolata-for-powerline':
provider => 'brewcask' 63 65 provider => 'brewcask'
} 64 66 }
65 67
homebrew::tap { 'caskroom/versions': } 66 68 homebrew::tap { 'caskroom/versions': }
-> 67 69 ->
package { 'intellij-idea-ultimate12': 68 70 package { 'intellij-idea-ultimate12':
provider => 'brewcask' 69 71 provider => 'brewcask'
} 70 72 }
71 73
homebrew::tap { 'railwaycat/emacsmacport': } 72 74 homebrew::tap { 'railwaycat/emacsmacport': }
-> 73 75 ->
package { 'emacs-mac': 74 76 package { 'emacs-mac':
provider => 'brewcask' 75 77 provider => 'brewcask'
} 76 78 }
77 79
# tmux 78 80 # tmux
Package['tmux'] 79 81 Package['tmux']
-> 80 82 ->
file { "${home}/.tmux.conf": 81 83 file { "${home}/.tmux.conf":
ensure => link, 82 84 ensure => link,
target => "${dotfiles}/tmux/tmux.conf", 83 85 target => "${dotfiles}/tmux/tmux.conf",
require => Repository["${dotfiles}"] 84 86 require => Repository["${dotfiles}"]
} 85 87 }
86 88
# Vim 87 89 # Vim
Package['vim'] 88 90 Package['vim']
-> 89 91 ->
file { "${home}/.vimrc": 90 92 file { "${home}/.vimrc":
ensure => link, 91 93 ensure => link,
target => "${dotfiles}/Vim/vimrc", 92 94 target => "${dotfiles}/Vim/vimrc",
require => Repository["${dotfiles}"] 93 95 require => Repository["${dotfiles}"]
} 94 96 }
-> 95 97 ->
file { ["${home}/.vim", "${home}/.vim/bundle"]: 96 98 file { ["${home}/.vim", "${home}/.vim/bundle"]:
ensure => directory 97 99 ensure => directory
} 98 100 }
-> 99 101 ->
repository { "${home}/.vim/bundle/Vundle.vim": 100 102 repository { "${home}/.vim/bundle/Vundle.vim":
source => 'gmarik/Vundle.vim' 101 103 source => 'gmarik/Vundle.vim'
} 102 104 }
-> 103 105 ->
exec { 'vim +BundleInstall +BundleClean +qall': } 104 106 exec { 'vim +BundleInstall +BundleClean +qall': }
105 107
106 108
# Emacs mac port 107 109 # Emacs mac port
Package['emacs-mac'] 108 110 Package['emacs-mac']
-> 109 111 ->
file { "${home}/.emacs.d": 110 112 file { "${home}/.emacs.d":
ensure => directory 111 113 ensure => directory
} 112 114 }
-> 113 115 ->
file { "${home}/.emacs.d/init.el": 114 116 file { "${home}/.emacs.d/init.el":
ensure => link, 115 117 ensure => link,
target => "${dotfiles}/Emacs/init.el", 116 118 target => "${dotfiles}/Emacs/init.el",
require => Repository["${dotfiles}"] 117 119 require => Repository["${dotfiles}"]
} 118 120 }
-> 119 121 ->
repository { "${home}/.emacs.d/snippets": 120 122 repository { "${home}/.emacs.d/snippets":
source => 'hanjianwei/yasnippet-snippets' 121 123 source => 'hanjianwei/yasnippet-snippets'
} 122 124 }
123 125
# Firefox 124 126 # Firefox
Package['firefox'] 125 127 Package['firefox']
-> 126 128 ->
file { "${home}/.vimperatorrc": 127 129 file { "${home}/.vimperatorrc":
target => "${dotfiles}/Vimperator/vimperatorrc", 128 130 target => "${dotfiles}/Vimperator/vimperatorrc",
require => Repository["${dotfiles}"] 129 131 require => Repository["${dotfiles}"]
} 130 132 }
131 133
# KeyRemap4Macbook 132 134 # KeyRemap4Macbook
# include keyremap4macbook 133 135 # include keyremap4macbook
# include keyremap4macbook::login_item 134 136 # include keyremap4macbook::login_item
# keyremap4macbook::remap { 'private.f19_to_hyper': } 135 137 # keyremap4macbook::remap { 'private.f19_to_hyper': }
# keyremap4macbook::private_xml { 'private.xml': 136 138 # keyremap4macbook::private_xml { 'private.xml':
# source => "${dotfiles}/KeyRemap4MacBook/private.xml", 137 139 # source => "${dotfiles}/KeyRemap4MacBook/private.xml",
# require => Repository["${dotfiles}"] 138 140 # require => Repository["${dotfiles}"]
# } 139 141 # }
modules/people/manifests/hanjianwei/mirrors.pp
class people::hanjianwei::mirrors inherits people::hanjianwei::config { 1 1 class people::hanjianwei::mirrors(
2 $home = $people::hanjianwei::config::home,
3 $dotfiles = $people::hanjianwei::config::dotfiles
4 ) {
include boxen::gemrc 2 5 include boxen::gemrc
3 6
File <| title == "/Users/${::boxen_user}/.gemrc" |> { 4 7 File <| title == "${home}/.gemrc" |> {
source => "${dotfiles}/Gem/gemrc", 5 8 source => "${dotfiles}/Gem/gemrc",
require => Repository["${dotfiles}"] 6 9 require => Repository["${dotfiles}"]
} 7 10 }
} 8 11 }
9 12
modules/people/manifests/hanjianwei/osx.pp
class people::hanjianwei::osx inherits people::hanjianwei::config { 1 1 class people::hanjianwei::osx(
2 $home = $people::hanjianwei::config::home,
3 $dotfiles = $people::hanjianwei::config::dotfiles
4 ) {
# Zsh 2 5 # Zsh
osx_chsh { $boxen_user: 3 6 osx_chsh { $boxen_user:
shell => '/bin/zsh' 4 7 shell => '/bin/zsh'
} 5 8 }
6 9
repository { "${home}/.zprezto": 7 10 repository { "${home}/.zprezto":
source => 'sorin-ionescu/prezto' 8 11 source => 'sorin-ionescu/prezto'
} 9 12 }
-> 10 13 ->
file { "${home}/.zshrc": 11 14 file { "${home}/.zshrc":
ensure => link, 12 15 ensure => link,
target => "${dotfiles}/Zsh/zshrc", 13 16 target => "${dotfiles}/Zsh/zshrc",
require => Repository["${dotfiles}"] 14 17 require => Repository["${dotfiles}"]
} 15 18 }
-> 16 19 ->
file { "${home}/.zshenv": 17 20 file { "${home}/.zshenv":
ensure => link, 18 21 ensure => link,
target => "${dotfiles}/Zsh/zshenv", 19 22 target => "${dotfiles}/Zsh/zshenv",
require => Repository["${dotfiles}"] 20 23 require => Repository["${dotfiles}"]
} 21 24 }
-> 22 25 ->
file { "${home}/.zpreztorc": 23 26 file { "${home}/.zpreztorc":
ensure => link, 24 27 ensure => link,
target => "${dotfiles}/Zsh/zpreztorc", 25 28 target => "${dotfiles}/Zsh/zpreztorc",
require => Repository["${dotfiles}"] 26 29 require => Repository["${dotfiles}"]
} 27 30 }
-> 28 31 ->
file { "${home}/.zlogin": 29 32 file { "${home}/.zlogin":
ensure => link, 30 33 ensure => link,
target => "${dotfiles}/Zsh/zlogin", 31 34 target => "${dotfiles}/Zsh/zlogin",
require => Repository["${dotfiles}"] 32 35 require => Repository["${dotfiles}"]
} 33 36 }
-> 34 37 ->
file { "${home}/.zlogout": 35 38 file { "${home}/.zlogout":
ensure => link, 36 39 ensure => link,
target => "${dotfiles}/Zsh/zlogout", 37 40 target => "${dotfiles}/Zsh/zlogout",
require => Repository["${dotfiles}"] 38 41 require => Repository["${dotfiles}"]
} 39 42 }
file { "${home}/.activate.sh": 40 43 file { "${home}/.activate.sh":
ensure => link, 41 44 ensure => link,
target => "${dotfiles}/Zsh/activate.sh", 42 45 target => "${dotfiles}/Zsh/activate.sh",
require => Repository["${dotfiles}"] 43 46 require => Repository["${dotfiles}"]
} 44 47 }
45 48
# Setup mirrors 46 49 # Setup mirrors
include people::hanjianwei::mirrors 47 50 include people::hanjianwei::mirrors
48 51
# OSX settings 49 52 # OSX settings
include 'osx::global::expand_save_dialog' 50 53 include 'osx::global::expand_save_dialog'
include 'osx::global::tap_to_click' 51 54 include 'osx::global::tap_to_click'
include 'osx::disable_app_quarantine' 52 55 include 'osx::disable_app_quarantine'
include 'osx::finder::show_all_on_desktop' 53 56 include 'osx::finder::show_all_on_desktop'
modules/people/manifests/hanjianwei/repositories.pp
class people::hanjianwei::repositories inherits people::hanjianwei::config { 1 1 class people::hanjianwei::repositories(
2 $home = $people::hanjianwei::config::home,
3 $dotfiles = $people::hanjianwei::config::dotfiles,
4 $srcdir = $people::hanjianwei::config::srcdir
5 ) {
6
# Git 2 7 # Git
file { "${home}/.gitconfig": 3 8 file { "${home}/.gitconfig":
target => "${dotfiles}/Git/gitconfig", 4 9 target => "${dotfiles}/Git/gitconfig",
require => Repository["${dotfiles}"] 5 10 require => Repository["${dotfiles}"]
} 6 11 }
7 12
# Repos 8 13 # Repos
repository { "${dotfiles}": 9 14 repository { "${dotfiles}":
source => 'hanjianwei/dotfiles' 10 15 source => 'hanjianwei/dotfiles'
16 }
17
18 repository { "${srcdir}/diyao/web":
19 source => 'hanjianwei/diyao-web'
} 11 20 }
} 12 21 }