Skip to content

Commit

Permalink
Merge pull request #66 from swipely/option-to-not-add-startup
Browse files Browse the repository at this point in the history
Add option to not add startup script
  • Loading branch information
tlunter committed Jun 4, 2015
2 parents a50bd94 + 159abb9 commit f4d7a32
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/dockly/deb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }
Expand Down Expand Up @@ -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

Expand Down
13 changes: 11 additions & 2 deletions spec/dockly/deb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions spec/dockly/rpm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f4d7a32

Please sign in to comment.