zitgit 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,9 @@
1
1
  - heads(commit).each do |head|
2
- .ref_label.branch_label
3
- = head.name
2
+ .ref_label.branch_label data-dropdown-name="branches"
3
+ a href="ref/#{URI::encode(head.name, '/')}" = head.name
4
4
  - remotes(commit).each do |head|
5
- .ref_label.remote_label
6
- = head.name
5
+ .ref_label.remote_label data-dropdown-name="remotes"
6
+ a href="ref/#{URI::encode(head.name, '/')}" = head.name
7
7
  - tags(commit).each do |head|
8
- .ref_label.tag_label
9
- = head.name
8
+ .ref_label.tag_label data-dropdown-name="tags"
9
+ a href="ref/#{URI::encode(head.name, '/')}" = head.name
@@ -1,7 +1,7 @@
1
1
  table.large-12.commits-table
2
2
  thead
3
3
  tr
4
- th.badges SHA
4
+ th.badges Info
5
5
  th.author Author
6
6
  th.message Message
7
7
  tbody
@@ -9,14 +9,15 @@ table.large-12.commits-table
9
9
  tr class=('selected' if i==0)
10
10
  td.badges
11
11
  == slim :'commits/labels', :locals => {commit: commit}, :layout => false
12
- .sha
13
- = commit.sha
12
+ .sha = commit.sha
13
+ .date = commit.date.strftime("%d.%m.%Y %H:%M")
14
14
  td.author
15
15
  =' commit.author.name
16
16
  = commit.author.email
17
17
  td.hidden
18
18
  == slim :'commits/detail', :locals => {commit: commit}, :layout => false
19
19
  td.message
20
- = commit.message
20
+ div
21
+ = commit.message
21
22
 
22
23
 
@@ -0,0 +1,11 @@
1
+ - diff.diff.lines.each do |line|
2
+ - if line.match /^\-\-\- a/
3
+ .diff-first-line.diff-a
4
+ = line
5
+ - elsif line.match /^\+\+\+ b/
6
+ .diff-first-line.diff-b
7
+ = line
8
+ - if diff.a_blob
9
+ img src="data:#{diff.a_blob.mime_type};base64,#{Base64.encode64(diff.a_blob.data)}"
10
+ - if diff.b_blob
11
+ img src="data:#{diff.b_blob.mime_type};base64,#{Base64.encode64(diff.b_blob.data)}"
@@ -0,0 +1,12 @@
1
+ - diff.diff.lines.each do |line|
2
+ - if line.match /^\-\-\- a/
3
+ .diff-first-line.diff-a
4
+ = line
5
+ - elsif line.match /^\+\+\+ b/
6
+ .diff-first-line.diff-b
7
+ = line
8
+ - elsif line.match /^\+\+\+ \/dev\/null/ or line.match /^\-\-\- \/dev\/null/
9
+ - elsif line.match /^@@ -/
10
+ .diff-summ-line
11
+ = summ_line(line)
12
+ - break
@@ -0,0 +1,5 @@
1
+ - if line.match(/(\s+)\n$/)
2
+ = line.rstrip
3
+ span.trailing = Regexp.last_match(1)
4
+ - else
5
+ = line
@@ -1,4 +1,9 @@
1
1
  ul.diff-names
2
+ - if diffs.count > 1
3
+ li.all.selected All files
4
+ -else
5
+ li.all.selected.hidden All files
6
+
2
7
  - diffs.each do |diff|
3
8
  li
4
9
  - if diff.deleted_file
@@ -16,24 +21,28 @@ ul.diff-names
16
21
  ul.diffs
17
22
  - diffs.each do |diff|
18
23
  li
