Permalink
Browse files

This commit being the commit immediately before the second commit.

  • Loading branch information...
0 parents commit d54334ad02583525d315dea3496242c07735f897 @benaskins benaskins committed Jun 7, 2010
Showing with 268 additions and 0 deletions.
  1. +5 −0 .document
  2. +21 −0 .gitignore
  3. +20 −0 LICENSE
  4. +35 −0 README.rdoc
  5. +22 −0 Rakefile
  6. +1 −0 VERSION
  7. +16 −0 lib/uat_director.rb
  8. +8 −0 lib/uat_director/configuration.rb
  9. +37 −0 lib/uat_director/helpers.rb
  10. +42 −0 lib/uat_director/rack_app.rb
  11. +3 −0 lib/uat_director/templates/index.haml
  12. +58 −0 uat_director.gemspec
5 .document
@@ -0,0 +1,5 @@
+README.rdoc
+lib/**/*.rb
+bin/*
+features/**/*.feature
+LICENSE
21 .gitignore
@@ -0,0 +1,21 @@
+## MAC OS
+.DS_Store
+
+## TEXTMATE
+*.tmproj
+tmtags
+
+## EMACS
+*~
+\#*
+.\#*
+
+## VIM
+*.swp
+
+## PROJECT::GENERAL
+coverage
+rdoc
+pkg
+
+## PROJECT::SPECIFIC
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2009 Ben Askins
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 README.rdoc
@@ -0,0 +1,35 @@
+= uat_director
+
+Adds a toolbar to your rails app that directs your clients to test stories that have been marked as 'delivered' in Pivotal Tracker.
+
+== Installing
+
+Add uat_director to your Gemfile:
+
+ gem 'uat_director'
+
+Create an initializer to configure your pivotal tracker api token and project id:
+
+ UatDirector.configure do |config|
+ config.pivotal_tracker_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+ config.pivotal_tracker_project = 123456
+ end
+
+Add the UatDirector::RackApp to your middleware stack:
+
+ require 'uat_director'
+ config.middleware.use(UatDirector::RackApp)
+
+== Note on Patches/Pull Requests
+
+* Fork the project.
+* Make your feature addition or bug fix.
+* Add tests for it. This is important so I don't break it in a
+ future version unintentionally.
+* Commit, do not mess with rakefile, version, or history.
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
+* Send me a pull request. Bonus points for topic branches.
+
+== Copyright
+
+Copyright (c) 2010 Ben Askins. See LICENSE for details.
22 Rakefile
@@ -0,0 +1,22 @@
+require 'rubygems'
+require 'rake'
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = "uat_director"
+ gem.summary = %Q{Direct your clients to test delivered features}
+ gem.description = %Q{Adds a toolbar to your rails app that directs your clients to test stories that have been marked as 'delivered' in Pivotal Tracker }
+ gem.email = "ben.askins@gmail.com"
+ gem.homepage = "http://github.com/benaskins/uat_director"
+ gem.authors = ["Ben Askins"]
+ # gem is a Gem::Specificatiohttp://www.rubygems.org/read/chapter/20 n... see http://www.rubygems.org/read/chapter/20 for additional settings
+ gem.add_dependency("pivotal-tracker", ">= 0.1.3")
+ gem.add_dependency("haml", ">= 3.0.9")
+ gem.add_dependency("rack", ">= 1.1.0")
+ end
+ Jeweler::GemcutterTasks.new
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+end
+
1 VERSION
@@ -0,0 +1 @@
+0.0.0
16 lib/uat_director.rb
@@ -0,0 +1,16 @@
+require 'uat_director/configuration'
+require 'uat_director/rack_app'
+require 'uat_director/helpers'
+
+ActionView::Base.send :include, UatDirector::Helpers
+
+module UatDirector
+ class << self
+ attr_accessor :configuration
+
+ def configure
+ self.configuration ||= Configuration.new
+ yield(configuration)
+ end
+ end
+end
8 lib/uat_director/configuration.rb
@@ -0,0 +1,8 @@
+module UatDirector
+
+ class Configuration
+ attr_accessor :pivotal_tracker_token
+ attr_accessor :pivotal_tracker_project
+ end
+
+end
37 lib/uat_director/helpers.rb
@@ -0,0 +1,37 @@
+module UatDirector
+ module Helpers
+ def uat_director
+<<TDSCRIPT
+<script type="text/javascript">
+ $("body").prepend("#{toolbar_html}");
+ $("#uat-bar").css({width: "100%", background: "#000", "text-align": "right"});
+ $("#uat-bar a.go").css({color: "#fff"});
+ $("#uat-bar .pop-over").css({position: "absolute", right: "0px", clear: "none", "z-index": "99999999", background: "#fff", "text-align": "left"});
+ $("#uat-bar .hide").css({display: "none"});
+ $(function() {
+ $("#uat-bar a.go").click(function() {
+ $.ajax({
+ url: '/uat_director',
+ success: function(response) {
+ $(".pop-over").append(response);
+ $(".pop-over").slideDown();
+ }
+ });
+ });
+
+ $("#uat-bar a.close").click(function() {
+ $(".pop-over").slideUp(function() {
+ $(".pop-over ol").remove();
+ });
+ });
+ });
+</script>
+TDSCRIPT
+ end
+
+ def toolbar_html
+ "<div id='uat-bar'><a class='go' href='#'>Show me what to test</a><div class='pop-over hide'><a class='close' href='#'>close</a></div></div>"
+ end
+ end
+end
+
42 lib/uat_director/rack_app.rb
@@ -0,0 +1,42 @@
+require 'pathname'
+require 'haml'
+require 'pivotal-tracker'
+
+module UatDirector
+ class RackApp
+ PT = PivotalTracker
+
+ def initialize(app)
+ @app = app
+ PT::Client.token = config.pivotal_tracker_token
+ end
+
+ def call(env)
+ if env["PATH_INFO"] =~ /^\/uat_director/
+ index
+ else
+ @app.call(env)
+ end
+ end
+
+ def index
+ @project = PT::Project.find(config.pivotal_tracker_project)
+ @stories = @project.stories.all(:current_state => "delivered")
+ haml "index"
+ end
+
+ def haml(file_name, options={})
+ template = (template_root + "#{file_name}.haml").read
+ [200, {"Content-Type" => "text/html"}, [Haml::Engine.new(template).render(self)]]
+ end
+
+ def template_root
+ Pathname.new(__FILE__).parent + "templates"
+ end
+
+ def config
+ UatDirector.configuration
+ end
+ end
+end
+
3 lib/uat_director/templates/index.haml
@@ -0,0 +1,3 @@
+%ol
+ - @stories.each do |story|
+ %li= story.name
58 uat_director.gemspec
@@ -0,0 +1,58 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{uat_director}
+ s.version = "0.0.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Ben Askins"]
+ s.date = %q{2010-06-07}
+ s.description = %q{Adds a toolbar to your rails app that directs your clients to test stories that have been marked as 'delivered' in Pivotal Tracker }
+ s.email = %q{ben.askins@gmail.com}
+ s.extra_rdoc_files = [
+ "LICENSE",
+ "README.rdoc"
+ ]
+ s.files = [
+ ".document",
+ ".gitignore",
+ "LICENSE",
+ "README.rdoc",
+ "Rakefile",
+ "VERSION",
+ "lib/uat_director.rb",
+ "lib/uat_director/configuration.rb",
+ "lib/uat_director/helpers.rb",
+ "lib/uat_director/rack_app.rb",
+ "lib/uat_director/templates/index.haml",
+ "uat_director.gemspec"
+ ]
+ s.homepage = %q{http://github.com/benaskins/uat_director}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.7}
+ s.summary = %q{Direct your clients to test delivered features}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<pivotal-tracker>, [">= 0.1.3"])
+ s.add_runtime_dependency(%q<haml>, [">= 3.0.9"])
+ s.add_runtime_dependency(%q<rack>, [">= 1.1.0"])
+ else
+ s.add_dependency(%q<pivotal-tracker>, [">= 0.1.3"])
+ s.add_dependency(%q<haml>, [">= 3.0.9"])
+ s.add_dependency(%q<rack>, [">= 1.1.0"])
+ end
+ else
+ s.add_dependency(%q<pivotal-tracker>, [">= 0.1.3"])
+ s.add_dependency(%q<haml>, [">= 3.0.9"])
+ s.add_dependency(%q<rack>, [">= 1.1.0"])
+ end
+end
+

0 comments on commit d54334a

Please sign in to comment.