Skip to content

Commit

Permalink
* Added gitignore file
Browse files Browse the repository at this point in the history
 * Added Rakefile with installer
 * Added ruby and git dotfiles
 * Added MIT license
 * Update rakefile
  • Loading branch information
Francisco J committed Sep 16, 2010
1 parent b5aac53 commit 6693a25
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
git/gitconfig
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2010 Francisco J. Casas

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 changes: 23 additions & 3 deletions README.textile
@@ -1,6 +1,26 @@
h1. My dotfiles
h1. My dot-files (coz' there's no place like 127.0.0.1)

h2. Introduction

These are my dotfiles. They're more an exercise to learn to use rake and other tools than a real and useful project. I took many ideas for them (and copied a lot of code) from:

* "Ryan Bates":http://github.com/ryanb/dotfiles
* "Bodaniel Jeanes":http://github.com/bjeanes/dot-files
* "Joe Ferris":http://github.com/jferris/config_files
* "Nando Vieira":http://github.com/fnando/dotfiles
* "Mislav Marohnić":http://github.com/mislav/dotfiles
* and some others that I will include when I remember :)

h2. What it does?

Those files are made just to configure my development system in a way which I'm confortable with. It also includes some interesting and useful tools that doesn't come by default with Mac OS X Snow Leopard.

h2. Can I use them?

Yes of course... but do it at your own risk. Ask me if you need some help or just fix what you think is wrong, but I cant garantee that it will work.

These files are MIT licensed so you can just change them as you want. However if you do some interesting thing with them I'd be pleased if you let me know... Just some little curiosity, you know ;)

h2. TODO

# Install http://github.com/robbyrussell/oh-my-zsh
# Get interesting and useful config from other dotfiles like http://github.com/ryanb/dotfiles or http://github.com/jferris/config_files
# Install http://github.com/robbyrussell/oh-my-zsh
72 changes: 72 additions & 0 deletions Rakefile
@@ -0,0 +1,72 @@
require 'rake'
require 'erb'

$replace_all = false

namespace :install do
desc "Install ruby related dotfiles"
task :ruby do
install("ruby")
end

desc "Install git related dotfiles"
task :git => "generate:gitconfig" do
install("git")
end

desc "Install shell related dotfiles"
task :shell do
end

desc "Install all the dotfiles"
task :all => [:ruby, :git, :shell]
end

namespace :generate do
desc "Generates the gitconfig file"
task :gitconfig do
puts "generating gitconfig"
File.open(File.join("git", "gitconfig"), 'w') do |new_file|
new_file.write ERB.new(File.read(File.join("git", "gitconfig.erb"))).result(binding)
end
end
end

def install(folder)
Dir["#{folder}/*"].each do |file|
next if file =~ /.erb$/
file_name = File.basename(file)
if File.exist?(File.join(ENV['HOME'], ".#{file_name}"))
if File.identical? file, File.join(ENV['HOME'], file_name)
puts "identical ~/.#{fike}"
elsif $replace_all
replace_file(file)
else
print "overwrite ~/.#{file_name}? [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_name}"
end
end
else
link_file(file)
end
end
end

def replace_file(file)
system %Q{rm -rf "$HOME/.#{File.basename(file)}"}
link_file(file)
end

def link_file(file)
puts "linking ~/.#{File.basename(file)}"
system %Q{ln -s "$PWD/#{file}" "$HOME/.#{File.basename(file)}"}
end
18 changes: 18 additions & 0 deletions git/gitconfig.erb
@@ -0,0 +1,18 @@
[user]
name = Francisco J.
email = nflamel@otrobloggeek.com
[color]
diff = auto
status = auto
branch = auto
[core]
excludesfile = <%= ENV['HOME'] %>/.gitignore %>
editor = mate -w
autocrlf = input
[apply]
whitespace = fix
[format]
pretty = %C(yellow)%h%Creset %s %C(red)(%cr)%Creset
[github]
user = franciscoj
token = <%= print("GitHub API Token: "); STDOUT.flush; STDIN.gets.chomp %>
4 changes: 4 additions & 0 deletions git/gitignore
@@ -0,0 +1,4 @@
.DS_Store
.svn
*~
.*.swp
9 changes: 9 additions & 0 deletions ruby/autotest
@@ -0,0 +1,9 @@
%w{redgreen/autotest autotest/growl autotest/fsevent autotest/restart}.each do |gem|
require gem
end

Autotest.add_hook :initialize do |autotest|
%w[.git .svn .hg .DS_Store ._* vendor tmp log doc].each do |exception|
autotest.add_exception(exception)
end
end
11 changes: 11 additions & 0 deletions ruby/gemrc
@@ -0,0 +1,11 @@
---
:verbose: true
gem: --no-ri --no-rdoc
:update_sources: true
:sources:
- http://gemcutter.org
- http://gems.rubyforge.org/
- http://gems.github.com
:backtrace: false
:bulk_threshold: 1000
:benchmark: false
17 changes: 17 additions & 0 deletions ruby/irbrc
@@ -0,0 +1,17 @@
#!/usr/bin/ruby
require 'irb/completion'
require 'irb/ext/save-history'

IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"

IRB.conf[:PROMPT_MODE] = :SIMPLE

%w[rubygems].each do |gem|
begin
require gem
rescue LoadError; end
end

# Load .railsrc
load File.dirname(__FILE__) + '/.railsrc' if $0 == 'irb' && ENV['RAILS_ENV']
4 changes: 4 additions & 0 deletions ruby/railsrc
@@ -0,0 +1,4 @@
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end

0 comments on commit 6693a25

Please sign in to comment.