ghoul 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ghoul/app.rb CHANGED
@@ -97,7 +97,7 @@ module Ghoul
97
97
 
98
98
  if resource.is_a?(Grit::Tree) || params[:splat][0] == ""
99
99
  @resource = resource
100
- @splat = params[:splat]
100
+ @splat = params[:splat][0]
101
101
  if @resource.contents.detect {|r| r.name.downcase =~ /readme/}
102
102
  @readme = @resource.contents.detect {|r| r.name.downcase =~ /readme/ }
103
103
  file_extension = @readme.name.split('.').last
@@ -16,7 +16,8 @@ module Ghoul
16
16
  end
17
17
 
18
18
  def repositories
19
- return Dir.entries(repos_path)
19
+ directory_entries = Dir.entries(repos_path)
20
+ return directory_entries.find_all { |r| File.directory?( File.join(repos_path, r) ) }
20
21
  end
21
22
 
22
23
  def commit_from_repository(repository, commit_id)
@@ -42,8 +42,9 @@ module Ghoul
42
42
  end
43
43
  alias_method :tree_for_commit_path, :blob_for_commit_path
44
44
 
45
- def raw_blob_for_commit_path(repository, commit, splat)
46
- url "/repository/#{repository}/#{commit}/raw/#{splat}"
45
+ def raw_blob_for_commit_path(repository, commit, splat="", name="")
46
+ parts = [repository, commit, "raw", splat, name].find_all { |i| i != ""}
47
+ url "/repository/#{parts.join("/")}"
47
48
  end
48
49
 
49
50
  def diff_for_commit_path(repository, commit)
@@ -31,6 +31,7 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
31
31
  .CodeRay span.line-numbers { padding: 0px 4px; }
32
32
  .CodeRay .line { display: block; float: left; width: 100%; }
33
33
  .CodeRay .code { width: 100%; }
34
+ .CodeRay pre { background:none !important; padding:none !important; border:none !important; }
34
35
  .CodeRay .code pre { overflow: auto; }
35
36
 
36
37
  .CodeRay .debug { color: white !important; background: blue !important; }
@@ -63,9 +63,6 @@ body
63
63
  a
64
64
  :color #777
65
65
 
66
- h1
67
- :float left
68
- :margin 20px 0
69
66
 
70
67
  #commits
71
68
  :float left
@@ -235,15 +232,22 @@ h1
235
232
  :float left
236
233
  :width 100%
237
234
  :margin-top 10px
238
- .message, .new_repo
235
+ .gravatar
236
+ :width 25px
237
+ :height 25px
238
+ :float left
239
+ .latest_commit, .new_repo
239
240
  :float left
240
241
  :margin-top 3px
241
- :font-size 10px
242
- :background #fff
243
- :border 1px solid #ccc
244
- :padding 4px
245
- :border-radius 5px
246
- :font-weight bold
242
+ :width 699px
243
+ p
244
+ :float left
245
+ :padding 0 0px 4px 0px
246
+ :width 100%
247
+ :font-size 10px
248
+ &.date
249
+ :color #999
250
+
247
251
 
248
252
  #diffs
249
253
  .diff
@@ -252,40 +256,6 @@ h1
252
256
  :overflow none
253
257
  :margin-bottom 20px
254
258
 
255
- #guide
256
- :float left
257
- :width 100%
258
- :overflow auto
259
- &.bordered
260
- :border 1px solid #ccc
261
- code
262
- :float left
263
- :background #f6f9fe
264
- :padding 5px
265
- :border 1px solid #ccc
266
- :width 100%
267
- :margin 0 -5px 0 -5px
268
- :margin 10px 0
269
- :border-radius 5px
270
- h1, h2, h3
271
- :margin-top 40px
272
- :float left
273
- :width 100%
274
- p
275
- :float left
276
- :margin-top 20px
277
- :width 100%
278
- :line-height 22px
279
- ul, ol
280
- :float left
281
- :margin 10px -40px 10px 40px
282
- :width 100%
283
-
284
- li
285
- :float left
286
- :width 100%
287
- :margin 10px 0
288
-
289
259
  form
290
260
  :float left
291
261
  :width 100%
@@ -328,7 +298,7 @@ form
328
298
  :font-size 26px
329
299
 
330
300
  a
331
- :color dodgerblue
301
+ :color #3B5593
332
302
 
333
303
  #pagination
334
304
  :float left
@@ -338,16 +308,74 @@ a
338
308
  #left
339
309
  :float left
340
310
 
311
+ h1
312
+ :margin-bottom 30px
313
+
341
314
  #readme
342
315
  :float left
343
316
  :margin-top 30px
