Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #52 from moonglum/update-all-the-things
Browse files Browse the repository at this point in the history
Update some outdated things
  • Loading branch information
moonglum committed Jun 22, 2014
2 parents 212c32d + 06d0d04 commit 3fae9e7
Show file tree
Hide file tree
Showing 24 changed files with 309 additions and 186 deletions.
114 changes: 114 additions & 0 deletions .hound.yml
@@ -0,0 +1,114 @@
AllCops:
Include:
- '../**/*.rake'
- 'Gemfile'
- 'Guardfile'
- 'Rakefile'
Exclude:
- !ruby/regexp /spec\/setup/

# Avoid parameter lists longer than five parameters.
ParameterLists:
Max: 4
CountKeywordArgs: true

# Avoid more than `Max` levels of nesting.
BlockNesting:
Max: 3

# Align with the style guide.
CollectionMethods:
PreferredMethods:
collect: 'map'
inject: 'reduce'
find: 'detect'
find_all: 'select'

HashSyntax:
Enabled: true

StringLiterals:
Enabled: true

Void:
Enabled: true

MethodLength:
Enabled: false

LineLength:
Enabled: false

DotPosition:
EnforcedStyle: 'leading'

SpaceInsideHashLiteralBraces:
Enabled: true

AlignParameters:
Enabled: true

# I don't agree with this
Blocks:
Enabled: false

NumericLiterals:
Enabled: true

SpaceInsideBrackets:
Enabled: true

WordArray:
Enabled: true

Lambda:
Enabled: true

RegexpLiteral:
Enabled: true

# Don't agree
ConstantName:
Enabled: false

TrivialAccessors:
Enabled: true
ExactNameMatch: true

Alias:
Enabled: true

Loop:
Enabled: false

# Do not agree at all
AndOr:
Enabled: false

# This is done by YARD Stick
Documentation:
Enabled: false

# Braces can be really, really useful for clarity
BracesAroundHashParameters:
Enabled: false

# I prefer raise over fail
SignalException:
EnforcedStyle: only_raise

ClassLength:
CountComments: false
Max: 140

# The suggested style does not match the common ruby way of aligning the content of a hash
IndentHash:
Enabled: false

# This cop seems to not work correctly. Also we don't agree with it.
FileName:
Enabled: false

# Double negations are extremely useful
DoubleNegation:
Enabled: false
10 changes: 10 additions & 0 deletions README.md
@@ -1,5 +1,14 @@
# Exogenesis

