zitgit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +5 -0
  3. data/Gemfile.lock +94 -0
  4. data/Guardfile +6 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +29 -0
  7. data/Rakefile +1 -0
  8. data/bin/zitgit +4 -0
  9. data/lib/zitgit/version.rb +3 -0
  10. data/lib/zitgit.rb +57 -0
  11. data/public/coffee/application.coffee +54 -0
  12. data/public/css/app.css +4071 -0
  13. data/public/images/loader.gif +0 -0
  14. data/public/js/application.js +69 -0
  15. data/public/js/jquery.js +5 -0
  16. data/public/js/jquery.nicescroll.js +111 -0
  17. data/public/scss/app.scss +155 -0
  18. data/public/scss/foundation/foundation/_variables.scss +1037 -0
  19. data/public/scss/foundation/foundation/components/_alert-boxes.scss +106 -0
  20. data/public/scss/foundation/foundation/components/_block-grid.scss +70 -0
  21. data/public/scss/foundation/foundation/components/_breadcrumbs.scss +124 -0
  22. data/public/scss/foundation/foundation/components/_button-groups.scss +88 -0
  23. data/public/scss/foundation/foundation/components/_buttons.scss +226 -0
  24. data/public/scss/foundation/foundation/components/_clearing.scss +211 -0
  25. data/public/scss/foundation/foundation/components/_custom-forms.scss +240 -0
  26. data/public/scss/foundation/foundation/components/_dropdown-buttons.scss +114 -0
  27. data/public/scss/foundation/foundation/components/_dropdown.scss +149 -0
  28. data/public/scss/foundation/foundation/components/_flex-video.scss +45 -0
  29. data/public/scss/foundation/foundation/components/_forms.scss +348 -0
  30. data/public/scss/foundation/foundation/components/_global.scss +267 -0
  31. data/public/scss/foundation/foundation/components/_grid.scss +184 -0
  32. data/public/scss/foundation/foundation/components/_inline-lists.scss +52 -0
  33. data/public/scss/foundation/foundation/components/_joyride.scss +208 -0
  34. data/public/scss/foundation/foundation/components/_keystrokes.scss +56 -0
  35. data/public/scss/foundation/foundation/components/_labels.scss +84 -0
  36. data/public/scss/foundation/foundation/components/_magellan.scss +21 -0
  37. data/public/scss/foundation/foundation/components/_orbit.scss +207 -0
  38. data/public/scss/foundation/foundation/components/_pagination.scss +99 -0
  39. data/public/scss/foundation/foundation/components/_panels.scss +76 -0
  40. data/public/scss/foundation/foundation/components/_pricing-tables.scss +130 -0
  41. data/public/scss/foundation/foundation/components/_progress-bars.scss +70 -0
  42. data/public/scss/foundation/foundation/components/_reveal.scss +131 -0
  43. data/public/scss/foundation/foundation/components/_section.scss +303 -0
  44. data/public/scss/foundation/foundation/components/_side-nav.scss +68 -0
  45. data/public/scss/foundation/foundation/components/_split-buttons.scss +159 -0
  46. data/public/scss/foundation/foundation/components/_sub-nav.scss +67 -0
  47. data/public/scss/foundation/foundation/components/_switch.scss +249 -0
  48. data/public/scss/foundation/foundation/components/_tables.scss +80 -0
  49. data/public/scss/foundation/foundation/components/_thumbs.scss +47 -0
  50. data/public/scss/foundation/foundation/components/_tooltips.scss +113 -0
  51. data/public/scss/foundation/foundation/components/_top-bar.scss +462 -0
  52. data/public/scss/foundation/foundation/components/_type.scss +422 -0
  53. data/public/scss/foundation/foundation/components/_visibility.scss +320 -0
  54. data/public/scss/foundation/foundation.scss +46 -0
  55. data/public/scss/foundation/normalize.scss +402 -0
  56. data/views/branch.slim +1 -0
  57. data/views/commits/detail.slim +12 -0
  58. data/views/commits/labels.slim +9 -0
  59. data/views/commits/list.slim +22 -0
  60. data/views/diffs/list.slim +39 -0
  61. data/views/index.slim +36 -0
  62. data/views/layout.slim +9 -0
  63. data/views/refs/dropdown.slim +3 -0
  64. data/zitgit.gemspec +30 -0
  65. metadata +239 -0
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+ gem "grit", '~> 2.5.0', git: 'https://github.com/gitlabhq/grit.git', ref: '42297cdcee16284d2e4eff23d41377f52fc28b9d'
5
+
data/Gemfile.lock ADDED
@@ -0,0 +1,94 @@
1
+ GIT
2
+ remote: https://github.com/gitlabhq/grit.git
3
+ revision: 42297cdcee16284d2e4eff23d41377f52fc28b9d
4
+ ref: 42297cdcee16284d2e4eff23d41377f52fc28b9d
5
+ specs:
6
+ grit (2.5.0)
7
+ diff-lcs (~> 1.1)
8
+ mime-types (~> 1.15)
9
+ posix-spawn (~> 0.3.6)
10
+
11
+ PATH
12
+ remote: .
13
+ specs:
14
+ zitgit (0.0.1)
15
+ sinatra (~> 1.4)
16
+ slim (~> 1.3)
17
+
18
+ GEM
19
+ remote: https://rubygems.org/
20
+ specs:
21
+ coderay (1.0.9)
22
+ coffee-script (2.2.0)
23
+ coffee-script-source
24
+ execjs
25
+ coffee-script-source (1.6.2)
26
+ diff-lcs (1.2.3)
27
+ execjs (1.4.0)
28
+ multi_json (~> 1.0)
29
+ ffi (1.7.0)
30
+ formatador (0.2.4)
31
+ guard (1.8.0)
32
+ formatador (>= 0.2.4)
33
+ listen (>= 1.0.0)
34
+ lumberjack (>= 1.0.2)
35
+ pry (>= 0.9.10)
36
+ thor (>= 0.14.6)
37
+ guard-coffeescript (1.3.0)
38
+ coffee-script (>= 2.2.0)
39
+ guard (>= 1.1.0)
40
+ guard-sass (1.0.5)
41
+ guard (>= 1.1.0)
42
+ sass (>= 3.1)
43
+ libv8 (3.11.8.17)
44
+ listen (1.0.2)
45
+ rb-fsevent (>= 0.9.3)
46
+ rb-inotify (>= 0.9)
47
+ rb-kqueue (>= 0.2)
48
+ lumberjack (1.0.3)
49
+ method_source (0.8.1)
50
+ mime-types (1.22)
51
+ multi_json (1.7.2)
52
+ posix-spawn (0.3.6)
53
+ pry (0.9.12)
54
+ coderay (~> 1.0.5)
55
+ method_source (~> 0.8)
56
+ slop (~> 3.4)
57
+ rack (1.5.2)
58
+ rack-protection (1.5.0)
59
+ rack
60
+ rake (10.0.4)
61
+ rb-fsevent (0.9.3)
62
+ rb-inotify (0.9.0)
63
+ ffi (>= 0.5.0)
64
+ rb-kqueue (0.2.0)
65
+ ffi (>= 0.5.0)
66
+ ref (1.0.4)
67
+ sass (3.2.7)
68
+ sinatra (1.4.2)
69
+ rack (~> 1.5, >= 1.5.2)
70
+ rack-protection (~> 1.4)
71
+ tilt (~> 1.3, >= 1.3.4)
72
+ slim (1.3.6)
73
+ temple (~> 0.5.5)
74
+ tilt (~> 1.3.3)
75
+ slop (3.4.4)
76
+ temple (0.5.5)
77
+ therubyracer (0.11.4)
78
+ libv8 (~> 3.11.8.12)
79
+ ref
80
+ thor (0.18.1)
81
+ tilt (1.3.6)
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ bundler (~> 1.3)
88
+ grit (~> 2.5.0)!
89
+ guard (~> 1.8)
90
+ guard-coffeescript (~> 1.3)
91
+ guard-sass (~> 1.0)
92
+ rake (~> 10.0)
93
+ therubyracer (~> 0.11)
94
+ zitgit!
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'sass', :input => 'public/scss', :output => 'public/css'
5
+
6
+ guard 'coffeescript', :input => 'public/coffee', :output => 'public/js'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Oleg Potapov
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Zitgit
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'zitgit'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install zitgit
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/zitgit ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'zitgit'
4
+ Zitgit::Zitgit.run!
@@ -0,0 +1,3 @@
1
+ module Zitgit
2
+ VERSION = "0.0.1"
3
+ end
data/lib/zitgit.rb ADDED
@@ -0,0 +1,57 @@
1
+ require_relative "zitgit/version"
2
+ require 'bundler'
3
+ Dir.chdir(File.dirname(__FILE__)) do
4
+ Bundler.setup
5
+ end
6
+ require 'sinatra/base'
7
+ require 'grit'
8
+ require 'slim'
9
+
10
+ module Zitgit
11
+ class Zitgit < Sinatra::Base
12
+ configure do
13
+ set :root, File.expand_path('..', File.dirname(__FILE__))
14
+ end
15
+
16
+ helpers do
17
+ def heads(commit)
18
+ repo = Grit::Repo.new('.')
19
+ repo.heads.select{|head| head.commit.id == commit.id}
20
+ end
21
+
22
+ def remotes(commit)
23
+ repo = Grit::Repo.new('.')
24
+ repo.remotes.select{|head| head.commit.id == commit.id}
25
+ end
26
+
27
+ def tags(commit)
28
+ repo = Grit::Repo.new('.')
29
+ repo.tags.select{|head| head.commit.id == commit.id}
30
+ end
31
+ end
32
+
33
+ get '/' do
34
+ repo = Grit::Repo.new('.')
35
+ current_branch = Grit::Head.current(repo)
36
+ commits = repo.commits(current_branch.name, 200)
37
+ repo_name = File.basename(repo.working_dir)
38
+ @branches = repo.heads
39
+ @remotes = repo.remotes
40
+ @tags = repo.tags
41
+ slim :index, :locals => {
42
+ current_branch: current_branch,
43
+ commits: commits,
44
+ repo_name: repo_name,
45
+ last_commit: commits[0]
46
+ }
47
+ end
48
+
49
+ get "/ref/:ref_name" do |ref_name|
50
+ repo = Grit::Repo.new('')
51
+ commits = repo.commits(ref_name, 200)
52
+ slim :branch, :locals => { commits: commits }, :layout => false
53
+ end
54
+
55
+ run! if app_file == $0
56
+ end
57
+ end
@@ -0,0 +1,54 @@
1
+ ChangeCommit = ($commit)->
2
+ $target_commit = $commit.clone()
3
+ $('.commits-table tr.selected').removeClass 'selected'
4
+ $commit.parents('tr').addClass 'selected'
5
+ $('.show_commit').html $target_commit
6
+ UpdateDiffsWidth()
7
+
8
+ SetHeight = ->
9
+ commit_offset = $('.show_commit').offset().top
10
+ $('.show_commit').height(window.innerHeight - commit_offset)
11
+ history_offset = $('.history').offset().top
12
+ $('.history').height(window.innerHeight - history_offset)
13
+
14
+
15
+ UpdateDiffsWidth = ->
16
+ $('.show_commit .diffs li').each (index)->
17
+ $(this).find('div').css('width', $(this)[0].scrollWidth)
18
+
19
+ $ ->
20
+ $('.top-bar .dropdown li a').on 'click', (e) ->
21
+ e.preventDefault()
22
+ $link = $(this)
23
+ timeout = setTimeout ->
24
+ $('.loader').show()
25
+ $('.main').hide()
26
+ , 1500
27
+ $.get $link.attr('href'), (data)->
28
+ clearTimeout(timeout)
29
+ $('.loader').hide()
30
+ $('.current_branch').text ''
31
+ $link.parents('.has-dropdown').find('.current_branch').text $link.text()
32
+ $('.commits-table').replaceWith data
33
+ $('.main').show()
34
+ ChangeCommit $('.commits-table tbody tr:first .commit')
35
+
36
+ $('.history').on 'click', '.commits-table tr', (e)->
37
+ ChangeCommit $(this).find('.commit')
38
+
39
+ UpdateDiffsWidth()
40
+ SetHeight()
41
+
42
+ $(window).resize ->
43
+ SetHeight()
44
+
45
+ $('.show_commit').niceScroll({
46
+ cursorcolor: '#ccc',
47
+ cursorwidth: 14
48
+ })
49
+ $('.history').niceScroll({
50
+ cursorcolor: '#ccc',
51
+ cursorwidth: 14,
52
+ railalign: 'left',
53
+ horizrailenabled: false
54
+ })