gitki 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/ChangeLog +0 -0
  2. data/README.rdoc +74 -0
  3. data/Rakefile +59 -0
  4. data/app.rb +90 -0
  5. data/bin/gitki +3 -0
  6. data/bin/gitki.ru +13 -0
  7. data/config.ru +3 -0
  8. data/console +13 -0
  9. data/lib/gitki.png +0 -0
  10. data/lib/gitki.rb +116 -0
  11. data/lib/home_template.haml +17 -0
  12. data/lib/navigation_template.haml +4 -0
  13. data/public/background.png +0 -0
  14. data/public/favicon.ico +0 -0
  15. data/setting.yml +3 -0
  16. data/spec/gitki_spec.rb +104 -0
  17. data/vendor/git_store/LICENSE +18 -0
  18. data/vendor/git_store/README.md +147 -0
  19. data/vendor/git_store/Rakefile +35 -0
  20. data/vendor/git_store/TODO +3 -0
  21. data/vendor/git_store/git_store.gemspec +40 -0
  22. data/vendor/git_store/lib/git_store.rb +373 -0
  23. data/vendor/git_store/lib/git_store/blob.rb +32 -0
  24. data/vendor/git_store/lib/git_store/commit.rb +65 -0
  25. data/vendor/git_store/lib/git_store/diff.rb +76 -0
  26. data/vendor/git_store/lib/git_store/handlers.rb +36 -0
  27. data/vendor/git_store/lib/git_store/pack.rb +425 -0
  28. data/vendor/git_store/lib/git_store/tag.rb +40 -0
  29. data/vendor/git_store/lib/git_store/tree.rb +183 -0
  30. data/vendor/git_store/lib/git_store/user.rb +29 -0
  31. data/vendor/git_store/test/bare_store_spec.rb +33 -0
  32. data/vendor/git_store/test/benchmark.rb +30 -0
  33. data/vendor/git_store/test/commit_spec.rb +81 -0
  34. data/vendor/git_store/test/git_store_spec.rb +257 -0
  35. data/vendor/git_store/test/helper.rb +18 -0
  36. data/vendor/git_store/test/tree_spec.rb +92 -0
  37. data/views/layout.haml +23 -0
  38. data/views/page.haml +7 -0
  39. data/views/pages.haml +9 -0
  40. data/views/styles.sass +87 -0
  41. metadata +103 -0