344
- :width 758px
345
- .bordered
317
+ :width 718px !important
318
+ :padding 20px
319
+ :border 1px solid #ccc
320
+ :overflow auto
321
+ table.CodeRay
322
+ :margin -30px -20px -20px -20px
323
+ :overflow auto
346
324
  :float left
347
- :width 718px !important
348
- :padding 20px
349
- :border 1px solid #ccc
350
- :border-top none
351
- .CodeRay
325
+ :width 758px
326
+ :border none
327
+ .section_bar
352
328
  :margin -20px
329
+ :border none
330
+ :border-bottom 1px solid #ccc
331
+ :margin-bottom 30px
332
+
333
+ #guide
334
+ :float left
335
+ :width 100%
336
+ code
337
+ :padding 3px
338
+ :background #f6f9fe
339
+ :border 1px solid #eee
340
+ :color #555
341
+ pre
342
+ :float left
343
+ :background #f6f9fe
344
+ :border 1px solid #ccc
345
+ :width 100%
346
+ :margin-bottom 20px
347
+ :border-radius 5px
348
+ code
349
+ :padding 10px
350
+ :float left
351
+ :border none
352
+ :border-radius none
353
+ :padding none
354
+ :background none
355
+
356
+ h2
357
+ :margin-top 10px
358
+ :margin-bottom 10px
359
+ :border-top 4px solid #f1f1f1
360
+ :padding-top 5px
361
+
362
+ h1, h2, h3, h4, h5
363
+ :float left
364
+ :width 100%
365
+ :margin-bottom 10px
366
+ p
367
+ :float left
368
+ :margin-bottom 20px
369
+ :width 100%
370
+ :line-height 22px
371
+ ul, ol
372
+ :float left
373
+ :margin 0 !important
374
+ :width 100%
375
+
376
+ li
377
+ :width auto
378
+ :margin 0 30px 20px 30px
379
+ :clear both
380
+
353
381
 
@@ -3,14 +3,17 @@
3
3
  <input name="name" placeholder="Repository name"/>
4
4
  </form>
5
5
 
6
- <div id="guide">
7
- <h2>Creating A Repository</h2>
6
+ <div id="readme">
7
+ <div id="guide">
8
+ <h1>Creating A Repository</h1>
8
9
 
9
- <p>Please bear in mind when you create a repository that:</p>
10
+ <p>Please bear in mind when you create a repository that:</p>
10
11
 
11
- <p>There is currently no authentication built into Ghoul. This first version is a proof of concept and I hope that something will be able to be built into future versions of this software.</p>
12
-
13
- <p>If you change ports you will need to change add the remote repository again on your local repository.</p>
12
+ <p>There is currently no authentication built into Ghoul. This first version is a proof of concept and I hope that something will be able to be built into future versions of this software.</p>
14
13
 
14
+ <p>If you change ports you will need to change add the remote repository again on your local repository.</p>
15
+
16
+ </div>
15
17
  </div>
16
18
 
19
+
@@ -1,34 +1,30 @@
1
1
  <% title "Setting up your repository" %>
2
2
 
3
- <div id="guide">
4
- <h2>Global Setup:</h2>
5
- <pre><code>
6
- git config --global user.name "Your Name"
7
- git config --global user.email author@accountsapp.com
8
- </code>
9
- </pre>
10
3
 
11
- <h2>Next Steps:</h2>
12
- <pre><code>
13
- mkdir <%=@repository%>
4
+ <div id="readme">
5
+ <div id="guide">
6
+ <h1>Setting Up Your Repo</h1>
7
+ <h2>Global Setup:</h2>
8
+ <pre><code>git config --global user.name "Your Name"
9
+ git config --global user.email author@accountsapp.com</code></pre>
10
+
11
+ <h2>Next Steps:</h2>
12
+ <pre><code>mkdir <%=@repository%>
14
13
  cd <%=@repository%>
15
14
  touch README
16
15
  git init
17
16
  git add README
18
17
  git commit -m 'first commit'
19
18
  git remote add origin <%=repository_git_url(@repository)%>
20
- git push -u origin master
21
- </code>
22
- </pre>
19
+ git push -u origin master</code></pre>
23
20
 
24
- <h2>Existing Repository:</h2>
25
- <pre><code>
26
- cd existing_repository
21
+ <h2>Existing Repository:</h2>
22
+ <pre><code>cd existing_repository
27
23
  git remote add origin <%=repository_git_url(@repository)%>
28
- git push -u origin master
29
- </code>
30
- </pre>
24
+ git push -u origin master</code></pre>
31
25
 
32
- <p>When you're done, <%= link_to "click here", repository_path(@repository) %></p>
26
+ <p>When you're done, <%= link_to "click here", repository_path(@repository) %></p>
27
+ </div>
33
28
  </div>
34
29
 
30
+
@@ -10,11 +10,13 @@
10
10
  <div class="data">
