From 3b9579818665858aaef09748d956984bccc96e85 Mon Sep 17 00:00:00 2001 From: Todd Lunter Date: Thu, 4 Jun 2015 16:54:08 -0400 Subject: [PATCH 1/2] Add option to not add startup script --- lib/dockly/deb.rb | 6 ++++-- spec/dockly/deb_spec.rb | 9 +++++++++ spec/dockly/rpm_spec.rb | 9 +++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/dockly/deb.rb b/lib/dockly/deb.rb index c7c18d3..49663e3 100644 --- a/lib/dockly/deb.rb +++ b/lib/dockly/deb.rb @@ -7,7 +7,8 @@ class Dockly::Deb logger_prefix '[dockly deb]' dsl_attribute :package_name, :version, :release, :arch, :build_dir, :deb_build_dir, :pre_install, :post_install, :pre_uninstall, - :post_uninstall, :s3_bucket, :files, :app_user, :vendor + :post_uninstall, :s3_bucket, :files, :app_user, :vendor, + :package_startup_script dsl_class_attribute :docker, Dockly::Docker dsl_class_attribute :foreman, Dockly::Foreman, type: Array @@ -20,6 +21,7 @@ class Dockly::Deb default_value :files, [] default_value :app_user, 'nobody' default_value :vendor, 'Dockly' + default_value :package_startup_script, true def file(source, destination) @files << { :source => source, :destination => destination } @@ -102,7 +104,7 @@ def build_package add_files(@dir_package) add_docker_auth_config(@dir_package) add_docker(@dir_package) - add_startup_script(@dir_package) + add_startup_script(@dir_package) if package_startup_script convert_package diff --git a/spec/dockly/deb_spec.rb b/spec/dockly/deb_spec.rb index 32c4676..2b6458c 100644 --- a/spec/dockly/deb_spec.rb +++ b/spec/dockly/deb_spec.rb @@ -166,6 +166,15 @@ subject.create_package! expect(`dpkg --contents #{filename}`).to include("dockly-startup.sh") end + + context 'when package_startup_script is false' do + before { subject.package_startup_script(false) } + + it 'does not place a startup script in the package' do + subject.create_package! + expect(`dpkg --contents #{filename}`).to_not include("dockly-startup.sh") + end + end end describe '#exists?' do diff --git a/spec/dockly/rpm_spec.rb b/spec/dockly/rpm_spec.rb index 0000ab1..67d6504 100644 --- a/spec/dockly/rpm_spec.rb +++ b/spec/dockly/rpm_spec.rb @@ -153,6 +153,15 @@ subject.create_package! expect(`rpm -qpl #{filename}`).to include("dockly-startup.sh") end + + context 'when package_startup_script is false' do + before { subject.package_startup_script(false) } + + it 'does not place a startup script in the package' do + subject.create_package! + expect(`rpm -qpl #{filename}`).to_not include("dockly-startup.sh") + end + end end describe '#exists?' do From 159abb9daf4ee9925eb7e542449d71b81d9bf697 Mon Sep 17 00:00:00 2001 From: Todd Lunter Date: Thu, 4 Jun 2015 16:54:20 -0400 Subject: [PATCH 2/2] Not sure how these tests were passing before :\ --- spec/dockly/deb_spec.rb | 4 ++-- spec/dockly/rpm_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/dockly/deb_spec.rb b/spec/dockly/deb_spec.rb index 2b6458c..1ff0406 100644 --- a/spec/dockly/deb_spec.rb +++ b/spec/dockly/deb_spec.rb @@ -64,7 +64,7 @@ name 'deb_test' import 'https://s3.amazonaws.com/swipely-pub/docker-export-ubuntu-latest.tgz' git_archive '.' - build 'touch /deb_worked' + build 'RUN touch /deb_worked' build_dir 'build/docker' end end @@ -89,7 +89,7 @@ name 'deb_test' import 'https://s3.amazonaws.com/swipely-pub/docker-export-ubuntu-latest.tgz' git_archive '.' - build 'touch /deb_worked' + build 'RUN touch /deb_worked' build_dir 'build/docker' registry :test_docker_registry do diff --git a/spec/dockly/rpm_spec.rb b/spec/dockly/rpm_spec.rb index 67d6504..5dbf72d 100644 --- a/spec/dockly/rpm_spec.rb +++ b/spec/dockly/rpm_spec.rb @@ -51,7 +51,7 @@ name 'rpm_test' import 'https://s3.amazonaws.com/swipely-pub/docker-export-ubuntu-latest.tgz' git_archive '.' - build 'touch /rpm_worked' + build 'RUN touch /rpm_worked' build_dir 'build/docker' end end @@ -76,7 +76,7 @@ name 'rpm_test' import 'https://s3.amazonaws.com/swipely-pub/docker-export-ubuntu-latest.tgz' git_archive '.' - build 'touch /rpm_worked' + build 'RUN touch /rpm_worked' build_dir 'build/docker' registry :test_docker_registry do