[meta] Add Prezto config
change
commit 315f30d521394142f8395df258394710cd9b8d5c
author Alpha Chen <alpha.chen@gmail.com>
date
parent a67bfc36
diff --git a/ansible/roles/dotfiles/files/setup_ssh_keys.rb b/ansible/roles/dotfiles/files/setup_ssh_keys.rb
deleted file mode 100644
index dffc6da2..00000000
--- a/ansible/roles/dotfiles/files/setup_ssh_keys.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'fileutils'
-
-include FileUtils
-
-def with_mount(image)
-  out = `hdiutil mount #{image}`
-  mountpoint = out.split(/\s+/).last
-  yield(mountpoint)
-ensure
-  puts `hdiutil unmount #{mountpoint}`
-end
-
-cd File.expand_path('~/.ssh')
-
-with_mount "~/Dropbox/sekritz.sparseimage" do |mountpoint|
-  from = Dir["#{mountpoint}/ssh keys/*"]
-  to = from.map {|file| File.basename(file) }
-  from.zip(to).each do |from, to|
-    next if File.exist?(to)
-
-    cp from, to
-    puts `chmod go-r #{to}`
-    puts `ssh-add -K #{to}`
-  end
-end
diff --git a/ansible/roles/dotfiles/tasks/dotfiles.yml b/ansible/roles/dotfiles/tasks/dotfiles.yml
new file mode 100644
index 00000000..a3fb0e8e
--- /dev/null
+++ b/ansible/roles/dotfiles/tasks/dotfiles.yml
@@ -0,0 +1,12 @@
+---
+- homebrew: name=stow
+- command: >
+    chdir={{ ansible_env.HOME }}/.dotfiles
+    stow --stow --target={{ ansible_env.HOME }} {{ item }}
+  with_items: stow
+- file:
+    src: "{{ ansible_env.HOME }}/.dotfiles/{{ item.key }}"
+    dest: "{{ ansible_env.HOME}}/{{ item.value }}"
+    state: link
+  with_dict: ln
+- local_action: command ruby scripts/setup_ssh_keys.rb
diff --git a/ansible/roles/dotfiles/tasks/main.yml b/ansible/roles/dotfiles/tasks/main.yml
index 3d74fce0..206c0e80 100644
--- a/ansible/roles/dotfiles/tasks/main.yml
+++ b/ansible/roles/dotfiles/tasks/main.yml
@@ -1,13 +1,4 @@
 ---
-- homebrew: name=stow
 # - git: repo=https://github.com/kejadlen/dotfiles.git dest=~/.dotfiles force=no
-- command: >
-    chdir={{ ansible_env.HOME }}/.dotfiles
-    stow --stow --target={{ ansible_env.HOME }} {{ item }}
-  with_items: stow
-- file:
-    src: "{{ ansible_env.HOME }}/.dotfiles/{{ item.key }}"
-    dest: "{{ ansible_env.HOME}}/{{ item.value }}"
-    state: link
-  with_dict: ln
-- local_action: command ruby setup_ssh_keys.rb
+- include: dotfiles.yml
+- include: prezto.yml
diff --git a/ansible/roles/dotfiles/tasks/prezto.yml b/ansible/roles/dotfiles/tasks/prezto.yml
new file mode 100644
index 00000000..cedd96f8
--- /dev/null
+++ b/ansible/roles/dotfiles/tasks/prezto.yml
@@ -0,0 +1,13 @@
+---
+- homebrew: name=zsh
+- file:
+    src: "{{ ansible_env.HOME }}/.dotfiles/src/prezto"
+    dest: "{{ ansible_env.HOME}}/.zprezto"
+    state: link
+- file:
+    src: "{{ ansible_env.HOME }}/.zprezto/runcoms/{{ item }}"
+    dest: "{{ ansible_env.HOME}}/.{{ item }}"
+    state: link
+  with_lines: ls ~/.zprezto/runcoms | grep -v README.md
+- command: chsh -s zsh alpha
+  sudo: True