19
- - diff.diff.lines.each do |line|
20
- - if line.match /^\-\-\- a/
21
- .diff-first-line.diff-a
22
- = line
23
- - elsif line.match /^\+\+\+ b/
24
- .diff-first-line.diff-b
25
- = line
26
- - elsif line.match /^@@ -/
27
- .diff-summ-line
28
- = line
29
- - elsif line[0] == '+'
30
- .diff-added-line
31
- = line
32
- - elsif line[0] == '-'
33
- .diff-removed-line
34
- = line
35
- - else
36
- .diff-line
37
- = line
38
-
39
-
24
+ - if is_image(diff)
25
+ == slim :'diffs/image', :locals => {diff: diff}, :layout => false
26
+ - elsif large_diff?(diff)
27
+ == slim :'diffs/large', :locals => {diff: diff}, :layout => false
28
+ - else
29
+ - diff.diff.lines.each do |line|
30
+ - if line.match /^\-\-\- a/
31
+ .diff-first-line.diff-a
32
+ = line
33
+ - elsif line.match /^\+\+\+ b/
34
+ .diff-first-line.diff-b
35
+ = line
36
+ - elsif line.match /^\+\+\+ \/dev\/null/ or line.match /^\-\-\- \/dev\/null/
37
+ - elsif line.match /^@@ -/
38
+ .diff-summ-line
39
+ = summ_line(line)
40
+ - elsif line[0] == '+'
41
+ .diff-added-line
42
+ == slim(:'diffs/line', :locals => {line: line}, :layout => false).force_encoding('utf-8')
43
+ - elsif line[0] == '-'
44
+ .diff-removed-line
45
+ == slim(:'diffs/line', :locals => {line: line}, :layout => false).force_encoding('utf-8')
46
+ - else
47
+ .diff-line
48
+ == slim(:'diffs/line', :locals => {line: line}, :layout => false).force_encoding('utf-8')
data/views/index.slim CHANGED
@@ -28,9 +28,14 @@ nav.top-bar
28
28
  a.active.current_branch
29
29
  ul.dropdown.tags
30
30
  == slim :'refs/dropdown', :locals => {refs: @tags}, :layout => false
31
+ ul.right
32
+ li
33
+ a.refresh href="/"
34
+ img src="images/refresh.png"
31
35
  .loader
32
- .main.row
36
+ .main
33
37
  .history.large-6.columns
38
+ == slim :'status/list', :locals => {repo: @repo}, :layout => false
34
39
  == slim :'commits/list', :locals => {commits: @commits}, :layout => false
35
40
  .show_commit.large-6.columns
36
41
  == slim :'commits/detail', :locals => {commit: @last_commit}, :layout => false
data/views/layout.slim CHANGED
@@ -1,6 +1,7 @@
1
1
  html
2
2
  head
3
3
  link rel="stylesheet" href="css/app.css"
4
+ title ="Zitgit - #{ @repo_name }"
4
5
  body
5
6
  == yield
6
7
  script type="text/javascript" src="js/jquery.js"
@@ -1,3 +1,4 @@
1
1
  - refs.each do |ref|
2
2
  li
