gitspotter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,72 @@
1
1
  #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require "capillary/log_parser"
5
+ require "capillary/commit"
2
6
 
3
7
  require 'gitspotter'
4
8
 
9
+ gitrepo_dotgit_path = "." #TODO use ARGV[0] if present and a directory
10
+
11
+ # Steal logic from graphs_controller here...
12
+
13
+ # TODO generate json based on git log in given repo dir
14
+ data = `git --git-dir=./.git log --all --graph --pretty=format:"%H§%P§%ai§%ae§%d§%s§" --decorate=full -100 master`
15
+
16
+ parser = Capillary::LogParser.new
17
+ data.split("\n").each { |line| parser << line }
18
+ git_json = parser.to_json
19
+
20
+ html_visualization = git_json
21
+
22
+ #puts html_visualization
23
+
24
+ def html_body(git_json)
25
+ <<HTML_BODY
26
+ <!DOCTYPE html>
27
+ <html>
28
+ <head>
29
+ <title>Gitspotter generated graph</title>
30
+
31
+ <script src="http://localhost:3000/javascripts/lib/jquery.js" type="text/javascript"></script>
32
+ <script src="http://localhost:3000/javascripts/lib/raphael/raphael-min.js" type="text/javascript"></script>
33
+ <script src="http://localhost:3000/javascripts/lib/buster-core/lib/buster-core.js" type="text/javascript"></script>
34
+ <script src="http://localhost:3000/javascripts/lib/buster-core/lib/buster-event-emitter.js" type="text/javascript"></script>
35
+ <script src="http://localhost:3000/javascripts/lib/capillary/lib/capillary.js" type="text/javascript"></script>
36
+ <script src="http://localhost:3000/javascripts/lib/capillary/lib/capillary/branch.js" type="text/javascript"></script>
37
+ <script src="http://localhost:3000/javascripts/lib/capillary/lib/capillary/graph.js" type="text/javascript"></script>
38
+ <script src="http://localhost:3000/javascripts/lib/capillary/lib/capillary/formatters/scale.js" type="text/javascript"></script>
39
+ <script src="http://localhost:3000/javascripts/lib/capillary/lib/capillary/formatters/svg-data.js" type="text/javascript"></script>
40
+ <script src="http://localhost:3000/javascripts/lib/capillary/lib/capillary/formatters/raphael.js" type="text/javascript"></script>
41
+ <script src="http://localhost:3000/javascripts/lib/capillary/lib/capillary/formatters/message-markup.js" type="text/javascript"></script>
42
+
43
+
44
+ </head>
45
+ <body id="graphs">
46
+ <div id="wrapper">
47
+
48
+ <div id='graph-data' style="display:none">#{git_json}</div>
49
+
50
+ <div class="capillary" id="capillary-log"
51
+ data-id-url="/gitorious/gitorious/graph/{{id}}"
52
+ data-message-url="/gitorious/gitorious/commit/{{id}}"
53
+ data-capillary-url="/api/gitorious/gitorious/log/graph/master">
54
+ <h2>This page requires JavaScript</h2>
55
+ </div>
56
+
57
+ <script src="http://localhost:3000/javascripts/gitorious/log-graph.js" type="text/javascript"></script>
58
+ <script src="http://localhost:3000/javascripts/onload.js" type="text/javascript"></script>
59
+
60
+ </div>
61
+ </div>
62
+ </body>
63
+ </html>
64
+ HTML_BODY
65
+
66
+ end
67
+
68
+ puts html_body(git_json)
5
69
 
6
- puts "Nothing to see"
70
+ # TODO: handle param so i can point it to any git repo
71
+ # TODO: embed javascripts/styling/other assets: copy the files I need into js_assets folder in gem, concat them, embed in markup
72
+ # TODO: rewrite to enable non-flickering/reloading refreshes of the graph
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "capillary"
23
24
 
24
25
  s.add_development_dependency "minitest"
25
26
  s.add_development_dependency "shoulda"
@@ -4,7 +4,8 @@ require 'json'
4
4
  require 'pathname'
5
5
 
6
6
  class Gitspotter
7
- VERSION = "0.0.2"
7
+ VERSION = "0.0.3"
8
+
8
9
 
9
10
 
10
11
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gitspotter
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thomas Kjeldahl Nilsson
@@ -11,6 +11,22 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2013-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ type: :runtime
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ! '>='
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ name: capillary
14
30
  - !ruby/object:Gem::Dependency
15
31
  type: :development
16
32
  requirement: !ruby/object:Gem::Requirement