Skip to content

Commit

Permalink
Merge 968ae90 into 9b397fb
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Sedlmair committed Jan 25, 2019
2 parents 9b397fb + 968ae90 commit d82607e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
# 0.4.3 / 2018.12.11
* [ENHANCEMENT] Use systemd if installed. There's no /sbin/init in Ubuntu 18.04.
* [TESTS] Added spec tests for Ubuntu 18.04

# 0.4.2 / 2018.12.11
* [ENHANCEMENT] added option to set the tmpdir path for source files

Expand Down
2 changes: 1 addition & 1 deletion fpm-fry.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |gem|
gem.name = 'fpm-fry'
gem.version = '0.4.2'
gem.version = '0.4.3'
gem.date = Time.now.strftime("%Y-%m-%d")

gem.summary = "FPM Fry"
Expand Down
2 changes: 1 addition & 1 deletion lib/fpm/fry/plugin/init.rb
Expand Up @@ -40,7 +40,7 @@ def init

private
def self.detect(inspector)
if inspector.link_target('/sbin/init') == '/lib/systemd/systemd'
if inspector.exists?('/lib/systemd/systemd')
return System.new(:systemd, {})
end
if inspector.exists?('/etc/init')
Expand Down
28 changes: 28 additions & 0 deletions spec/detector_spec.rb
Expand Up @@ -91,6 +91,34 @@

end

context 'with ubuntu:18.04' do

let(:result) do
result = nil
with_inspector('ubuntu:18.04') do |inspector|
result = Detector.detect(inspector)
end
result
end

it 'finds ubuntu' do
expect(result[:distribution]).to eq('ubuntu')
end

it 'finds release 18.04' do
expect(result[:release]).to eq('18.04')
end

it 'finds codename bionic' do
expect(result[:codename]).to eq('bionic')
end

it 'finds flavour debian' do
expect(result[:flavour]).to eq('debian')
end

end

context 'with ubuntu:16.04' do

let(:result) do
Expand Down
10 changes: 10 additions & 0 deletions spec/plugin/init_spec.rb
Expand Up @@ -11,6 +11,7 @@
allow(inspector).to receive(:exists?).with(String).and_return(false)
allow(inspector).to receive(:link_target).with(String).and_return(nil)
allow(inspector).to receive(:exists?).with("/etc/init.d").and_return(true)
allow(inspector).to receive(:exists?).with("/lib/systemd/systemd").and_return(true)
inspector
}

Expand All @@ -36,6 +37,15 @@
end

context 'init detection (real)' do
context 'with ubuntu:18.04' do
it 'finds systemd' do
with_inspector('ubuntu:18.04') do |insp|
builder = FPM::Fry::Recipe::Builder.new({},inspector: insp)
builder.extend(FPM::Fry::Plugin::Init)
expect(builder.init).to be_systemd
end
end
end

context 'with ubuntu:16.04' do
it 'finds systemd' do
Expand Down

0 comments on commit d82607e

Please sign in to comment.