11
11
  <% begin %>
12
12
  <% last_commit = commit_from_repository(repo, "trunk") %>
13
- <div class="message">
14
- Last updated by <%= last_commit.author.name %> on <%= date_format(last_commit.committed_date) %>
13
+ <%=gravatar_image(last_commit.author.email, 25)%>
14
+ <div class="latest_commit">
15
+ <p><%=last_commit.message%></p>
16
+ <p class="date">Last updated by <%= last_commit.author.name %> on <%= date_format(last_commit.committed_date) %></p>
15
17
  </div>
16
18
  <% rescue %>
17
- <div class="message">New repository</div>
19
+ <!-- No commits in this repository -->
18
20
  <% end %>
19
21
  </div>
20
22
  </div>
@@ -22,52 +24,52 @@
22
24
  <% end %>
23
25
  </div>
24
26
  <% else %>
27
+ <div id="readme">
28
+ <div id="guide">
29
+ <h1>Ghoul - Prettier Git For Everyone :)</h1>
30
+ <p><a href="http://github.com/georgedrummond/ghoul">Ghoul</a> is a simple yet good looking interface for your git repositories written in <a href="http://sinatrarb.com">sinatra</a>. It is currently only for demonstration purposes and use on your secure local machine as it does not enforce any authentication as of yet.</p>
25
31
 
26
- <div id="guide">
27
- <h1>Ghoul - Prettier Git For Everyone :)</h1>
28
- <p><a href="http://github.com/georgedrummond/ghoul">Ghoul</a> is a simple yet good looking interface for your git repositories written in <a href="http://sinatrarb.com">sinatra</a>. It is currently only for demonstration purposes and use on your secure local machine as it does not enforce any authentication as of yet.</p>
32
+ <h2>Installation</h2>
33
+ <p>Ghoul can be run either using the ghoul gem or by downloading the git repository and running through the rackup command.</p>
34
+ <pre><code># Installing via rubygems
29
35
 
30
- <h2>Installation</h2>
31
- <p>Ghoul can be run either using the ghoul gem or by downloading the git repository and running through the rackup command.</p>
32
- <pre><code># Installing via rubygems
36
+ gem install ghoul
37
+ ghoul server</code></pre>
38
+ <pre><code># Installing from the git repository
33
39
 
34
- gem install ghoul
35
- ghoul server</code></pre>
36
- <pre><code># Installing from the git repository
37
-
38
- git clone http://github.com/georgedrummond/ghoul
39
- cd ghoul
40
- bundle install
41
- rackup
42
- </code></pre>
40
+ git clone http://github.com/georgedrummond/ghoul
41
+ cd ghoul
42
+ bundle install
43
+ rackup
44
+ </code></pre>
43
45
 
44
- <h2>How it works</h2>
45
- <p>Ghoul uses the grit, written by the guys at github for parsing your repositories which are located in a folder named "repos" within your
46
- home folder e.g. /Users/georgedrummond/repos. For git push, ghoul uses grack. Grack has no authentication so ghoul should only be used
47
- on your local machine.</p>
46
+ <h2>How it works</h2>
47
+ <p>Ghoul uses the grit, written by the guys at github for parsing your repositories which are located in a folder named "repos" within your
48
+ home folder e.g. /Users/georgedrummond/repos. For git push, ghoul uses grack. Grack has no authentication so ghoul should only be used
49
+ on your local machine.</p>
48
50
 
49
- <h2>License</h2>
50
- <pre><code>Copyright (c) 2011 George Drummond, george@accountsapp.com
51
+ <h2>License</h2>
52
+ <pre><code>Copyright (c) 2011 George Drummond, george@accountsapp.com
51
53
 
52
- Permission is hereby granted, free of charge, to any person obtaining
53
- a copy of this software and associated documentation files (the
54
- "Software"), to deal in the Software without restriction, including
55
- without limitation the rights to use, copy, modify, merge, publish,
56
- distribute, sublicense, and/or sell copies of the Software, and to
57
- permit persons to whom the Software is furnished to do so, subject to
58
- the following conditions:
54
+ Permission is hereby granted, free of charge, to any person obtaining
55
+ a copy of this software and associated documentation files (the
56
+ "Software"), to deal in the Software without restriction, including
57
+ without limitation the rights to use, copy, modify, merge, publish,
58
+ distribute, sublicense, and/or sell copies of the Software, and to
59
+ permit persons to whom the Software is furnished to do so, subject to
60
+ the following conditions:
59
61
 
60
- The above copyright notice and this permission notice shall be
61
- included in all copies or substantial portions of the Software.
62
+ The above copyright notice and this permission notice shall be
63
+ included in all copies or substantial portions of the Software.
62
64
 