3
- a href="ref/#{URI::encode(ref.name, '/')}" = ref.name
3
+ - unless is_head_ref(ref)
4
+ a href="ref/#{URI::encode(ref.name, '/')}" = ref.name
@@ -0,0 +1,10 @@
1
+ .diff-first-line.diff-b
2
+ |+++ b/
3
+ = item.path
4
+ .diff-summ-line
5
+ |1 -> 1-
6
+ = item.blob.content.lines.count
7
+ - item.blob.content.lines.each do |line|
8
+ .diff-added-line
9
+ == slim(:'diffs/line', :locals => {line: '+'+line}, :layout => false).force_encoding('utf-8')
10
+
@@ -0,0 +1,21 @@
1
+ - item.diff_string.lines.each do |line|
2
+ - if line.match /^\-\-\- a/
3
+ .diff-first-line.diff-a
4
+ = line
5
+ - elsif line.match /^\+\+\+ b/
6
+ .diff-first-line.diff-b
7
+ = line
8
+ - elsif line.match /^\+\+\+ \/dev\/null/ or line.match /^\-\-\- \/dev\/null/
9
+ - elsif line.match /^@@ -/
10
+ .diff-summ-line
11
+ = summ_line(line)
12
+ - elsif line[0] == '+'
13
+ .diff-added-line
14
+ == slim(:'diffs/line', :locals => {line: line}, :layout => false).force_encoding('utf-8')
15
+ - elsif line[0] == '-'
16
+ .diff-removed-line
17
+ == slim(:'diffs/line', :locals => {line: line}, :layout => false).force_encoding('utf-8')
18
+ - else
19
+ .diff-line
20
+ == slim(:'diffs/line', :locals => {line: line}, :layout => false).force_encoding('utf-8')
21
+
@@ -0,0 +1,9 @@
1
+ .diff-first-line.diff-b
2
+ |--- a/
3
+ = item.path
4
+ .diff-summ-line
5
+ = "1-#{item.blob.content.lines.count} -> 1"
6
+ - item.blob.content.lines.each do |line|
7
+ .diff-removed-line
8
+ == slim(:'diffs/line', :locals => {line: '-'+line}, :layout => false).force_encoding('utf-8')
9
+
@@ -0,0 +1,30 @@
1
+ .status
2
+ a.status-link Stage
3
+ .status_content
4
+ .commit
5
+ h4 Stage
6
+ ul.diff-names
7
+ li.all.selected All files
8
+ - @repo.status.added.each do |file|
9
+ li
10
+ a.new_file = file[1].path
11
+ - @repo.status.changed.each do |file|
12
+ - if not file[1].sha_index.match(/^0+$/)
13
+ li
14
+ a.changed = file[1].path
15
+ - @repo.status.deleted.each do |file|
16
+ - if file[1].stage.nil?
17
+ li
18
+ a.deleted = file[1].path
19
+ ul.diffs
20
+ - @repo.status.added.each do |file|
21
+ li
22
+ == slim(:'status/added', :locals => {item: file[1]}, :layout => false)
23
+ - @repo.status.changed.each do |file|
24
+ - if not file[1].sha_index.match(/^0+$/)
25
+ li
26
+ == slim(:'status/changed', :locals => {item: file[1]}, :layout => false)
27
+ - @repo.status.deleted.each do |file|
28
+ - if file[1].stage.nil?
29
+ li
30
+ == slim(:'status/deleted', :locals => {item: file[1]}, :layout => false)
data/zitgit.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'sinatra', "~> 1.4"
22
22
  spec.add_dependency 'slim', "~> 1.3"
23
+ spec.add_dependency 'gitlab-grit', "~> 2.5.1"
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.3"
25
26
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zitgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-01 00:00:00.000000000 Z
12
+ date: 2013-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: '1.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: gitlab-grit
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.5.1
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.5.1
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: bundler
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -171,11 +187,15 @@ files:
171
187
  - README.md
172
188
  - Rakefile
173
189
  - bin/zitgit
190
+ - lib/grit/status.rb
174
191
  - lib/zitgit.rb
192
+ - lib/zitgit/helpers/git.rb
193
+ - lib/zitgit/helpers/views.rb
175
194
  - lib/zitgit/version.rb
176
195
  - public/coffee/application.coffee
177
196
  - public/css/app.css
178
197
  - public/images/loader.gif
198
+ - public/images/refresh.png
179
199
  - public/js/application.js
180
200
  - public/js/jquery.js
181
201
  - public/js/jquery.nicescroll.js
@@ -222,10 +242,17 @@ files:
222
242
  - views/commits/detail.slim
223
243
  - views/commits/labels.slim
224
244
  - views/commits/list.slim
245
+ - views/diffs/image.slim
246
+ - views/diffs/large.slim
247
+ - views/diffs/line.slim
225
248
  - views/diffs/list.slim
226
249
  - views/index.slim
227
250
  - views/layout.slim
228
251
  - views/refs/dropdown.slim
252
+ - views/status/added.slim
253
+ - views/status/changed.slim
254
+ - views/status/deleted.slim
255
+ - views/status/list.slim
229
256
  - zitgit.gemspec
230
257
  homepage: ''
231
258
  licenses:
@@ -248,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
275
  version: '0'
249
276
  requirements: []
250
277
  rubyforge_project:
251
- rubygems_version: 1.8.25
278
+ rubygems_version: 1.8.24
252
279
  signing_key:
253
280
  specification_version: 3
254
281
  summary: Git repository viewer