devenv_build 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/devenv_build +6 -0
- data/bin/setup +7 -0
- data/devenv_build.gemspec +25 -0
- data/lib/devenv_build/cli.rb +83 -0
- data/lib/devenv_build/files/provision.rb +109 -0
- data/lib/devenv_build/files/vagrantfile.rb +45 -0
- data/lib/devenv_build/files.rb +35 -0
- data/lib/devenv_build/provisioning/haskell.rb +13 -0
- data/lib/devenv_build/provisioning/nginx_passenger.rb +25 -0
- data/lib/devenv_build/provisioning/nodejs.rb +24 -0
- data/lib/devenv_build/provisioning/postgresql.rb +22 -0
- data/lib/devenv_build/provisioning/redis.rb +17 -0
- data/lib/devenv_build/provisioning/ruby.rb +49 -0
- data/lib/devenv_build/provisioning/ruby_on_rails.rb +25 -0
- data/lib/devenv_build/provisioning/rustlang.rb +17 -0
- data/lib/devenv_build/provisioning/sbcl.rb +13 -0
- data/lib/devenv_build/provisioning.rb +44 -0
- data/lib/devenv_build/version.rb +3 -0
- data/lib/devenv_build.rb +7 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 87e6f06ff70256e902643218dc293cc7558ed32f
|
4
|
+
data.tar.gz: 5a8f876b0a9377b8c0167721cf2da912e2b1fa74
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 556452b5f33500785da3cd2ced1474aedffac8e7c046232a0f3b22ab85c9f724a363d5db13baa98be6c5d2873296f0af153dcff3dc2e2278406ec7f7442f76bb
|
7
|
+
data.tar.gz: f94bb03c655634ac2493646b0e688d5ed7169396de7db8db402ac7ee096d28a0f94f472f72a665d41c170b15bf8dc56b3a202cd4e25b9b110101dda82401db9c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Francisco Soto
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# DevenvBuild
|
2
|
+
|
3
|
+
Simple tool to generate development environments based on Vagrant and VirtualBox.
|
4
|
+
|
5
|
+
You can includes a mix and match of programming languages, databases, frameworks or tools. Just point it to a directory and say what you need and you'll get your devenv. No more copying Vagrantfile and provisioning scripts around.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Run the following on your command line:
|
10
|
+
|
11
|
+
$ gem install devenv_build
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ devenv_build --help
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
You just need to run the command with a target directory and a bunch of includes.
|
20
|
+
|
21
|
+
Examples:
|
22
|
+
|
23
|
+
$ devenv_build --help
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/devenv_build/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "devenv_build"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/devenv_build
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'devenv_build/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "devenv_build"
|
8
|
+
spec.version = DevenvBuild::VERSION
|
9
|
+
spec.authors = ["Francisco Soto"]
|
10
|
+
spec.email = ["ebobby@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Development environment builder based on Vagrant and VirtualBox.}
|
13
|
+
spec.description = %q{Simple tool to generate development environments based on Vagrant and VirtualBox.
|
14
|
+
|
15
|
+
You can includes a mix and match of programming languages, databases, frameworks or tools. Just point it to a directory and say what you need and you'll get your devenv. No more copying Vagrantfile and provisioning scripts around.}
|
16
|
+
spec.homepage = "http://github.com/ebobby/devenv_build"
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
spec.executables = %w(devenv_build)
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module DevenvBuild
|
4
|
+
class Cli
|
5
|
+
def initialize (cmdargs)
|
6
|
+
@args = cmdargs
|
7
|
+
self
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
options = parse_command_line(@args)
|
12
|
+
|
13
|
+
DevenvBuild::Files::Vagrantfile.new(options).generate
|
14
|
+
DevenvBuild::Files::Provision.new(options).generate
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def default_options
|
20
|
+
options = {}
|
21
|
+
options[:destination_directory] = nil
|
22
|
+
options[:box_name] = nil
|
23
|
+
|
24
|
+
Provisioning.provisioning_modules.map do |module_name, mod|
|
25
|
+
options[module_name] = false
|
26
|
+
end
|
27
|
+
|
28
|
+
options
|
29
|
+
end
|
30
|
+
|
31
|
+
def parse_command_line (args)
|
32
|
+
options = default_options
|
33
|
+
|
34
|
+
o = OptionParser.new do |opts|
|
35
|
+
opts.banner = "Generate a Vagrant development environment with the selected programming languages and tools.\n\n"
|
36
|
+
|
37
|
+
opts.on('-d', '--directory=DIRECTORY', 'Target directory where to create the environment on.') do |dir|
|
38
|
+
options[:destination_directory] = dir
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on('-n', '--devenv-name=NAME', 'Name of your development environment.') do |dir|
|
42
|
+
options[:box_name] = dir
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on('--all', 'Install everything.') do |dir|
|
46
|
+
options[:all] = true
|
47
|
+
end
|
48
|
+
|
49
|
+
Provisioning.provisioning_modules.map do |module_name, mod|
|
50
|
+
opts.on("--#{module_name}", mod.help, &mod.options_setter(module_name, options))
|
51
|
+
end
|
52
|
+
|
53
|
+
opts.on('-h', '--help', 'Print this screen.') do |dir|
|
54
|
+
puts opts
|
55
|
+
exit
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
begin
|
60
|
+
o.parse!(args)
|
61
|
+
|
62
|
+
Provisioning.provisioning_modules.map do |module_name, mod|
|
63
|
+
mod.options_setter(module_name, options).call
|
64
|
+
end if options[:all]
|
65
|
+
|
66
|
+
if options[:destination_directory].nil?
|
67
|
+
puts "Need a target directory.\n\n"
|
68
|
+
raise OptionParser::MissingArgument
|
69
|
+
end
|
70
|
+
|
71
|
+
unless Provisioning.provisioning_modules.keys.any? { |module_name| options[module_name] }
|
72
|
+
puts "You need to specify at least one thing to include.\n\n"
|
73
|
+
raise OptionParser::MissingArgument
|
74
|
+
end
|
75
|
+
rescue
|
76
|
+
puts o
|
77
|
+
exit
|
78
|
+
end
|
79
|
+
|
80
|
+
options
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Files
|
3
|
+
class Provision < Base
|
4
|
+
def initialize(options)
|
5
|
+
super
|
6
|
+
|
7
|
+
provisioning_modules = []
|
8
|
+
|
9
|
+
DevenvBuild::Provisioning.provisioning_modules.map do |k, v|
|
10
|
+
provisioning_modules << v if options[k]
|
11
|
+
end
|
12
|
+
|
13
|
+
@provisioning_modules = provisioning_modules
|
14
|
+
end
|
15
|
+
|
16
|
+
def filename
|
17
|
+
File.join(options[:destination_directory], File.join('provision', 'provision.sh'))
|
18
|
+
end
|
19
|
+
|
20
|
+
def template
|
21
|
+
<<-PROVISION_EOF
|
22
|
+
#!/bin/bash
|
23
|
+
|
24
|
+
echo "Setting up locales..."
|
25
|
+
/usr/sbin/update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
|
26
|
+
|
27
|
+
echo "Setting up APT mirrors..."
|
28
|
+
`cat >/etc/apt/sources.list <<\\EOF
|
29
|
+
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse
|
30
|
+
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse
|
31
|
+
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted universe multiverse
|
32
|
+
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted universe multiverse
|
33
|
+
EOF
|
34
|
+
`
|
35
|
+
|
36
|
+
export DEBIAN_FRONTEND=noninteractive
|
37
|
+
|
38
|
+
apt-get -y update
|
39
|
+
apt-get -y upgrade
|
40
|
+
|
41
|
+
apt-get -y install build-essential curl git-core imagemagick subversion python-software-properties \\
|
42
|
+
zip unzip rlwrap openssl linux-tools-generic systemtap htop gdb tree rar unrar \\
|
43
|
+
screen vim zsh
|
44
|
+
|
45
|
+
## BEFORE ##############################################################################################
|
46
|
+
#{before}
|
47
|
+
########################################################################################################
|
48
|
+
|
49
|
+
apt-get -y update
|
50
|
+
|
51
|
+
## MIDDLE ##############################################################################################
|
52
|
+
#{middle}
|
53
|
+
########################################################################################################
|
54
|
+
|
55
|
+
# Setup hostname
|
56
|
+
echo "Setup hostname..."
|
57
|
+
echo "devenv" > /etc/hostname
|
58
|
+
echo "127.0.0.1 devenv" >> /etc/hosts
|
59
|
+
hostname devenv
|
60
|
+
|
61
|
+
# Setup environment
|
62
|
+
echo "Setup environment..."
|
63
|
+
`cat >/home/vagrant/.environment.sh <<\\EOF
|
64
|
+
# Environment variables
|
65
|
+
export PS1="[\\[\\033[1;34m\\]\\u\\[\\033[0m\\]@\\h:\\[\\033[1;37m\\]\\w\\[\\033[0m\\]]$ "
|
66
|
+
EOF
|
67
|
+
`
|
68
|
+
echo 'source ~/.environment.sh' >> /home/vagrant/.bash_profile
|
69
|
+
touch /home/vagrant/.secret_keys.sh
|
70
|
+
chown vagrant:vagrant /home/vagrant/.environment.sh
|
71
|
+
chown vagrant:vagrant /home/vagrant/.secret_keys.sh
|
72
|
+
|
73
|
+
## AFTER ##############################################################################################
|
74
|
+
#{after}
|
75
|
+
########################################################################################################
|
76
|
+
|
77
|
+
apt-get -y autoremove
|
78
|
+
apt-get -y autoclean
|
79
|
+
apt-get -y clean
|
80
|
+
|
81
|
+
PROVISION_EOF
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def section(section_name)
|
87
|
+
@provisioning_modules.map do |m|
|
88
|
+
<<-MOD_EOF
|
89
|
+
## Setup for #{m.class.to_s} #######################
|
90
|
+
#{m.send(section_name)}
|
91
|
+
####################################################
|
92
|
+
MOD_EOF
|
93
|
+
end.join("\n")
|
94
|
+
end
|
95
|
+
|
96
|
+
def before
|
97
|
+
section(:before)
|
98
|
+
end
|
99
|
+
|
100
|
+
def middle
|
101
|
+
section(:middle)
|
102
|
+
end
|
103
|
+
|
104
|
+
def after
|
105
|
+
section(:after)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
module DevenvBuild
|
4
|
+
module Files
|
5
|
+
class Vagrantfile < Base
|
6
|
+
def filename
|
7
|
+
File.join(options[:destination_directory], 'Vagrantfile')
|
8
|
+
end
|
9
|
+
|
10
|
+
def template
|
11
|
+
<<-EOF
|
12
|
+
# -*- mode: ruby -*-
|
13
|
+
# vi: set ft=ruby :
|
14
|
+
|
15
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
16
|
+
VAGRANTFILE_API_VERSION = "2"
|
17
|
+
|
18
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
19
|
+
config.vm.box = "ubuntu/trusty64"
|
20
|
+
|
21
|
+
config.vm.network "private_network", ip: "192.168.50.4"
|
22
|
+
config.vm.network "forwarded_port", guest: 3000, host: 3000
|
23
|
+
config.ssh.forward_agent = true
|
24
|
+
|
25
|
+
config.vm.synced_folder ".", "/vagrant", type: "nfs"
|
26
|
+
config.vm.provision "shell", path: "provision/provision.sh"
|
27
|
+
|
28
|
+
config.vm.provider "virtualbox" do |v|
|
29
|
+
v.name = "#{box_name}"
|
30
|
+
v.memory = 1024
|
31
|
+
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
32
|
+
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
EOF
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def box_name
|
41
|
+
options[:box_name] || "Development Environment #{SecureRandom.uuid}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module DevenvBuild
|
4
|
+
module Files
|
5
|
+
class Base
|
6
|
+
def initialize(options)
|
7
|
+
@options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate
|
11
|
+
destination = filename
|
12
|
+
|
13
|
+
Dir.mkdir(File.dirname(destination)) unless
|
14
|
+
Dir.exists?(File.dirname(destination))
|
15
|
+
|
16
|
+
File.open(destination, 'w') { |f| f.write(template) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def filename
|
20
|
+
'nofile'
|
21
|
+
end
|
22
|
+
|
23
|
+
def template
|
24
|
+
""
|
25
|
+
end
|
26
|
+
|
27
|
+
def options
|
28
|
+
@options
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'devenv_build/files/vagrantfile'
|
35
|
+
require 'devenv_build/files/provision'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Provisioning
|
3
|
+
class NginxPassenger < Base
|
4
|
+
def help
|
5
|
+
'Install Nginx + Phusion Passenger.'
|
6
|
+
end
|
7
|
+
|
8
|
+
def before
|
9
|
+
<<-BEFORE
|
10
|
+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
|
11
|
+
apt-get install -y apt-transport-https ca-certificates
|
12
|
+
echo "deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main" > /etc/apt/sources.list.d/passenger.list
|
13
|
+
BEFORE
|
14
|
+
end
|
15
|
+
|
16
|
+
def middle
|
17
|
+
'apt-get install -y passenger nginx-extras'
|
18
|
+
end
|
19
|
+
|
20
|
+
def after
|
21
|
+
'perl -i -p -e \'s/# passenger_root \/usr\/lib\/ruby\/vendor_ruby\/phusion_passenger\/locations\.ini\;\n/passenger_root \/usr\/lib\/ruby\/vendor_ruby\/phusion_passenger\/locations.ini;\n\tpassenger_ruby \/home\/vagrant\/.rbenv\/shims\/ruby;\n/\' /etc/nginx/nginx.conf'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Provisioning
|
3
|
+
class Nodejs < Base
|
4
|
+
def help
|
5
|
+
'Install NodeJS and up to-date NPM.'
|
6
|
+
end
|
7
|
+
|
8
|
+
def before
|
9
|
+
<<-BEFORE
|
10
|
+
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
11
|
+
add-apt-repository https://deb.nodesource.com/node_0.12/
|
12
|
+
BEFORE
|
13
|
+
end
|
14
|
+
|
15
|
+
def middle
|
16
|
+
'apt-get -y install nodejs'
|
17
|
+
end
|
18
|
+
|
19
|
+
def after
|
20
|
+
'npm install npm -g'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Provisioning
|
3
|
+
class Postgresql < Base
|
4
|
+
def help
|
5
|
+
'Install PostgreSQL with permissions for vagrant user.'
|
6
|
+
end
|
7
|
+
|
8
|
+
def middle
|
9
|
+
"apt-get -y install postgresql postgresql-contrib postgresql-client libpq-dev"
|
10
|
+
end
|
11
|
+
|
12
|
+
def after
|
13
|
+
<<-AFTER
|
14
|
+
sudo -u postgres pg_dropcluster --stop 9.3 main
|
15
|
+
sudo -u postgres pg_createcluster --start 9.3 main
|
16
|
+
sudo -u postgres createuser -d -R -w -S vagrant
|
17
|
+
perl -i -p -e 's/local all all peer/local all all trust/' /etc/postgresql/9.3/main/pg_hba.conf
|
18
|
+
AFTER
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Provisioning
|
3
|
+
class Redis < Base
|
4
|
+
def help
|
5
|
+
'Install redis server and redis tools.'
|
6
|
+
end
|
7
|
+
|
8
|
+
def before
|
9
|
+
'add-apt-repository ppa:chris-lea/redis-server'
|
10
|
+
end
|
11
|
+
|
12
|
+
def middle
|
13
|
+
'apt-get -y install redis-server redis-tools libhiredis-dev'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Provisioning
|
3
|
+
class Ruby < Base
|
4
|
+
def help
|
5
|
+
'Install Ruby (with rbenv).'
|
6
|
+
end
|
7
|
+
|
8
|
+
def before
|
9
|
+
<<-BEFORE
|
10
|
+
execute_with_rbenv () {
|
11
|
+
`cat >/home/vagrant/temp-script.sh <<\\EOF
|
12
|
+
export HOME=/home/vagrant
|
13
|
+
if [ -d $HOME/.rbenv ]; then
|
14
|
+
export PATH=\"$HOME/.rbenv/bin:$PATH\"
|
15
|
+
eval \"$(rbenv init -)\"
|
16
|
+
fi
|
17
|
+
|
18
|
+
EOF
|
19
|
+
`
|
20
|
+
echo $1 >> /home/vagrant/temp-script.sh
|
21
|
+
chmod +x /home/vagrant/temp-script.sh
|
22
|
+
su vagrant -c \"bash -c /home/vagrant/temp-script.sh\"
|
23
|
+
rm /home/vagrant/temp-script.sh
|
24
|
+
}
|
25
|
+
BEFORE
|
26
|
+
end
|
27
|
+
|
28
|
+
def middle
|
29
|
+
<<-MIDDLE
|
30
|
+
`cat >/home/vagrant/install_rbenv.sh <<\\EOF
|
31
|
+
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
|
32
|
+
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
|
33
|
+
echo 'export PATH=\"$HOME/.rbenv/bin:$PATH\"' >> ~/.bash_profile
|
34
|
+
echo 'eval \"$(rbenv init -)\"' >> ~/.bash_profile
|
35
|
+
EOF
|
36
|
+
`
|
37
|
+
chmod +x /home/vagrant/install_rbenv.sh
|
38
|
+
su vagrant -c \"bash -c /home/vagrant/install_rbenv.sh\"
|
39
|
+
rm /home/vagrant/install_rbenv.sh
|
40
|
+
|
41
|
+
sudo apt-get -y install zlib1g-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev \\
|
42
|
+
sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev
|
43
|
+
|
44
|
+
execute_with_rbenv \"rbenv install 2.2.2 ; rbenv global 2.2.2\"
|
45
|
+
MIDDLE
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Provisioning
|
3
|
+
class RubyOnRails < Base
|
4
|
+
def options_setter(module_name, options)
|
5
|
+
proc do
|
6
|
+
options[module_name] = true
|
7
|
+
options[:ruby] = true
|
8
|
+
options[:nodejs] = true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def help
|
13
|
+
'Install Ruby On Rails (will include Ruby with rbenv and NodeJS).'
|
14
|
+
end
|
15
|
+
|
16
|
+
def middle
|
17
|
+
<<-MIDDLE
|
18
|
+
sudo apt-get -y install nodejs
|
19
|
+
|
20
|
+
execute_with_rbenv \"gem install rails\"
|
21
|
+
MIDDLE
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Provisioning
|
3
|
+
class Rustlang < Base
|
4
|
+
def help
|
5
|
+
'Install the Rust programming language.'
|
6
|
+
end
|
7
|
+
|
8
|
+
def middle
|
9
|
+
<<-MIDDLE
|
10
|
+
curl -s https://static.rust-lang.org/rustup.sh > rs.sh;
|
11
|
+
sh ./rs.sh -y > /dev/null;
|
12
|
+
rm rs.sh
|
13
|
+
MIDDLE
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module DevenvBuild
|
2
|
+
module Provisioning
|
3
|
+
def self.provisioning_modules
|
4
|
+
@modules = (self.constants - [:Base]).map do |module_name|
|
5
|
+
[ module_name.downcase.to_sym, self.const_get(module_name).new ]
|
6
|
+
end.to_h
|
7
|
+
end
|
8
|
+
|
9
|
+
class Base
|
10
|
+
def options_setter(module_name, options)
|
11
|
+
proc { options[module_name] = true }
|
12
|
+
end
|
13
|
+
|
14
|
+
def help
|
15
|
+
'Help line'
|
16
|
+
end
|
17
|
+
|
18
|
+
def before
|
19
|
+
''
|
20
|
+
end
|
21
|
+
|
22
|
+
def middle
|
23
|
+
''
|
24
|
+
end
|
25
|
+
|
26
|
+
def after
|
27
|
+
''
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
require 'devenv_build/provisioning/ruby'
|
34
|
+
require 'devenv_build/provisioning/nodejs'
|
35
|
+
require 'devenv_build/provisioning/rustlang'
|
36
|
+
require 'devenv_build/provisioning/haskell'
|
37
|
+
require 'devenv_build/provisioning/sbcl'
|
38
|
+
|
39
|
+
require 'devenv_build/provisioning/ruby_on_rails'
|
40
|
+
|
41
|
+
require 'devenv_build/provisioning/postgresql'
|
42
|
+
require 'devenv_build/provisioning/redis'
|
43
|
+
|
44
|
+
require 'devenv_build/provisioning/nginx_passenger'
|
data/lib/devenv_build.rb
ADDED
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: devenv_build
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Francisco Soto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: |-
|
42
|
+
Simple tool to generate development environments based on Vagrant and VirtualBox.
|
43
|
+
|
44
|
+
You can includes a mix and match of programming languages, databases, frameworks or tools. Just point it to a directory and say what you need and you'll get your devenv. No more copying Vagrantfile and provisioning scripts around.
|
45
|
+
email:
|
46
|
+
- ebobby@gmail.com
|
47
|
+
executables:
|
48
|
+
- devenv_build
|
49
|
+
extensions: []
|
50
|
+
extra_rdoc_files: []
|
51
|
+
files:
|
52
|
+
- ".gitignore"
|
53
|
+
- ".rspec"
|
54
|
+
- ".travis.yml"
|
55
|
+
- CODE_OF_CONDUCT.md
|
56
|
+
- Gemfile
|
57
|
+
- LICENSE.txt
|
58
|
+
- README.md
|
59
|
+
- Rakefile
|
60
|
+
- bin/console
|
61
|
+
- bin/devenv_build
|
62
|
+
- bin/setup
|
63
|
+
- devenv_build.gemspec
|
64
|
+
- lib/devenv_build.rb
|
65
|
+
- lib/devenv_build/cli.rb
|
66
|
+
- lib/devenv_build/files.rb
|
67
|
+
- lib/devenv_build/files/provision.rb
|
68
|
+
- lib/devenv_build/files/vagrantfile.rb
|
69
|
+
- lib/devenv_build/provisioning.rb
|
70
|
+
- lib/devenv_build/provisioning/haskell.rb
|
71
|
+
- lib/devenv_build/provisioning/nginx_passenger.rb
|
72
|
+
- lib/devenv_build/provisioning/nodejs.rb
|
73
|
+
- lib/devenv_build/provisioning/postgresql.rb
|
74
|
+
- lib/devenv_build/provisioning/redis.rb
|
75
|
+
- lib/devenv_build/provisioning/ruby.rb
|
76
|
+
- lib/devenv_build/provisioning/ruby_on_rails.rb
|
77
|
+
- lib/devenv_build/provisioning/rustlang.rb
|
78
|
+
- lib/devenv_build/provisioning/sbcl.rb
|
79
|
+
- lib/devenv_build/version.rb
|
80
|
+
homepage: http://github.com/ebobby/devenv_build
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.4.5
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Development environment builder based on Vagrant and VirtualBox.
|
104
|
+
test_files: []
|