Skip to content

Commit

Permalink
Added user env variables and git configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeering committed Jul 23, 2015
1 parent bdea963 commit 264825c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.textile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1. Common tool and environment set for Linux
h2. Common tool and environment setting for Linux

This is non-destructive. Any changes or updates to existing configuration files will prompt you for overrides and provide a difference of the changes if relevant.

Expand Down
2 changes: 1 addition & 1 deletion Thorfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Default < Thor

desc 'setup', 'Setup all homefiles and environment variables that go along with them.'
def setup
[:bash, :tmux, :vim].each do |config|
[:bash, :git, :ruby, :tmux, :vim].each do |config|
invoke "#{config}:setup"
end
end
Expand Down
3 changes: 3 additions & 0 deletions bash.thor
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class Bash < Thor
# Assume that we are going to have to force this or remove any existing file
create_link "#{ENV['HOME']}/.bash", "#{Dir.pwd}/bash"
create_link "#{ENV['HOME']}/.bashrc", "#{Dir.pwd}/bash/bashrc"
email = ENV['EMAIL_ADDRESS'] ||= ask('What is your default email address?', default: 'example@example.com'.gsub(/example/, ENV['USERNAME']))
full_name = ENV['FULL_NAME'] ||= ask('What is full name? (ex: John Doe)')
create_file "#{ENV['HOME']}/.bash/user.private.bash", "export EMAIL_ADDRESS='#{email}'\nexport FULL_NAME='#{full_name}'"
end

end
16 changes: 16 additions & 0 deletions git.thor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Git < Thor

include Thor::Actions

source_root File.expand_path(File.dirname(__FILE__), 'git')

desc 'setup', 'Setup git environment.'
def setup
email = ENV['EMAIL_ADDRESS'] || ask('What email address would you like to associate with git?', default: 'example@example.com'.gsub(/example/, ENV['USERNAME']))
name = ENV['FULL_NAME'] || ask('What is the full name associate with git?')
template 'git/.gitconfig', '~/.gitconfig', email: email, name: name
template 'git/.gitignore_global', '~/.gitingore_global'
end

end

7 changes: 7 additions & 0 deletions git/.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[color]
ui = true
[user]
email = <%= config[:email] %>
name = <%= config[:name] %>
[core]
excludesfile = <%= "#{ENV['HOME']}" %>/.gitignore_global
3 changes: 3 additions & 0 deletions git/.gitignore_global
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Project ruby settings
.ruby-gemset
.ruby-version
10 changes: 10 additions & 0 deletions ruby.thor
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Ruby < Thor

include Thor::Actions

desc 'setup', 'Setup ruby environment.'
def setup
create_file '~/.gemrc', 'gem: --no-document'
end

end

0 comments on commit 264825c

Please sign in to comment.