Version: 0.2
Vagrant Swiftbox is an open source Vagrant configuration focused on Swift development.
The primary goal of Vagrant Swiftbox is to provide an easy way for developer to get familiar with Swift development. It provides a consistent environment that are not bound to the restrictions of the host operating system.
Vagrant Swiftbox requires recent versions of both Vagrant and VirtualBox to be installed.
Vagrant is a "tool for building and distributing development environments". It works with virtualization software such as VirtualBox to provide a virtual machine sandboxed from your local environment.
To use Vagrant Swiftbox you will need to install some software first. This is what allows you to create a virtual machine on your host machine (typically, your actual computer you are working on).
- Use any local operating system such as Mac OS X, Linux, or Windows.
- Install VirtualBox 4.3.x
- Install Vagrant 1.6.x
vagrant
will now be available as a command in your terminal, try it out.
This is the easy way to start using Swift. It will download the Swift binaries and make it available on your virtual machine. If you would like to build Swift from the source files, skip to "Advanced: Build Swift from Source"
- Download or clone this repository to your local machine.
- Using git:
git clone git://github.com/rheinardkorf/vagrant-swiftbox swiftbox
- Using git:
- In a command prompt, change into the new directory with
cd swiftbox
(or wherever you cloned/extracted the repo) - Start the Vagrant environment with
vagrant up
- The initial setup takes some time. If you want to save time on future boxes, consider using the vagrant-cachier plugin.
- Pay attention if the script requires administrator passwords.
- Login in for development.
- Type in
vagrant ssh
in this project's folder to access your virtual machine (VM). - When logged in, type in
swift
to use the Swift REPL and get started immediately. - See Using the Swift REPL documentation.
- Type in
- Access projects in the VM and on your local machine.
- For convenience the /projects folder on your computer and the /srv/projects folder on your VM are mapped and kept in sync allowing you to access the same files in both environments.
- Once you are done and you would like to shut down your VM, make sure you're not inside your VM
exit
and then typevagrant halt
on your local machine.
- Install the vagrant-hostsupdater plugin with
vagrant plugin install vagrant-hostsupdater
- Note: This is not required, but will automatically setup your local hosts file to access
swiftbox
.
- Note: This is not required, but will automatically setup your local hosts file to access
- Install the vagrant-triggers plugin (
vagrant plugin install vagrant-triggers
)- This is handy if you want to execute code when your virtual machine
up
s,halts
orreloads
.
- This is handy if you want to execute code when your virtual machine
If you don't want to wait for the binaries to be updated; you want to contribute to Swift or you have a very specific reason for doing so, you can build Swift from it's source code.
- Download or clone this repository to your local machine.
- Using git:
git clone git://github.com/rheinardkorf/vagrant-swiftbox swiftbox
- Using git:
- In a command prompt, change into the new directory with
cd swiftbox
(or wherever you cloned/extracted the repo) - Start Vagrant without the default provisioning (fancy word for setup):
vagrant up --no-provision
- Pay attention if the script requires administrator passwords.
- Make sure the previous command succeeded, then provision using the Swift source:
vagrant provision --provision-with source
- Downloading and building from source takes a very long time 45 min plus. Go do something while you wait for the code to compile.
- Login in for development.
- Type in
vagrant ssh
in this project's folder to access your virtual machine (VM). - The Swift tools will now be available for use.
- Type in
- Access projects in the VM and on your local machine.
- For convenience the /projects folder on your computer and the /srv/projects folder on your VM are mapped and kept in sync allowing you to access the same files in both environments.
- Go to
~/swift-src/swift
and type the following two commands:git fetch
git pull
- Update all related projects by typing:
~/swift-src/swift
./utils/update-checkout
- Build the project and install:
./utils/build-script --preset=buildbot_linux_1404 install_destdir=~/swift-build installable_package=~/swift.tar.gz
sudo rsync -rl .~/swift-build/usr/ /usr/
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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Get a copy of this license here: GNU General Public License