libdolt 0.20.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,11 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
- - jruby-18mode
5
- - jruby-19mode
6
4
  - rbx-18mode
7
5
  - rbx-19mode
8
6
  - ruby-head
9
- - jruby-head
10
7
  - 1.8.7
11
8
  - ree
data/Gemfile.lock CHANGED
@@ -45,5 +45,5 @@ DEPENDENCIES
45
45
  minitest (~> 2.0)
46
46
  mocha
47
47
  rake (~> 0.9)
48
- redcarpet (= 2.2.0)
48
+ redcarpet (~> 2.2)
49
49
  tiltout (~> 1.4)
@@ -17,5 +17,5 @@
17
17
  #++
18
18
 
19
19
  module Dolt
20
- VERSION = "0.20.0"
20
+ VERSION = "0.21.0"
21
21
  end
data/libdolt.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_development_dependency "minitest", "~> 2.0"
24
24
  s.add_development_dependency "rake", "~> 0.9"
25
- s.add_development_dependency "redcarpet", "2.2.0"
25
+ s.add_development_dependency "redcarpet", "~> 2.2"
26
26
  s.add_development_dependency "tiltout", "~>1.4"
27
27
  s.add_development_dependency "mocha"
28
28
 
@@ -0,0 +1,2 @@
1
+ x��AJ�0�a�9����$} <Dq�-&� ��D����� �~��_Ǿo|H�0M�� 5�%`S� ��54 ���x��ܗ�'4�-���F����e� ��ZF �N�����c;�&��*��w����ŧ>���F�S������N�gƽ�
2
+ �U�Q�Os߄P�
@@ -0,0 +1 @@
1
+ x���J1 �a�}��$MMg�&x�
@@ -1 +1 @@
1
- fc5f5fb50b435e183925b341909610aace90a413
1
+ e8d33ae69b8c4d3df1e8fad4733d69720b176849
@@ -22,31 +22,31 @@ require "ostruct"
22
22
  require "mocha/setup"
23
23
 
24
24
  describe Dolt::Git::Repository do
25
- before { @repository = Dolt::Git::Repository.new(".") }
25
+ before { @repository = Dolt::Git::Repository.new(Dolt.fixture_repo_path) }
26
26
 
27
27
  describe "#submodules" do
28
28
  it "returns list of submodules" do
29
- submodules = @repository.submodules("c1f6cd9")
29
+ submodules = @repository.submodules("60eebb9")
30
30
  url = "git://gitorious.org/gitorious/ui3.git"
31
31
 
32
32
  assert_equal [{ :path => "vendor/ui", :url => url }], submodules
33
33
  end
34
34
 
35
35
  it "returns empty array if no submodules" do
36
- submodules = @repository.submodules("26139a3")
36
+ submodules = @repository.submodules("fc5f5fb")
37
37
  assert_equal [], submodules
38
38
  end
39
39
  end
40
40
 
41
41
  describe "#tree" do
42
42
  it "includes submodule data for trees" do
43
- tree = @repository.tree("3dc532f", "vendor")
43
+ tree = @repository.tree("60eebb9", "vendor")
44
44
 
45
45
  assert_equal({
46
46
  :type => :submodule,
47
47
  :filemode => 57344,
48
48
  :name => "ui",
49
- :oid => "d167e3e1c17a27e4cf459dd380670801b0659659",
49
+ :oid => "77c88454e83e59772e9bf460ef22251cc9d63f9f",
50
50
  :url => "git://gitorious.org/gitorious/ui3.git"
51
51
  }, tree.entries.first)
52
52
  end
@@ -54,82 +54,89 @@ describe Dolt::Git::Repository do
54
54
 
55
55
  describe "#tree_entry" do
56
56
  it "includes submodule data for trees" do
57
- tree = @repository.tree_entry("3dc532f", "vendor")
57
+ tree = @repository.tree_entry("60eebb9", "vendor")
58
58
 
59
59
  assert_equal({
60
60
  :type => :submodule,
61
61
  :filemode => 57344,
62
62
  :name => "ui",
63
- :oid => "d167e3e1c17a27e4cf459dd380670801b0659659",
63
+ :oid => "77c88454e83e59772e9bf460ef22251cc9d63f9f",
64
64
  :url => "git://gitorious.org/gitorious/ui3.git"
65
65
  }, tree.entries.first)
66
66
  end
67
67
 
68
68
  it "returns blob" do
69
- blob = @repository.tree_entry("3dc532f", "Gemfile")
69
+ blob = @repository.tree_entry("fc5f5fb", "README.org")
70
70
 
71
71
  assert blob.is_a?(Rugged::Blob)
72
- assert_equal "source \"http://rubygems.org\"\n\ngemspec\n", blob.content
72
+ assert_equal "* This is a readme\n It even has some text in it\n", blob.content
73
73
  end
74
74
  end
75
75
 
76
76
  describe "#blame" do
77
77
  it "returns blame" do
78
- blame = @repository.blame("master", "Gemfile")
78
+ blame = @repository.blame("master", "README.org")
79
79
  assert Dolt::Git::Blame === blame
80
80
  end
81
81
 
82
82
  it "separates tree-like and path" do
83
- cmd = "git --git-dir #{@repository.path} blame -l -t -p master -- Gemfile"
83
+ cmd = "git --git-dir #{@repository.path} blame -l -t -p master -- README.org"
84
84
  Dolt::Git.expects(:shell).with(cmd).returns(Dolt::FakeProcess.new(0))
85
- @repository.blame("master", "Gemfile")
85
+ @repository.blame("master", "README.org")
86
86
  end
87
87
 
88
88
  it "does not allow injecting evil commands" do
89
- cmd = "git --git-dir #{@repository.path} blame -l -t -p master -- Gemfile\\; rm -fr /tmp"
89
+ cmd = "git --git-dir #{@repository.path} blame -l -t -p master -- README.org\\; rm -fr /tmp"
90
90
  Dolt::Git.expects(:shell).with(cmd).returns(Dolt::FakeProcess.new(0))
91
- @repository.blame("master", "Gemfile; rm -fr /tmp")
91
+ @repository.blame("master", "README.org; rm -fr /tmp")
92
92
  end
93
93
  end
94
94
 
95
95
  describe "#log" do
96
96
  it "returns commits" do
97
- log = @repository.log("master", "dolt.gemspec", 2)
97
+ log = @repository.log("master", "README.org", 2)
98
98
  assert_equal 2, log.length
99
99
  assert Hash === log[0]
100
+
101
+ log = @repository.log("master", "README.org", 1)
102
+ assert_equal 1, log.length
100
103
  end
101
104
  end
102
105
 
103
106
  describe "#tree_history" do
104
107
  it "fails if path is not a tree" do
105
- assert_raises Exception do |err|
106
- tree = @repository.tree_history("master", "Gemfile")
108
+ begin
109
+ tree = @repository.tree_history("master", "README.org")
110
+ raise "Should've raised an Exception"
111
+ rescue Exception => err
107
112
  assert_match /not a tree/, err.message
108
113
  end
109
114
  end
110
115
 
111
116
  it "fails if path does not exist in ref" do
112
- assert_raises Rugged::IndexerError do |err|
113
- tree = @repository.tree_history("26139a3", "test")
117
+ begin
118
+ tree = @repository.tree_history("fc5f5fb", "test")
119
+ raise "Should've raised an Rugged::IndexerError"
120
+ rescue Rugged::IndexerError => err
114
121
  assert_match /does not exist/, err.message
115
122
  end
116
123
  end
117
124
 
118
125
  it "returns tree with history" do
119
- log = @repository.tree_history("48ffbf7", "")
126
+ log = @repository.tree_history("e8d33ae", "")
120
127
 
121
- assert_equal 11, log.length
128
+ assert_equal 4, log.length
122
129
  expected = {
123
130
  :type => :blob,
124
131
  :oid => "e90021f89616ddf86855d05337c188408d3b417e",
125
132
  :filemode => 33188,
126
133
  :name => ".gitmodules",
127
134
  :history => [{
128
- :oid => "906d67b4f3e5de7364ba9b57d174d8998d53ced6",
135
+ :oid => "60eebb9021a6ce7d582c2f2d4aa5bfb3672150ae",
129
136
  :author => { :name => "Christian Johansen",
130
137
  :email => "christian@cjohansen.no" },
131
- :summary => "Working Moron server for viewing blobs",
132
- :date => Time.parse("Mon Sep 10 15:07:39 +0200 2012"),
138
+ :summary => "Add submodule",
139
+ :date => Time.parse("Tue Jun 18 09:01:48 +0200 2013"),
133
140
  :message => ""
134
141
  }]
135
142
  }
@@ -138,19 +145,19 @@ describe Dolt::Git::Repository do
138
145
  end
139
146
 
140
147
  it "returns nested tree with history" do
141
- log = @repository.tree_history("48ffbf7", "lib")
148
+ log = @repository.tree_history("e8d33ae", "lib")
142
149
 
143
150
  expected = [{
144
- :type => :tree,
145
- :oid => "58f84405b588699b24c619aa4cd83669c5623f88",
146
- :filemode => 16384,
147
- :name => "dolt",
151
+ :type => :blob,
152
+ :oid => "85026eda8302b98fa54cc24445a118028865a2e2",
153
+ :filemode => 33188,
154
+ :name => "foo.rb",
148
155
  :history => [{
149
- :oid => "8ab4f8c42511f727244a02aeee04824891610bbd",
150
- :author => { :name => "Christian Johansen",
151
- :email => "christian@gitorious.com" },
152
- :summary => "New version",
153
- :date => Time.parse("Mon Oct 1 16:34:00 +0200 2012"),
156
+ :oid => "fc5f5fb50b435e183925b341909610aace90a413",
157
+ :author => { :name => "Marius Mathiesen",
158
+ :email => "marius@gitorious.com" },
159
+ :summary => "Stuff and stuff",
160
+ :date => Time.parse("Tue Jun 11 13:10:31 +0200 2013"),
154
161
  :message => ""
155
162
  }]
156
163
  }]
@@ -25,8 +25,7 @@ class Resolver
25
25
  def initialize; @resolved = []; end
26
26
 
27
27
  def resolve(repo)
28
- dot_git = File.dirname(__FILE__) + "/../fixtures/dolt-test-repo.git"
29
- repository = Dolt::Git::Repository.new(dot_git)
28
+ repository = Dolt::Git::Repository.new(Dolt.fixture_repo_path)
30
29
  @resolved << repository
31
30
  repository
32
31
  end
data/test/test_helper.rb CHANGED
@@ -23,7 +23,14 @@ require "stringio"
23
23
 
24
24
  Bundler.require(:default, :test)
25
25
 
26
+ # Ensure consistent timing
27
+ ENV["TZ"] = "UTC-2"
28
+
26
29
  module Dolt
30
+ def self.fixture_repo_path
31
+ File.join(File.dirname(__FILE__), "fixtures/dolt-test-repo.git")
32
+ end
33
+
27
34
  module Html
28
35
  def select(html, tag_name)
29
36
  html.scan(/<#{tag_name}[^>]*>.*?<\/#{tag_name}>/m)
data/views/404.erb CHANGED
@@ -19,6 +19,12 @@
19
19
  %>
20
20
  <div class="container gts-body">
21
21
  <h1><%= @title = "No such path" %></h1>
22
- <h2><%= CGI::escapeElement(error.respond_to?(:message) ? error.message : error).gsub(/</, "&lt;") %></h2>
23
- <p><a href="<%= tree_url(repository_slug, ref, "") %>">Go back</a></p>
22
+ <% if defined?(error) && !error.nil? %>
23
+ <h2><%= CGI::escapeElement(error.respond_to?(:message) ? error.message : error).gsub(/</, "&lt;") %></h2>
24
+ <% end %>
25
+ <% if defined?(repository_slug) %>
26
+ <p><a href="<%= tree_url(repository_slug, ref, "") %>">Go back</a></p>
27
+ <% else %>
28
+ <p><a href="/">Go back</a></p>
29
+ <% end %>
24
30
  </div>
data/views/blob.erb CHANGED
@@ -28,6 +28,6 @@
28
28
  <li><a href="<%= raw_url(repository_slug, ref, path) %>">Raw blob</a></li>
29
29
  </ul>
30
30
  <%= breadcrumb(repository_slug, ref, path) %>
31
- <%= format_blob(path, blob.text(nil, Encoding.default_external), repository_slug, ref) %>
31
+ <%= format_blob(path, blob.text(nil, defined?(Encoding) ? Encoding.default_external : nil), repository_slug, ref) %>
32
32
  </div>
33
33
  </div>
data/views/tree.erb CHANGED
@@ -54,7 +54,7 @@
54
54
  <div class="gts-page-header">
55
55
  <h2><%= readme[:path] %></h2>
56
56
  </div>
57
- <%= format_blob(readme[:path], readme[:blob].text(nil, Encoding.default_external), repository_slug, ref) %>
57
+ <%= format_blob(readme[:path], readme[:blob].text(nil, defined?(Encoding) ? Encoding.default_external : nil), repository_slug, ref) %>
58
58
  </div>
59
59
  <% end %>
60
60
  </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libdolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.21.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-06-14 00:00:00.000000000 Z
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rugged
@@ -144,17 +144,17 @@ dependencies:
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
147
- - - '='
147
+ - - ~>
148
148
  - !ruby/object:Gem::Version
149
- version: 2.2.0
149
+ version: '2.2'
150
150
  type: :development
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  none: false
154
154
  requirements:
155
- - - '='
155
+ - - ~>
156
156
  - !ruby/object:Gem::Version
157
- version: 2.2.0
157
+ version: '2.2'
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: tiltout
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -234,10 +234,17 @@ files:
234
234
  - test/fixtures/dolt-test-repo.git/config
235
235
  - test/fixtures/dolt-test-repo.git/description
236
236
  - test/fixtures/dolt-test-repo.git/info/exclude
237
+ - test/fixtures/dolt-test-repo.git/objects/12/67a0fbd3ec606c20f3f1dca1f53bb9505ba9b5
237
238
  - test/fixtures/dolt-test-repo.git/objects/26/4c348a80906538018616fa16fc35d04bdf38b0
239
+ - test/fixtures/dolt-test-repo.git/objects/60/eebb9021a6ce7d582c2f2d4aa5bfb3672150ae
238
240
  - test/fixtures/dolt-test-repo.git/objects/85/026eda8302b98fa54cc24445a118028865a2e2
239
241
  - test/fixtures/dolt-test-repo.git/objects/89/cd7e9d4564928de6b803b36c6e3d081c8d9ca1
240
242
  - test/fixtures/dolt-test-repo.git/objects/b4/0c249db94476cac7fa91a9d6491c0faf21ec21
243
+ - test/fixtures/dolt-test-repo.git/objects/c0/35ba24bb3bed31589bc6736ca9b116175eb723
244
+ - test/fixtures/dolt-test-repo.git/objects/c8/cc83f1a1fc3640fce14ab73d4fa4b22b6211d8
245
+ - test/fixtures/dolt-test-repo.git/objects/de/dbf2faa4f522716ab727e4325a3d75772e137b
246
+ - test/fixtures/dolt-test-repo.git/objects/e8/d33ae69b8c4d3df1e8fad4733d69720b176849
247
+ - test/fixtures/dolt-test-repo.git/objects/e9/0021f89616ddf86855d05337c188408d3b417e
241
248
  - test/fixtures/dolt-test-repo.git/objects/fc/5f5fb50b435e183925b341909610aace90a413
242
249
  - test/fixtures/dolt-test-repo.git/refs/heads/master
243
250
  - test/fixtures/dolt-test-repo.git/refs/tags/testable-tag