Class: UatDirector::RackApp
- Inherits:
-
Object
- Object
- UatDirector::RackApp
- Defined in:
- lib/uat_director/rack_app.rb
Constant Summary collapse
- PT =
PivotalTracker
Instance Method Summary collapse
- #accept(pivotal_story_id) ⇒ Object
- #call(env) ⇒ Object
- #config ⇒ Object
- #haml(file_name, options = {}) ⇒ Object
- #index ⇒ Object
-
#initialize(app) ⇒ RackApp
constructor
A new instance of RackApp.
- #project ⇒ Object
- #render(html) ⇒ Object
- #template_root ⇒ Object
Constructor Details
Instance Method Details
#accept(pivotal_story_id) ⇒ Object
30 31 32 33 34 |
# File 'lib/uat_director/rack_app.rb', line 30 def accept(pivotal_story_id) story = project.stories.find(pivotal_story_id.to_i) story.update(:current_state => 'accepted') render "Accepted" end |
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/uat_director/rack_app.rb', line 14 def call(env) case env["PATH_INFO"] when /^\/uat_director$/ index when /^\/uat_director\/(.*)\/accept/ accept $1 else @app.call(env) end end |
#config ⇒ Object
53 54 55 |
# File 'lib/uat_director/rack_app.rb', line 53 def config UatDirector.configuration end |
#haml(file_name, options = {}) ⇒ Object
40 41 42 43 |
# File 'lib/uat_director/rack_app.rb', line 40 def haml(file_name, ={}) template = (template_root + "#{file_name}.haml").read render Haml::Engine.new(template).render(self) end |
#index ⇒ Object
25 26 27 28 |
# File 'lib/uat_director/rack_app.rb', line 25 def index @stories = project.stories.all(:current_state => "delivered") haml "index" end |
#project ⇒ Object
36 37 38 |
# File 'lib/uat_director/rack_app.rb', line 36 def project @project ||= PT::Project.find(config.pivotal_tracker_project) end |
#render(html) ⇒ Object
45 46 47 |
# File 'lib/uat_director/rack_app.rb', line 45 def render(html) [200, {"Content-Type" => "text/html"}, [html]] end |
#template_root ⇒ Object
49 50 51 |
# File 'lib/uat_director/rack_app.rb', line 49 def template_root Pathname.new(__FILE__).parent + "templates" end |