lib/space/screen.rb in space-0.0.3 vs lib/space/screen.rb in space-0.0.4

- old
+ new

@@ -1,28 +1,32 @@ module Space class Screen - attr_reader :app + autoload :Progress, 'space/screen/progress' + autoload :Dashboard, 'space/screen/dashboard' + autoload :View, 'space/screen/view' - def initialize(app) - @app = app + attr_reader :project, :view + + def initialize(project) + @project = project end + def display(name) + @view = create(name) + render + end + def render - system 'clear' - puts render_project - repos = app.repos.scoped? ? app.repos.self_and_dependencies : app.repos - repos.each do |repo| - puts render_repo(repo) - end + view.render end + def notify(event) + view.notify(event) + end + private - def render_project - View.new.render(:project, :app => app, :bundle => app.bundle) - end - - def render_repo(repo) - View.new.render(:repo, :app => app, :repo => repo, :git => repo.git, :bundle => repo.bundle) + def create(screen) + self.class.const_get(screen.to_s.capitalize).new(project) end end end