jsmestad-sinatra_git 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.textile +4 -0
- data/Rakefile +42 -0
- data/TODO +4 -0
- data/VERSION +1 -0
- data/config.ru.example +11 -0
- data/lib/sinatra_git/app.rb +30 -0
- data/lib/sinatra_git/views/commits.haml +16 -0
- data/lib/sinatra_git.rb +7 -0
- data/spec/fixtures.rb +0 -0
- data/spec/sinatra_git_spec.rb +8 -0
- data/spec/spec_helper.rb +40 -0
- metadata +97 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 YOUR NAME
|
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
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rack'
|
3
|
+
require 'spec/rake/spectask'
|
4
|
+
|
5
|
+
GEM = "sinatra_git"
|
6
|
+
AUTHORS = ["Justin Smestad"]
|
7
|
+
EMAIL = "justin.smestad@gmail.com"
|
8
|
+
HOMEPAGE = "http://evalcode.com"
|
9
|
+
SUMMARY = "A sinatra app that provides a github wrapper for offloading api calls to github."
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
gem.name = GEM
|
15
|
+
gem.summary = SUMMARY
|
16
|
+
gem.email = EMAIL
|
17
|
+
gem.homepage = HOMEPAGE
|
18
|
+
gem.authors = AUTHORS
|
19
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
+
|
21
|
+
gem.add_dependency "sinatra", ">= 0.9.2"
|
22
|
+
gem.add_dependency "haml"
|
23
|
+
gem.add_dependency "octopi"
|
24
|
+
end
|
25
|
+
rescue LoadError
|
26
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
task :default => :spec
|
31
|
+
|
32
|
+
desc "Run specs"
|
33
|
+
Spec::Rake::SpecTask.new do |t|
|
34
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
35
|
+
t.spec_opts = %w(-fs --color)
|
36
|
+
t.spec_opts << '--loadby' << 'random'
|
37
|
+
|
38
|
+
t.rcov_opts << '--exclude' << 'spec'
|
39
|
+
t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
|
40
|
+
t.rcov_opts << '--text-summary'
|
41
|
+
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
42
|
+
end
|
data/TODO
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/config.ru.example
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra_git'
|
3
|
+
|
4
|
+
#DataMapper.setup(:default, "mysql://atmos:fail@localhost/Sinatra_git_production")
|
5
|
+
|
6
|
+
class SinatraGitSite < SinatraGit::App
|
7
|
+
set :public, File.expand_path(File.dirname(__FILE__), "public")
|
8
|
+
set :environment, :production
|
9
|
+
end
|
10
|
+
|
11
|
+
run SinatraGitSite
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module SinatraGit
|
2
|
+
class App < Sinatra::Base
|
3
|
+
include Octopi
|
4
|
+
|
5
|
+
configure do
|
6
|
+
set :views, File.dirname(__FILE__) + '/views'
|
7
|
+
end
|
8
|
+
|
9
|
+
helpers do
|
10
|
+
def fetch_repo
|
11
|
+
@repo = Repository.find(params[:username], params[:repo])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
get '/:username/:repo/:action' do
|
16
|
+
haml "%p= fetch_repo.send(params[:action].to_sym).inspect"
|
17
|
+
end
|
18
|
+
|
19
|
+
get '/:username/:repo' do
|
20
|
+
fetch_repo
|
21
|
+
@commits = @repo.commits
|
22
|
+
haml :commits
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/' do
|
26
|
+
haml "%h2= 'Hello There, buddy!'"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
%h2= "GitHub Status for '#{@repo.name}'"
|
2
|
+
%p= "Repository has #{@commits.size} commit(s)"
|
3
|
+
|
4
|
+
%h3 Recent Activity (8 most recent)
|
5
|
+
%ul
|
6
|
+
- 8.times do |i|
|
7
|
+
%li
|
8
|
+
= @commits[i].message
|
9
|
+
%ul
|
10
|
+
%li
|
11
|
+
= DateTime.parse(@commits[i].committed_date).strftime("%c")
|
12
|
+
%li
|
13
|
+
= @commits[i].committer["name"]
|
14
|
+
%li
|
15
|
+
%a{:href => @commits[i].url }
|
16
|
+
= @commits[i].url
|
data/lib/sinatra_git.rb
ADDED
data/spec/fixtures.rb
ADDED
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
$TESTING=true
|
2
|
+
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
require 'rubygems'
|
4
|
+
require 'randexp'
|
5
|
+
require 'sinatra_git'
|
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 SinatraGit::App
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jsmestad-sinatra_git
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Smestad
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-03 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.2
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: haml
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: octopi
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
description:
|
46
|
+
email: justin.smestad@gmail.com
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- LICENSE
|
53
|
+
- README.textile
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- LICENSE
|
57
|
+
- README.textile
|
58
|
+
- Rakefile
|
59
|
+
- TODO
|
60
|
+
- VERSION
|
61
|
+
- config.ru.example
|
62
|
+
- lib/sinatra_git.rb
|
63
|
+
- lib/sinatra_git/app.rb
|
64
|
+
- lib/sinatra_git/views/commits.haml
|
65
|
+
- spec/fixtures.rb
|
66
|
+
- spec/sinatra_git_spec.rb
|
67
|
+
- spec/spec_helper.rb
|
68
|
+
has_rdoc: false
|
69
|
+
homepage: http://evalcode.com
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options:
|
72
|
+
- --charset=UTF-8
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
version:
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 1.2.0
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
summary: A sinatra app that provides a github wrapper for offloading api calls to github.
|
94
|
+
test_files:
|
95
|
+
- spec/fixtures.rb
|
96
|
+
- spec/sinatra_git_spec.rb
|
97
|
+
- spec/spec_helper.rb
|