summary refs log tree commit diff
path: root/pull.rb
blob: d06df66b05c86500bd52832dfda6b66c595e77e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env ruby

require 'fileutils'

dotfiles = {}

dirs = ['.']
dirs.each do |dir|
  Dir.foreach(dir) do |file|
    next if file[0] == '.'
    file = File.join(dir, file)
    if File.directory? file
      dirs << file
      next
    end
    dotfiles[file] = file.sub('.', '~').sub('_', '.') if %r{/_} =~ file
  end
end

dotfiles.each do |a, b|
  a, b = File.expand_path(a), File.expand_path(b)
  FileUtils.cp(b, a)
  puts "#{b} -> #{a}"
end

system('git add .')
system('git commit -a')
system('git push')