@@ -0,0 +1,18 @@
1
+
2
+ def git_show(id)
3
+ IO.popen("git show #{id}") do |io|
4
+ io.gets
5
+ end
6
+ end
7
+
8
+ def git_ls_tree(id)
9
+ lines = []
10
+
11
+ IO.popen("git ls-tree #{id}") do |io|
12
+ while line = io.gets
13
+ lines << line.split(" ")
14
+ end
15
+ end
16
+
17
+ lines
18
+ end
@@ -0,0 +1,92 @@
1
+ require "#{File.dirname(__FILE__)}/../lib/git_store"
2
+ require "#{File.dirname(__FILE__)}/helper"
3
+ require 'pp'
4
+
5
+ describe GitStore::Tree do
6
+ REPO = '/tmp/git_store_test'
7
+
8
+ attr_reader :store, :tree
9
+
10
+ before(:each) do
11
+ FileUtils.rm_rf REPO
12
+ Dir.mkdir REPO
13
+ Dir.chdir REPO
14
+
15
+ `git init`
16
+
17
+ @store = GitStore.new(REPO)
18
+ end
19
+
20
+ it "should parse a table" do
21
+ tree = GitStore::Tree.new(store)
22
+
23
+ a = store.put_object("blob", "a")
24
+ b = store.put_object("blob", "b")
25
+ c = store.put_object("blob", "c")
26
+
27
+ data =
28
+ "100644 a\0#{ [a].pack("H*") }" +
29
+ "100644 b\0#{ [b].pack("H*") }" +
30
+ "100644 c\0#{ [c].pack("H*") }"
31
+
32
+ tree.parse(data)
33
+
34
+ tree.get('a').should == 'a'
35
+ tree.get('b').should == 'b'
36
+ tree.get('c').should == 'c'
37
+ end
38
+
39
+ it "should write a table" do
40
+ tree = GitStore::Tree.new(store)
41
+
42
+ tree['a'] = 'a'
43
+ tree['b'] = 'b'
44
+ tree['c'] = 'c'
45
+
46
+ id = tree.write
47
+
48
+ a = ["2e65efe2a145dda7ee51d1741299f848e5bf752e"].pack('H*')
49
+ b = ["63d8dbd40c23542e740659a7168a0ce3138ea748"].pack('H*')
50
+ c = ["3410062ba67c5ed59b854387a8bc0ec012479368"].pack('H*')
51
+
52
+ data =
53
+ "100644 a\0#{a}" +
54
+ "100644 b\0#{b}" +
55
+ "100644 c\0#{c}"
56
+
57
+ store.get_object(id).should == ['tree', data]
58
+ end
59
+
60
+ it "should save trees" do
61
+ tree = GitStore::Tree.new(store)
62
+
63
+ tree['a'] = 'a'
64
+ tree['b'] = 'b'
65
+ tree['c'] = 'c'
66
+
67
+ tree.write
68
+
69
+ git_ls_tree(tree.id).should ==
70
+ [["100644", "blob", "2e65efe2a145dda7ee51d1741299f848e5bf752e", "a"],
71
+ ["100644", "blob", "63d8dbd40c23542e740659a7168a0ce3138ea748", "b"],
72
+ ["100644", "blob", "3410062ba67c5ed59b854387a8bc0ec012479368", "c"]]
73
+ end
74
+
75
+ it "should save nested trees" do
76
+ tree = GitStore::Tree.new(store)
77
+
78
+ tree['x/a'] = 'a'
79
+ tree['x/b'] = 'b'
80
+ tree['x/c'] = 'c'
81
+
82
+ tree.write
83
+
84
+ git_ls_tree(tree.id) ==
85
+ [["040000", "tree", "24e88cb96c396400000ef706d1ca1ed9a88251aa", "x"]]
86
+
87
+ git_ls_tree("24e88cb96c396400000ef706d1ca1ed9a88251aa").should ==
88
+ [["100644", "blob", "2e65efe2a145dda7ee51d1741299f848e5bf752e", "a"],
89
+ ["100644", "blob", "63d8dbd40c23542e740659a7168a0ce3138ea748", "b"],
90
+ ["100644", "blob", "3410062ba67c5ed59b854387a8bc0ec012479368", "c"]]
91
+ end
92
+ end
@@ -0,0 +1,23 @@
1
+ %html
2
+ %head
3
+ %meta{:"http-equiv"=>"Content-Type", :content=>"text/html;charset=UTF-8"}
4
+ %title= options.title
5
+ %link{:rel=>'stylesheet', :type=>'text/css', :href=>'/css', :media=>'screen,tv,projection'}
6
+ %script{:type=>"text/javascript", :src=>"/jquery.js"}
7
+ %body
8
+ #wrap
9
+ #header
10
+ %h1
11
+ %a{:href => '/'}= options.title
12
+
13
+ #content{:style => 'float: left; width: 70%'}
14
+ = yield
15
+
16
+ #navigation{:style => 'float: right; width: 26%'}
17
+ = navigation
18
+
19
+ %div{:style => 'clear: both;'}
20
+
21
+ #footer
22
+ Powerd by
23
+ %a{:href=>'http://github.com/jugyo/gitki'} Gitki
@@ -0,0 +1,7 @@
1
+ .page
2
+ .page_header
3
+ %h2.title= @page.title
4
+ .page_body
5
+ ~ markup(@page.body)
6
+ .page_footer
7
+ %a{:href => "/raw/#{@name}"}= 'raw'
@@ -0,0 +1,9 @@
1
+ .page
2
+ .page_header
3
+ %h2.title Pages
4
+ .page_body
5
+ %ul
6
+ - @pages.each do |name, page|
7
+ %li
8
+ %a{:href => "/#{name}"}= page.title.empty? ? name : page.title
9
+ .page_footer
@@ -0,0 +1,87 @@
1
+ body
2
+ font-family: Verdana, Helvetica
3
+ font-size: 13.0px
4
+ margin: 0
5
+ padding: 0
6
+ background: url(/background.png)
7
+ background-repeat: no-repeat
8
+ background-position: top right
9
+
10
+ h1
11
+ font-size: 240%
12
+ margin: 16px 4px
13
+ padding: 0
14
+ a
15
+ color: blue
16
+
17
+ pre
18
+ margin: 4px 8px
19
+ padding: 4px 6px
20
+ border: solid 1px silver
21
+ background-color: #ECECEC
22
+
23
+ tt
24
+ padding: 1px 2px
25
+ background-color: #E7E7E7
26
+
27
+ #wrap
28
+ margin: 24px
29
+
30
+ #footer
31
+ margin: 4px
32
+ text-align: right
33
+ font-size: 86%
34
+ color: gray
35
+ a
36
+ color: orange
37
+
38
+ #content
39
+ border: solid 1px silver
40
+
41
+ .page
42
+ padding: 4px
43
+ h2
44
+ color: green
45
+ margin: 0
46
+ padding: 0
47
+ .page_header
48
+ border-bottom: dashed 1px silver
49
+ .page_body
50
+ padding: 10px
51
+ h3
52
+ font-size: 140%
53
+ color: gray
54
+ paddin: 0
55
+ border-bottom: solid 1px silver
56
+ margin: 24px 0 16px 0
57
+
58
+ .page_footer
59
+ text-align: right
60
+ a
61
+ color: gray
62
+
63
+ form.page_edit_form
64
+ a
65
+ color: gray
66
+
67
+ #navigation
68
+ border-left: dashed 1px silver
69
+ margin: 0 4px
70
+ padding: 4px
71
+ font-size: 86%
72
+ h3
73
+ color: gray
74
+ margin: 4px 0
75
+ a
76
+ color: green
77
+ ul
78
+ margin: 8px 0
79
+ padding: 0
80
+ li
81
+ margin: 1px 0
82
+ list-style: none
83
+
84
+ #error-message
85
+ font-weight: bold
86
+ margin: 12px
87
+ color: red
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gitki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - jugyo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-11 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.4
24
+ version:
25
+ description: Gitki is a wiki using git to store data.
26
+ email: jugyo.org@gmail.com
27
+ executables:
28
+ - gitki
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - Rakefile
35
+ - README.rdoc
36
+ - ChangeLog
37
+ - app.rb
38
+ - config.ru
39
+ - console
40
+ - setting.yml
41
+ - lib/gitki.png
42
+ - lib/gitki.rb
43
+ - lib/home_template.haml
44
+ - lib/navigation_template.haml
45
+ - spec/gitki_spec.rb
46
+ - bin/gitki
47
+ - bin/gitki.ru
48
+ - public/background.png
49
+ - public/favicon.ico
50
+ - vendor/git_store/git_store.gemspec
51
+ - vendor/git_store/lib/git_store/blob.rb
52
+ - vendor/git_store/lib/git_store/commit.rb
53
+ - vendor/git_store/lib/git_store/diff.rb
54
+ - vendor/git_store/lib/git_store/handlers.rb
55
+ - vendor/git_store/lib/git_store/pack.rb
56
+ - vendor/git_store/lib/git_store/tag.rb
57
+ - vendor/git_store/lib/git_store/tree.rb
58
+ - vendor/git_store/lib/git_store/user.rb
59
+ - vendor/git_store/lib/git_store.rb
60
+ - vendor/git_store/LICENSE
61
+ - vendor/git_store/Rakefile
62
+ - vendor/git_store/README.md
63
+ - vendor/git_store/test/bare_store_spec.rb
64
+ - vendor/git_store/test/benchmark.rb
65
+ - vendor/git_store/test/commit_spec.rb
66
+ - vendor/git_store/test/git_store_spec.rb
67
+ - vendor/git_store/test/helper.rb
68
+ - vendor/git_store/test/tree_spec.rb
69
+ - vendor/git_store/TODO
70
+ - views/layout.haml
71
+ - views/page.haml
72
+ - views/pages.haml
73
+ - views/styles.sass
74
+ has_rdoc: true
75
+ homepage: http://github.com/jugyo/gitki
76
+ licenses: []
77
+
78
+ post_install_message:
79
+ rdoc_options: []
80
+
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ version:
95
+ requirements: []
96
+
97
+ rubyforge_project: gitki
98
+ rubygems_version: 1.3.4
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Gitki is a wiki using git to store data.
102
+ test_files: []
103
+