Skip to content

Commit 47374aa

Browse files
committed
Initial commit
1 parent 0c82a7d commit 47374aa

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed

Vagrantfile

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
require "./dependency_manager"
5+
6+
check_plugins ["vagrant-exec", "vagrant-hostsupdater", "vagrant-cachier", "vagrant-triggers"]
7+
8+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
9+
# configures the configuration version (we support older styles for
10+
# backwards compatibility). Please don't change it unless you know what
11+
# you're doing.
12+
Vagrant.configure(2) do |config|
13+
# The most common configuration options are documented and commented below.
14+
# For a complete reference, please see the online documentation at
15+
# https://docs.vagrantup.com.
16+
17+
# Every Vagrant development environment requires a box. You can search for
18+
# boxes at https://atlas.hashicorp.com/search.
19+
config.vm.box = "base"
20+
21+
# Disable automatic box update checking. If you disable this, then
22+
# boxes will only be checked for updates when the user runs
23+
# `vagrant box outdated`. This is not recommended.
24+
# config.vm.box_check_update = false
25+
26+
# Create a forwarded port mapping which allows access to a specific port
27+
# within the machine from a port on the host machine. In the example below,
28+
# accessing "localhost:8080" will access port 80 on the guest machine.
29+
# config.vm.network "forwarded_port", guest: 80, host: 8080
30+
31+
# Create a private network, which allows host-only access to the machine
32+
# using a specific IP.
33+
# config.vm.network "private_network", ip: "192.168.33.10"
34+
35+
# Create a public network, which generally matched to bridged network.
36+
# Bridged networks make the machine appear as another physical device on
37+
# your network.
38+
# config.vm.network "public_network"
39+
40+
# Share an additional folder to the guest VM. The first argument is
41+
# the path on the host to the actual folder. The second argument is
42+
# the path on the guest to mount the folder. And the optional third
43+
# argument is a set of non-required options.
44+
# config.vm.synced_folder "../data", "/vagrant_data"
45+
46+
# Provider-specific configuration so you can fine-tune various
47+
# backing providers for Vagrant. These expose provider-specific options.
48+
# Example for VirtualBox:
49+
#
50+
# config.vm.provider "virtualbox" do |vb|
51+
# # Display the VirtualBox GUI when booting the machine
52+
# vb.gui = true
53+
#
54+
# # Customize the amount of memory on the VM:
55+
# vb.memory = "1024"
56+
# end
57+
#
58+
# View the documentation for the provider you are using for more
59+
# information on available options.
60+
61+
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
62+
# such as FTP and Heroku are also available. See the documentation at
63+
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
64+
# config.push.define "atlas" do |push|
65+
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
66+
# end
67+
68+
# Enable provisioning with a shell script. Additional provisioners such as
69+
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
70+
# documentation for more information about their specific syntax and use.
71+
# config.vm.provision "shell", inline: <<-SHELL
72+
# sudo apt-get update
73+
# sudo apt-get install -y apache2
74+
# SHELL
75+
end

dependency_manager.rb

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/ruby
2+
# @Author: Dev_NIX
3+
# @Date: 2016-03-07 14:24:11
4+
# @Last Modified by: Dev_NIX
5+
# @Last Modified time: 2016-03-07 16:06:55
6+
7+
def check_plugins(dependencies)
8+
installed_dependencies = []
9+
10+
puts "\033[1m" << "Checking dependencies..." << "\e[0m"
11+
12+
raw_output = `vagrant plugin list`
13+
raw_list = raw_output.split("\n")
14+
15+
raw_list.each do |plugin|
16+
installed_dependencies.push plugin.slice((plugin.index("\e[0m")+4)..(plugin.index("(")-1)).strip
17+
end
18+
19+
no_missing = false
20+
21+
dependencies.each_with_index do |dependency, index|
22+
if not installed_dependencies.include? dependency
23+
puts "\033[33m" << " - Missing '#{dependency}'!" << "\e[0m"
24+
if not system "vagrant plugin install #{dependency}"
25+
puts "\n\033[33m" << " - Could not install plugin '#{dependency}'. " << "\e[0m\033[41m" <<"Stopped." << "\e[0m"
26+
exit
27+
end
28+
29+
if no_missing == nil
30+
no_missing = false
31+
end
32+
else
33+
if no_missing == nil
34+
no_missing = true
35+
end
36+
end
37+
end
38+
39+
if no_missing
40+
puts "\033[1m\033[36m" << " - All dependencies already satisfied" << "\e[0m"
41+
else
42+
puts "\033[1m\033[32m" << " - Dependencies installed" << "\e[0m"
43+
end
44+
45+
end

0 commit comments

Comments
 (0)