buggie 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :gemcutter
2
+ gem 'pivotal-tracker'
@@ -0,0 +1,22 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ builder (2.1.2)
5
+ happymapper (0.3.2)
6
+ libxml-ruby (~> 1.1.3)
7
+ libxml-ruby (1.1.4)
8
+ mime-types (1.16)
9
+ nokogiri (1.4.3.1)
10
+ pivotal-tracker (0.2.2)
11
+ builder
12
+ happymapper (>= 0.3.2)
13
+ nokogiri (~> 1.4.3.1)
14
+ rest-client (~> 1.6.0)
15
+ rest-client (1.6.1)
16
+ mime-types (>= 1.16)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ pivotal-tracker
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ #It's Buggie time!#
2
+
3
+ Getting nice stats from your pivotal projects.
4
+
5
+ #Example#
6
+
7
+ Simple usage to capture the number of open and closed bugs:
8
+
9
+ require 'rubygems'
10
+ require 'lib/buggie'
11
+
12
+ b = Buggie.with("guilherme.silveira@caelum.com.br", "your_password_here")
13
+ puts b.projects["QCon 2010"].to_html
14
+
15
+
16
+ #Team and Contact#
17
+
18
+ "Guilherme Silveira":guilherme.silveira@caelum.com.br
19
+
20
+ #How to contribute#
21
+
22
+ Fork, patch, test, push and send a pull request.
@@ -0,0 +1,45 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+ require 'rake/gempackagetask'
5
+
6
+ desc 'Default: run unit tests.'
7
+ task :default => :test
8
+
9
+ desc 'Test the relata plugin.'
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << 'lib'
12
+ t.libs << 'test'
13
+ t.pattern = 'test/**/*_test.rb'
14
+ t.verbose = true
15
+ end
16
+
17
+ desc 'Generate documentation for the relata plugin.'
18
+ Rake::RDocTask.new(:rdoc) do |rdoc|
19
+ rdoc.rdoc_dir = 'rdoc'
20
+ rdoc.title = 'Buggie'
21
+ rdoc.options << '--line-numbers' << '--inline-source'
22
+ rdoc.rdoc_files.include('README.markdown')
23
+ rdoc.rdoc_files.include('lib/**/*.rb')
24
+ end
25
+
26
+ PKG_FILES = FileList[ '[a-zA-Z]*', 'generators/**/*', 'lib/**/*', 'rails/**/*', 'tasks/**/*', 'test/**/*' ]
27
+
28
+ spec = Gem::Specification.new do |s|
29
+ s.name = "buggie"
30
+ s.version = "0.1"
31
+ s.author = "Guilherme Silveira"
32
+ s.email = "guilherme.silveira@caelum.com.br"
33
+ s.homepage = "http://github.com/caelum/buggie"
34
+ s.platform = Gem::Platform::RUBY
35
+ s.summary = "Helps poking around with pivotal stats"
36
+ s.files = PKG_FILES.to_a
37
+ s.require_path = "lib"
38
+ s.has_rdoc = false
39
+ s.extra_rdoc_files = ["README.markdown"]
40
+ end
41
+
42
+ desc 'Turn this plugin into a gem.'
43
+ Rake::GemPackageTask.new(spec) do |pkg|
44
+ pkg.gem_spec = spec
45
+ end
data/init.rb ADDED
@@ -0,0 +1,3 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), "lib"))
2
+
3
+ require "pivotal-tracker"
@@ -0,0 +1 @@
1
+ # Install hook code here
@@ -0,0 +1,92 @@
1
+ require 'pivotal-tracker'
2
+
3
+ module Caelum
4
+ module Buggie
5
+ end
6
+ end
7
+
8
+ class Caelum::Buggie::Iteration
9
+ def initialize(project, p)
10
+ @project = project
11
+ @iteration = p
12
+ end
13
+ def closed_bugs
14
+ @iteration.stories.select do |story|
15
+ (story.story_type == "bug" && story.current_state == "accepted")
16
+ end.size
17
+ end
18
+ def open_bugs
19
+ @project.stories.all.select do |s|
20
+ s.story_type == "bug" && (s.created_at >= @iteration.start && s.created_at <= @iteration.finish)
21
+ end.size
22
+ end
23
+ def name
24
+ "Iteration #{@iteration.number}"
25
+ end
26
+ end
27
+ class Caelum::Buggie::Iterations
28
+ def initialize(project, p)
29
+ @project = project
30
+ @iterations = p
31
+ end
32
+ def bugs_per_iteration
33
+ @iterations.collect do |i|
34
+ Caelum::Buggie::Iteration.new(@project, i)
35
+ end
36
+ end
37
+
38
+ def to_html
39
+ content = '<html>
40
+ <head>
41
+ <script type="text/javascript" src="http://www.google.com/jsapi"></script>
42
+ <script type="text/javascript">
43
+ google.load("visualization", "1", {packages:["corechart"]});
44
+ google.setOnLoadCallback(drawChart);
45
+ function drawChart() {
46
+ var data = new google.visualization.DataTable();
47
+ data.addColumn("string", "Iteration");
48
+ data.addColumn("number", "Opened");
49
+ data.addColumn("number", "Closed");'
50
+ bugs = bugs_per_iteration
51
+ content = content + "data.addRows(#{bugs.size});"
52
+ i = 0
53
+ bugs.each do |iteration, v|
54
+ content = content + "data.setValue(#{i}, 0, '#{iteration.name}');"
55
+ content = content + "data.setValue(#{i}, 1, #{iteration.open_bugs});"
56
+ content = content + "data.setValue(#{i}, 2, #{iteration.closed_bugs});"
57
+ i = i + 1
58
+ end
59
+ content = content + "
60
+ var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
61
+ chart.draw(data, {width: 640, height: 480, title: 'Overral opened x closed bugs'});
62
+ }
63
+ </script>
64
+ </head>
65
+ <body>
66
+ <div id='chart_div'></div>
67
+ </body>
68
+ </html>"
69
+ end
70
+ end
71
+
72
+ class Caelum::Buggie::Client
73
+ def initialize(auth)
74
+ @token = auth
75
+ end
76
+ def projects
77
+ PivotalTracker::Project.all.inject({}) do |m, p|
78
+ m[p.name] = Caelum::Buggie::Iterations.new(p, p.iterations.all)
79
+ m
80
+ end
81
+ end
82
+ end
83
+
84
+ module Buggie
85
+
86
+ def self.with(username, password)
87
+ Caelum::Buggie::Client.new(
88
+ PivotalTracker::Client.token(username, password)
89
+ )
90
+ end
91
+
92
+ end
@@ -0,0 +1,20 @@
1
+ <html>
2
+ <head>
3
+ <script type="text/javascript" src="http://www.google.com/jsapi"></script>
4
+ <script type="text/javascript">
5
+ google.load("visualization", "1", {packages:["corechart"]});
6
+ google.setOnLoadCallback(drawChart);
7
+ function drawChart() {
8
+ var data = new google.visualization.DataTable();
9
+ data.addColumn("string", "Iteration");
10
+ data.addColumn("number", "Opened");
11
+ data.addColumn("number", "Closed");data.addRows(21);data.setValue(0, 0, 'Iteration 1');data.setValue(0, 1, 0);data.setValue(0, 2, 0);data.setValue(1, 0, 'Iteration 2');data.setValue(1, 1, 0);data.setValue(1, 2, 0);data.setValue(2, 0, 'Iteration 3');data.setValue(2, 1, 1);data.setValue(2, 2, 1);data.setValue(3, 0, 'Iteration 4');data.setValue(3, 1, 1);data.setValue(3, 2, 0);data.setValue(4, 0, 'Iteration 5');data.setValue(4, 1, 0);data.setValue(4, 2, 0);data.setValue(5, 0, 'Iteration 6');data.setValue(5, 1, 1);data.setValue(5, 2, 1);data.setValue(6, 0, 'Iteration 7');data.setValue(6, 1, 0);data.setValue(6, 2, 0);data.setValue(7, 0, 'Iteration 8');data.setValue(7, 1, 3);data.setValue(7, 2, 0);data.setValue(8, 0, 'Iteration 9');data.setValue(8, 1, 0);data.setValue(8, 2, 2);data.setValue(9, 0, 'Iteration 10');data.setValue(9, 1, 1);data.setValue(9, 2, 1);data.setValue(10, 0, 'Iteration 11');data.setValue(10, 1, 2);data.setValue(10, 2, 0);data.setValue(11, 0, 'Iteration 12');data.setValue(11, 1, 3);data.setValue(11, 2, 4);data.setValue(12, 0, 'Iteration 13');data.setValue(12, 1, 1);data.setValue(12, 2, 3);data.setValue(13, 0, 'Iteration 14');data.setValue(13, 1, 5);data.setValue(13, 2, 2);data.setValue(14, 0, 'Iteration 15');data.setValue(14, 1, 0);data.setValue(14, 2, 4);data.setValue(15, 0, 'Iteration 16');data.setValue(15, 1, 0);data.setValue(15, 2, 0);data.setValue(16, 0, 'Iteration 17');data.setValue(16, 1, 2);data.setValue(16, 2, 0);data.setValue(17, 0, 'Iteration 18');data.setValue(17, 1, 15);data.setValue(17, 2, 3);data.setValue(18, 0, 'Iteration 19');data.setValue(18, 1, 11);data.setValue(18, 2, 19);data.setValue(19, 0, 'Iteration 20');data.setValue(19, 1, 6);data.setValue(19, 2, 5);data.setValue(20, 0, 'Iteration 21');data.setValue(20, 1, 0);data.setValue(20, 2, 0);
12
+ var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
13
+ chart.draw(data, {width: 640, height: 480, title: 'Overral opened x closed bugs'});
14
+ }
15
+ </script>
16
+ </head>
17
+ <body>
18
+ <div id='chart_div'></div>
19
+ </body>
20
+ </html>
@@ -0,0 +1,20 @@
1
+ <html>
2
+ <head>
3
+ <script type="text/javascript" src="http://www.google.com/jsapi"></script>
4
+ <script type="text/javascript">
5
+ google.load("visualization", "1", {packages:["corechart"]});
6
+ google.setOnLoadCallback(drawChart);
7
+ function drawChart() {
8
+ var data = new google.visualization.DataTable();
9
+ data.addColumn("string", "Iteration");
10
+ data.addColumn("number", "Opened");
11
+ data.addColumn("number", "Closed");data.addRows(22);data.setValue(0, 0, 'Iteration 1');data.setValue(0, 1, 0);data.setValue(0, 2, 0);data.setValue(1, 0, 'Iteration 2');data.setValue(1, 1, 0);data.setValue(1, 2, 0);data.setValue(2, 0, 'Iteration 3');data.setValue(2, 1, 0);data.setValue(2, 2, 0);data.setValue(3, 0, 'Iteration 4');data.setValue(3, 1, 0);data.setValue(3, 2, 0);data.setValue(4, 0, 'Iteration 5');data.setValue(4, 1, 0);data.setValue(4, 2, 0);data.setValue(5, 0, 'Iteration 6');data.setValue(5, 1, 0);data.setValue(5, 2, 0);data.setValue(6, 0, 'Iteration 7');data.setValue(6, 1, 0);data.setValue(6, 2, 0);data.setValue(7, 0, 'Iteration 8');data.setValue(7, 1, 0);data.setValue(7, 2, 0);data.setValue(8, 0, 'Iteration 9');data.setValue(8, 1, 0);data.setValue(8, 2, 0);data.setValue(9, 0, 'Iteration 10');data.setValue(9, 1, 1);data.setValue(9, 2, 0);data.setValue(10, 0, 'Iteration 11');data.setValue(10, 1, 0);data.setValue(10, 2, 0);data.setValue(11, 0, 'Iteration 12');data.setValue(11, 1, 0);data.setValue(11, 2, 1);data.setValue(12, 0, 'Iteration 13');data.setValue(12, 1, 2);data.setValue(12, 2, 0);data.setValue(13, 0, 'Iteration 14');data.setValue(13, 1, 2);data.setValue(13, 2, 1);data.setValue(14, 0, 'Iteration 15');data.setValue(14, 1, 2);data.setValue(14, 2, 0);data.setValue(15, 0, 'Iteration 16');data.setValue(15, 1, 3);data.setValue(15, 2, 2);data.setValue(16, 0, 'Iteration 17');data.setValue(16, 1, 0);data.setValue(16, 2, 0);data.setValue(17, 0, 'Iteration 18');data.setValue(17, 1, 0);data.setValue(17, 2, 2);data.setValue(18, 0, 'Iteration 19');data.setValue(18, 1, 2);data.setValue(18, 2, 1);data.setValue(19, 0, 'Iteration 20');data.setValue(19, 1, 0);data.setValue(19, 2, 0);data.setValue(20, 0, 'Iteration 21');data.setValue(20, 1, 0);data.setValue(20, 2, 2);data.setValue(21, 0, 'Iteration 22');data.setValue(21, 1, 0);data.setValue(21, 2, 0);
12
+ var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
13
+ chart.draw(data, {width: 640, height: 480, title: 'Overral opened x closed bugs'});
14
+ }
15
+ </script>
16
+ </head>
17
+ <body>
18
+ <div id='chart_div'></div>
19
+ </body>
20
+ </html>
data/test.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'lib/buggie'
3
+
4
+ b = Buggie.with("guilherme.silveira@caelum.com.br", "your_password_here")
5
+ puts b.projects["QCon 2010"].to_html
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: buggie
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Guilherme Silveira
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-07 00:00:00 -03:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description:
22
+ email: guilherme.silveira@caelum.com.br
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.markdown
29
+ files:
30
+ - Gemfile
31
+ - Gemfile.lock
32
+ - init.rb
33
+ - install.rb
34
+ - MIT-LICENSE
35
+ - Rakefile
36
+ - README.markdown
37
+ - sample.html
38
+ - sample_tectura.html
39
+ - test.rb
40
+ - uninstall.rb
41
+ - lib/buggie.rb
42
+ has_rdoc: false
43
+ homepage: http://github.com/caelum/buggie
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options: []
48
+
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.3.7
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: Helps poking around with pivotal stats
76
+ test_files: []
77
+