Skip to content

Commit

Permalink
Merge branch 'pr/27'
Browse files Browse the repository at this point in the history
  • Loading branch information
kostya committed Jan 13, 2014
2 parents 5ce72db + 8fe80f9 commit c655bfc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/eye/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def add_group(group)

# sort processes in name order
def resort_groups
@groups = @groups.sort_by{|gr| gr.name == '__default__' ? 'zzzzz' : gr.name }
@groups = @groups.sort { |a, b| a.name == '__default__' ? 1 : (b.name == '__default__' ? -1 : (a.name <=> b.name)) }
end

def status_data(debug = false)
Expand Down
4 changes: 4 additions & 0 deletions lib/eye/utils/alive_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def sort_by(&block)
self.class.new super
end

def sort(&block)
self.class.new super
end

def +(other)
if other.is_a?(Eye::Utils::AliveArray)
@arr += other.pure
Expand Down
16 changes: 16 additions & 0 deletions spec/controller/load_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,22 @@
p22.object_id.should == p2.object_id
end

it "order of applications and groups" do
with_temp_file(<<-F){ |f| subject.load(f ) }
Eye.app(:app2) { }
Eye.app(:app1) {
process("p"){ pid_file "1" }
group(:gr3){}
group(:gr2){}
group(:gr1){}
}
F

subject.applications.map(&:name).should == %w{app1 app2}
app = subject.applications[0]
app.groups.map(&:name).should == %w{gr1 gr2 gr3 __default__}
end

describe "configs" do
after(:each){ set_glogger }

Expand Down

0 comments on commit c655bfc

Please sign in to comment.