boxci 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +146 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +118 -0
- data/Rakefile +13 -0
- data/bin/boxci +6 -0
- data/boxci.gemspec +28 -0
- data/lib/boxci/builder.rb +29 -0
- data/lib/boxci/cli.rb +70 -0
- data/lib/boxci/config_permutation.rb +15 -0
- data/lib/boxci/config_permutation_component.rb +11 -0
- data/lib/boxci/config_permutation_component_factory.rb +7 -0
- data/lib/boxci/config_permutation_components/rbenv.rb +13 -0
- data/lib/boxci/dependency_checker.rb +55 -0
- data/lib/boxci/global_config.rb +26 -0
- data/lib/boxci/initializer.rb +41 -0
- data/lib/boxci/language.rb +35 -0
- data/lib/boxci/language_factory.rb +7 -0
- data/lib/boxci/languages/ruby.rb +31 -0
- data/lib/boxci/project_config.rb +96 -0
- data/lib/boxci/provider.rb +35 -0
- data/lib/boxci/provider_config.rb +23 -0
- data/lib/boxci/provider_factory.rb +7 -0
- data/lib/boxci/providers/aws.rb +27 -0
- data/lib/boxci/providers/openstack.rb +27 -0
- data/lib/boxci/providers/virtualbox.rb +24 -0
- data/lib/boxci/templates/Vagrantfile +41 -0
- data/lib/boxci/templates/boxci/global_config.yml.tt +1 -0
- data/lib/boxci/templates/dot_boxci.yml.tt +11 -0
- data/lib/boxci/templates/languages/ruby/main.pp +27 -0
- data/lib/boxci/templates/providers/aws/Vagrantfile.erb +45 -0
- data/lib/boxci/templates/providers/aws.yml.tt +5 -0
- data/lib/boxci/templates/providers/openstack/Vagrantfile.erb +37 -0
- data/lib/boxci/templates/providers/openstack.yml.tt +16 -0
- data/lib/boxci/templates/providers/virtualbox/Vagrantfile.erb +47 -0
- data/lib/boxci/templates/providers/virtualbox.yml.tt +2 -0
- data/lib/boxci/templates/puppet/manifests/.empty_directory +0 -0
- data/lib/boxci/templates/puppet/modules/.empty_directory +0 -0
- data/lib/boxci/test_runner.rb +134 -0
- data/lib/boxci/tester.rb +287 -0
- data/lib/boxci/version.rb +3 -0
- data/lib/boxci.rb +71 -0
- data/spec/lib/boxci/builder_spec.rb +86 -0
- data/spec/lib/boxci/config_permutation_component_factory_spec.rb +17 -0
- data/spec/lib/boxci/config_permutation_component_spec.rb +19 -0
- data/spec/lib/boxci/config_permutation_components/rbenv_spec.rb +12 -0
- data/spec/lib/boxci/config_permutation_spec.rb +27 -0
- data/spec/lib/boxci/dependency_checker_spec.rb +215 -0
- data/spec/lib/boxci/global_config_spec.rb +34 -0
- data/spec/lib/boxci/initializer_spec.rb +117 -0
- data/spec/lib/boxci/language_factory_spec.rb +17 -0
- data/spec/lib/boxci/language_spec.rb +31 -0
- data/spec/lib/boxci/project_config_spec.rb +218 -0
- data/spec/lib/boxci/provider_config_spec.rb +39 -0
- data/spec/lib/boxci/provider_factory_spec.rb +17 -0
- data/spec/lib/boxci/provider_spec.rb +30 -0
- data/spec/lib/boxci/tester_spec.rb +15 -0
- data/spec/lib/boxci_spec.rb +176 -0
- data/spec/spec_helper.rb +11 -0
- metadata +213 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a475fe47696c8556909205cd4298df0c1daff83f
|
4
|
+
data.tar.gz: c13165f012d2e9baeace5c45c4fc6ff8d4432df5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d95af11773c6c3c0f56a663d976b8b708e62f17fcf31f408ddc6058e9274aaa3031e6a7bcdbcf614eaa85a2f6fb0372518e5afd54bb177b982bb47d53efc37fb
|
7
|
+
data.tar.gz: a3ed46d45eb0bfa6f2d6d1bad7716611bd5bc3d520bd893f23174d2395a4c74d0449f2b026ceda0544058a0af0edc192bf65bba88d9b7914d76046efd2bc5b65
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.0
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
# ChangeLog
|
2
|
+
|
3
|
+
The following are lists of the notable changes included with each release.
|
4
|
+
This is intended to help keep people informed about notable changes between
|
5
|
+
versions as well as provide a rough history.
|
6
|
+
|
7
|
+
#### Next Release
|
8
|
+
|
9
|
+
#### v0.0.30
|
10
|
+
|
11
|
+
- Renamed project from `shanty` to `boxci`
|
12
|
+
- Moved all `TODO.txt` items to GitHub Issues
|
13
|
+
- Corrected author emails in the gemspec
|
14
|
+
|
15
|
+
#### v0.0.29
|
16
|
+
|
17
|
+
- Made Initializer not inherit from Thor
|
18
|
+
- Made Bulder not inherit from Thor
|
19
|
+
- Made Tester not inherit from Thor
|
20
|
+
|
21
|
+
#### v0.0.28
|
22
|
+
|
23
|
+
- Remove vagrant debugging from test subcommand cleanup
|
24
|
+
|
25
|
+
#### v0.0.27
|
26
|
+
|
27
|
+
- Included stderr on test subcomand cleanup logging
|
28
|
+
|
29
|
+
#### v0.0.26
|
30
|
+
|
31
|
+
- Added logging to the test subcommand cleanup
|
32
|
+
|
33
|
+
#### v0.0.25
|
34
|
+
|
35
|
+
- Moved workspace cleanup dir rm out of workspace folder block
|
36
|
+
|
37
|
+
#### v0.0.24
|
38
|
+
|
39
|
+
- Hid output of cleanup commands
|
40
|
+
|
41
|
+
#### v0.0.23
|
42
|
+
|
43
|
+
- Set SIGPIPE handler to `SIG_IGN`
|
44
|
+
|
45
|
+
#### v0.0.22
|
46
|
+
|
47
|
+
- Cleaned up hackish logging a bit
|
48
|
+
|
49
|
+
#### v0.0.21
|
50
|
+
|
51
|
+
- Switched rescue exception handling to StandardError
|
52
|
+
|
53
|
+
#### v0.0.20
|
54
|
+
|
55
|
+
- Added better exception logging
|
56
|
+
|
57
|
+
#### v0.0.19
|
58
|
+
|
59
|
+
- Added Errno::EPIPE swallowing in SIGTERM handler
|
60
|
+
|
61
|
+
#### v0.0.18
|
62
|
+
|
63
|
+
- Added rescue handler for cleanup in SIGTERM handler
|
64
|
+
|
65
|
+
#### v0.0.17
|
66
|
+
|
67
|
+
- Added Errno::EPIPE exception swallowing
|
68
|
+
|
69
|
+
#### v0.0.16
|
70
|
+
|
71
|
+
- Added Tester globalish exception logging
|
72
|
+
|
73
|
+
#### v0.0.15
|
74
|
+
|
75
|
+
- Fix few issues with the hack logging from `v0.0.14`
|
76
|
+
|
77
|
+
#### v0.0.14
|
78
|
+
|
79
|
+
- Added hack logging to verify signal handling
|
80
|
+
|
81
|
+
#### v0.0.13
|
82
|
+
|
83
|
+
- Added SIGPIPE swallowing to handle CI servers that kill stdout & stderr on
|
84
|
+
build stop.
|
85
|
+
|
86
|
+
#### v0.0.12
|
87
|
+
|
88
|
+
- Remove top level exception handler
|
89
|
+
|
90
|
+
#### v0.0.11
|
91
|
+
|
92
|
+
- Wrapped test subcommand with unhandled exception handler
|
93
|
+
|
94
|
+
#### v0.0.10
|
95
|
+
|
96
|
+
- Added `--version` option to shanty
|
97
|
+
|
98
|
+
#### v0.0.9
|
99
|
+
|
100
|
+
- Added SIGTINT handler to run cleanup in test subcommand
|
101
|
+
- Added SIGTERM handler to run cleanup in test subcommand
|
102
|
+
|
103
|
+
#### v0.0.8
|
104
|
+
|
105
|
+
- Reworked init subcommand's provider option to match test subcommand
|
106
|
+
- Made it default to empty global config if not found
|
107
|
+
- Remove all the puts debugging added in v0.0.5 for Bamboo
|
108
|
+
- Add rake version constraint to gemspec
|
109
|
+
|
110
|
+
#### v0.0.7
|
111
|
+
|
112
|
+
- Made exceptino handler re-raise so thor exits when an exception happens
|
113
|
+
|
114
|
+
#### v0.0.6
|
115
|
+
|
116
|
+
- Added exception reporting around the initial config load in tester
|
117
|
+
|
118
|
+
#### v0.0.5
|
119
|
+
|
120
|
+
- Added puts around everything to see what was happening in Bamboo
|
121
|
+
|
122
|
+
#### v0.0.4
|
123
|
+
|
124
|
+
- Replaced test subcommand with puts to verify in Bamboo
|
125
|
+
|
126
|
+
#### v0.0.3
|
127
|
+
|
128
|
+
- Added thor exit on failure
|
129
|
+
|
130
|
+
#### v0.0.2
|
131
|
+
|
132
|
+
- Fixed bug where openstack node names had underscores
|
133
|
+
- Added artifact gathering and downloading
|
134
|
+
- Added `box_size` option to the `.shanty.yml`
|
135
|
+
- Fixed multiple script hook calls bug
|
136
|
+
- Made vagrant destroy forced so it doesn't prompt the user
|
137
|
+
- Fixed cd'ing issue before untar of code
|
138
|
+
- Bubble up exit code from test suite
|
139
|
+
- Added new test runner generator
|
140
|
+
- Added basic config permutations handling for rbenv
|
141
|
+
- Made virtualbox the default provider
|
142
|
+
- Added virtualbox support so can test things locally
|
143
|
+
|
144
|
+
#### v0.0.1
|
145
|
+
|
146
|
+
- Initial release
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 ReachLocal, Inc.
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
# boxci: standardizing virtual development & ci environments
|
2
|
+
|
3
|
+
Boxci makes creating a virtualized development & continuous integration
|
4
|
+
environments as easy as possible.
|
5
|
+
|
6
|
+
It does this by focusing on implementing standards around the use of
|
7
|
+
[Vagrant](http://www.vagrantup.com/) for managing your development
|
8
|
+
and continuous integration environment. This means that it helps you
|
9
|
+
configure and setup [Vagrant](http://www.vagrantup.com/), generate a well
|
10
|
+
structured initial puppet manifest, and handles spinning up your puppet
|
11
|
+
managed continuous integration environment up in the cloud and running your
|
12
|
+
automated test suites.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Install it by running the following:
|
17
|
+
|
18
|
+
$ gem install boxci
|
19
|
+
|
20
|
+
## Set up your project
|
21
|
+
|
22
|
+
Setting a new or existing project up with Boxci is done with the following
|
23
|
+
steps.
|
24
|
+
|
25
|
+
1. Setup initial `boxci` configs & skeletons
|
26
|
+
2. Update the generated configs
|
27
|
+
3. Build your base `boxci` puppet manifest
|
28
|
+
4. Iterate on your `boxci` puppet manifest
|
29
|
+
5. Run your test suite using `boxci`
|
30
|
+
|
31
|
+
### Setup initial boxci configs & skeletons
|
32
|
+
|
33
|
+
To *boxcify* your project you need to run the `boxci init <language>` command.
|
34
|
+
This command will create an initial `.boxci.yml` config for you in the current
|
35
|
+
working directory. Therefore, you should run this command from the root of
|
36
|
+
your project. It will also handle creating your user level `boxci`
|
37
|
+
configurations in the `~/.boxci` direcotry. An example of this can be seen as
|
38
|
+
follows:
|
39
|
+
|
40
|
+
$ boxci init ruby
|
41
|
+
|
42
|
+
*Note:* The above will create user level configs using the default provider
|
43
|
+
`virtualbox`. If you want to use `boxci` always with a cloud provider simply
|
44
|
+
rerun the `init` command specifying one of the supported providers. The
|
45
|
+
following is an example:
|
46
|
+
|
47
|
+
$ boxci init -p openstack ruby
|
48
|
+
|
49
|
+
This will go through and setup the proper directory stucture and create the
|
50
|
+
config files just as before. However, when it identifies conflicts with the
|
51
|
+
existing files it will prompt you and ask you if you want to overwrite, diff
|
52
|
+
the files, not overwrite, etc.
|
53
|
+
|
54
|
+
This means that you can rerun the command over and over again and not worry
|
55
|
+
about it overwriting your configs unless you tell it too. This is also useful
|
56
|
+
in the scenarios where a new version of `boxci` has come out and added config
|
57
|
+
options because then you can rerun it and choose to diff them to see what was
|
58
|
+
added.
|
59
|
+
|
60
|
+
### Update the generated configs
|
61
|
+
|
62
|
+
Now that the initial configs and skeleton have been generated. We need to go
|
63
|
+
through the configs and update them.
|
64
|
+
|
65
|
+
### Build your base Boxci
|
66
|
+
|
67
|
+
### Iterate on your Boxci
|
68
|
+
|
69
|
+
### Run your Test Suite using Boxci
|
70
|
+
|
71
|
+
To run your automated test suite in the cloud or locally in a `boxci` managed
|
72
|
+
virtual machine simply run the following from the project's root directory.
|
73
|
+
|
74
|
+
$ boxci test
|
75
|
+
|
76
|
+
To see more output on what is happening, pass the "-v" flag for verbose:
|
77
|
+
|
78
|
+
$ boxci test -v
|
79
|
+
|
80
|
+
For details on other options you can set for test runs run the following
|
81
|
+
command:
|
82
|
+
|
83
|
+
$ boxci help test
|
84
|
+
|
85
|
+
## Get Help
|
86
|
+
|
87
|
+
`boxci` provides a useful help system within the command line tool. You can
|
88
|
+
see these messages by using the help command as follows:
|
89
|
+
|
90
|
+
$ boxci help
|
91
|
+
|
92
|
+
The above shows you the top level `boxci help` including a break down of it's
|
93
|
+
subcommands. You can get detailed help on each subcommand by running the
|
94
|
+
following:
|
95
|
+
|
96
|
+
$ boxci help SUBCOMMAND
|
97
|
+
|
98
|
+
For example if you wanted the detailed help on `init` you would run the
|
99
|
+
following:
|
100
|
+
|
101
|
+
$ boxci help init
|
102
|
+
|
103
|
+
## Config Breakdown
|
104
|
+
|
105
|
+
### .boxci.yml
|
106
|
+
|
107
|
+
After initializing, you need to configure the `.boxci.yml` in the root of your
|
108
|
+
project.
|
109
|
+
|
110
|
+
See the generated `.boxci.yml` file for help with configuration.
|
111
|
+
|
112
|
+
## Contributing
|
113
|
+
|
114
|
+
1. Fork it ( http://github.com/reachlocal/boxci/fork )
|
115
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
116
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
117
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
118
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/boxci
ADDED
data/boxci.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'boxci/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "boxci"
|
8
|
+
spec.version = Boxci::VERSION
|
9
|
+
spec.authors = ["Andrew De Ponte", "Brian Miller", "Russell Cloak"]
|
10
|
+
spec.email = ["cyphactor@gmail.com", "brimil01@gmail.com", "russcloak@gmail.cm"]
|
11
|
+
spec.summary = %q{Tool simplifying Vagrant based development & continuous integration environments.}
|
12
|
+
spec.description = %q{Boxci is focused on defining standards and building tooling around using Vagrant for development & continuous integration environments to make using them as easy as possible.}
|
13
|
+
spec.homepage = "http://github.com/reachlocal/boxci"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "thor", "~> 0.18"
|
22
|
+
spec.add_runtime_dependency "net-ssh", "~> 2.7"
|
23
|
+
spec.add_runtime_dependency "net-scp", "~> 1.1"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
26
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Boxci
|
4
|
+
class Builder
|
5
|
+
include Thor::Base
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
source_root(File.dirname(__FILE__))
|
9
|
+
|
10
|
+
def build
|
11
|
+
generate_project_vagrantfile
|
12
|
+
generate_starter_puppet_manifest
|
13
|
+
end
|
14
|
+
|
15
|
+
def generate_project_vagrantfile
|
16
|
+
dependency_checker = Boxci::DependencyChecker.new
|
17
|
+
dependency_checker.verify_boxci_config
|
18
|
+
|
19
|
+
@project_config = Boxci.project_config
|
20
|
+
template "templates/Vagrantfile", File.join(Boxci.project_path, "Vagrantfile")
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_starter_puppet_manifest
|
24
|
+
directory "templates/puppet", File.join(Boxci.project_path, "puppet")
|
25
|
+
language = Boxci::LanguageFactory.build(Boxci.project_config.language)
|
26
|
+
language.generate_starter_puppet_manifest
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/boxci/cli.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
module Boxci
|
2
|
+
class CLI < Thor
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
DEFAULT_PROVIDER='virtualbox'
|
6
|
+
DEFAULT_REVISION='HEAD'
|
7
|
+
|
8
|
+
desc "init [-p PROVIDER] LANGUAGE", "Initializes boxci in the present working directory"
|
9
|
+
long_desc <<-LONGDESC
|
10
|
+
`boxci init [-p PROVIDER] LANGUAGE` will create a .boxci directory in
|
11
|
+
your user's home directory, create a provider specific config (ex:
|
12
|
+
~/.boxci/providers/virtualbox.yml), set the default provider in
|
13
|
+
(~/.boxci/global_config.yml), and create a project config (.boxci.yml)
|
14
|
+
in the current working directory.
|
15
|
+
|
16
|
+
LANGUAGE is required, it is the language of your project, see supported
|
17
|
+
languages below.
|
18
|
+
|
19
|
+
--provider (-p) is optional. If omitted, it will use your configured
|
20
|
+
default provider (#{Boxci.default_provider}). If you don't have a
|
21
|
+
default provider configured it will default to '#{DEFAULT_PROVIDER}'.
|
22
|
+
|
23
|
+
Supported Languages: #{Boxci::Language.supported_languages.join(", ")}
|
24
|
+
\005Supported Providers: #{Boxci::Provider.supported_providers.join(", ")}
|
25
|
+
LONGDESC
|
26
|
+
option :provider, :type => :string, :aliases => "-p", :default => Boxci.default_provider
|
27
|
+
def init(language)
|
28
|
+
initializer = Boxci::Initializer.new
|
29
|
+
initializer.init(language, options['provider'])
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "build", "Generates Vagrantfile & starter Puppet manifest"
|
33
|
+
long_desc <<-LONGDESC
|
34
|
+
`boxci build` will interpret your project config (.boxci.yml) and create
|
35
|
+
a starting Vagrantfile and puppet setup in the current working directory.
|
36
|
+
LONGDESC
|
37
|
+
def build
|
38
|
+
builder = Boxci::Builder.new
|
39
|
+
builder.build
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "test [-v] [-p PROVIDER] [REVISION]", "Spins up the boxci, runs the tests, then destroys the boxci"
|
43
|
+
long_desc <<-LONGDESC
|
44
|
+
`boxci test [-v] [-p PROVIDER] [REVISION]` will spin up a new VM using
|
45
|
+
the PROVIDER and run the given test steps against the REVISION.
|
46
|
+
|
47
|
+
--verbose (or -v) is optional. If added, there will be much more output
|
48
|
+
a lot of debugging information, as well as explain exactly which commands
|
49
|
+
are being run.
|
50
|
+
|
51
|
+
--provider (-p) is optional. If omitted, it will use your configured
|
52
|
+
default provider (#{Boxci.default_provider}). If you don't have a
|
53
|
+
default provider configured it will default to '#{DEFAULT_PROVIDER}'.
|
54
|
+
|
55
|
+
REVISION is optional, and if omitted will default to '#{DEFAULT_REVISION}'.
|
56
|
+
LONGDESC
|
57
|
+
option :verbose, :type => :boolean, :aliases => "-v"
|
58
|
+
option :provider, :type => :string, :aliases => "-p", :default => Boxci.default_provider
|
59
|
+
def test(revision=DEFAULT_REVISION)
|
60
|
+
tester = Boxci::Tester.new
|
61
|
+
tester.test(options.merge({"revision" => revision}))
|
62
|
+
end
|
63
|
+
|
64
|
+
map "--version" => :version
|
65
|
+
desc "--version", "Output the version of boxci being executed"
|
66
|
+
def version
|
67
|
+
puts "v#{Boxci::VERSION}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Boxci
|
2
|
+
class ConfigPermutation
|
3
|
+
def initialize(components)
|
4
|
+
@components = components
|
5
|
+
end
|
6
|
+
|
7
|
+
def switch_to_script
|
8
|
+
component_scripts = []
|
9
|
+
@components.each do |component|
|
10
|
+
component_scripts << component.switch_to_script
|
11
|
+
end
|
12
|
+
return component_scripts.join("\n")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Boxci
|
2
|
+
module ConfigPermutationComponents
|
3
|
+
class Rbenv < Boxci::ConfigPermutationComponent
|
4
|
+
def switch_to_script
|
5
|
+
<<SCRIPT
|
6
|
+
echo "Switching to ruby #{@val}"
|
7
|
+
rbenv local #{@val}
|
8
|
+
echo "Swithed to ruby `ruby --version`"
|
9
|
+
SCRIPT
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Boxci
|
2
|
+
class DependencyChecker < Thor
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
no_commands do
|
6
|
+
def verify_all
|
7
|
+
begin
|
8
|
+
self.verify_vagrant
|
9
|
+
self.verify_cloud_provider_config
|
10
|
+
self.verify_repo_puppet_directory
|
11
|
+
self.verify_vagrantfile
|
12
|
+
# List other dependencies here
|
13
|
+
rescue Boxci::MissingDependency => e
|
14
|
+
puts e.message
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def verify_vagrant
|
20
|
+
if !system("which vagrant > /dev/null")
|
21
|
+
raise Boxci::MissingDependency, "It looks like you don't have Vagrant installed. Please install it now with: \"brew install vagrant\""
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def verify_cloud_provider_config
|
26
|
+
if !File.exists?(File.join(File.expand_path(ENV["HOME"]), ".boxci", "cloud_provider_config.yml"))
|
27
|
+
raise Boxci::MissingDependency, "It looks like you don't have the Cloud Provider Config setup. Generate an example with: \"boxci generate cloud_provider_config\""
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def verify_repo_puppet_directory
|
32
|
+
puppet_directory = File.join(Boxci.project_path, "puppet")
|
33
|
+
error_message = "It looks like you don't have Puppet files setup for your repository. You can generate example files by running: \"boxci init\""
|
34
|
+
|
35
|
+
if !File.directory?(puppet_directory)
|
36
|
+
raise Boxci::MissingDependency, error_message
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def verify_vagrantfile
|
41
|
+
vagrant_file = File.join(Boxci.project_path, "Vagrantfile")
|
42
|
+
if !File.exists?(vagrant_file)
|
43
|
+
raise Boxci::MissingDependency, "It looks like you don't have a Vagrantfile setup for your repository. You can generate an example file by running: \"boxci generate vagrantfile\" "
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def verify_boxci_config
|
48
|
+
config_file = File.join(Boxci.project_path, ".boxci.yml")
|
49
|
+
if !File.exists?(config_file)
|
50
|
+
raise Boxci::MissingDependency, "It looks like you're missing the Boxci configuration file. You can generate an example file by running: \"boxci init\" "
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Boxci
|
2
|
+
class GlobalConfig
|
3
|
+
def initialize
|
4
|
+
@global_config = {}
|
5
|
+
end
|
6
|
+
|
7
|
+
def load
|
8
|
+
@global_config.merge!(read_global_config_hash)
|
9
|
+
end
|
10
|
+
|
11
|
+
def default_provider
|
12
|
+
@global_config['default_provider']
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def read_global_config_hash
|
18
|
+
global_config_path = File.join(ENV['HOME'], '/.boxci/global_config.yml')
|
19
|
+
if File.exist?(global_config_path)
|
20
|
+
global_config = YAML::load_file(global_config_path)
|
21
|
+
else
|
22
|
+
global_config = {}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module Boxci
|
4
|
+
class Initializer
|
5
|
+
include Thor::Base
|
6
|
+
include Thor::Actions
|
7
|
+
source_root(File.dirname(__FILE__))
|
8
|
+
|
9
|
+
def init(language, provider)
|
10
|
+
create_provider_config(provider)
|
11
|
+
set_default_provider(provider)
|
12
|
+
create_project_config(language)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_provider_config(provider)
|
16
|
+
template "templates/providers/#{provider}.yml.tt", "~/.boxci/providers/#{provider}.yml"
|
17
|
+
end
|
18
|
+
|
19
|
+
# TODO: Change this name to create_global_config
|
20
|
+
def set_default_provider(provider)
|
21
|
+
@provider = provider
|
22
|
+
template "templates/boxci/global_config.yml.tt", "~/.boxci/global_config.yml"
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_project_config(language)
|
26
|
+
boxci_file = File.join(Boxci.project_path, ".boxci.yml")
|
27
|
+
@language = language
|
28
|
+
@current_ruby_version = dot_ruby_version
|
29
|
+
template "templates/dot_boxci.yml.tt", boxci_file
|
30
|
+
end
|
31
|
+
|
32
|
+
def dot_ruby_version
|
33
|
+
dot_ruby_version_file_path = File.join(Boxci.project_path, ".ruby-version")
|
34
|
+
return nil unless File.exist?(dot_ruby_version_file_path)
|
35
|
+
dot_ruby_version_content = File.read(dot_ruby_version_file_path).strip
|
36
|
+
if dot_ruby_version_content =~ /(?:ruby-)?(\d+\.\d+\.\d+(?:-p\d+)?)(?:@[\w\-]+)?/
|
37
|
+
return $1
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Boxci
|
2
|
+
class Language < Thor
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
no_commands do
|
6
|
+
def self.source_root
|
7
|
+
File.dirname(__FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.supported_languages
|
11
|
+
@@supported_languages ||= []
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.inherited(subclass)
|
15
|
+
self.supported_languages << subclass.to_s.split('::').last.downcase
|
16
|
+
end
|
17
|
+
|
18
|
+
def before_permutation_switch
|
19
|
+
""
|
20
|
+
end
|
21
|
+
|
22
|
+
def after_permutation_switch
|
23
|
+
""
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_script
|
27
|
+
raise ::Boxci::PureVirtualMethod, "'default_script' must be implemented on Boxci::Language subclasses"
|
28
|
+
end
|
29
|
+
|
30
|
+
def generate_starter_puppet_manifest
|
31
|
+
raise ::Boxci::PureVirtualMethod, "'generate_starter_puppet_manifest' must be implemented on Boxci::Language subclasses"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|