63
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
64
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
65
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
66
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
67
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
68
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
69
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</code></pre>
65
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
66
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
67
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
68
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
69
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
70
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
71
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</code></pre>
72
+ </div>
70
73
  </div>
71
-
72
74
  <% end %>
73
75
 
@@ -1,8 +1,11 @@
1
1
  <% title "Please set up the repos path"%>
2
- <div id="guide">
3
- <h2>Please Set Up The Repos Path</h2>
4
- <p>Before you can run <b>Ghoul</b> you must setup the home for your ghoul repositories. This is where we will store our bare repositories and its where you will push to.</p>
5
- <p>To continue please create an empty folder in <b><%= repos_path %></b></p>
6
- <pre><code>$ mkdir <%= repos_path %></code></pre>
7
- <p>When you have done that please <a href="<%= repositories_path %>">click here</a></p>
8
- </div>
2
+
3
+ <div id="readme">
4
+ <div id="guide">
5
+ <h1>Please Set Up The Repos Path</h1>
6
+ <p>Before you can run <b>Ghoul</b> you must setup the home for your ghoul repositories. This is where we will store our bare repositories and its where you will push to.</p>
7
+ <p>To continue please create an empty folder in <b><%= repos_path %></b></p>
8
+ <pre><code>$ mkdir <%= repos_path %></code></pre>
9
+ <p>When you have done that please <a href="<%= repositories_path %>">click here</a></p>
10
+ </div>
11
+ </div>
@@ -6,11 +6,11 @@
6
6
  <% @resource.contents.sort { |a, b| [b.class.name, a.name.downcase] <=> [a.class.name, b.name.downcase] }.each do |f| %>
7
7
  <% if f.is_a?(Grit::Tree) %>
8
8
  <div class="tree gradient">
9
- <div class="name"><%= link_to "#{f.name}/", tree_for_commit_path(@repository, params[:commit], params[:splat][0], f.name) %></div>
9
+ <div class="name"><%= link_to "#{f.name}/", tree_for_commit_path(@repository, params[:commit], @splat, f.name) %></div>
10
10
  </div>
11
11
  <% else %>
12
12
  <div class="blob gradient">
13
- <div class="name"><%= link_to f.name, blob_for_commit_path(@repository, params[:commit], params[:splat][0], f.name) %></div>
13
+ <div class="name"><%= link_to f.name, blob_for_commit_path(@repository, params[:commit], @splat, f.name) %></div>
14
14
  </div>
15
15
  <% end %>
16
16
  <% end %>
@@ -19,9 +19,9 @@
19
19
  <% if @readme %>
20
20
  <div id="readme">
21
21
  <div class="section_bar gradient">
22
- <%=link_to @readme.name, "#" %>
22
+ <%=link_to @readme.name, raw_blob_for_commit_path(@repository, params[:commit], @splat, @readme.name) %>
23
23
  </div>
24
- <div id="guide" class="bordered">
24
+ <div id="guide">
25
25
  <%=@readme_contents %>
26
26
  </div>
27
27
  </div>
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ghoul
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghoul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70361372280140 !ruby/object:Gem::Requirement
16
+ requirement: &70155838986120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70361372280140
24
+ version_requirements: *70155838986120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sinatra
27
- requirement: &70361372279540 !ruby/object:Gem::Requirement
27
+ requirement: &70155838985520 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.3.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70361372279540
35
+ version_requirements: *70155838985520
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sass
38
- requirement: &70361372279080 !ruby/object:Gem::Requirement
38
+ requirement: &70155838985080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70361372279080
46
+ version_requirements: *70155838985080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: grit
49
- requirement: &70361372278460 !ruby/object:Gem::Requirement
49
+ requirement: &70155838980900 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70361372278460
57
+ version_requirements: *70155838980900
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: georgedrummond_sinatra_helpers
60
- requirement: &70361372277880 !ruby/object:Gem::Requirement
60
+ requirement: &70155838980300 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70361372277880
68
+ version_requirements: *70155838980300
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ghoul_grack
71
- requirement: &70361372276360 !ruby/object:Gem::Requirement
71
+ requirement: &70155838978100 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - =
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.0.1
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70361372276360
79
+ version_requirements: *70155838978100
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: coderay
82
- requirement: &70361372275940 !ruby/object:Gem::Requirement
82
+ requirement: &70155838977640 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70361372275940
90
+ version_requirements: *70155838977640
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: redcarpet
93
- requirement: &70361372268960 !ruby/object:Gem::Requirement
93
+ requirement: &70155838977060 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70361372268960
101
+ version_requirements: *70155838977060
102
102
  description: Ghoul is a simple yet good looking interface for your git repositories
103
103
  written in sinatra. It is currently only for demonstration purposes and use on your
104
104
  secure local machine as it does not enforce any authentication as of yet.