jsmestad-gripht 0.2.0 → 0.3.0
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/VERSION +1 -1
- data/gripht.gemspec +3 -3
- data/lib/gripht/app.rb +8 -3
- data/lib/gripht/views/application.js +2 -2
- data/lib/gripht/views/index.haml +31 -26
- data/lib/gripht/views/stories.haml +3 -3
- data/lib/gripht.rb +1 -1
- data/spec/gripht_spec.rb +6 -0
- data/spec/spec_helper.rb +27 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/gripht.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{gripht}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.3.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Justin Smestad"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-06-01}
|
10
10
|
s.email = %q{justin.smestad@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
37
|
s.require_paths = ["lib"]
|
38
38
|
s.rubyforge_project = %q{gripht}
|
39
|
-
s.rubygems_version = %q{1.3.
|
39
|
+
s.rubygems_version = %q{1.3.4}
|
40
40
|
s.summary = %q{TODO}
|
41
41
|
s.test_files = [
|
42
42
|
"spec/fixtures.rb",
|
data/lib/gripht/app.rb
CHANGED
@@ -7,9 +7,13 @@ module Gripht
|
|
7
7
|
RestClient::Resource.new 'http://www.pivotaltracker.com/services/v2/projects', :headers => { 'X-TrackerToken' => ENV['TRACKER_TOKEN']}
|
8
8
|
end
|
9
9
|
|
10
|
-
def fetch_stories(project_id)
|
11
|
-
|
12
|
-
|
10
|
+
def fetch_stories(project_id, limit=10, options={})
|
11
|
+
options = {:state => 'started'} if options.empty?
|
12
|
+
params = "limit=#{limit}&filter="
|
13
|
+
options.each { |key, value| params << "#{key.to_s}%3A%22#{CGI::escape(value)}%22%20" }
|
14
|
+
stories = Nokogiri::XML(resource["#{project_id}/stories?#{params}"].get).xpath('//story')
|
15
|
+
#Gripht::Log.logger.error CGI::escape(params)
|
16
|
+
{ options[:state].to_sym => stories.collect do |story|
|
13
17
|
{
|
14
18
|
:name => story.at('name').content,
|
15
19
|
:owner => story.at('owned_by').content,
|
@@ -40,6 +44,7 @@ module Gripht
|
|
40
44
|
get '/' do
|
41
45
|
@projects = Nokogiri::XML(resource.get).xpath('//project').collect { |r| { :id => r.at('id').content, :name => r.at('name').content } }
|
42
46
|
@projects.each { |project| project.merge!(fetch_stories(project[:id])) }
|
47
|
+
@projects.each { |project| project.merge!(fetch_stories(project[:id], 10, {:state => 'finished'})) }
|
43
48
|
haml :index
|
44
49
|
end
|
45
50
|
|
@@ -5,7 +5,7 @@ function callMeOften(id)
|
|
5
5
|
method: 'get',
|
6
6
|
url: '/update_project/' + id,
|
7
7
|
dataType : 'text',
|
8
|
-
success: function (text) { $('h4 a#' + id).parents('h4').next().fadeOut('slow').html(text).fadeIn('slow'); }
|
8
|
+
success: function (text) { $('h4 a#' + id).parents('h4').next('h5').next('ul').fadeOut('slow').html(text).fadeIn('slow'); }
|
9
9
|
});
|
10
10
|
}
|
11
11
|
}
|
@@ -29,4 +29,4 @@ jQuery(document).ready(function($) {
|
|
29
29
|
$('h4 a').slowEach(8000, function(){
|
30
30
|
setInterval(callMeOften(this.id), 20000);
|
31
31
|
});
|
32
|
-
});
|
32
|
+
});
|
data/lib/gripht/views/index.haml
CHANGED
@@ -1,26 +1,31 @@
|
|
1
|
-
%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
%
|
6
|
-
|
7
|
-
- @projects.each do |project|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
%
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
%h1 Gripht
|
2
|
+
%p This is the gripht dashboard. It is continuously polling Pivotal Tracker for current status on its member projects.
|
3
|
+
- if @projects.empty?
|
4
|
+
%h4 Uh oh!
|
5
|
+
%p It seems that the provided Pivotal Tracker API Key does not have access to any projects. Add them to a project, then reload this page.
|
6
|
+
- else
|
7
|
+
- @projects.each do |project|
|
8
|
+
%h4
|
9
|
+
= project[:name]
|
10
|
+
%span
|
11
|
+
= " - "
|
12
|
+
%a{:href => "http://www.pivotaltracker.com/projects/#{project[:id]}", :id => project[:id] }
|
13
|
+
View Project
|
14
|
+
%h5 In Progress
|
15
|
+
%ul
|
16
|
+
- project[:started].each do |story|
|
17
|
+
%li.story
|
18
|
+
%a{:href => "#"}= story[:name]
|
19
|
+
= "(#{story[:owner]})"
|
20
|
+
%p.hidden
|
21
|
+
= story[:description] != "" ? story[:description] : "No Description Provided."
|
22
|
+
%br
|
23
|
+
%a{:href => story[:url]} Open story on Pivotal Tracker.
|
24
|
+
%h5 Recently Finished
|
25
|
+
%ul
|
26
|
+
- if project[:finished].empty?
|
27
|
+
%p No stories have been completed recently.
|
28
|
+
- project[:finished].each do |story|
|
29
|
+
%li.story
|
30
|
+
= story[:name]
|
31
|
+
%hr
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/ This is a partial only used for rendering updates.
|
2
|
-
- @stories[:
|
2
|
+
- @stories[:started].each do |story|
|
3
3
|
%li.story
|
4
4
|
%a{:href => "#"}
|
5
5
|
= story[:name]
|
6
|
-
"(#{story[:owner]})"
|
6
|
+
= "(#{story[:owner]})"
|
7
7
|
%p.hidden
|
8
8
|
= story[:description] != "" ? story[:description] : "No Description Provided."
|
9
9
|
%br
|
10
|
-
%a{:href => story[:url]} Open story on Pivotal Tracker.
|
10
|
+
%a{:href => story[:url]} Open story on Pivotal Tracker.
|
data/lib/gripht.rb
CHANGED
data/spec/gripht_spec.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
3
|
describe "Gripht" do
|
4
|
+
|
5
|
+
it "fetch_stories should return valid hash" do
|
6
|
+
result = fetch_stories('1234')
|
7
|
+
|
8
|
+
end
|
9
|
+
|
4
10
|
it "should do nothing" do
|
5
11
|
get '/'
|
6
12
|
last_response.should have_selector("h2:contains('Hello There, buddy!')")
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
$TESTING=true
|
2
|
+
|
2
3
|
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
3
4
|
require 'rubygems'
|
4
5
|
require 'randexp'
|
@@ -11,9 +12,32 @@ require 'fakeweb'
|
|
11
12
|
require 'pp'
|
12
13
|
|
13
14
|
FakeWeb.allow_net_connect = false
|
15
|
+
FakeWeb.register_uri :any, "http://www.pivotaltracker.com/services/v2/", :string => <<-eof
|
16
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
17
|
+
<stories type="array" count="0" total="0" filter="'label:'needs feedback' type:bug">
|
18
|
+
<story>
|
19
|
+
<id type="integer">4567889</id>
|
20
|
+
<story_type>bug</story_type>
|
21
|
+
<url>http://www.pivotaltracker.com/story/show/STORY_ID</url>
|
22
|
+
<estimate type="integer">-1</estimate>
|
23
|
+
<current_state>started</current_state>
|
24
|
+
<description>Now, Scotty!</description>
|
25
|
+
<name>More power to shields</name>
|
26
|
+
<requested_by>James Kirk</requested_by>
|
27
|
+
<owned_by>Montgomery Scott</owned_by>
|
28
|
+
<created_at>Oct 16, 2008</created_at>
|
29
|
+
<created_at type="datetime">2008/12/10 00:00:00 UTC</created_at>
|
30
|
+
<accepted_at type="datetime">2008/12/10 00:00:00 UTC</accepted_at>
|
31
|
+
<iteration>
|
32
|
+
<number>3</number>
|
33
|
+
<start type="datetime">2009/01/05 00:00:02 UTC</start>
|
34
|
+
<finish type="datetime">2009/01/19 00:00:02 UTC</finish>
|
35
|
+
</iteration>
|
36
|
+
<labels>label 1,label 2,label 3</labels>
|
37
|
+
</story>
|
38
|
+
</stories>
|
39
|
+
eof
|
14
40
|
|
15
|
-
#require File.dirname(__FILE__)+'/fixtures'
|
16
|
-
#DataMapper.setup(:default, 'sqlite3::memory:')
|
17
41
|
|
18
42
|
class Net::HTTPResponse
|
19
43
|
def body=(content)
|
@@ -26,6 +50,7 @@ Spec::Runner.configure do |config|
|
|
26
50
|
config.include(Rack::Test::Methods)
|
27
51
|
config.include(Webrat::Methods)
|
28
52
|
config.include(Webrat::Matchers)
|
53
|
+
config.include(Gripht::Helpers)
|
29
54
|
|
30
55
|
config.before(:each) do
|
31
56
|
#DataMapper.auto_migrate!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsmestad-gripht
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Smestad
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-01 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|