jsmestad-gripht 0.1.2

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .DS_Store
2
+ config.ru
3
+ tmp/*
4
+ public/*
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Justin Smestad
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.
data/README.textile ADDED
@@ -0,0 +1,7 @@
1
+ h3. gripht
2
+
3
+ p. Gripht (`git` + `graph`) is a sinatra application that provides visibility into multiple Pivotal Tracker projects. The goal is to give a high-level view of what each project is currently working on with javascript controlled updates. This will allow the application to be open in "kiosk" mode for public viewing eventually utilizing graphing libraries to better visualize things like velocity and statistical averages.
4
+
5
+ h3. Copyright
6
+
7
+ Copyright (c) 2009 Justin Smestad. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,41 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'spec/rake/spectask'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "gripht"
9
+ gem.summary = %Q{TODO}
10
+ gem.email = "justin.smestad@gmail.com"
11
+ gem.homepage = "http://github.com/jsmestad/gripht"
12
+ gem.authors = ["Justin Smestad"]
13
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
+
15
+ gem.add_dependency "sinatra", ">= 0.9.1.1"
16
+ gem.add_dependency "rubigen", ">= 1.5.2"
17
+ gem.add_dependency "rack-test", ">= 0.1.0"
18
+ gem.add_dependency "webrat", ">= 0.4.3"
19
+ gem.add_dependency "fakeweb", ">= 1.2.0"
20
+ gem.add_dependency 'haml', ">= 2.0.9"
21
+ gem.add_dependency 'rest-client', ">= 0.9.2"
22
+ gem.add_dependency 'nokogiri'
23
+ end
24
+
25
+ rescue LoadError
26
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
27
+ end
28
+
29
+ task :default => :spec
30
+
31
+ desc "Run specs"
32
+ Spec::Rake::SpecTask.new(:spec) do |t|
33
+ t.spec_files = FileList['spec/**/*_spec.rb']
34
+ t.spec_opts = %w(-fs --color)
35
+ t.spec_opts << '--loadby' << 'random'
36
+
37
+ t.rcov_opts << '--exclude' << 'spec'
38
+ t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
39
+ t.rcov_opts << '--text-summary'
40
+ t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
41
+ end
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ TODO:
2
+ Implement Gripht
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
data/config.ru.example ADDED
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'gripht'
3
+
4
+ class GriphtSite < Gripht::App
5
+ set :public, File.expand_path(File.dirname(__FILE__), "public")
6
+ set :environment, :production
7
+ end
8
+
9
+ run GriphtSite
data/gripht.gemspec ADDED
@@ -0,0 +1,78 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{gripht}
5
+ s.version = "0.1.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Justin Smestad"]
9
+ s.date = %q{2009-05-22}
10
+ s.email = %q{justin.smestad@gmail.com}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.textile"
14
+ ]
15
+ s.files = [
16
+ ".gitignore",
17
+ "LICENSE",
18
+ "README.textile",
19
+ "Rakefile",
20
+ "TODO",
21
+ "VERSION",
22
+ "config.ru.example",
23
+ "gripht.gemspec",
24
+ "lib/gripht.rb",
25
+ "lib/gripht/app.rb",
26
+ "lib/gripht/views/application.js",
27
+ "lib/gripht/views/failed.haml",
28
+ "lib/gripht/views/index.haml",
29
+ "lib/gripht/views/layout.haml",
30
+ "spec/fixtures.rb",
31
+ "spec/gripht_spec.rb",
32
+ "spec/spec_helper.rb"
33
+ ]
34
+ s.homepage = %q{http://github.com/jsmestad/gripht}
35
+ s.rdoc_options = ["--charset=UTF-8"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = %q{1.3.3}
38
+ s.summary = %q{TODO}
39
+ s.test_files = [
40
+ "spec/fixtures.rb",
41
+ "spec/gripht_spec.rb",
42
+ "spec/spec_helper.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_runtime_dependency(%q<sinatra>, [">= 0.9.1.1"])
51
+ s.add_runtime_dependency(%q<rubigen>, [">= 1.5.2"])
52
+ s.add_runtime_dependency(%q<rack-test>, [">= 0.1.0"])
53
+ s.add_runtime_dependency(%q<webrat>, [">= 0.4.3"])
54
+ s.add_runtime_dependency(%q<fakeweb>, [">= 1.2.0"])
55
+ s.add_runtime_dependency(%q<haml>, [">= 2.0.9"])
56
+ s.add_runtime_dependency(%q<rest-client>, [">= 0.9.2"])
57
+ s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
58
+ else
59
+ s.add_dependency(%q<sinatra>, [">= 0.9.1.1"])
60
+ s.add_dependency(%q<rubigen>, [">= 1.5.2"])
61
+ s.add_dependency(%q<rack-test>, [">= 0.1.0"])
62
+ s.add_dependency(%q<webrat>, [">= 0.4.3"])
63
+ s.add_dependency(%q<fakeweb>, [">= 1.2.0"])
64
+ s.add_dependency(%q<haml>, [">= 2.0.9"])
65
+ s.add_dependency(%q<rest-client>, [">= 0.9.2"])
66
+ s.add_dependency(%q<nokogiri>, [">= 0"])
67
+ end
68
+ else
69
+ s.add_dependency(%q<sinatra>, [">= 0.9.1.1"])
70
+ s.add_dependency(%q<rubigen>, [">= 1.5.2"])
71
+ s.add_dependency(%q<rack-test>, [">= 0.1.0"])
72
+ s.add_dependency(%q<webrat>, [">= 0.4.3"])
73
+ s.add_dependency(%q<fakeweb>, [">= 1.2.0"])
74
+ s.add_dependency(%q<haml>, [">= 2.0.9"])
75
+ s.add_dependency(%q<rest-client>, [">= 0.9.2"])
76
+ s.add_dependency(%q<nokogiri>, [">= 0"])
77
+ end
78
+ end
data/lib/gripht.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'sinatra/base'
3
+ require 'haml/util'
4
+ require 'haml/engine'
5
+ require 'rest_client'
6
+ require 'logger'
7
+ require 'nokogiri'
8
+
9
+ module Gripht
10
+ module Log
11
+ def self.logger
12
+ if @logger.nil?
13
+ @logger = Logger.new("lifeline.log")
14
+ @logger.level = Logger::INFO
15
+ end
16
+ @logger
17
+ end
18
+ end
19
+ end
20
+
21
+ require File.dirname(__FILE__) + '/gripht/app'
data/lib/gripht/app.rb ADDED
@@ -0,0 +1,39 @@
1
+ module Gripht
2
+ class App < Sinatra::Default
3
+ set :views, File.dirname(__FILE__) + '/views'
4
+
5
+ helpers do
6
+ # something goes here...
7
+ end
8
+
9
+ errors do
10
+ Gripht::Log.logger.info env['sinatra.error'].message
11
+ haml :failed
12
+ end
13
+
14
+ get '/application.js' do
15
+ @application_js ||= File.read(File.dirname(__FILE__) + '/views/application.js')
16
+ end
17
+
18
+ get '/' do
19
+ resource = RestClient::Resource.new 'http://www.pivotaltracker.com/services/v2/projects', :headers => { 'X-TrackerToken' => ENV['TRACKER_TOKEN']}
20
+ @projects = Nokogiri::XML(resource.get).xpath('//project').collect { |r| { :id => r.at('id').content, :name => r.at('name').content } }
21
+ @projects.each do |project|
22
+ project.merge!({ :stories => Nokogiri::XML(resource["#{project[:id]}/stories?limit=10&filter=state%3Astarted"].get).xpath('//story').collect do |story|
23
+ {
24
+ :name => story.at('name').content,
25
+ :owner => story.at('owned_by').content,
26
+ :created_at => story.at('created_at').content,
27
+ :description => story.at('description').nil? ? "" : story.at('description').content,
28
+ :url => story.at('url').content,
29
+ :type => story.at('story_type').content
30
+ }
31
+ end
32
+ })
33
+ end
34
+
35
+ haml :index
36
+ end
37
+
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ jQuery(document).ready(function($) {
2
+ $('.story a').live('click', function(){ $(this).next('p').slideToggle('slow'); });
3
+ });
@@ -0,0 +1,6 @@
1
+ %h3 Oops! Something went wrong!
2
+
3
+ %p
4
+ The error has been logged. Now, please
5
+ %a{:href => '/'}
6
+ return home
@@ -0,0 +1,26 @@
1
+ %h2 Index Action
2
+
3
+ %p Stuff goes here.
4
+
5
+ %h3 Current Projects
6
+
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
+ %ul
15
+ - project[:stories].each do |story|
16
+ %li.story
17
+ %a{:href => "#"}= story[:name]
18
+ = "(#{story[:owner]})"
19
+ %p.hidden
20
+ = story[:description] != "" ? story[:description] : "No Description Provided."
21
+ %br
22
+ %a{:href => story[:url]} Open story on Pivotal Tracker.
23
+
24
+
25
+ / - @projects.each do |project|
26
+ / %li= project
@@ -0,0 +1,13 @@
1
+ !!!Strict
2
+ %html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
3
+ %head
4
+ %title Gripht -- Default Install
5
+ %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"}
6
+ %script{:type => 'text/javascript', :src => "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"}
7
+ %script{:type => 'text/javascript', :src => "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"}
8
+ %script{:type => 'text/javascript', :src => "/application.js"}
9
+
10
+ %link{:href => '/css/screen.css', :media => 'screen', :rel => 'stylesheet', :type => 'text/css', :media => 'screen, projection'}
11
+
12
+ %body
13
+ = yield
data/spec/fixtures.rb ADDED
File without changes
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "Gripht" do
4
+ it "should do nothing" do
5
+ get '/'
6
+ last_response.should have_selector("h2:contains('Hello There, buddy!')")
7
+ end
8
+ end
@@ -0,0 +1,40 @@
1
+ $TESTING=true
2
+ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require 'rubygems'
4
+ require 'randexp'
5
+ require 'gripht'
6
+ #require 'dm-core'
7
+ require 'rack/test'
8
+ require 'webrat/sinatra'
9
+ #require 'dm-sweatshop'
10
+ require 'fakeweb'
11
+ require 'pp'
12
+
13
+ FakeWeb.allow_net_connect = false
14
+
15
+ #require File.dirname(__FILE__)+'/fixtures'
16
+ #DataMapper.setup(:default, 'sqlite3::memory:')
17
+
18
+ class Net::HTTPResponse
19
+ def body=(content)
20
+ @body = content
21
+ @read = true
22
+ end
23
+ end
24
+
25
+ Spec::Runner.configure do |config|
26
+ config.include(Rack::Test::Methods)
27
+ config.include(Webrat::Methods)
28
+ config.include(Webrat::Matchers)
29
+
30
+ config.before(:each) do
31
+ #DataMapper.auto_migrate!
32
+ FakeWeb.clean_registry
33
+ end
34
+
35
+ def app
36
+ @app = Rack::Builder.new do
37
+ run Gripht::App
38
+ end
39
+ end
40
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jsmestad-gripht
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Justin Smestad
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-22 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.1.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rubigen
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.5.2
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rack-test
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.1.0
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: webrat
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.4.3
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: fakeweb
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.2.0
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: haml
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 2.0.9
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: rest-client
77
+ type: :runtime
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 0.9.2
84
+ version:
85
+ - !ruby/object:Gem::Dependency
86
+ name: nokogiri
87
+ type: :runtime
88
+ version_requirement:
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ version:
95
+ description:
96
+ email: justin.smestad@gmail.com
97
+ executables: []
98
+
99
+ extensions: []
100
+
101
+ extra_rdoc_files:
102
+ - LICENSE
103
+ - README.textile
104
+ files:
105
+ - .gitignore
106
+ - LICENSE
107
+ - README.textile
108
+ - Rakefile
109
+ - TODO
110
+ - VERSION
111
+ - config.ru.example
112
+ - gripht.gemspec
113
+ - lib/gripht.rb
114
+ - lib/gripht/app.rb
115
+ - lib/gripht/views/application.js
116
+ - lib/gripht/views/failed.haml
117
+ - lib/gripht/views/index.haml
118
+ - lib/gripht/views/layout.haml
119
+ - spec/fixtures.rb
120
+ - spec/gripht_spec.rb
121
+ - spec/spec_helper.rb
122
+ has_rdoc: false
123
+ homepage: http://github.com/jsmestad/gripht
124
+ post_install_message:
125
+ rdoc_options:
126
+ - --charset=UTF-8
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: "0"
134
+ version:
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: "0"
140
+ version:
141
+ requirements: []
142
+
143
+ rubyforge_project:
144
+ rubygems_version: 1.2.0
145
+ signing_key:
146
+ specification_version: 3
147
+ summary: TODO
148
+ test_files:
149
+ - spec/fixtures.rb
150
+ - spec/gripht_spec.rb
151
+ - spec/spec_helper.rb