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 e6a56cb
Showing
28 changed files
with
1,349 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,12 @@ | ||
root = true | ||
|
||
[**] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
quote_type = single | ||
spaces_around_operators = true | ||
trim_trailing_whitespace = true | ||
|
||
[**.rb] | ||
indent_style = space | ||
indent_size = 2 |
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,3 @@ | ||
.ruby-version | ||
coverage | ||
tmp |
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,6 @@ | ||
language: ruby | ||
rvm: | ||
- "1.8.7" | ||
- "2.1.1" | ||
# uncomment this line if your project needs to run something other than `rake`: | ||
# # script: bundle exec rspec spec |
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,10 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rake' | ||
|
||
group :development, :test do | ||
gem 'minitest' | ||
gem 'mime-types', '1.17' | ||
gem 'simplecov', '~> 0.7.1' | ||
gem 'coveralls', :require => false | ||
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,33 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
coveralls (0.7.0) | ||
multi_json (~> 1.3) | ||
rest-client | ||
simplecov (>= 0.7) | ||
term-ansicolor | ||
thor | ||
mime-types (1.17) | ||
minitest (5.3.3) | ||
multi_json (1.9.3) | ||
rake (10.3.1) | ||
rest-client (1.6.7) | ||
mime-types (>= 1.16) | ||
simplecov (0.7.1) | ||
multi_json (~> 1.0) | ||
simplecov-html (~> 0.7.1) | ||
simplecov-html (0.7.1) | ||
term-ansicolor (1.3.0) | ||
tins (~> 1.0) | ||
thor (0.19.1) | ||
tins (1.1.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
coveralls | ||
mime-types (= 1.17) | ||
minitest | ||
rake | ||
simplecov (~> 0.7.1) |
Large diffs are not rendered by default.
Oops, something went wrong.
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,100 @@ | ||
# DevEnv [![Build Status](https://travis-ci.org/mweppler/dev-env.png)](https://travis-ci.org/mweppler/dev-env) [![Coverage Status](https://coveralls.io/repos/mweppler/dev-env/badge.png)](https://coveralls.io/r/mweppler/dev-env) | ||
|
||
https://github.com/mweppler/dev-env | ||
|
||
--- | ||
|
||
## DESCRIPTION | ||
|
||
DevEnv: An somewhat opinionated developer environment. | ||
|
||
## Installation | ||
|
||
## Usage | ||
|
||
### rake install | ||
|
||
__What you can expect to happen__ | ||
|
||
Install will for that the prereqresites are met: | ||
|
||
* install homebrew | ||
`ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"` | ||
* install xcode command line tools | ||
* install xcode | ||
|
||
__Setup workspace and directories:__ | ||
|
||
mkdir -p developer/{bin,config,css,database,dev_env,java,javascript,keystore,php,projects,python,repos,ruby,shell,sources,toolkit} | ||
|
||
__Copy basic versions of `.bashrc`, `.bash_profile`, `.zshrc`, to `~/developer/dot_files` and symlink them to `$HOME`__ | ||
|
||
__Ask if you would like to install some recommended software:__ | ||
|
||
* install git | ||
* install rbenv | ||
`git clone https://github.com/sstephenson/rbenv.git ~/.rbenv` | ||
`echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc` | ||
`echo 'eval "$(rbenv init -)"' >> ~/.zshrc` | ||
`source .zshrc` | ||
`type rbenv` | ||
`#=> "rbenv is a shell function"` | ||
* install ruby-build | ||
`git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build` | ||
`rbenv rehash` | ||
`rbenv install 1.9.3-p448` | ||
`rbenv install 2.0.0-p247` | ||
* install iterm2 | ||
`curl -O http://www.iterm2.com/downloads/stable/iTerm2_v1_0_0.zip` | ||
* install oh-my-zsh | ||
`curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh` | ||
* install mvim | ||
`brew install macvim` | ||
* install janus | ||
`curl -Lo- https://bit.ly/janus-bootstrap | bash` | ||
copy files from dotfiles: `.vimrc.before`, `.vimrc.after` & `.janus` to `$HOME` | ||
* install gems rails, bundler, pry, rspec, cucumber | ||
* install gem gollum (requires icu4c, which will: `brew install icu4c` for you) | ||
* install python, pip, virtualenv and virtualenvwrapper, & Django 1.6 | ||
`brew install python` | ||
_pip is installed with brew install python_ | ||
`pip install virtualenvwrapper` | ||
_add the following to startup shell script:_ | ||
`export WORKON_HOME=$HOME/.virtualenvs` | ||
`export PROJECT_HOME=$HOME/directory-you-do-development-in` | ||
`source /usr/local/bin/virtualenvwrapper.sh` | ||
`pip install Django==1.6` | ||
* install node & npm | ||
`brew install node` | ||
* install pow | ||
`curl get.pow.cx | sh` | ||
|
||
## REQUIREMENTS | ||
|
||
Ruby 1.8.7 - 2.1.1 | ||
|
||
## Tested | ||
|
||
__Install has been tested on the following platform(s)/version(s):__ | ||
|
||
* Mac OS X 10.9, Ruby 2.1.1 | ||
* Mac OS X 10.8, Ruby 1.8.7 | ||
|
||
## COPYRIGHT | ||
|
||
DevEnv: An somewhat opinionated developer environment. | ||
Copyright (C) 2014 Matt Weppler | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
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,218 @@ | ||
if RUBY_VERSION == '1.8.7' | ||
require 'pathname' | ||
ROOT_PATH = File.expand_path(File.dirname(Pathname.new(__FILE__).realpath.to_s)) | ||
else | ||
ROOT_PATH = File.expand_path(File.dirname(File.realpath(__FILE__))) | ||
end | ||
|
||
$LOAD_PATH.unshift File.join(ROOT_PATH, 'lib') | ||
|
||
require 'rubygems' | ||
require 'rake/testtask' | ||
|
||
desc 'Run all the tests' | ||
Rake::TestTask.new do |t| | ||
t.libs << %w(lib test) | ||
t.test_files = FileList['test/test_*.rb'] | ||
t.verbose = true | ||
end | ||
|
||
desc 'Test DevEnv.' | ||
task :default do | ||
sh 'rake test' | ||
end | ||
|
||
require 'dev_env' | ||
require 'dev_env/install' | ||
require 'dev_env/shell_customizations' | ||
require 'fileutils' | ||
|
||
include DevEnv | ||
|
||
desc 'Run irb' | ||
task :console do | ||
ARGV.clear | ||
begin | ||
require 'pry' | ||
Pry.start | ||
rescue LoadError => _error | ||
require 'irb' | ||
require 'irb/completion' | ||
IRB.start | ||
end | ||
end | ||
|
||
desc 'create the necessary developer directories.' | ||
task :dev_dirs do | ||
orig_dotpath = File.expand_path File.join(ROOT_PATH, '..', 'original_dotfiles') | ||
FileUtils.mkdir_p orig_dotpath | ||
puts "creating directory: #{orig_dotpath}" | ||
FileUtils.mkdir_p dev_path | ||
puts "creating directory: #{dev_path}" | ||
cp_dirs(dev_path, dev_dirs) | ||
cp_dirs(dev_path, pub_dirs) | ||
cp_dirs(dev_path, priv_dirs) | ||
end | ||
|
||
desc 'backup & link dotfiles files.' | ||
task :dotfiles do | ||
dotfiles.each do |dotfile| | ||
copy_dots = File.expand_path File.join(ROOT_PATH, 'dotfiles', ".#{dotfile}") | ||
new_dots = File.expand_path File.join(dev_path, 'dotfiles') | ||
old_dots = File.expand_path File.join(ROOT_PATH, '..', 'original_dotfiles') | ||
|
||
puts "copy #{copy_dots} to #{new_dots}" | ||
FileUtils.cp copy_dots, new_dots | ||
|
||
ln_dest = File.expand_path File.join(users_home, ".#{dotfile}") | ||
puts "copy #{ln_dest} to #{old_dots}" | ||
FileUtils.mv ln_dest, old_dots if File.exists? ".#{ln_dest}" | ||
|
||
ln_src = File.expand_path File.join(new_dots, ".#{dotfile}") | ||
puts "link #{ln_src} to #{ln_dest}" | ||
FileUtils.ln_s(ln_src, ln_dest) unless File.exists? ln_dest | ||
end | ||
end | ||
|
||
task :install => [:prereqs, :dev_dirs, :dotfiles, :install_useful] do | ||
# ... | ||
end | ||
|
||
# TODO: clean this mess of an idea up... | ||
desc 'install useful software' | ||
task :install_useful do | ||
if %x(which git).empty? | ||
git_resp = ask('Would you like to install git?', %w(yes no quit)) | ||
if git_resp == 'yes' | ||
DevEnv::Install.brew 'git' | ||
elsif git_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
end | ||
|
||
if %x(which rbenv).empty? | ||
rbenv_resp = ask('Would you like to install rbenv & ruby-build?', %w(yes no quit)) | ||
if rbenv_resp == 'yes' | ||
DevEnv::Install.clone_repo 'https://github.com/sstephenson/rbenv.git', '$HOME/.rbenv' | ||
DevEnv::ShellCustomizations.echo_export 'PATH', '$HOME/.rbenv/bin:$PATH', %w(.bashrc .zshrc) | ||
DevEnv::ShellCustomizations.echo_eval '$(rbenv init -)', ['.bashrc', '.zshrc'] | ||
die('could not install rbenv') unless %x(type rbenv).include? 'rbenv is' | ||
unless %x(rbenv install).start_with?('Usage: rbenv install') | ||
DevEnv::Install.clone_repo 'https://github.com/sstephenson/ruby-build.git', '~/.rbenv/plugins/ruby-build' | ||
end | ||
%x(rbenv rehash) | ||
ruby_resp = ask('Would you like to install a version of ruby now?', %w(yes no quit)) | ||
if ruby_resp == 'yes' | ||
avail_rubys = %x(rbenv install --list).split("\n").map{ |v| v.strip } | ||
version = ask('Available versions: ', avail_rubys) | ||
unless %x(rbenv versions).include? version.chop.strip | ||
%x(rbenv install #{version}) | ||
%x(rbenv rehash ; rbenv global #{version}) | ||
%x(rbenv rehash ; rbenv shell #{version}) # rbenv: no such command `shell' | ||
%x(rbenv rehash ; rbenv local #{version}) | ||
DevEnv::ShellCustomizations.echo_export 'PATH', '~/.rbenv/bin:~/.rbenv/shims:$PATH', %w(.bashrc .zshrc) | ||
end | ||
elsif ruby_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
elsif rbenv_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
end | ||
|
||
gem_resp = ask('Would you like to install gems: rails, bundler, pry, rspec, cucumber', %w(yes no quit)) | ||
if gem_resp == 'yes' | ||
%w(rails bundler pry rspec cucumber).each do |gem| | ||
DevEnv::Install.gem gem | ||
end | ||
elsif gem_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
|
||
gollum_resp = ask('Would you like to install the gollum gem (requires icu4c)?', %w(yes no quit)) | ||
if gollum_resp == 'yes' | ||
DevEnv::Install.brew 'icu4c' | ||
DevEnv::Install.gem 'gollum' | ||
elsif gollum_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
|
||
iterm_resp = ask('Would you like to install iTerm2?', %w(yes no quit)) | ||
if iterm_resp == 'yes' | ||
DevEnv::Install.curl 'http://www.iterm2.com/downloads/stable/iTerm2_v1_0_0.zip' | ||
elsif iterm_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
|
||
# TODO: not working | ||
oh_my_zsh_resp = ask('Would you like to install oh-my-zsh?', %w(yes no quit)) | ||
if oh_my_zsh_resp == 'yes' | ||
File.delete File.expand_path File.join(users_home, '.zshrc') | ||
DevEnv::Install.curl 'https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh', :stream => true | ||
ln_dest = File.expand_path File.join(users_home, '.zshrc') | ||
ln_src = File.expand_path File.join(dotfile_path, '.zshrc') | ||
FileUtils.ln_s(ln_src, ln_dest) unless File.exist? ln_dest | ||
elsif oh_my_zsh_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
|
||
py_resp = ask('Would you like to install python, pip, virtualenvwrapper & Django 1.6?', %w(yes no quit)) | ||
if py_resp == 'yes' | ||
DevEnv::Install.brew 'python' | ||
# pip is installed with brew install python | ||
DevEnv::Install.pip 'virtualenvwrapper' | ||
DevEnv::ShellCustomizations.echo_export 'WORKON_HOME', '$HOME/.virtualenvs', %w(.bashrc .zshrc) | ||
DevEnv::ShellCustomizations.echo_export 'PROJECT_HOME', '$HOME/developer/python', %w(.bashrc .zshrc) | ||
DevEnv::Install.pip 'Django==1.6' | ||
elsif py_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
|
||
node_resp = ask('Would you like to install node & npm?', %w(yes no quit)) | ||
if node_resp == 'yes' | ||
DevEnv::Install.brew 'node' | ||
elsif node_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
|
||
pow_resp = ask('Would you like to install pow?', %w(yes no quit)) | ||
if pow_resp == 'yes' | ||
DevEnv::Install.curl 'http://get.pow.cx', :stream => true | ||
elsif pow_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
|
||
janus_resp = ask('Would you like to install Janus?', %w(yes no quit)) | ||
if janus_resp == 'yes' | ||
%w(.vimrc.before .vimrc.after .janus).each do |vim_dot| | ||
ln = File.expand_path File.join(users_home, vim_dot) | ||
File.delete ln if File.exists? ln | ||
end | ||
DevEnv::Install.curl 'https://raw.github.com/carlhuda/janus/master/bootstrap.sh', :stream => true | ||
%w(.vimrc.before .vimrc.after .janus).each do |vim_dot| | ||
ln_src = File.expand_path File.join(dotfile_path, vim_dot) | ||
if File.exists? ln_src | ||
ln_dest = File.expand_path File.join(users_home, vim_dot) | ||
FileUtils.ln_s(ln_src, ln_dest) unless File.exist? ln_dest | ||
end | ||
end | ||
elsif janus_resp == 'quit' | ||
quit('User initiated quit.') | ||
end | ||
end | ||
|
||
desc 'Check that all prerequsites are met.' | ||
task :prereqs do | ||
if %x(which brew).empty? | ||
puts "It doesn't look like you have homebrew installed. We need to install it now." | ||
quit('User initiated quit.') if ask('Would you like to continue?', %w(yes quit)) == 'quit' | ||
unless system(%q(ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)")) | ||
die("Couldn't install homebrew") | ||
end | ||
end | ||
# at least a system version of ruby | ||
# die("Can't find xcode.") if %x[which ruby].empty? | ||
# xcode | ||
# die("Can't find xcode.") if %x[which xcode-select].empty? | ||
puts 'All prereqresites have been met.' | ||
end |
Oops, something went wrong.