Skip to content

Commit

Permalink
Merge pull request #144 from opscode/GH-140
Browse files Browse the repository at this point in the history
Fixes Github Issue #140
  • Loading branch information
adamhjk committed Apr 25, 2014
2 parents 53b57bc + bcce59f commit 24688af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/omnibus/library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def build_order
@components.each do |component|
if head.length == 0
head << component
elsif @project.dependencies.include?(component.name)
elsif @project.dependencies.include?(component.name) && @components.none? { |c| c.dependencies.include?(component.name) }
tail << component
else
head << component
Expand Down
10 changes: 7 additions & 3 deletions spec/unit/library_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
homepage 'http://getchef.com'
dependency 'preparation'
dependency 'erchef'
dependency 'postgresql'
dependency 'chef'
EOH
Omnibus::Project.new(raw_project, 'chef-server.rb')
Expand All @@ -40,27 +41,30 @@
library = Omnibus::Library.new(project)
library.component_added(preparation)
library.component_added(erlang)
library.component_added(postgresql) # as a skitch trans dep
library.component_added(skitch)
library.component_added(erchef)
library.component_added(ruby)
library.component_added(chef)
library
end

project_deps = [:preparation, :erchef, :chef]
project_deps = [:preparation, :erchef, :postgresql, :chef]
erchef_deps = [:erlang, :skitch]
chef_deps = [:ruby]

[project_deps, erchef_deps, chef_deps].flatten.each do |dep|
let(dep) do
software = Omnibus::Software.new('', "#{dep}.rb", 'chef-server')
software.name(dep.to_s)
software.dependency('postgresql') if dep == :skitch
software
end
end

it 'returns an array of software descriptions, with all non top level deps first' do
expect(library.build_order).to eql([preparation, erlang, skitch, ruby, erchef, chef])
it 'returns an array of software descriptions, with all top level deps first, assuming they are not themselves transitive deps' do
library.build_order.map { |m| m.name.to_s }
expect(library.build_order).to eql([preparation, erlang, postgresql, skitch, ruby, erchef, chef])
end
end

Expand Down

0 comments on commit 24688af

Please sign in to comment.