From 225d9deac5ebc1ee4db7da59a1a4a70dcc9a27f6 Mon Sep 17 00:00:00 2001 From: Jianwei Han Date: Thu, 10 Jul 2014 09:20:50 +0800 Subject: [PATCH] Use puppet-dotfiles to manage configs --- Puppetfile | 3 +- Puppetfile.lock | 12 +- .../people/manifests/hanjianwei/applications.pp | 168 ++++++++------------- modules/people/manifests/hanjianwei/mirrors.pp | 11 -- modules/people/manifests/hanjianwei/osx.pp | 52 +------ .../people/manifests/hanjianwei/repositories.pp | 20 +-- 6 files changed, 72 insertions(+), 194 deletions(-) delete mode 100644 modules/people/manifests/hanjianwei/mirrors.pp diff --git a/Puppetfile b/Puppetfile index ac27b76..31cd155 100644 --- a/Puppetfile +++ b/Puppetfile @@ -41,7 +41,7 @@ github "module-data", "0.0.3", :repo => "ripienaar/puppet-module-data" github "dnsmasq", "1.0.1" github "gcc", "2.0.101" github "git", "2.4.0" -github "homebrew", "1.9.4.rc", :repo => "hanjianwei/puppet-homebrew" +github "homebrew", "1.9.4" github "hub", "1.3.0" github "inifile", "1.0.3", :repo => "puppetlabs/puppetlabs-inifile" github "nginx", "1.4.3" @@ -59,3 +59,4 @@ github "xquartz", "1.1.1" github "osx", "2.7.0" github "property_list_key", "0.2.1", :repo => "glarizza/puppet-property_list_key" github "brewcask", "0.0.4.rc2", :repo => "hanjianwei/puppet-brewcask" +github "dotfiles", "0.0.2", :repo => "hanjianwei/puppet-dotfiles" diff --git a/Puppetfile.lock b/Puppetfile.lock index 12b3fff..8a504de 100644 --- a/Puppetfile.lock +++ b/Puppetfile.lock @@ -19,6 +19,11 @@ GITHUBTARBALL git (2.4.0) GITHUBTARBALL + remote: boxen/puppet-homebrew + specs: + homebrew (1.9.4) + +GITHUBTARBALL remote: boxen/puppet-hub specs: hub (1.3.0) @@ -79,9 +84,9 @@ GITHUBTARBALL brewcask (0.0.4.rc2) GITHUBTARBALL - remote: hanjianwei/puppet-homebrew + remote: hanjianwei/puppet-dotfiles specs: - homebrew (1.9.4.rc) + dotfiles (0.0.2) GITHUBTARBALL remote: puppetlabs/puppetlabs-inifile @@ -102,9 +107,10 @@ DEPENDENCIES boxen (= 3.6.1) brewcask (= 0.0.4.rc2) dnsmasq (= 1.0.1) + dotfiles (= 0.0.2) gcc (= 2.0.101) git (= 2.4.0) - homebrew (= 1.9.4.rc) + homebrew (= 1.9.4) hub (= 1.3.0) inifile (= 1.0.3) module-data (= 0.0.3) diff --git a/modules/people/manifests/hanjianwei/applications.pp b/modules/people/manifests/hanjianwei/applications.pp index 0a4c1be..b600eec 100644 --- a/modules/people/manifests/hanjianwei/applications.pp +++ b/modules/people/manifests/hanjianwei/applications.pp @@ -1,16 +1,10 @@ -class people::hanjianwei::applications( - $home = $people::hanjianwei::config::home, - $dotfiles = $people::hanjianwei::config::dotfiles -) { +class people::hanjianwei::applications { # Declare all Homebrew packages - package { - [ - 'wget', - 'qt5', - 'tmux', - 'vim' - ]: + package { ['wget', + 'qt5', + 'tmux', + 'vim']: } homebrew::tap { 'homebrew/science': } @@ -20,42 +14,39 @@ class people::hanjianwei::applications( # Declare all Hombrew Cask packages include brewcask - package { - [ - 'acorn', - 'alfred', - 'atom', - 'bettertouchtool', - 'caffeine', - 'cleanmymac', - 'dropbox', - 'evernote', - 'fantastical', - 'firefox', - 'google-chrome', - 'hazel', - 'iterm2', - 'keyboard-maestro', - 'keyremap4macbook', - 'mactex', - 'omnifocus', - 'onepassword', - 'parallels', - 'pycharm-ce', - 'scapple', - 'screenflow', - 'scrivener', - 'seil', - 'shiori', - 'trim-enabler', - 'qq', - 'qt-creator', - 'vagrant', - 'virtualbox', - 'welly', - 'xmind' - ]: - provider => 'brewcask' + package { ['acorn', + 'alfred', + 'atom', + 'bettertouchtool', + 'caffeine', + 'cleanmymac', + 'dropbox', + 'evernote', + 'fantastical', + 'firefox', + 'google-chrome', + 'hazel', + 'iterm2', + 'keyboard-maestro', + 'keyremap4macbook', + 'mactex', + 'omnifocus', + 'onepassword', + 'parallels', + 'pycharm-ce', + 'scapple', + 'screenflow', + 'scrivener', + 'seil', + 'shiori', + 'trim-enabler', + 'qq', + 'qt-creator', + 'vagrant', + 'virtualbox', + 'welly', + 'xmind']: + provider => 'brewcask' } # Taps @@ -77,77 +68,36 @@ class people::hanjianwei::applications( provider => 'brewcask' } - # tmux - Package['tmux'] - -> - file { "${home}/.tmux.conf": - ensure => link, - target => "${dotfiles}/tmux/tmux.conf", - require => Repository["${dotfiles}"] + # Apps configuration + class { 'dotfiles::tmux': + require => Package['tmux'], } - # Vim - Package['vim'] - -> - file { "${home}/.vimrc": - ensure => link, - target => "${dotfiles}/Vim/vimrc", - require => Repository["${dotfiles}"] - } - -> - file { ["${home}/.vim", "${home}/.vim/bundle"]: - ensure => directory + class { 'dotfiles::vim': + require => Package['vim'], } - -> - repository { "${home}/.vim/bundle/Vundle.vim": - source => 'gmarik/Vundle.vim' - } - -> - exec { 'vim +BundleInstall +BundleClean +qall': } - - # Emacs mac port - Package['emacs-mac'] - -> - file { "${home}/.emacs.d": - ensure => directory - } - -> - file { "${home}/.emacs.d/init.el": - ensure => link, - target => "${dotfiles}/Emacs/init.el", - require => Repository["${dotfiles}"] + class { 'dotfiles::emacs': + require => Package['emacs-mac'], } - -> - repository { "${home}/.emacs.d/snippets": - source => 'hanjianwei/yasnippet-snippets' + + class { 'dotfiles::vimperator': + require => Package['firefox'], } - # Firefox - Package['firefox'] - -> - file { "${home}/.vimperatorrc": - target => "${dotfiles}/Vimperator/vimperatorrc", - require => Repository["${dotfiles}"] + class { 'dotfiles::keyremap4macbook': + require => Package['keyremap4macbook'], } - # KeyRemap4Macbook - # include keyremap4macbook - # include keyremap4macbook::login_item - # keyremap4macbook::remap { 'private.f19_to_hyper': } - # keyremap4macbook::private_xml { 'private.xml': - # source => "${dotfiles}/KeyRemap4MacBook/private.xml", - # require => Repository["${dotfiles}"] - # } + class { 'dotfiles::seil': + require => Package['seil'] + } - # Seil - #include seil - #include seil::login_item - #seil::bind { 'keyboard bindings': - #mappings => { 'capslock' => 80 } - #} + osx_chsh { $boxen_user: + shell => '/bin/zsh' + } - # Vagrant - #include vagrant - #vagrant::plugin { 'vagrant-vbguest': } + include dotfiles::git + include dotfiles::zsh + include dotfiles::rubygems } diff --git a/modules/people/manifests/hanjianwei/mirrors.pp b/modules/people/manifests/hanjianwei/mirrors.pp deleted file mode 100644 index b148ab1..0000000 --- a/modules/people/manifests/hanjianwei/mirrors.pp +++ /dev/null @@ -1,11 +0,0 @@ -class people::hanjianwei::mirrors( - $home = $people::hanjianwei::config::home, - $dotfiles = $people::hanjianwei::config::dotfiles -) { - include boxen::gemrc - - File <| title == "${home}/.gemrc" |> { - source => "${dotfiles}/Gem/gemrc", - require => Repository["${dotfiles}"] - } -} diff --git a/modules/people/manifests/hanjianwei/osx.pp b/modules/people/manifests/hanjianwei/osx.pp index 06a4535..3cbd40e 100644 --- a/modules/people/manifests/hanjianwei/osx.pp +++ b/modules/people/manifests/hanjianwei/osx.pp @@ -1,54 +1,4 @@ -class people::hanjianwei::osx( - $home = $people::hanjianwei::config::home, - $dotfiles = $people::hanjianwei::config::dotfiles -) { - # Zsh - osx_chsh { $boxen_user: - shell => '/bin/zsh' - } - - repository { "${home}/.zprezto": - source => 'sorin-ionescu/prezto' - } - -> - file { "${home}/.zshrc": - ensure => link, - target => "${dotfiles}/Zsh/zshrc", - require => Repository["${dotfiles}"] - } - -> - file { "${home}/.zshenv": - ensure => link, - target => "${dotfiles}/Zsh/zshenv", - require => Repository["${dotfiles}"] - } - -> - file { "${home}/.zpreztorc": - ensure => link, - target => "${dotfiles}/Zsh/zpreztorc", - require => Repository["${dotfiles}"] - } - -> - file { "${home}/.zlogin": - ensure => link, - target => "${dotfiles}/Zsh/zlogin", - require => Repository["${dotfiles}"] - } - -> - file { "${home}/.zlogout": - ensure => link, - target => "${dotfiles}/Zsh/zlogout", - require => Repository["${dotfiles}"] - } - file { "${home}/.activate.sh": - ensure => link, - target => "${dotfiles}/Zsh/activate.sh", - require => Repository["${dotfiles}"] - } - - # Setup mirrors - include people::hanjianwei::mirrors - +class people::hanjianwei::osx { # OSX settings include 'osx::global::expand_save_dialog' include 'osx::global::tap_to_click' diff --git a/modules/people/manifests/hanjianwei/repositories.pp b/modules/people/manifests/hanjianwei/repositories.pp index e55ecd3..b6a5902 100644 --- a/modules/people/manifests/hanjianwei/repositories.pp +++ b/modules/people/manifests/hanjianwei/repositories.pp @@ -1,21 +1,3 @@ -class people::hanjianwei::repositories( - $home = $people::hanjianwei::config::home, - $dotfiles = $people::hanjianwei::config::dotfiles, - $srcdir = $people::hanjianwei::config::srcdir -) { +class people::hanjianwei::repositories { - # Git - file { "${home}/.gitconfig": - target => "${dotfiles}/Git/gitconfig", - require => Repository["${dotfiles}"] - } - - # Repos - repository { "${dotfiles}": - source => 'hanjianwei/dotfiles' - } - - repository { "${srcdir}/diyao/web": - source => 'hanjianwei/diyao-web' - } } -- 1.8.5.3