exogenesis 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.hound.yml +117 -0
- data/.rspec +2 -0
- data/.travis.yml +16 -0
- data/CHANGELOG.md +6 -0
- data/README.md +70 -8
- data/Rakefile +6 -1
- data/exogenesis.gemspec +10 -8
- data/lib/exogenesis.rb +14 -6
- data/lib/exogenesis/passengers/dotfile.rb +28 -0
- data/lib/exogenesis/passengers/fonts.rb +44 -0
- data/lib/exogenesis/passengers/git_repo.rb +36 -0
- data/lib/exogenesis/passengers/homebrew.rb +78 -0
- data/lib/exogenesis/passengers/homebrew_cask.rb +70 -0
- data/lib/exogenesis/passengers/npm.rb +43 -0
- data/lib/exogenesis/passengers/python.rb +37 -0
- data/lib/exogenesis/passengers/rbenv.rb +51 -0
- data/lib/exogenesis/passengers/rvm.rb +55 -0
- data/lib/exogenesis/passengers/vundle.rb +37 -0
- data/lib/exogenesis/support/executor.rb +195 -0
- data/lib/exogenesis/support/output.rb +93 -0
- data/lib/exogenesis/support/passenger.rb +57 -0
- data/lib/exogenesis/support/ship.rb +30 -0
- data/lib/exogenesis/support/spacesuit.rb +31 -0
- data/lib/exogenesis/support/task_skipped.rb +9 -0
- data/lib/exogenesis/version.rb +1 -1
- data/spec/spec_helper.rb +20 -0
- data/spec/support/executor_double.rb +28 -0
- data/spec/unit/dotfile_spec.rb +40 -0
- data/spec/unit/fonts_spec.rb +54 -0
- data/spec/unit/git_repo_spec.rb +44 -0
- data/spec/unit/homebrew_cask_spec.rb +96 -0
- data/spec/unit/homebrew_spec.rb +107 -0
- data/spec/unit/npm_spec.rb +58 -0
- data/spec/unit/python_spec.rb +64 -0
- data/spec/unit/rbenv_spec.rb +52 -0
- data/spec/unit/rvm_spec.rb +79 -0
- data/spec/unit/vundle_spec.rb +62 -0
- metadata +89 -30
- data/lib/exogenesis/abstract_package_manager.rb +0 -25
- data/lib/exogenesis/dotfile.rb +0 -45
- data/lib/exogenesis/homebrew.rb +0 -45
- data/lib/exogenesis/oh-my-zsh.rb +0 -28
- data/lib/exogenesis/rvm.rb +0 -32
- data/lib/exogenesis/vundle.rb +0 -53
@@ -1,25 +0,0 @@
|
|
1
|
-
class AbstractPackageManager
|
2
|
-
# The arguments are arbitrary, please see the individual files for it
|
3
|
-
def initialize
|
4
|
-
end
|
5
|
-
|
6
|
-
# Installs the package manager itself
|
7
|
-
def setup
|
8
|
-
end
|
9
|
-
|
10
|
-
# Installs all packages (the list has to be provided in the initialize method)
|
11
|
-
def install
|
12
|
-
end
|
13
|
-
|
14
|
-
# Updates the package manager itself and all packages
|
15
|
-
def update
|
16
|
-
end
|
17
|
-
|
18
|
-
# Starts a clean-up process
|
19
|
-
def cleanup
|
20
|
-
end
|
21
|
-
|
22
|
-
# Uninstalls all packages and the package manager itself
|
23
|
-
def teardown
|
24
|
-
end
|
25
|
-
end
|
data/lib/exogenesis/dotfile.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'exogenesis/abstract_package_manager'
|
2
|
-
|
3
|
-
# Links all files in the directory `tilde` to your home directory
|
4
|
-
class Dotfile < AbstractPackageManager
|
5
|
-
def install
|
6
|
-
file_names.each { |dotfile| link_file dotfile }
|
7
|
-
end
|
8
|
-
|
9
|
-
def teardown
|
10
|
-
file_names.each { |dotfile| unlink_file dotfile }
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def link_file(file_name)
|
16
|
-
original = File.join Dir.pwd, "tilde", file_name.to_s
|
17
|
-
target = File.join Dir.home, ".#{file_name}"
|
18
|
-
|
19
|
-
if File.symlink? target
|
20
|
-
puts "#{file_name} already linked"
|
21
|
-
else
|
22
|
-
puts "Linking #{file_name}"
|
23
|
-
`ln -s #{original} #{target}`
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def unlink_file(file_name)
|
28
|
-
target = File.join Dir.home, ".#{file_name}"
|
29
|
-
|
30
|
-
if File.symlink? target
|
31
|
-
`rm #{target}`
|
32
|
-
puts "Symlink for #{target} removed"
|
33
|
-
else
|
34
|
-
puts "No symlink for #{target} existed."
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def file_names
|
39
|
-
file_names = Dir.entries(File.join(Dir.pwd, "tilde"))
|
40
|
-
|
41
|
-
file_names.delete_if do |filename|
|
42
|
-
filename[0] == "."
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/exogenesis/homebrew.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'exogenesis/abstract_package_manager'
|
2
|
-
|
3
|
-
# Manages Homebrew - the premier package manager for Mac OS
|
4
|
-
class Homebrew < AbstractPackageManager
|
5
|
-
# Expects an array of packages to install, a package can either be:
|
6
|
-
# * A String: Then it will just install the package with this name
|
7
|
-
# * An Object with a single key value pair. The key is the name of the package, the value is an array of options passed to it
|
8
|
-
def initialize(brews)
|
9
|
-
@brews = brews
|
10
|
-
end
|
11
|
-
|
12
|
-
def update
|
13
|
-
puts "Updating Homebrew..."
|
14
|
-
`brew update`
|
15
|
-
puts "Upgrading the following apps: #{`brew outdated`}"
|
16
|
-
`brew upgrade`
|
17
|
-
end
|
18
|
-
|
19
|
-
def install
|
20
|
-
@brews.each do |brew|
|
21
|
-
if brew.class == String
|
22
|
-
install_package brew
|
23
|
-
else
|
24
|
-
name = brew.keys.first
|
25
|
-
options = brew[name]
|
26
|
-
install_package name, options
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def install_package(name, options = [])
|
34
|
-
print "Installing #{name}... "
|
35
|
-
status = `brew install #{name} #{options.join}`
|
36
|
-
|
37
|
-
raise "No formula for #{name}" if status.include? "No available formula"
|
38
|
-
|
39
|
-
if status.include? "already installed"
|
40
|
-
puts "Already Installed!"
|
41
|
-
else
|
42
|
-
puts "Installed!"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/exogenesis/oh-my-zsh.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'exogenesis/abstract_package_manager'
|
2
|
-
|
3
|
-
# Installs and removes OhMyZSH
|
4
|
-
class OhMyZSH < AbstractPackageManager
|
5
|
-
def install
|
6
|
-
print "Cloning Oh-my-zsh..."
|
7
|
-
target = File.join Dir.home, ".oh-my-zsh"
|
8
|
-
|
9
|
-
if File.exists? target
|
10
|
-
puts "Oh-my-zsh already exists"
|
11
|
-
else
|
12
|
-
`git clone git://github.com/moonglum/oh-my-zsh.git #{target}`
|
13
|
-
puts "Cloned!"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def teardown
|
18
|
-
print "Removing Oh-my-zsh..."
|
19
|
-
target = File.join Dir.home, ".oh-my-zsh"
|
20
|
-
|
21
|
-
if File.exists? target
|
22
|
-
`rm -r #{target}`
|
23
|
-
puts "Removed!"
|
24
|
-
else
|
25
|
-
puts "Did not exist"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
data/lib/exogenesis/rvm.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'exogenesis/abstract_package_manager'
|
2
|
-
|
3
|
-
# Installs the Ruby Version Manager RVM
|
4
|
-
class Rvm < AbstractPackageManager
|
5
|
-
# Expects an array of rubies as Strings you want to install
|
6
|
-
def initialize(rubies)
|
7
|
-
@rubies = rubies
|
8
|
-
end
|
9
|
-
|
10
|
-
def install
|
11
|
-
@rubies.each do |ruby|
|
12
|
-
print "Installing #{ruby}..."
|
13
|
-
status = `rvm install #{ruby} --with-gcc=gcc-4.2`
|
14
|
-
|
15
|
-
if status.include? "Already installed"
|
16
|
-
puts "Already Installed!"
|
17
|
-
else
|
18
|
-
puts "Installed!"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def update
|
24
|
-
puts "Updating RVM"
|
25
|
-
`rvm get head`
|
26
|
-
`rvm reload`
|
27
|
-
@rubies.each do |ruby|
|
28
|
-
print "Upgrading #{ruby}..."
|
29
|
-
system "rvm upgrade #{ruby}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/lib/exogenesis/vundle.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'exogenesis/abstract_package_manager'
|
2
|
-
|
3
|
-
# Manages the Vim Package Manager Vundle
|
4
|
-
class Vundle < AbstractPackageManager
|
5
|
-
# The dependencies are read from you Vim files
|
6
|
-
# It creates a `~/.vim` folder and clones Vundle.
|
7
|
-
# Then it runs BundleInstall in Vim.
|
8
|
-
def install
|
9
|
-
create_vim_folder
|
10
|
-
clone
|
11
|
-
bundle_install
|
12
|
-
end
|
13
|
-
|
14
|
-
def teardown
|
15
|
-
print "Removing Vundle..."
|
16
|
-
target = File.join Dir.home, ".vim"
|
17
|
-
|
18
|
-
if File.exists? target
|
19
|
-
`rm -r #{target}`
|
20
|
-
puts "Removed!"
|
21
|
-
else
|
22
|
-
puts "Did not exist"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def update
|
27
|
-
puts "Updating Vim Bundles"
|
28
|
-
system "vim +BundleUpdate +qall"
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def create_vim_folder
|
34
|
-
target = File.join Dir.home, ".vim"
|
35
|
-
Dir.mkdir target unless File.exists? target
|
36
|
-
end
|
37
|
-
|
38
|
-
def clone
|
39
|
-
target = File.join Dir.home, ".vim", "bundle", "vundle"
|
40
|
-
|
41
|
-
if File.exists? target
|
42
|
-
puts "Vundle already exists"
|
43
|
-
else
|
44
|
-
`git clone git://github.com/gmarik/vundle.git #{target}`
|
45
|
-
puts "Cloned!"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def bundle_install
|
50
|
-
system "vim +BundleInstall\! +qall"
|
51
|
-
system "vim +BundleClean\! +qall"
|
52
|
-
end
|
53
|
-
end
|