root/dotfiles/setup/ishihara-setup.rb @ 18064

Revision 7191, 1.4 kB (checked in by ishihara, 5 years ago)

dotfiles/vim/ishihara: initial import

  • Property svn:executable set to *
Line 
1#!/usr/bin/env ruby
2
3USER = 'ishihara'
4
5
6require 'fileutils'
7require 'pathname'
8require 'yaml'
9
10include FileUtils::Verbose
11
12def link(src, dst)
13  src = Pathname.new(src).expand_path
14  dst = Pathname.new(dst).expand_path
15  rm dst if dst.symlink?
16  ln_s src, dst
17end
18
19def update_tree(tree)
20  tree.each do |dir, value|
21    case value
22    when Hash
23      system "svn up -N #{dir}"
24      cd dir do
25        update_tree value
26      end
27    when true
28      system "svn up #{dir}"
29    when false
30      system "svn up -N #{dir}"
31    end
32  end
33end
34
35
36configs = YAML.load(DATA.read.gsub('__USER__', USER))
37
38if true
39  system 'svn co -N http://svn.coderepos.org/share/ coderepos'
40  cd 'coderepos' do
41    update_tree configs['coderepos']
42  end
43end
44
45if true
46  configs['mkdir'].each do |dir|
47    dir = Pathname.new(dir).expand_path
48    mkdir dir unless dir.exist?
49  end
50end
51
52if true
53  configs['links'].each do |dst, src|
54    link src, dst
55  end
56end
57
58
59__END__
60coderepos:
61  dotfiles:
62    screen:
63      __USER__: true
64    setup: false
65    vim:
66      __USER__: true
67    zsh:
68      __USER__: true
69
70mkdir:
71  - ~/.vim-backup
72  - ~/.vim-swap
73
74links:
75  ~/.screenrc: coderepos/dotfiles/screen/__USER__/.screenrc
76  ~/.vim:      coderepos/dotfiles/vim/__USER__/.vim
77  ~/.vimrc:    coderepos/dotfiles/vim/__USER__/.vimrc
78  ~/.zsh:      coderepos/dotfiles/zsh/__USER__/.zsh
79  ~/.zshenv:   coderepos/dotfiles/zsh/__USER__/.zshenv
Note: See TracBrowser for help on using the browser.