This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5db9e1a
Showing
20 changed files
with
1,406 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
vim/bundle/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
require 'rake' | ||
require 'erb' | ||
|
||
desc "install the dot files into user's home directory" | ||
task :install do | ||
replace_all = false | ||
Dir['*'].each do |file| | ||
next if %w[Rakefile].include? file | ||
|
||
if File.exist?(File.join(ENV['HOME'], ".#{file.sub('.erb', '')}")) | ||
if File.identical? file, File.join(ENV['HOME'], ".#{file.sub('.erb', '')}") | ||
puts "identical ~/.#{file.sub('.erb', '')}" | ||
elsif replace_all | ||
replace_file(file) | ||
else | ||
print "overwrite ~/.#{file.sub('.erb', '')}? [ynaq] " | ||
case $stdin.gets.chomp | ||
when 'a' | ||
replace_all = true | ||
replace_file(file) | ||
when 'y' | ||
replace_file(file) | ||
when 'q' | ||
exit | ||
else | ||
puts "skipping ~/.#{file.sub('.erb', '')}" | ||
end | ||
end | ||
else | ||
link_file(file) | ||
end | ||
end | ||
download_omz | ||
download_vim_bundles | ||
end | ||
|
||
def download_omz | ||
if not(File.exist?(ENV['HOME'] + "/.oh-my-zsh")) | ||
system "git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh" | ||
end | ||
end | ||
|
||
def download_vim_bundles | ||
if not(File.exist?(ENV['HOME'] + "/.vim/bundle")) | ||
Dir.mkdir(ENV['HOME'] + "/.vim/bundle")) | ||
end | ||
if not(File.exist?(ENV['HOME'] + "/.vim/bundle/vim-fugitive")) | ||
system "git clone git://github.com/tpope/vim-fugitive.git ~/.vim/bundle/vim-fugitive" | ||
end | ||
if not(File.exist?(ENV['HOME'] + "/.vim/bundle/vim-colors-solarized")) | ||
system "git clone git://github.com/altercation/vim-colors-solarized.git ~/.vim/bundle/vim-colors-solarized" | ||
end | ||
end | ||
|
||
def replace_file(file) | ||
system %Q{rm -rf "$HOME/.#{file.sub('.erb', '')}"} | ||
link_file(file) | ||
end | ||
|
||
def link_file(file) | ||
if file =~ /.erb$/ | ||
puts "generating ~/.#{file.sub('.erb', '')}" | ||
File.open(File.join(ENV['HOME'], ".#{file.sub('.erb', '')}"), 'w') do |new_file| | ||
new_file.write ERB.new(File.read(file)).result(binding) | ||
end | ||
else | ||
puts "linking ~/.#{file}" | ||
system %Q{ln -s "$PWD/#{file}" "$HOME/.#{file}"} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env ruby -w | ||
|
||
class TagVersions | ||
def initialize(args) | ||
print_help if args.empty? | ||
@regexp = nil | ||
@preview = false | ||
args.each do |argument| | ||
case argument | ||
when '-a', '--all' then @regexp = ".*" | ||
when '-p', '--preview' then @preview = true | ||
when '-h', '--help' then print_help | ||
else @regexp = argument | ||
end | ||
end | ||
end | ||
|
||
def print_help | ||
puts <<-HELP | ||
Usage: tagversions [OPTIONS] [REGEXP] | ||
Look through the git commits for messages with the given regular expression and tag what looks like verisons. | ||
Options: | ||
-a, --all Search all commits, not just the ones matching the regular expression. | ||
-p, --preview Don't do actual branching, instead print out what will be tagged. | ||
-h, --help Display this help page. | ||
HELP | ||
exit | ||
end | ||
|
||
def run | ||
tags = `git tag`.split("\n") | ||
`git log --pretty="%H %s" | grep "#{@regexp}"`.split("\n").each do |line| | ||
version = line[/\bv?(\d\.[\d\.]*)\b/, 1] | ||
sha = line[/^\w+/] | ||
if version && !version.empty? && !tags.include?(version) | ||
puts "Tagging #{version} on #{sha}" | ||
tags << version | ||
`git tag -a "#{version}" -m "version #{version}" "#{sha}"` unless @preview | ||
end | ||
end | ||
end | ||
end | ||
|
||
TagVersions.new($*).run |
Oops, something went wrong.