lobot 2.0.0pre → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -10
- data/.gitmodules +1 -1
- data/.pairs +15 -0
- data/.rvmrc +1 -1
- data/.travis.yml +5 -0
- data/Gemfile +2 -2
- data/LICENSE.txt +1 -1
- data/README.md +67 -29
- data/Rakefile +11 -6
- data/Vagrantfile +8 -5
- data/bin/lobot +2 -4
- data/chef/cookbooks/pivotal_ci/attributes/jenkins.rb +1 -0
- data/chef/cookbooks/pivotal_ci/files/default/tests/minitest/default_test.rb +40 -2
- data/chef/cookbooks/pivotal_ci/recipes/id_rsa.rb +5 -0
- data/chef/cookbooks/pivotal_ci/recipes/jenkins_config.rb +5 -2
- data/chef/cookbooks/pivotal_ci/recipes/limited_travis_ci_environment.rb +4 -0
- data/chef/cookbooks/pivotal_ci/templates/default/jenkins-job-config.xml.erb +8 -6
- data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/attributes/default.rb +0 -1
- data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/recipes/bootstrap.rb +41 -0
- data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/recipes/default.rb +1 -41
- data/chef/travis-cookbooks/ci_environment/apt/recipes/default.rb +8 -7
- data/chef/travis-cookbooks/ci_environment/bazaar/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/cassandra/attributes/default.rb +6 -3
- data/chef/travis-cookbooks/ci_environment/cassandra/recipes/datastax.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/cassandra/recipes/package.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/cassandra/recipes/tarball.rb +6 -2
- data/chef/travis-cookbooks/ci_environment/cassandra/templates/default/cassandra.init.erb +58 -131
- data/chef/travis-cookbooks/ci_environment/chromium/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/clang/attributes/tarball.rb +2 -7
- data/chef/travis-cookbooks/ci_environment/clang/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/clang/recipes/tarball.rb +2 -4
- data/chef/travis-cookbooks/ci_environment/couchdb/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu-12.04.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu1110_ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu1204_ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/doxygen/recipes/default.rb +24 -0
- data/chef/travis-cookbooks/ci_environment/elasticsearch/attributes/default.rb +4 -1
- data/chef/travis-cookbooks/ci_environment/elasticsearch/recipes/default.rb +8 -5
- data/chef/travis-cookbooks/ci_environment/emacs/recipes/nox.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/firefox/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/git/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/git/recipes/ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/golang/attributes/default.rb +3 -3
- data/chef/travis-cookbooks/ci_environment/gradle/attributes/tarball.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/haskell/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/haskell/recipes/ghc_package.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/haskell/recipes/ghc_source.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_package.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_source.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/haskell/recipes/source.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/hbase/recipes/cdh4.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/java/attributes/default.rb +4 -2
- data/chef/travis-cookbooks/ci_environment/java/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/java/recipes/oraclejdk7.rb +6 -1
- data/chef/travis-cookbooks/ci_environment/kerl/attributes/source.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/kerl/files/default/erlang.cookie +1 -0
- data/chef/travis-cookbooks/ci_environment/kerl/recipes/source.rb +8 -0
- data/chef/travis-cookbooks/ci_environment/kestrel/recipes/tarball.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/leiningen/attributes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/leiningen/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/leiningen/recipes/lein1x.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/leiningen/recipes/lein2x.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/libffi/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/libgdbm/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/libncurses/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/libossp-uuid/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/libreadline/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/libssl/recipes/098.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/libssl/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/libxml/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/lighttpd/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/maven3/recipes/default.rb +5 -2
- data/chef/travis-cookbooks/ci_environment/maven3/recipes/package.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/maven3/recipes/ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/maven3/recipes/tarball.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/memcached/attributes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/memcached/attributes/ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/memcached/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/memcached/recipes/ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/mercurial/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/mercurial/recipes/ppa.rb +36 -0
- data/chef/travis-cookbooks/ci_environment/mongodb/attributes/mongodb.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/mongodb/files/default/mongodb.sysvinit.sh +1 -1
- data/chef/travis-cookbooks/ci_environment/mongodb/recipes/apt.rb +5 -5
- data/chef/travis-cookbooks/ci_environment/mongodb/recipes/server.rb +5 -2
- data/chef/travis-cookbooks/ci_environment/mysql/attributes/default.rb +1 -3
- data/chef/travis-cookbooks/ci_environment/mysql/recipes/server_on_ramfs.rb +6 -1
- data/chef/travis-cookbooks/ci_environment/mysql/templates/default/my.cnf.erb +0 -2
- data/chef/travis-cookbooks/ci_environment/mysql/templates/default/ramfs/my.cnf.erb +0 -2
- data/chef/travis-cookbooks/ci_environment/neo4j-server/attributes/tarball.rb +13 -2
- data/chef/travis-cookbooks/ci_environment/neo4j-server/recipes/tarball.rb +26 -2
- data/chef/travis-cookbooks/ci_environment/networking_basic/recipes/default.rb +4 -1
- data/chef/travis-cookbooks/ci_environment/nodejs/attributes/multi.rb +3 -3
- data/chef/travis-cookbooks/ci_environment/nodejs/recipes/multi.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/openssh/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/perlbrew/attributes/multi.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/phantomjs/attributes/default.rb +2 -2
- data/chef/travis-cookbooks/ci_environment/phantomjs/metadata.rb +3 -0
- data/chef/travis-cookbooks/ci_environment/phantomjs/recipes/default.rb +3 -1
- data/chef/travis-cookbooks/ci_environment/phantomjs/recipes/tarball.rb +3 -2
- data/chef/travis-cookbooks/ci_environment/php/attributes/default.rb +40 -2
- data/chef/travis-cookbooks/ci_environment/php/providers/pecl.rb +73 -0
- data/chef/travis-cookbooks/ci_environment/php/recipes/extensions.rb +25 -0
- data/chef/travis-cookbooks/ci_environment/php/recipes/multi.rb +5 -4
- data/chef/travis-cookbooks/ci_environment/php/resources/pecl.rb +10 -0
- data/chef/travis-cookbooks/ci_environment/phpbuild/attributes/default.rb +2 -2
- data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/after-install.d/phpunit.sh +58 -0
- data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/definitions/5.2.17 +3 -1
- data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/definitions/5.3.3 +2 -1
- data/chef/travis-cookbooks/ci_environment/phpbuild/providers/build.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/phpbuild/recipes/default.rb +8 -10
- data/chef/travis-cookbooks/ci_environment/phpbuild/templates/default/default_configure_options.erb +4 -0
- data/chef/travis-cookbooks/ci_environment/phpenv/attributes/default.rb +6 -0
- data/chef/travis-cookbooks/ci_environment/phpenv/recipes/default.rb +11 -7
- data/chef/travis-cookbooks/ci_environment/postgresql/recipes/server_on_ramfs.rb +2 -2
- data/chef/travis-cookbooks/ci_environment/python/attributes/default.rb +2 -2
- data/chef/travis-cookbooks/ci_environment/python/recipes/multi.rb +10 -3
- data/chef/travis-cookbooks/ci_environment/rabbitmq/attributes/default.rb +3 -0
- data/chef/travis-cookbooks/ci_environment/rabbitmq/recipes/default.rb +6 -2
- data/chef/travis-cookbooks/ci_environment/ragel/recipes/custom.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/ragel/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/redis/attributes/default.rb +3 -0
- data/chef/travis-cookbooks/ci_environment/redis/recipes/default.rb +6 -3
- data/chef/travis-cookbooks/ci_environment/redis/recipes/ppa.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/riak/attributes/default.rb +1 -0
- data/chef/travis-cookbooks/ci_environment/riak/attributes/package.rb +3 -3
- data/chef/travis-cookbooks/{messaging_broker/openssl/recipes/default.rb → ci_environment/riak/attributes/service.rb} +4 -3
- data/chef/travis-cookbooks/ci_environment/riak/recipes/config.rb +2 -2
- data/chef/travis-cookbooks/ci_environment/riak/recipes/default.rb +12 -5
- data/chef/travis-cookbooks/ci_environment/rvm/attributes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/rvm/attributes/multi.rb +2 -0
- data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/global.gems +1 -1
- data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/jruby/global.gems +1 -1
- data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/2.0.0/global.gems +2 -0
- data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/head/global.gems +2 -0
- data/chef/travis-cookbooks/ci_environment/rvm/recipes/default.rb +23 -1
- data/chef/travis-cookbooks/ci_environment/rvm/recipes/multi.rb +2 -2
- data/chef/travis-cookbooks/ci_environment/rvm/templates/default/bundler_config.yml.erb +2 -0
- data/chef/travis-cookbooks/ci_environment/sbt/CHANGELOG.md +20 -0
- data/chef/travis-cookbooks/ci_environment/sbt/LICENSE +201 -0
- data/chef/travis-cookbooks/ci_environment/sbt/README.md +78 -2
- data/chef/travis-cookbooks/ci_environment/sbt/attributes/default.rb +36 -10
- data/chef/travis-cookbooks/ci_environment/sbt/metadata.json +27 -17
- data/chef/travis-cookbooks/ci_environment/sbt/metadata.rb +13 -6
- data/chef/travis-cookbooks/ci_environment/sbt/recipes/default.rb +101 -51
- data/chef/travis-cookbooks/ci_environment/sbt/templates/default/jvmopts.erb +7 -0
- data/chef/travis-cookbooks/ci_environment/sbt/templates/default/sbtopts.erb +54 -0
- data/chef/travis-cookbooks/ci_environment/sphinx/attributes/default.rb +2 -2
- data/chef/travis-cookbooks/ci_environment/sphinx/metadata.rb +4 -4
- data/chef/travis-cookbooks/ci_environment/sphinx/recipes/all.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/sphinx/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/{messaging_broker/build-essential/recipes/default.rb → ci_environment/sqlite/recipes/ppa.rb} +13 -24
- data/chef/travis-cookbooks/ci_environment/subversion/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/sweeper/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/travis_build_environment/attributes/default.rb +2 -0
- data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/ci_user.rb +2 -2
- data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/default.rb +1 -3
- data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/root.rb +5 -1
- data/chef/travis-cookbooks/ci_environment/travis_build_environment/templates/default/ci_user/{dot_bashrc.sh → dot_bashrc.sh.erb} +0 -4
- data/chef/travis-cookbooks/ci_environment/unarchivers/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/xserver/metadata.rb +3 -0
- data/chef/travis-cookbooks/ci_environment/xserver/recipes/default.rb +1 -1
- data/chef/travis-cookbooks/ci_environment/zeromq/recipes/default.rb +6 -23
- data/chef/travis-cookbooks/ci_environment/zeromq/recipes/{20x.rb → ppa.rb} +14 -14
- data/chef/travis-cookbooks/ci_environment/zookeeper/recipes/cdh4.rb +1 -1
- data/chef/travis-cookbooks/worker_host/java/metadata.rb +1 -1
- data/chef/travis-cookbooks/worker_host/java/recipes/openjdk.rb +6 -0
- data/chef/travis-cookbooks/worker_host/jruby/attributes/default.rb +1 -1
- data/chef/travis-cookbooks/worker_host/jruby/metadata.rb +1 -1
- data/chef/travis-cookbooks/worker_host/jruby/recipes/default.rb +1 -0
- data/chef/travis-cookbooks/worker_host/monit/recipes/default.rb +21 -17
- data/chef/travis-cookbooks/worker_host/networking_basic/metadata.rb +1 -1
- data/chef/travis-cookbooks/worker_host/networking_basic/recipes/default.rb +0 -6
- data/chef/travis-cookbooks/worker_host/ntp/.gitignore +1 -0
- data/chef/travis-cookbooks/worker_host/ntp/.travis.yml +6 -0
- data/chef/travis-cookbooks/worker_host/ntp/CHANGELOG.md +35 -0
- data/chef/travis-cookbooks/worker_host/ntp/CONTRIBUTING +29 -0
- data/chef/travis-cookbooks/worker_host/ntp/LICENSE +201 -0
- data/chef/travis-cookbooks/worker_host/ntp/README.md +163 -0
- data/chef/travis-cookbooks/worker_host/ntp/Rakefile +19 -0
- data/chef/travis-cookbooks/worker_host/ntp/TESTING.md +213 -0
- data/chef/travis-cookbooks/worker_host/ntp/attributes/default.rb +54 -0
- data/chef/travis-cookbooks/{messaging_broker/rabbitmq/resources/vhost.rb → worker_host/ntp/attributes/ntpdate.rb} +6 -7
- data/chef/travis-cookbooks/worker_host/ntp/chefignore +19 -0
- data/chef/travis-cookbooks/worker_host/ntp/files/default/ntp.leapseconds +222 -0
- data/chef/travis-cookbooks/worker_host/ntp/metadata.json +117 -0
- data/chef/travis-cookbooks/worker_host/ntp/metadata.rb +45 -0
- data/chef/travis-cookbooks/worker_host/ntp/recipes/default.rb +50 -0
- data/chef/travis-cookbooks/worker_host/ntp/recipes/disable.rb +22 -0
- data/chef/travis-cookbooks/worker_host/ntp/recipes/ntpdate.rb +36 -0
- data/chef/travis-cookbooks/{messaging_broker/openssl/libraries/secure_password.rb → worker_host/ntp/recipes/undo.rb} +17 -18
- data/chef/travis-cookbooks/worker_host/ntp/templates/default/ntp.conf.erb +55 -0
- data/chef/travis-cookbooks/worker_host/ntp/templates/default/ntpdate.erb +14 -0
- data/chef/travis-cookbooks/worker_host/rvm/recipes/multi.rb +1 -1
- data/chef/travis-cookbooks/worker_host/travis_worker/attributes/default.rb +10 -3
- data/chef/travis-cookbooks/worker_host/travis_worker/files/default/signal_wrapper.rb +22 -0
- data/chef/travis-cookbooks/worker_host/travis_worker/metadata.rb +2 -2
- data/chef/travis-cookbooks/worker_host/travis_worker/recipes/bluebox.rb +97 -0
- data/chef/travis-cookbooks/worker_host/travis_worker/recipes/default.rb +25 -15
- data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/sv-travis-worker-run.erb +1 -1
- data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/worker-bluebox.yml.erb +21 -0
- data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/worker.yml.erb +0 -4
- data/chef/travis-cookbooks/worker_host/travis_worker_collectd/metadata.rb +1 -0
- data/chef/travis-cookbooks/worker_host/travis_worker_collectd/recipes/bluebox.rb +15 -0
- data/chef/travis-cookbooks/worker_host/travis_worker_collectd/recipes/default.rb +1 -0
- data/chef/travis-cookbooks/worker_host/users/recipes/default.rb +5 -0
- data/cookbooks/.gitkeep +3 -0
- data/lib/lobot.rb +8 -4
- data/lib/lobot/amazon.rb +33 -19
- data/lib/lobot/cli.rb +70 -46
- data/lib/lobot/config.rb +151 -19
- data/lib/lobot/configuration_wizard.rb +117 -0
- data/lib/lobot/keychain.rb +36 -0
- data/lib/lobot/password.rb +13 -0
- data/lib/lobot/sobo.rb +57 -13
- data/lib/lobot/templates/default_rails_build_script.sh +13 -0
- data/lib/lobot/version.rb +2 -2
- data/lobot.gemspec +4 -5
- data/script/bootstrap_server.sh +1 -1
- data/script/ci_build.sh +13 -0
- data/spec/assets/test_cert.crt +18 -0
- data/spec/fixtures/ssh_keys/vagrant_test_key +27 -0
- data/spec/fixtures/ssh_keys/vagrant_test_key.pub +1 -0
- data/spec/lib/lobot/amazon_spec.rb +80 -39
- data/spec/lib/lobot/cli_spec.rb +223 -154
- data/spec/lib/lobot/config_spec.rb +207 -5
- data/spec/lib/lobot/configuration_wizard_spec.rb +347 -0
- data/spec/lib/lobot/keychain_spec.rb +33 -0
- data/spec/lib/lobot/password_spec.rb +15 -0
- data/spec/spec_helper.rb +19 -1
- data/templates/Gemfile-remote +4 -0
- metadata +83 -100
- data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/1.8.6/global.gems +0 -2
- data/chef/travis-cookbooks/ci_environment/travis_build_environment/files/default/root/dot_bashrc.sh +0 -86
- data/chef/travis-cookbooks/ci_environment/zeromq/attributes/default.rb +0 -7
- data/chef/travis-cookbooks/messaging_broker/build-essential/README.md +0 -24
- data/chef/travis-cookbooks/messaging_broker/build-essential/metadata.rb +0 -10
- data/chef/travis-cookbooks/messaging_broker/emacs/metadata.rb +0 -11
- data/chef/travis-cookbooks/messaging_broker/emacs/recipes/default.rb +0 -21
- data/chef/travis-cookbooks/messaging_broker/erlang/attributes/default.rb +0 -1
- data/chef/travis-cookbooks/messaging_broker/erlang/metadata.rb +0 -11
- data/chef/travis-cookbooks/messaging_broker/erlang/recipes/default.rb +0 -27
- data/chef/travis-cookbooks/messaging_broker/git/README.rdoc +0 -37
- data/chef/travis-cookbooks/messaging_broker/git/metadata.rb +0 -16
- data/chef/travis-cookbooks/messaging_broker/git/recipes/default.rb +0 -24
- data/chef/travis-cookbooks/messaging_broker/git/recipes/server.rb +0 -34
- data/chef/travis-cookbooks/messaging_broker/git/templates/default/sv-git-daemon-log-run.erb +0 -2
- data/chef/travis-cookbooks/messaging_broker/git/templates/default/sv-git-daemon-run.erb +0 -3
- data/chef/travis-cookbooks/messaging_broker/haproxy/README.md +0 -79
- data/chef/travis-cookbooks/messaging_broker/haproxy/attributes/default.rb +0 -22
- data/chef/travis-cookbooks/messaging_broker/haproxy/metadata.rb +0 -13
- data/chef/travis-cookbooks/messaging_broker/haproxy/recipes/app_lb.rb +0 -50
- data/chef/travis-cookbooks/messaging_broker/haproxy/recipes/default.rb +0 -42
- data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy-app_lb.cfg.erb +0 -34
- data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy-default.erb +0 -4
- data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy.cfg.erb +0 -27
- data/chef/travis-cookbooks/messaging_broker/iptables/definitions/iptables_rule.rb +0 -35
- data/chef/travis-cookbooks/messaging_broker/iptables/files/default/rebuild-iptables +0 -284
- data/chef/travis-cookbooks/messaging_broker/iptables/metadata.rb +0 -10
- data/chef/travis-cookbooks/messaging_broker/iptables/recipes/default.rb +0 -50
- data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/all_established.erb +0 -2
- data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/all_icmp.erb +0 -2
- data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/iptables_load.erb +0 -3
- data/chef/travis-cookbooks/messaging_broker/openssl/README.md +0 -37
- data/chef/travis-cookbooks/messaging_broker/openssl/metadata.rb +0 -8
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/README.md +0 -86
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/attributes/default.rb +0 -10
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/metadata.rb +0 -63
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/providers/user.rb +0 -66
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/providers/vhost.rb +0 -34
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/recipes/cluster.rb +0 -35
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/recipes/default.rb +0 -51
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/resources/user.rb +0 -25
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/doterlang.cookie.erb +0 -1
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/rabbitmq-env.conf.erb +0 -10
- data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/rabbitmq_cluster.config.erb +0 -5
- data/ci_build.sh +0 -20
- data/docs/ci_yml.md +0 -39
- data/features/ci.feature +0 -29
- data/features/config/secrets.yml.example +0 -4
- data/features/step_definitions/ci_steps.rb +0 -137
- data/features/support/env.rb +0 -12
- data/lib/generators/lobot/USAGE +0 -15
- data/lib/generators/lobot/config_generator.rb +0 -141
- data/lib/generators/lobot/install_generator.rb +0 -25
- data/lib/generators/lobot/templates/Capfile +0 -6
- data/lib/generators/lobot/templates/ci.yml +0 -22
- data/lib/generators/lobot/templates/ci_build.sh +0 -22
- data/lib/generators/lobot/templates/deploy-ci.rb +0 -7
- data/lib/generators/lobot/templates/soloistrc +0 -23
- data/lib/lobot/jenkins.rb +0 -17
- data/lib/lobot/railtie.rb +0 -20
- data/lib/lobot/recipes/ci.rb +0 -78
- data/lib/lobot/tasks/ci.rake +0 -93
- data/spec/lib/lobot/jenkins_spec.rb +0 -14
@@ -1,8 +1,99 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require "spec_helper"
|
2
3
|
|
3
4
|
describe Lobot::Config do
|
4
5
|
let(:default_config) { Lobot::Config.new }
|
5
6
|
|
7
|
+
describe "#add_build" do
|
8
|
+
let(:name) { "bob" }
|
9
|
+
let(:repository) { "http://github.com/mkocher/soloist.git" }
|
10
|
+
let(:branch) { "master" }
|
11
|
+
let(:command) { "script/ci_build.sh" }
|
12
|
+
|
13
|
+
let(:build_params) { {
|
14
|
+
"name" => name,
|
15
|
+
"repository" => repository,
|
16
|
+
"command" => command,
|
17
|
+
"branch" => branch,
|
18
|
+
"junit_publisher" => true
|
19
|
+
} }
|
20
|
+
|
21
|
+
it "adds a build to the node attributes" do
|
22
|
+
subject.add_build(name, repository, branch, command)
|
23
|
+
subject.node_attributes.jenkins.builds.should =~ [build_params]
|
24
|
+
end
|
25
|
+
|
26
|
+
it "does not add a build twice with identical parameters" do
|
27
|
+
subject.add_build(name, repository, branch, command)
|
28
|
+
subject.add_build(name, repository, branch, command)
|
29
|
+
subject.node_attributes.jenkins.builds.should =~ [build_params]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#display" do
|
34
|
+
before do
|
35
|
+
subject.add_build("default", "repos", "branch", "command")
|
36
|
+
subject.add_build("integration", "repos", "branch", "command")
|
37
|
+
subject.add_build("enemy", "repos", "branch", "command")
|
38
|
+
end
|
39
|
+
|
40
|
+
context "without a running instance" do
|
41
|
+
it "returns a pretty-printed string version of the config" do
|
42
|
+
# The basic_auth_password will be blank on CI, so we force it
|
43
|
+
subject.stub(:basic_auth_password).and_return('password')
|
44
|
+
|
45
|
+
subject.display.should == <<OOTPÜT
|
46
|
+
-- ciborg configuration --
|
47
|
+
Instance ID:
|
48
|
+
IP Address:
|
49
|
+
Instance size: #{subject.instance_size}
|
50
|
+
|
51
|
+
Builds:
|
52
|
+
default
|
53
|
+
integration
|
54
|
+
enemy
|
55
|
+
|
56
|
+
Web URL:
|
57
|
+
User name: #{subject.basic_auth_user}
|
58
|
+
User password: #{subject.basic_auth_password}
|
59
|
+
|
60
|
+
CC Menu URL:
|
61
|
+
OOTPÜT
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "with a running instance" do
|
66
|
+
subject do
|
67
|
+
Lobot::Password.stub(:generate).and_return('password')
|
68
|
+
Lobot::Config.new({instance_id: 'i-xxxxxx',
|
69
|
+
master: '127.0.0.1',
|
70
|
+
instance_size: 'c9.humungous'
|
71
|
+
})
|
72
|
+
end
|
73
|
+
|
74
|
+
it "returns a pretty-printed string version of the config" do
|
75
|
+
|
76
|
+
subject.display.should == <<OOTPÜT
|
77
|
+
-- ciborg configuration --
|
78
|
+
Instance ID: i-xxxxxx
|
79
|
+
IP Address: 127.0.0.1
|
80
|
+
Instance size: c9.humungous
|
81
|
+
|
82
|
+
Builds:
|
83
|
+
default https://127.0.0.1/job/default/rssAll
|
84
|
+
integration https://127.0.0.1/job/integration/rssAll
|
85
|
+
enemy https://127.0.0.1/job/enemy/rssAll
|
86
|
+
|
87
|
+
Web URL: https://127.0.0.1
|
88
|
+
User name: ci
|
89
|
+
User password: password
|
90
|
+
|
91
|
+
CC Menu URL: https://ci:password@127.0.0.1/cc.xml
|
92
|
+
OOTPÜT
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
6
97
|
describe "with a file" do
|
7
98
|
let(:config_contents) { {ssh_port: 42} }
|
8
99
|
let(:tempfile) do
|
@@ -14,10 +105,64 @@ describe Lobot::Config do
|
|
14
105
|
|
15
106
|
let(:config) { Lobot::Config.from_file(tempfile.path) }
|
16
107
|
|
108
|
+
describe "#valid?" do
|
109
|
+
it "returns true by default" do
|
110
|
+
config.should be_valid
|
111
|
+
config.errors.should be_empty
|
112
|
+
end
|
113
|
+
|
114
|
+
context "when there is no jenkins config" do
|
115
|
+
let(:config_contents) { {node_attributes: {}} }
|
116
|
+
|
117
|
+
it "returns false" do
|
118
|
+
config.should_not be_valid
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
context "when jenkins config has no builds" do
|
123
|
+
let(:config_contents) { {node_attributes: {jenkins: {}}} }
|
124
|
+
|
125
|
+
it "returns false" do
|
126
|
+
config.should_not be_valid
|
127
|
+
end
|
128
|
+
|
129
|
+
it "has a useful error message" do
|
130
|
+
config.errors.should include("your config file does not have a [:node_attributes][:jenkins][:builds] key")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
17
135
|
describe ".from_file" do
|
18
136
|
it "loads from a yaml file" do
|
19
137
|
config.ssh_port.should == 42
|
20
138
|
end
|
139
|
+
|
140
|
+
context "when the yaml file does not exist" do
|
141
|
+
let(:config) { Lobot::Config.from_file("#{tempfile.path}-nonexistent") }
|
142
|
+
|
143
|
+
it "does not load from a yaml file" do
|
144
|
+
config.ssh_port.should == 22
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context "handles deprecated keypair_name attribute" do
|
149
|
+
let(:tempfile) do
|
150
|
+
Tempfile.new('lobot-config').tap do |file|
|
151
|
+
file.write <<-YAML
|
152
|
+
---
|
153
|
+
ssh_port: 42
|
154
|
+
keypair_name: lobot
|
155
|
+
YAML
|
156
|
+
file.close
|
157
|
+
end
|
158
|
+
end
|
159
|
+
let(:config) { Lobot::Config.from_file(tempfile.path) }
|
160
|
+
|
161
|
+
it "silently removes it from the configuration" do
|
162
|
+
config.ssh_port.should == 42
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
21
166
|
end
|
22
167
|
|
23
168
|
describe "#save" do
|
@@ -29,6 +174,14 @@ describe Lobot::Config do
|
|
29
174
|
end
|
30
175
|
end
|
31
176
|
|
177
|
+
describe "#update" do
|
178
|
+
it "sets and persists the provided values" do
|
179
|
+
config.update(ssh_port: 20912)
|
180
|
+
config = Lobot::Config.from_file(tempfile.path)
|
181
|
+
config.ssh_port.should == 20912
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
32
185
|
describe "soloistrc-specific attributes" do
|
33
186
|
let(:recipes) { ["pivotal_workstation::broken_postgres", "pivotal_workstation::janus"] }
|
34
187
|
let(:node_attributes) { default_config.node_attributes.merge({"radiator" => {"busted" => "hella"}}) }
|
@@ -54,15 +207,27 @@ describe Lobot::Config do
|
|
54
207
|
|
55
208
|
describe "defaults" do
|
56
209
|
its(:ssh_port) { should == 22 }
|
57
|
-
its(:server_ssh_key) { should =~ /id_rsa$/ }
|
58
|
-
its(:github_ssh_key) { should =~ /id_rsa$/ }
|
59
210
|
its(:recipes) { should == ["pivotal_ci::jenkins", "pivotal_ci::limited_travis_ci_environment", "pivotal_ci"] }
|
60
|
-
its(:cookbook_paths) { should == ['./chef/cookbooks/', './chef/travis-cookbooks/ci_environment'] }
|
211
|
+
its(:cookbook_paths) { should == ['./chef/cookbooks/', './chef/travis-cookbooks/ci_environment', './chef/project-cookbooks'] }
|
61
212
|
its(:instance_size) { should == 'c1.medium' }
|
62
213
|
|
214
|
+
context 'when id_rsa exists' do
|
215
|
+
before { File.stub(:exists?).and_return(true) }
|
216
|
+
|
217
|
+
its(:server_ssh_key_path) { should == File.expand_path('~/.ssh/id_rsa')}
|
218
|
+
its(:github_ssh_key_path) { should == File.expand_path('~/.ssh/id_rsa')}
|
219
|
+
end
|
220
|
+
|
221
|
+
context 'when id_rsa does not exist' do
|
222
|
+
before { File.stub(:exists?).and_return(false) }
|
223
|
+
|
224
|
+
its(:server_ssh_key_path) { should_not be }
|
225
|
+
its(:github_ssh_key_path) { should_not be }
|
226
|
+
end
|
227
|
+
|
63
228
|
describe "#node_attributes" do
|
64
229
|
it "defaults to overwriting the travis build environment" do
|
65
|
-
subject.node_attributes.travis_build_environment.to_hash.should ==
|
230
|
+
subject.node_attributes.travis_build_environment.to_hash.should == {
|
66
231
|
"user" => "jenkins",
|
67
232
|
"group" => "nogroup",
|
68
233
|
"home" => "/var/lib/jenkins"
|
@@ -71,6 +236,10 @@ describe Lobot::Config do
|
|
71
236
|
end
|
72
237
|
|
73
238
|
describe "#soloistrc" do
|
239
|
+
before do
|
240
|
+
Haddock::Password.stub(:generate).and_return('a_secure_password')
|
241
|
+
end
|
242
|
+
|
74
243
|
it "defaults to recipes and nginx basic auth" do
|
75
244
|
subject.soloistrc.should == {
|
76
245
|
"recipes" => subject.recipes,
|
@@ -78,6 +247,7 @@ describe Lobot::Config do
|
|
78
247
|
"node_attributes" => {
|
79
248
|
"nginx" => {
|
80
249
|
"basic_auth_user" => "ci",
|
250
|
+
"basic_auth_password" => 'a_secure_password'
|
81
251
|
},
|
82
252
|
"travis_build_environment" => {
|
83
253
|
"user" => "jenkins",
|
@@ -91,5 +261,37 @@ describe Lobot::Config do
|
|
91
261
|
}
|
92
262
|
end
|
93
263
|
end
|
264
|
+
|
265
|
+
describe 'ssh key accessors' do
|
266
|
+
before do
|
267
|
+
File.stub(:exists?).with(File.expand_path('~/.ssh/id_rsa')).and_return(true)
|
268
|
+
end
|
269
|
+
|
270
|
+
context 'github' do
|
271
|
+
before do
|
272
|
+
File.stub(:read).with(subject.github_ssh_key_path) { "---GITHUB PRIVATE---" }
|
273
|
+
File.stub(:read).with(subject.github_ssh_pubkey_path) { "---GITHUB PUBLIC---" }
|
274
|
+
end
|
275
|
+
|
276
|
+
its(:github_ssh_key_path) { should =~ /^\/.*id_rsa$/ }
|
277
|
+
its(:github_ssh_pubkey_path) { should =~ /^\/.*id_rsa\.pub$/ }
|
278
|
+
|
279
|
+
its(:github_ssh_key) { should == "---GITHUB PRIVATE---" }
|
280
|
+
its(:github_ssh_pubkey) { should == "---GITHUB PUBLIC---" }
|
281
|
+
end
|
282
|
+
|
283
|
+
context 'server' do
|
284
|
+
before do
|
285
|
+
File.stub(:read).with(subject.server_ssh_key_path) { "---SERVER PRIVATE---" }
|
286
|
+
File.stub(:read).with(subject.server_ssh_pubkey_path) { "---SERVER PUBLIC---" }
|
287
|
+
end
|
288
|
+
|
289
|
+
its(:server_ssh_key_path) { should =~ /^\/.*id_rsa$/ }
|
290
|
+
its(:server_ssh_pubkey_path) { should =~ /^\/.*id_rsa\.pub$/ }
|
291
|
+
|
292
|
+
its(:server_ssh_key) { should == "---SERVER PRIVATE---" }
|
293
|
+
its(:server_ssh_pubkey) { should == "---SERVER PUBLIC---" }
|
294
|
+
end
|
295
|
+
end
|
94
296
|
end
|
95
|
-
end
|
297
|
+
end
|
@@ -0,0 +1,347 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lobot::ConfigurationWizard do
|
4
|
+
let(:working_path) { Dir.mktmpdir }
|
5
|
+
let(:cli) { double(:cli).as_null_object }
|
6
|
+
let(:wizard) { Lobot::ConfigurationWizard.new }
|
7
|
+
|
8
|
+
before { wizard.stub(:cli => cli) }
|
9
|
+
|
10
|
+
around do |example|
|
11
|
+
Dir.chdir(working_path) { example.run }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#config" do
|
15
|
+
it "creates the config directory if it does not exist" do
|
16
|
+
expect {
|
17
|
+
wizard.config
|
18
|
+
}.to change {
|
19
|
+
File.directory?(File.join(working_path, "config"))
|
20
|
+
}.from(false).to(true)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "uses the values in your existing lobot.yml" do
|
24
|
+
FileUtils.mkdir_p "config"
|
25
|
+
config = Lobot::Config.new(:path => "config/lobot.yml")
|
26
|
+
config.ssh_port = 2222
|
27
|
+
config.save
|
28
|
+
|
29
|
+
wizard.config.ssh_port.should == 2222
|
30
|
+
end
|
31
|
+
|
32
|
+
it "saves off the config to config/lobot.yml" do
|
33
|
+
expect {
|
34
|
+
wizard.config.save
|
35
|
+
}.to change {
|
36
|
+
File.exists?(File.join(working_path, "config", "lobot.yml"))
|
37
|
+
}.from(false).to(true)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#ask_with_default" do
|
42
|
+
it "makes you feel like you need a shower" do
|
43
|
+
wizard.should_receive(:ask).with("Your ID [1]:")
|
44
|
+
wizard.ask_with_default("Your ID", "1")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "defaults to the default value" do
|
48
|
+
wizard.should_receive(:ask).and_return("")
|
49
|
+
wizard.ask_with_default("Who is buried in Grant's Tomb", "Grant").should == "Grant"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "uses the provided answer" do
|
53
|
+
wizard.should_receive(:ask).and_return("robert e lee's left nipple")
|
54
|
+
wizard.ask_with_default("Who is buried in Grant's Tomb", "Grant").should_not == "Grant"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "does not display a nil default" do
|
58
|
+
wizard.should_receive(:ask).with("Monkey mustache:")
|
59
|
+
wizard.ask_with_default("Monkey mustache", nil)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "#setup" do
|
64
|
+
before do
|
65
|
+
wizard.stub(:ask => "totally-valid-value", :yes? => true, :say => nil)
|
66
|
+
wizard.config.stub(:save)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "Says that you're trying to set up a ci box" do
|
70
|
+
question = "It looks like you're trying to set up a CI Box. Can I help? (Yes/No)"
|
71
|
+
wizard.should_receive(:yes?).with(question)
|
72
|
+
wizard.setup
|
73
|
+
end
|
74
|
+
|
75
|
+
it "prompts for aws credentials" do
|
76
|
+
wizard.should_receive(:prompt_for_aws)
|
77
|
+
wizard.setup
|
78
|
+
end
|
79
|
+
|
80
|
+
it "prompts for nginx basic auth credentials" do
|
81
|
+
wizard.should_receive(:prompt_for_basic_auth)
|
82
|
+
wizard.setup
|
83
|
+
end
|
84
|
+
|
85
|
+
it "prompts for an ssh key" do
|
86
|
+
wizard.should_receive(:prompt_for_ssh_key)
|
87
|
+
wizard.setup
|
88
|
+
end
|
89
|
+
|
90
|
+
it "prompts for a github key" do
|
91
|
+
wizard.should_receive(:prompt_for_github_key)
|
92
|
+
wizard.setup
|
93
|
+
end
|
94
|
+
|
95
|
+
it "prompts for a build" do
|
96
|
+
wizard.should_receive(:prompt_for_build)
|
97
|
+
wizard.setup
|
98
|
+
end
|
99
|
+
|
100
|
+
it "confirms the entered configuration values" do
|
101
|
+
reloaded_config = double("reloaded_config")
|
102
|
+
wizard.config.should_receive(:reload).and_return(reloaded_config)
|
103
|
+
reloaded_config.should_receive(:display)
|
104
|
+
wizard.stub(:user_wants_to_create_instance?).and_return(false)
|
105
|
+
|
106
|
+
wizard.setup
|
107
|
+
end
|
108
|
+
|
109
|
+
it "saves the config" do
|
110
|
+
wizard.config.should_receive(:save)
|
111
|
+
wizard.setup
|
112
|
+
end
|
113
|
+
|
114
|
+
it "prompts to start an instance on amazon" do
|
115
|
+
wizard.should_receive(:user_wants_to_create_instance?)
|
116
|
+
wizard.setup
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'when the user wants to create an instance' do
|
120
|
+
before do
|
121
|
+
wizard.stub(:user_wants_to_create_instance?).and_return(true)
|
122
|
+
end
|
123
|
+
|
124
|
+
it "creates the instance then provisions the server" do
|
125
|
+
wizard.should_receive(:create_instance).ordered
|
126
|
+
wizard.should_receive(:provision_server).ordered
|
127
|
+
wizard.setup
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'when the user does not want to create an instance' do
|
132
|
+
before do
|
133
|
+
wizard.stub(:user_wants_to_create_instance?).and_return(false)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "does not creates an instance nor provision anything" do
|
137
|
+
wizard.should_not_receive(:create_instance)
|
138
|
+
wizard.should_not_receive(:provision_server)
|
139
|
+
wizard.setup
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "#prompt_for_aws" do
|
145
|
+
before { wizard.stub(:say) }
|
146
|
+
|
147
|
+
it "reads in the key and secret" do
|
148
|
+
wizard.should_receive(:ask).and_return("aws-key")
|
149
|
+
wizard.should_receive(:ask).and_return("aws-secret-key")
|
150
|
+
|
151
|
+
wizard.prompt_for_aws
|
152
|
+
|
153
|
+
wizard.config.aws_key.should == "aws-key"
|
154
|
+
wizard.config.aws_secret.should == "aws-secret-key"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "#prompt_for_basic_auth" do
|
159
|
+
it "prompts for the username and password" do
|
160
|
+
wizard.should_receive(:ask).and_return("admin")
|
161
|
+
wizard.should_receive(:ask).and_return("password")
|
162
|
+
|
163
|
+
wizard.prompt_for_basic_auth
|
164
|
+
|
165
|
+
wizard.config.node_attributes.nginx.basic_auth_user.should == "admin"
|
166
|
+
wizard.config.node_attributes.nginx.basic_auth_password.should == "password"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe "#prompt_for_ssh_key" do
|
171
|
+
it "prompts for the path" do
|
172
|
+
wizard.should_receive(:ask).and_return("~/.ssh/top_secret_rsa")
|
173
|
+
|
174
|
+
wizard.prompt_for_ssh_key
|
175
|
+
|
176
|
+
wizard.config.server_ssh_key_path.should == File.expand_path("~/.ssh/top_secret_rsa")
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe "#prompt_for_github_key" do
|
181
|
+
it "prompts for the path" do
|
182
|
+
wizard.should_receive(:ask).and_return("~/.ssh/the_matthew_kocher_memorial_key")
|
183
|
+
|
184
|
+
wizard.prompt_for_github_key
|
185
|
+
|
186
|
+
wizard.config.github_ssh_key_path.should == File.expand_path("~/.ssh/the_matthew_kocher_memorial_key")
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
describe "#prompt_for_build" do
|
191
|
+
def first_jenkins_build
|
192
|
+
wizard.config.node_attributes.jenkins.builds.first
|
193
|
+
end
|
194
|
+
|
195
|
+
before do
|
196
|
+
wizard.stub(:ask)
|
197
|
+
wizard.stub(:this_is_a_rails_project?).and_return(false)
|
198
|
+
end
|
199
|
+
|
200
|
+
context "when there are no builds" do
|
201
|
+
before do
|
202
|
+
wizard.should_receive(:ask_with_default).with("What is the address of your git repository?", nil).ordered.and_return("Fort-Knox")
|
203
|
+
wizard.should_receive(:ask_with_default).with("What would you like to name your build?", nil).ordered.and_return("fancy-build")
|
204
|
+
wizard.should_receive(:ask_with_default).with("What command should be run during the build?", nil).ordered.and_return("build.sh")
|
205
|
+
end
|
206
|
+
|
207
|
+
it "asks you for the build name" do
|
208
|
+
wizard.prompt_for_build
|
209
|
+
first_jenkins_build["name"].should == "fancy-build"
|
210
|
+
end
|
211
|
+
|
212
|
+
it "asks you for the git repository" do
|
213
|
+
wizard.prompt_for_build
|
214
|
+
first_jenkins_build["repository"].should == "Fort-Knox"
|
215
|
+
end
|
216
|
+
|
217
|
+
context "when it is not a rails project or the user does not want the sample build script" do
|
218
|
+
it "asks you for the build command" do
|
219
|
+
wizard.prompt_for_build
|
220
|
+
first_jenkins_build["command"].should == "build.sh"
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
it "always builds the master branch" do
|
225
|
+
wizard.prompt_for_build
|
226
|
+
first_jenkins_build["branch"].should == "master"
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|
230
|
+
|
231
|
+
context "when the project is a rails project" do
|
232
|
+
before do
|
233
|
+
wizard.should_receive(:this_is_a_rails_project?).and_return(true)
|
234
|
+
end
|
235
|
+
|
236
|
+
it "asks whether you would like to use the sample rails build script" do
|
237
|
+
wizard.should_receive(:yes?).with("It looks like this is a Rails project. Would you like to use the default Rails build script? (Yes/No)").and_return(true)
|
238
|
+
wizard.prompt_for_build
|
239
|
+
end
|
240
|
+
|
241
|
+
context "and when the user wants to use the sample build script" do
|
242
|
+
it 'generates a ci_build.sh file' do
|
243
|
+
wizard.should_receive(:yes?).with("It looks like this is a Rails project. Would you like to use the default Rails build script? (Yes/No)").and_return(true)
|
244
|
+
wizard.should_receive(:copy_file)
|
245
|
+
wizard.prompt_for_build
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
context "when there are builds" do
|
251
|
+
before do
|
252
|
+
wizard.stub(:ask_with_default)
|
253
|
+
|
254
|
+
wizard.config.node_attributes.jenkins.builds << {
|
255
|
+
"name" => "first-post",
|
256
|
+
"repository" => "what",
|
257
|
+
"command" => "hot-grits",
|
258
|
+
"branch" => "oak"
|
259
|
+
}
|
260
|
+
|
261
|
+
wizard.config.node_attributes.jenkins.builds << {
|
262
|
+
"name" => "grails",
|
263
|
+
"repository" => "huh",
|
264
|
+
"command" => "colored-greens",
|
265
|
+
"branch" => "larch"
|
266
|
+
}
|
267
|
+
end
|
268
|
+
|
269
|
+
it "prompts for the name using the first build as a default" do
|
270
|
+
wizard.should_receive(:ask_with_default).with("What would you like to name your build?", "first-post")
|
271
|
+
wizard.prompt_for_build
|
272
|
+
end
|
273
|
+
|
274
|
+
it "prompts for the repository using the first build as a default" do
|
275
|
+
wizard.should_receive(:ask_with_default).with("What is the address of your git repository?", "what")
|
276
|
+
wizard.prompt_for_build
|
277
|
+
end
|
278
|
+
|
279
|
+
it "prompts for the repository using the first build as a default" do
|
280
|
+
wizard.should_receive(:ask_with_default).with("What command should be run during the build?", "hot-grits")
|
281
|
+
wizard.prompt_for_build
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
describe "#user_wants_to_create_instance?" do
|
287
|
+
before { wizard.stub(:yes? => true, :say => nil) }
|
288
|
+
|
289
|
+
context "when there is not an instance in the config" do
|
290
|
+
it "asks to start an amazon instance" do
|
291
|
+
wizard.should_receive(:yes?).and_return(:yep)
|
292
|
+
wizard.user_wants_to_create_instance?.should == :yep
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
context "when there is an instance in the config" do
|
297
|
+
before { wizard.config.master = "1.123.123.1" }
|
298
|
+
|
299
|
+
it "does not ask to start an instance" do
|
300
|
+
wizard.should_not_receive(:yes?)
|
301
|
+
wizard.user_wants_to_create_instance?.should_not be
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
describe "#create_instance" do
|
307
|
+
it "calls create on CLI" do
|
308
|
+
cli.should_receive(:create)
|
309
|
+
wizard.create_instance
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
describe "#provision_server" do
|
314
|
+
before { wizard.stub(:say) }
|
315
|
+
|
316
|
+
context "when there is no instance in the config" do
|
317
|
+
it "does not bootstrap the instance" do
|
318
|
+
cli.should_not_receive(:bootstrap)
|
319
|
+
wizard.provision_server
|
320
|
+
end
|
321
|
+
|
322
|
+
it "does not run chef" do
|
323
|
+
cli.should_not_receive(:chef)
|
324
|
+
wizard.provision_server
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
context "when an instance exists" do
|
329
|
+
before do
|
330
|
+
wizard.config
|
331
|
+
wizard.config.master = "1.2.3.4"
|
332
|
+
wizard.config.save
|
333
|
+
wizard.config.master = nil
|
334
|
+
end
|
335
|
+
|
336
|
+
it "bootstraps the instance" do
|
337
|
+
cli.should_receive(:bootstrap)
|
338
|
+
wizard.provision_server
|
339
|
+
end
|
340
|
+
|
341
|
+
it "runs chef" do
|
342
|
+
cli.should_receive(:chef)
|
343
|
+
wizard.provision_server
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|