ghoul 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 +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +39 -0
- data/LICENSE +20 -0
- data/README.md +46 -0
- data/Rakefile +1 -0
- data/bin/ghoul +19 -0
- data/config.ru +30 -0
- data/ghoul.gemspec +51 -0
- data/lib/ghoul/app.rb +119 -0
- data/lib/ghoul/lib/helpers.rb +64 -0
- data/lib/ghoul/lib/repository.rb +41 -0
- data/lib/ghoul/lib/url_helpers.rb +53 -0
- data/lib/ghoul/public/css/buttons.css +38 -0
- data/lib/ghoul/public/css/coderay.css +136 -0
- data/lib/ghoul/public/css/github-buttons.css +393 -0
- data/lib/ghoul/public/flash/clippy.swf +0 -0
- data/lib/ghoul/public/images/bg.png +0 -0
- data/lib/ghoul/public/images/big_logo.png +0 -0
- data/lib/ghoul/public/images/dir.png +0 -0
- data/lib/ghoul/public/images/gh-icons.png +0 -0
- data/lib/ghoul/public/images/logo-hover.png +0 -0
- data/lib/ghoul/public/images/logo.png +0 -0
- data/lib/ghoul/public/images/txt.png +0 -0
- data/lib/ghoul/views/404.erb +10 -0
- data/lib/ghoul/views/app.sass +316 -0
- data/lib/ghoul/views/blob.erb +11 -0
- data/lib/ghoul/views/commits.erb +11 -0
- data/lib/ghoul/views/diff.erb +16 -0
- data/lib/ghoul/views/error.erb +6 -0
- data/lib/ghoul/views/layout.erb +25 -0
- data/lib/ghoul/views/new_repo.erb +16 -0
- data/lib/ghoul/views/no_commits.erb +34 -0
- data/lib/ghoul/views/partials/_breadcrumbs.erb +6 -0
- data/lib/ghoul/views/partials/_commit.erb +10 -0
- data/lib/ghoul/views/partials/_footer.erb +5 -0
- data/lib/ghoul/views/partials/_repo_header.erb +17 -0
- data/lib/ghoul/views/partials/_repo_top_bar.erb +8 -0
- data/lib/ghoul/views/repo_settings.erb +18 -0
- data/lib/ghoul/views/repositories.erb +73 -0
- data/lib/ghoul/views/setup_repos_path.erb +8 -0
- data/lib/ghoul/views/tree.erb +17 -0
- data/lib/ghoul.rb +24 -0
- data/lib/server.rb +39 -0
- data/lib/version.rb +3 -0
- data/sample +0 -0
- data/spec/ghoul_helpers_spec.rb +62 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/url_helper_spec.rb +56 -0
- metadata +195 -0
data/lib/server.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "rack"
|
3
|
+
|
4
|
+
module Ghoul
|
5
|
+
module Server
|
6
|
+
|
7
|
+
def self.start
|
8
|
+
begin
|
9
|
+
config_path = File.join(File.dirname(__FILE__), "..", "config.ru")
|
10
|
+
|
11
|
+
message = <<-start_message.gsub(/^ {8}/, '')
|
12
|
+
|
13
|
+
###########################################################
|
14
|
+
#
|
15
|
+
# Using Ghoul via the "ghoul server" command is
|
16
|
+
# insecure by default. It is only intended for a secure
|
17
|
+
# local environment e.g. behind a firewall where only you
|
18
|
+
# or people you trust can access your machine on a lan.
|
19
|
+
#
|
20
|
+
#############################################################
|
21
|
+
|
22
|
+
Starting service on http://0.0.0.0:3003
|
23
|
+
|
24
|
+
start_message
|
25
|
+
|
26
|
+
puts message
|
27
|
+
|
28
|
+
ENV['RACK_ENV'] = "production"
|
29
|
+
Rack::Server.new(:config => config_path, :Port => 3003).start
|
30
|
+
|
31
|
+
# Open the users browser to our new server
|
32
|
+
# system("open http://0.0.0.0:3003")
|
33
|
+
rescue
|
34
|
+
puts " --> The ghoul shut down."
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/version.rb
ADDED
data/sample
ADDED
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ghoul', 'lib', 'helpers.rb')
|
2
|
+
|
3
|
+
include Ghoul::Helpers
|
4
|
+
|
5
|
+
describe Ghoul::Helpers do
|
6
|
+
require "georgedrummond_sinatra_helpers"
|
7
|
+
include GeorgeDrummond::Sinatra::Helpers
|
8
|
+
|
9
|
+
def url(url)
|
10
|
+
return url
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "title" do
|
14
|
+
it "should assign title" do
|
15
|
+
title("Web page title")
|
16
|
+
@title.should == "Web page title"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "partial" do
|
21
|
+
def erb(partial, *args)
|
22
|
+
return "erb(:'#{partial}', #{args})"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should use erb template from partials directory" do
|
26
|
+
partial(:repo_header, :title => "Ghoul Repository" ).should == "erb(:'partials/_repo_header', {:layout=>false, :locals=>{:title=>\"Ghoul Repository\"}})"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "date format" do
|
31
|
+
it "should return date in a nicer format" do
|
32
|
+
date = Time.new(2008,6,21, 13,30,0, "+09:00")
|
33
|
+
date_format(date).should == "21 Jun 2008 @ 13:30"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "breadcrumbs from splat" do
|
38
|
+
it "should return the correct breadcrumbs" do
|
39
|
+
breadcrumbs_from_splat("repository_name", "commitxyz", "george/drummond").should == "<a href=\"/repository/repository_name/commitxyz/tree/george/drummond/george\">george</a>/<a href=\"/repository/repository_name/commitxyz/tree/george/drummond/george/drummond\">drummond</a>"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "filesize formatter" do
|
44
|
+
it "should return size in bytes" do
|
45
|
+
human_file_size(0).should == "0 bytes"
|
46
|
+
human_file_size(234).should == "234 bytes"
|
47
|
+
human_file_size(1023).should == "1023 bytes"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return size in KB" do
|
51
|
+
human_file_size(2034).should == "1 KB"
|
52
|
+
human_file_size(2534).should == "2 KB"
|
53
|
+
human_file_size(88034).should == "85 KB"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return size in MB" do
|
57
|
+
human_file_size(4194304).should == "4 MB"
|
58
|
+
human_file_size(10485760).should == "10 MB"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
data/spec/spec_helper.rb
ADDED
File without changes
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ghoul', 'lib', 'url_helpers.rb')
|
2
|
+
|
3
|
+
include Ghoul::UrlHelpers
|
4
|
+
|
5
|
+
describe Ghoul::UrlHelpers do
|
6
|
+
before(:each) do
|
7
|
+
@repository = "ghoul"
|
8
|
+
@request = mock('request')
|
9
|
+
end
|
10
|
+
|
11
|
+
def url(url)
|
12
|
+
return url
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should route guides_path" do
|
16
|
+
guides_path.should == "/guides"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should route repository_path" do
|
20
|
+
repository_path(@repository).should == "/repository/ghoul/trunk/tree"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should route repository_git_url" do
|
24
|
+
@request.should_receive(:host_with_port).and_return("localhost:3000")
|
25
|
+
repository_git_url(@repository).should == "http://localhost:3000/repo/ghoul"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should route repository_settings_path" do
|
29
|
+
repository_settings_path(@repository).should == "/repository/ghoul/settings"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should route clone_url" do
|
33
|
+
@request.should_receive(:host_with_port).and_return("localhost:3000")
|
34
|
+
clone_url(@repository).should == "http://localhost:3000/repo/ghoul"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should route commit_path" do
|
38
|
+
commit_path(@repository, "xyz").should == "/repository/ghoul/commits/xyz"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should route blob_for_commit_path" do
|
42
|
+
blob_for_commit_path(@repository, "xyz", "abc/def", "ruby.rb").should == "/repository/ghoul/xyz/tree/abc/def/ruby.rb"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should route blob_for_commit_path without a path" do
|
46
|
+
blob_for_commit_path(@repository, "xyz", "", "ruby.rb").should == "/repository/ghoul/xyz/tree/ruby.rb"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should route raw_blob_for_commit_path" do
|
50
|
+
raw_blob_for_commit_path(@repository, "commitxyz", "xyz/e/fe/fe").should == "/repository/ghoul/commitxyz/raw/xyz/e/fe/fe"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should route diff_for_commit_path" do
|
54
|
+
diff_for_commit_path(@repository, "commitxyz").should == "/repository/ghoul/commitxyz/diff"
|
55
|
+
end
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ghoul
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- George Drummond
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-28 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rack
|
16
|
+
requirement: &70253275938440 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70253275938440
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sinatra
|
27
|
+
requirement: &70253275936620 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - =
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.3.1
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70253275936620
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: sass
|
38
|
+
requirement: &70253275934980 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70253275934980
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: grit
|
49
|
+
requirement: &70253275924920 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70253275924920
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: georgedrummond_sinatra_helpers
|
60
|
+
requirement: &70253275923600 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70253275923600
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ghoul_grack
|
71
|
+
requirement: &70253275922460 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - =
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.0.1
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70253275922460
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: coderay
|
82
|
+
requirement: &70253275921780 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70253275921780
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: redcarpet
|
93
|
+
requirement: &70253275921120 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70253275921120
|
102
|
+
description: Ghoul is a simple yet good looking interface for your git repositories
|
103
|
+
written in sinatra. It is currently only for demonstration purposes and use on your
|
104
|
+
secure local machine as it does not enforce any authentication as of yet.
|
105
|
+
email:
|
106
|
+
- george@accountsapp.com
|
107
|
+
executables:
|
108
|
+
- ghoul
|
109
|
+
extensions: []
|
110
|
+
extra_rdoc_files: []
|
111
|
+
files:
|
112
|
+
- .gitignore
|
113
|
+
- Gemfile
|
114
|
+
- Gemfile.lock
|
115
|
+
- LICENSE
|
116
|
+
- README.md
|
117
|
+
- Rakefile
|
118
|
+
- bin/ghoul
|
119
|
+
- config.ru
|
120
|
+
- ghoul.gemspec
|
121
|
+
- lib/ghoul.rb
|
122
|
+
- lib/ghoul/app.rb
|
123
|
+
- lib/ghoul/lib/helpers.rb
|
124
|
+
- lib/ghoul/lib/repository.rb
|
125
|
+
- lib/ghoul/lib/url_helpers.rb
|
126
|
+
- lib/ghoul/public/css/buttons.css
|
127
|
+
- lib/ghoul/public/css/coderay.css
|
128
|
+
- lib/ghoul/public/css/github-buttons.css
|
129
|
+
- lib/ghoul/public/flash/clippy.swf
|
130
|
+
- lib/ghoul/public/images/bg.png
|
131
|
+
- lib/ghoul/public/images/big_logo.png
|
132
|
+
- lib/ghoul/public/images/dir.png
|
133
|
+
- lib/ghoul/public/images/gh-icons.png
|
134
|
+
- lib/ghoul/public/images/logo-hover.png
|
135
|
+
- lib/ghoul/public/images/logo.png
|
136
|
+
- lib/ghoul/public/images/txt.png
|
137
|
+
- lib/ghoul/views/404.erb
|
138
|
+
- lib/ghoul/views/app.sass
|
139
|
+
- lib/ghoul/views/blob.erb
|
140
|
+
- lib/ghoul/views/commits.erb
|
141
|
+
- lib/ghoul/views/diff.erb
|
142
|
+
- lib/ghoul/views/error.erb
|
143
|
+
- lib/ghoul/views/layout.erb
|
144
|
+
- lib/ghoul/views/new_repo.erb
|
145
|
+
- lib/ghoul/views/no_commits.erb
|
146
|
+
- lib/ghoul/views/partials/_breadcrumbs.erb
|
147
|
+
- lib/ghoul/views/partials/_commit.erb
|
148
|
+
- lib/ghoul/views/partials/_footer.erb
|
149
|
+
- lib/ghoul/views/partials/_repo_header.erb
|
150
|
+
- lib/ghoul/views/partials/_repo_top_bar.erb
|
151
|
+
- lib/ghoul/views/repo_settings.erb
|
152
|
+
- lib/ghoul/views/repositories.erb
|
153
|
+
- lib/ghoul/views/setup_repos_path.erb
|
154
|
+
- lib/ghoul/views/tree.erb
|
155
|
+
- lib/server.rb
|
156
|
+
- lib/version.rb
|
157
|
+
- sample
|
158
|
+
- spec/ghoul_helpers_spec.rb
|
159
|
+
- spec/spec_helper.rb
|
160
|
+
- spec/url_helper_spec.rb
|
161
|
+
homepage: ''
|
162
|
+
licenses: []
|
163
|
+
post_install_message: ! " \n#################################################\n#\n#
|
164
|
+
Thanks for installing Ghoul and giving it a go!\n#\n# This is a proof of concept
|
165
|
+
release and in the\n# next few months I hope to add to Ghoul and\n# make it more
|
166
|
+
fully featured.\n#\n# I think the idea behind Ghoul is kind of cool\n# and if you
|
167
|
+
do too, why not contribute and\n# check out our github page.\n#\n# => http://github.com/georgedrummond/ghoul\n#\n#################################################\n\nTo
|
168
|
+
Start the Ghoul server run:\n\n ghoul server\n \n"
|
169
|
+
rdoc_options: []
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ! '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
none: false
|
180
|
+
requirements:
|
181
|
+
- - ! '>='
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
requirements: []
|
185
|
+
rubyforge_project:
|
186
|
+
rubygems_version: 1.8.11
|
187
|
+
signing_key:
|
188
|
+
specification_version: 3
|
189
|
+
summary: Ghoul is a simple yet good looking interface for your git repositories written
|
190
|
+
in sinatra. It is currently only for demonstration purposes and use on your secure
|
191
|
+
local machine as it does not enforce any authentication as of yet.
|
192
|
+
test_files:
|
193
|
+
- spec/ghoul_helpers_spec.rb
|
194
|
+
- spec/spec_helper.rb
|
195
|
+
- spec/url_helper_spec.rb
|