| Project | Exogenesis
|:----------------|:--------------------------------------------------
| Homepage | https://github.com/moonglum/exogenesis
| CI | [![Build Status](http://img.shields.io/travis/moonglum/exogenesis.svg)](http://travis-ci.org/moonglum/exogenesis)
| Code Metrics | [![Code Climate](http://img.shields.io/codeclimate/github/moonglum/exogenesis.svg)](https://codeclimate.com/github/moonglum/exogenesis) [![Code Climate Coverage](http://img.shields.io/codeclimate/coverage/github/moonglum/exogenesis.svg)](https://codeclimate.com/github/moonglum/exogenesis)
| Gem Version | [![Gem Version](http://img.shields.io/gem/v/exogenesis.svg)](http://rubygems.org/gems/exogenesis)
| Dependencies | [![Dependency Status](http://img.shields.io/gemnasium/moonglum/exogenesis.svg)](https://gemnasium.com/moonglum/exogenesis)


A collection of classes that help you install, update and teardown package managers and other things useful for your dotfiles. It's something like a meta package manager (package manager is the wrong word... still searching for a better one). After setting it up you can do the following:

* `rake up`: Setup, install and update your software
Expand Down Expand Up @@ -82,3 +91,4 @@ Additions of new classes are more than welcome, even if they are complimentary t
So far, the following people have contributed to the project:

* Bodo Tasche aka @bitboxer
* Felix Schäfer aka @thegcat
9 changes: 4 additions & 5 deletions Rakefile
@@ -1,7 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |config|
end
RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec
18 changes: 9 additions & 9 deletions exogenesis.gemspec
Expand Up @@ -4,21 +4,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'exogenesis/version'

Gem::Specification.new do |spec|
spec.name = "exogenesis"
spec.name = 'exogenesis'
spec.version = Exogenesis::VERSION
spec.authors = ["moonglum"]
spec.email = ["moonglum@moonbeamlabs.com"]
spec.authors = ['moonglum']
spec.email = ['moonglum@moonbeamlabs.com']
spec.description = %q{Build your dotfile installer, updater and teardown}
spec.summary = %q{A collection of classes that help you install, update and teardown package managers and other things useful for your dotfiles.}
spec.homepage = "https://github.com/moonglum/exogenesis"
spec.license = "MIT"
spec.homepage = 'https://github.com/moonglum/exogenesis'
spec.license = 'MIT'

spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.require_paths = ['lib']

spec.add_development_dependency "bundler", "~> 1.6.0"
spec.add_development_dependency "rake", "~> 10.2.2"
spec.add_development_dependency "rspec", "~> 3.0.0.beta2"
spec.add_development_dependency 'bundler', '~> 1.6.0'
spec.add_development_dependency 'rake', '~> 10.3.2'
spec.add_development_dependency 'rspec', '~> 3.0.0'
end
28 changes: 14 additions & 14 deletions lib/exogenesis.rb
@@ -1,17 +1,17 @@
require "exogenesis/version"
require "exogenesis/passengers/dotfile"
require "exogenesis/passengers/homebrew"
require "exogenesis/passengers/homebrew_cask"
require "exogenesis/passengers/rvm"
require "exogenesis/passengers/rbenv"
require "exogenesis/passengers/vundle"
require "exogenesis/passengers/fonts"
require "exogenesis/passengers/python"
require "exogenesis/passengers/git_repo"
require "exogenesis/passengers/npm"
require "exogenesis/support/output"
require "exogenesis/support/executor"
require "exogenesis/support/ship"
require 'exogenesis/version'
require 'exogenesis/passengers/dotfile'
require 'exogenesis/passengers/homebrew'
require 'exogenesis/passengers/homebrew_cask'
require 'exogenesis/passengers/rvm'
require 'exogenesis/passengers/rbenv'
require 'exogenesis/passengers/vundle'
require 'exogenesis/passengers/fonts'
require 'exogenesis/passengers/python'
require 'exogenesis/passengers/git_repo'
require 'exogenesis/passengers/npm'
require 'exogenesis/support/output'
require 'exogenesis/support/executor'
require 'exogenesis/support/ship'

module Exogenesis
end
2 changes: 1 addition & 1 deletion lib/exogenesis/passengers/dotfile.rb
Expand Up @@ -12,7 +12,7 @@ def up
end

def down
each_dotfile do |source, destination|
each_dotfile do |_source, destination|
rm_rf destination
end
end
Expand Down
11 changes: 5 additions & 6 deletions lib/exogenesis/passengers/fonts.rb
Expand Up @@ -24,21 +24,20 @@ def install_all_fonts
end

def collect_fonts
Dir.glob(File.join(fonts_path, "**/*.{ttf,otf}")).each do |file|
Dir.glob(File.join(fonts_path, '**/*.{ttf,otf}')).each do |file|
yield file
end
end

def install_font(file)
unless File.exist? target_font_path(file)
execute "Copying #{File.basename file}", "cp #{file} #{target_font_path(file)}"
if File.exist? target_font_path(file)
skip_task "Copying #{File.basename file}", 'Already copied'
else
skip_task "Copying #{File.basename file}", "Already copied"
execute "Copying #{File.basename file}", "cp #{file} #{target_font_path(file)}"
end
end

def target_font_path(file)
File.join(ENV['HOME'], "Library/Fonts", File.basename(file))
File.join(ENV['HOME'], 'Library/Fonts', File.basename(file))
end

end
4 changes: 2 additions & 2 deletions lib/exogenesis/passengers/python.rb
Expand Up @@ -14,13 +14,13 @@ def up
end

execute 'Link Python', 'brew link --overwrite python' do |output|
raise TaskSkipped.new('Already linked') if output.include? 'Already linked'
raise TaskSkipped, 'Already linked' if output.include? 'Already linked'
end

(['pip'] + pips).each do |package|
if installed_pips.include? package
execute "Upgrade #{package}", "pip install --user --upgrade #{package}" do |output|
raise TaskSkipped.new('Already up to date') if output.include? 'already up-to-date'
raise TaskSkipped, 'Already up to date' if output.include? 'already up-to-date'
end
else
execute "Install #{package}", "pip install --user #{package}"
Expand Down
21 changes: 10 additions & 11 deletions lib/exogenesis/passengers/rbenv.rb
Expand Up @@ -12,36 +12,35 @@ def up
install_rbenv
end
rubies.each { |ruby| install_ruby ruby }
execute "Rehash", "rbenv rehash"
execute 'Rehash', 'rbenv rehash'
end

def down
execute_interactive "Teardown", "rm -r ~/.rbenv"
execute_interactive 'Teardown', 'rm -r ~/.rbenv'
end

private
private

def install_rbenv
execute "Install rbenv", "git clone https://github.com/sstephenson/rbenv.git ~/.rbenv"
execute "Install ruby-build plugin", "git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build"
execute 'Install rbenv', 'git clone https://github.com/sstephenson/rbenv.git ~/.rbenv'
execute 'Install ruby-build plugin', 'git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build'
end

def update_rbenv
execute "Update rbenv", "cd ~/.rbenv && git pull"
execute "Update ruby-build", "cd ~/.rbenv/plugins/ruby-build && git pull"
execute 'Update rbenv', 'cd ~/.rbenv && git pull'
execute 'Update ruby-build', 'cd ~/.rbenv/plugins/ruby-build && git pull'
end

def install_ruby(ruby)
unless installed_versions.include? ruby
execute "Installing #{ruby}", "rbenv install #{ruby}"
end
return if installed_versions.include? ruby
execute "Installing #{ruby}", "rbenv install #{ruby}"
end

def installed_versions
return @installed_versions if @installed_versions

@installed_versions = []
execute "Getting Installed Versions", "rbenv versions" do |output|
execute 'Getting Installed Versions', 'rbenv versions' do |output|
output.scan(/^[\*]?\s*([\S]*).*$/).each do |ruby|
@installed_versions << ruby[0]
end
Expand Down
6 changes: 3 additions & 3 deletions lib/exogenesis/passengers/rvm.rb
Expand Up @@ -20,7 +20,7 @@ def down
execute_interactive 'Teardown', 'rvm implode'
end

private
private

def install_or_update_ruby(ruby)
if installed_versions[ruby].nil?
Expand All @@ -35,8 +35,8 @@ def install_ruby(ruby)
end

def update_ruby(old_ruby, new_ruby)
execute "Upgrading #{new_ruby}", "rvm upgrade #{old_ruby} #{new_ruby} --force --with-gcc=gcc-4.2" do |output, error_output|
raise TaskSkipped.new('Already Up to Date') if error_output.include? 'are the same'
execute "Upgrading #{new_ruby}", "rvm upgrade #{old_ruby} #{new_ruby} --force --with-gcc=gcc-4.2" do |_output, error_output|
raise TaskSkipped, 'Already Up to Date' if error_output.include? 'are the same'
end
end

Expand Down

0 comments on commit 3fae9e7

Please sign in to comment.