ginatra 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -14,4 +14,4 @@ _layouts/
14
14
  .yardoc
15
15
  doc/*
16
16
  pkg/*
17
- ginatra.gemspec
17
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem "rake"
7
+ gem "rspec"
8
+ gem "webrat"
9
+ gem "rack-test"
10
+ gem "cucumber"
11
+ end
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
- Ginatra
2
- =======
1
+ # Ginatra
2
+ [![](http://stillmaintained.com/lenary/ginatra.png)](http://stillmaintained.com/lenary/ginatra)
3
+
3
4
 
4
5
  This project is to make a clone of gitweb in Ruby and Sinatra. It serves git
5
6
  repositories out of a set of specified directories using an array of glob-based
@@ -96,6 +97,9 @@ Attribution
96
97
  - Elia Schito (elia)
97
98
  - Scott Wisely (Syd)
98
99
  - Jonathan Stott (namelessjon)
100
+ - Michael James (umjames)
101
+
102
+ In a new spirit of openness, all those who submit a patch that gets applied will gain commit access to the main (lenary/ginatra) repository.
99
103
 
100
104
  **Thanks**
101
105
 
data/Rakefile CHANGED
@@ -1,88 +1,39 @@
1
- require 'rubygems'
1
+ require "bundler"
2
+ Bundler.setup(:default, :development)
2
3
  require 'cucumber/rake/task'
3
- require 'spec/rake/spectask'
4
+ require 'rspec/core/rake_task'
4
5
 
5
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
6
+ task :default => ['rake:spec', 'rake:features']
6
7
 
7
- require "ginatra"
8
8
 
9
- task :default => ['rake:spec', 'rake:features']
9
+ desc "Clones the Test Repository"
10
+ task :repo do |t|
11
+ FileUtils.cd(File.join(File.dirname(__FILE__), "repos")) do
12
+ puts `git clone git://github.com/atmos/hancock-client.git test`
13
+ end
14
+ end
10
15
 
11
16
  desc "Runs the Cucumber Feature Suite"
12
17
  Cucumber::Rake::Task.new(:features) do |t|
13
- t.cucumber_opts = "--format pretty"
18
+ t.cucumber_opts = ["--format pretty", "features"]
14
19
  end
15
-
16
20
  namespace :features do
17
-
18
21
  desc "Runs the `@current` feature(s) or scenario(s)"
19
22
  Cucumber::Rake::Task.new(:current) do |c|
20
- c.cucumber_opts = "--format pretty -t current"
23
+ c.cucumber_opts = ["--format pretty", "-t current", "features"]
21
24
  end
22
-
23
25
  end
24
26
 
25
27
  desc "Runs the RSpec Test Suite"
26
- Spec::Rake::SpecTask.new(:spec) do |r|
27
- r.spec_files = FileList['spec/*_spec.rb']
28
- r.spec_opts = ['--color']
28
+ RSpec::Core::RakeTask.new(:spec) do |r|
29
+ r.pattern = 'spec/*_spec.rb'
30
+ r.rspec_opts = ['--color']
29
31
  end
30
-
31
32
  namespace :spec do
32
-
33
33
  desc "RSpec Test Suite with pretty output"
34
- Spec::Rake::SpecTask.new(:long) do |r|
35
- r.spec_files = FileList['spec/*_spec.rb']
36
- r.spec_opts = ['--color', '--format specdoc']
37
- end
38
-
39
- desc "RSpec Test Suite with html output"
40
- Spec::Rake::SpecTask.new(:html) do |r|
41
- r.spec_files = FileList['spec/*_spec.rb']
42
- r.spec_opts = ['--color', '--format html:spec/html_spec.html']
43
- end
44
-
45
- end
46
-
47
- namespace :setup do
48
-
49
- desc "Clones the Test Repository"
50
- task :repo do |t|
51
- FileUtils.cd(File.join(Dir.pwd, "repos")) do
52
- puts `git clone git://github.com/atmos/hancock-client.git test`
53
- end
54
- end
55
-
56
- desc "Installs the Required Gems"
57
- task :gems do |t|
58
- gems = %w(grit kematzy-sinatra-cache)
59
- puts %x(gem install #{gems.join(" ")})
60
- end
61
-
62
- desc "Installs the Test Gems"
63
- task :test do |t|
64
- gems = %w(rspec webrat rack-test cucumber)
65
- puts %x(gem install #{gems.join(" ")})
66
- end
67
-
68
- end
69
-
70
- begin
71
- require 'jeweler'
72
- Jeweler::Tasks.new do |gemspec|
73
- gemspec.name = "ginatra"
74
- gemspec.summary = "A Gitweb Clone in Sinatra and Grit"
75
- gemspec.description = "Host your own git repository browser through the power of Sinatra and Grit"
76
- gemspec.email = "sam@lenary.co.uk"
77
- gemspec.homepage = "http://lenary.github.com/ginatra"
78
- gemspec.authors = ["Sam Elliott", "Ryan Bigg"]
79
- gemspec.version = Ginatra::VERSION
80
- gemspec.add_dependency('sinatra', '>=0.9.4')
81
- gemspec.add_dependency('grit', '>=1.1.1')
82
- gemspec.add_dependency('vegas', '>=0.1.0')
83
- gemspec.add_dependency('open4', '>= 0.9.6')
34
+ RSpec::Core::RakeTask.new(:long) do |r|
35
+ r.pattern = 'spec/*_spec.rb'
36
+ r.rspec_opts = ['--color', '--format documentation']
84
37
  end
85
- rescue LoadError
86
- puts "Jeweler not available. Install it with: sudo gem install jeweler"
87
38
  end
88
39
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
4
-
3
+ require "bundler"
4
+ Bundler.setup(:default)
5
5
  require "ginatra"
6
6
 
7
7
  module Ginatra::Executable
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
4
-
3
+ require "bundler"
4
+ Bundler.setup(:default)
5
5
  require "ginatra"
6
6
  require "logger"
7
7
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
4
-
3
+ require "bundler"
4
+ Bundler.setup(:default)
5
5
  require "ginatra"
6
6
  require "logger"
7
7
 
@@ -19,7 +19,7 @@ module Ginatra::Directory
19
19
  Usage: ginatra-directory [ list | add <globs> | remove <globs> ]
20
20
 
21
21
  Commands:
22
- add - Adds the <globs> to the array of dirs that Ginatra
22
+ add - Adds the <globs> to the array of dirs that Ginatra
23
23
  looks in for repositories.
24
24
  remove - Removes the <globs> from the aforementioned array.
25
25
  list - Lists the globs Ginatra looks in for repositories
@@ -1,17 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- begin
4
- require 'rubygems'
5
- rescue LoadError
6
- end
7
- require "vegas"
8
-
9
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
10
-
3
+ require "bundler"
4
+ Bundler.setup(:default)
11
5
  require "ginatra"
6
+ require "vegas"
12
7
 
13
8
  Vegas::Runner.new(Ginatra::App, 'ginatra-server', {:port => Ginatra::Config.port, :host => Ginatra::Config.host}) do |runner, opts, app|
14
-
9
+
15
10
  opts.banner = "Usage: ginatra-server [[options] start | stop | status]"
16
11
 
17
12
  opts.separator " start - Start the Ginatra HTTP Server"
@@ -29,6 +24,6 @@ Vegas::Runner.new(Ginatra::App, 'ginatra-server', {:port => Ginatra::Config.port
29
24
  runner.options[:start] = false
30
25
  at_exit { puts opts }
31
26
  end
32
-
27
+
33
28
  end
34
29
 
data/config.ru CHANGED
@@ -1,9 +1,7 @@
1
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
2
-
1
+ require "bundler"
2
+ Bundler.setup(:default)
3
3
  require "ginatra"
4
4
 
5
-
6
-
7
5
  map '/' do
8
6
  run Ginatra::App
9
7
  end
@@ -2,32 +2,34 @@ Feature: Page
2
2
  In order to use multiple repositories
3
3
  As a browser
4
4
  I want to see the home page
5
+
6
+ Background:
7
+ Given I am on the homepage
5
8
 
6
- Scenario:
7
- When I open '/'
9
+ Scenario: Viewing all the repositories
8
10
  Then I should see "Ginatra"
9
11
  And I should see "View My Git Repositories"
10
12
  And I should see "test"
11
13
  And I should see "description file for this repository and set the description for it."
12
- Scenario:
13
- When I open '/test'
14
- Then I should see "Ginatra"
15
- And I should see "test"
14
+
15
+ Scenario: Viewing a single repository
16
+ When I follow "test"
16
17
  And I should see "description file for this repository and set the description for it."
17
18
  And I should see "Commits"
19
+ # Perhaps "And I should see xxxxxx as the latest commit"
18
20
  And I should see "(author)"
19
- Scenario:
20
- When I open '/test/commit/eefb4c3'
21
- Then I should see "Ginatra"
22
- And I should see "test"
21
+
22
+ Scenario: Viewing a commit
23
+ When I follow "test"
23
24
  And I should see "description file for this repository and set the description for it."
24
- And I should see "Commit: eefb4c3"
25
- And I should see "doh, thanks lenary for reminding me of the files i'd forgotten"
26
- Scenario:
27
- When I open '/test/tree/24f701fd'
28
- Then I should see "Ginatra"
25
+ When I follow "095955b6402c30ef24520bafdb8a8687df0a98d3"
26
+ And I should see "Commit: 095955b"
27
+ And I should see "first pass at having the hancock client"
28
+
29
+ Scenario: Viewing a file on a commit
30
+ When I open '/test/tree/6f27ba2f'
29
31
  And I should see "test"
30
32
  And I should see "description file for this repository and set the description for it."
31
- And I should see "Tree: 24f701fd"
33
+ And I should see "Tree: 6f27ba2f"
32
34
  And I should see "README.md"
33
35
  And I should see ".gitignore"
@@ -0,0 +1,7 @@
1
+ Given /^I am on the homepage$/ do
2
+ visit '/'
3
+ end
4
+
5
+ Then /^show me the page$/ do
6
+ save_and_open_page
7
+ end
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "ginatra"
3
+ s.version = "2.2.3"
4
+ s.summary = "A Gitweb Clone in Sinatra and Grit"
5
+ s.description = "Host your own git repository browser through the power of Sinatra and Grit"
6
+ s.email = "sam@lenary.co.uk"
7
+ s.homepage = "http://lenary.co.uk/ginatra"
8
+ s.authors = ["Sam Elliott", "Ryan Bigg"]
9
+ s.add_dependency('bundler', '~> 1.0.15')
10
+ s.add_dependency('sinatra', '~> 1.2.6')
11
+ s.add_dependency('grit', '~> 2.4.1')
12
+ s.add_dependency('vegas', '~> 0.1.8')
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- spec`.split("\n")
16
+ s.executables = `git ls-files -- bin`.split("\n").map {|f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+ end
@@ -1,28 +1,19 @@
1
- # We only want Rubygems if it exists. Else, we assume they know what they're doing.
2
- begin
3
- require 'rubygems'
4
- rescue LoadError
5
- end
6
- require 'sinatra/base'
7
- require 'grit'
8
-
9
- # The Ginatra Namespace Module
10
- module Ginatra; end
11
1
 
12
- # i feel this is cleaner than the #{current_path} shenanigans ($: is the load path)
13
- $:.unshift File.dirname(__FILE__)
2
+ require "bundler"
3
+ Bundler.setup(:default)
4
+ require 'sinatra/base'
14
5
 
15
- # Loading in whichever order
16
- require "ginatra/repo"
17
- require "ginatra/repo_list"
18
- require "ginatra/config"
19
- require "ginatra/helpers"
20
6
 
21
7
  require "sinatra/partials"
22
8
 
23
9
  # Written myself. i know, what the hell?!
24
10
  module Ginatra
25
11
 
12
+ autoload :Config, "ginatra/config"
13
+ autoload :Helpers, "ginatra/helpers"
14
+ autoload :Repo, "ginatra/repo"
15
+ autoload :RepoList, "ginatra/repo_list"
16
+
26
17
  # A standard error class for inheritance.
27
18
  class Error < StandardError; end
28
19
 
@@ -41,8 +32,6 @@ module Ginatra
41
32
  end
42
33
  end
43
34
 
44
- VERSION = "2.2.1"
45
-
46
35
  # The main application class.
47
36
  #
48
37
  # This class contains all the core application logic
@@ -68,17 +57,7 @@ module Ginatra
68
57
  set :views, "#{current_path}/../views"
69
58
  end
70
59
 
71
- helpers do
72
-
73
- # Ginatra::Helpers module full of goodness
74
- include Helpers
75
-
76
- # My Sinatra Partials implementation.
77
- #
78
- # check out http://gist.github.com/119874
79
- # for more details
80
- include ::Sinatra::Partials
81
- end
60
+ helpers Helpers, Sinatra::Partials
82
61
 
83
62
  # Let's handle a CommitsError.
84
63
  #
@@ -102,7 +81,7 @@ module Ginatra
102
81
  @repo = RepoList.find(params[:repo])
103
82
  @commits = @repo.commits
104
83
  return "" if @commits.empty?
105
- etag(@commits.first.id)
84
+ etag(@commits.first.id) if Ginatra::App.environment?(:production)
106
85
  builder :atom, :layout => nil
107
86
  end
108
87
 
@@ -114,7 +93,7 @@ module Ginatra
114
93
  get '/:repo' do
115
94
  @repo = RepoList.find(params[:repo])
116
95
  @commits = @repo.commits
117
- etag(@commits.first.id)
96
+ etag(@commits.first.id) if Ginatra::App.environment?(:production)
118
97
  erb :log
119
98
  end
120
99
 
@@ -126,7 +105,7 @@ module Ginatra
126
105
  @repo = RepoList.find(params[:repo])
127
106
  @commits = @repo.commits(params[:ref])
128
107
  return "" if @commits.empty?
129
- etag(@commits.first.id)
108
+ etag(@commits.first.id) if Ginatra::App.environment?(:production)
130
109
  builder :atom, :layout => nil
131
110
  end
132
111
 
@@ -140,7 +119,7 @@ module Ginatra
140
119
  params[:page] = 1
141
120
  @repo = RepoList.find(params[:repo])
142
121
  @commits = @repo.commits(params[:ref])
143
- etag(@commits.first.id)
122
+ etag(@commits.first.id) if Ginatra::App.environment?(:production)
144
123
  erb :log
145
124
  end
146
125
 
@@ -161,7 +140,7 @@ module Ginatra
161
140
  get '/:repo/commit/:commit' do
162
141
  @repo = RepoList.find(params[:repo])
163
142
  @commit = @repo.commit(params[:commit]) # can also be a ref
164
- etag(@commit.id)
143
+ etag(@commit.id) if Ginatra::App.environment?(:production)
165
144
  erb(:commit)
166
145
  end
167
146
 
@@ -183,12 +162,11 @@ module Ginatra
183
162
  get '/:repo/tree/:tree' do
184
163
  @repo = RepoList.find(params[:repo])
185
164
 
186
- # this might look silly but it's needed to pass the --verify.
187
- if (tag = @repo.git.method_missing('rev_parse', {}, '--verify', "#{params[:tree]}^{tree}")).empty?
165
+ if (tag = @repo.git.rev_parse({'--verify' => ''}, "#{params[:tree]}^{tree}")).empty?
188
166
  # we don't have a tree.
189
167
  not_found
190
168
  else
191
- etag(tag)
169
+ etag(tag) if Ginatra::App.environment?(:production)
192
170
  end
193
171
 
194
172
  @tree = @repo.tree(params[:tree]) # can also be a ref (i think)
@@ -213,7 +191,7 @@ module Ginatra
213
191
  # this allows people to put in the remaining part of the path to the file, rather than endless clicks like you need in github
214
192
  redirect "#{params[:repo]}/blob/#{params[:tree]}/#{params[:splat].first}"
215
193
  else
216
- etag(@tree.id)
194
+ etag(@tree.id) if Ginatra::App.environment?(:production)
217
195
  @path = {}
218
196
  @path[:tree] = "#{params[:repo]}/tree/#{params[:tree]}/#{params[:splat].first}"
219
197
  @path[:blob] = "#{params[:repo]}/blob/#{params[:tree]}/#{params[:splat].first}"
@@ -228,7 +206,7 @@ module Ginatra
228
206
  get '/:repo/blob/:blob' do
229
207
  @repo = RepoList.find(params[:repo])
230
208
  @blob = @repo.blob(params[:blob])
231
- etag(@blob.id)
209
+ etag(@blob.id) if Ginatra::App.environment?(:production)
232
210
  erb(:blob)
233
211
  end
234
212
 
@@ -247,7 +225,7 @@ module Ginatra
247
225
  # this allows people to put in the remaining part of the path to the folder, rather than endless clicks like you need in github
248
226
  redirect "/#{params[:repo]}/tree/#{params[:tree]}/#{params[:splat].first}"
249
227
  else
250
- etag(@blob.id)
228
+ etag(@blob.id) if Ginatra::App.environment?(:production)
251
229
  erb(:blob)
252
230
  end
253
231
  end
@@ -1,3 +1,6 @@
1
+ require "yaml"
2
+ require 'fileutils'
3
+
1
4
  module Ginatra
2
5
 
3
6
  # A Wrapper for the ginatra configuration variables,
@@ -27,7 +30,7 @@ module Ginatra
27
30
 
28
31
  # create log_file location
29
32
  # The log_file config option should be an absolute file system path
30
- # It doesn't have to exist, but ginatra should have the proper file system privileges to create the directories
33
+ # It doesn't have to exist, but ginatra should have the proper file system privileges to create the directories
31
34
  # and files along the specified path
32
35
  unless log_file == STDOUT
33
36
  parent_dir, separator, file_component = log_file.rpartition("/")
@@ -53,33 +56,27 @@ module Ginatra
53
56
  @logger
54
57
  end
55
58
 
56
- # Dumps the Default configuration to +CONFIG_PATH+,
57
- # WITHOUT regard for what's already there.
58
- #
59
- # Very Destructive Method. Use with care!
60
- def self.setup!
59
+ unless File.exist?(CONFIG_PATH)
60
+ FileUtils.mkdir_p(File.dirname(CONFIG_PATH))
61
61
  File.open(CONFIG_PATH, 'w') do |f|
62
62
  YAML.dump(DEFAULT_CONFIG, f)
63
63
  end
64
64
  end
65
65
 
66
- unless File.exist?(CONFIG_PATH)
67
- require 'fileutils'
68
- FileUtils.mkdir_p(File.dirname(CONFIG_PATH))
69
- setup!
70
- end
71
-
72
66
  # Loads the configuration and merges it with
73
67
  # the default configuration.
74
68
  #
75
69
  # @return [Hash] config a hash of the configuration options
76
70
  def self.load!
77
- @config = {}
78
- begin
79
- @config = YAML.load_file(CONFIG_PATH)
80
- rescue Errno::ENOENT
71
+ loaded_config = {}
72
+ @config = DEFAULT_CONFIG.dup
73
+ if File.size(CONFIG_PATH) == 0
74
+ dump!
75
+ else
76
+ loaded_config = YAML.load_file(CONFIG_PATH)
77
+ @config.merge!(loaded_config)
81
78
  end
82
- @config = DEFAULT_CONFIG.merge(@config)
79
+ @config
83
80
  end
84
81
 
85
82
  # Dumps the _current_ configuration to +CONFIG_PATH+
@@ -1,5 +1,4 @@
1
1
  require "digest/md5"
2
- require "open4"
3
2
 
4
3
  module Ginatra
5
4
  # Helpers used in the views usually,
@@ -231,30 +230,5 @@ module Ginatra
231
230
  def atom_feed_link(repo_param, ref=nil)
232
231
  "<a href=\"" + prefix_url("#{repo_param}#{"/#{ref}" if !ref.nil?}.atom") + "\" title=\"Atom Feed\" class=\"atom\">Feed</a>"
233
232
  end
234
-
235
- def pygmentize(content, filename=nil)
236
- type = !filename ? "diff" : pygmentize_type(filename)
237
- html_output = ''
238
- Open4.popen4("pygmentize -l #{type} -f html") do |pid, stdin, stdout, stderr|
239
- stdin.puts content
240
- stdin.close
241
- html_output = stdout.read.strip
242
- [stdout, stderr].each {|io| io.close }
243
- end
244
- html_output
245
- rescue Errno::ENOENT
246
- return "<div class=\"highlight\"><pre>#{content}</pre></div>"
247
- end
248
-
249
- def pygmentize_type(filename)
250
- type =''
251
- Open4.popen4("pygmentize -N #{filename}") do |pid, stdin, stdout, stderr|
252
- type = stdout.read.strip
253
- [stdin, stdout, stderr].each {|io| io.close }
254
- end
255
- type
256
- rescue Errno::ENOENT
257
- return "text"
258
- end
259
233
  end
260
234
  end
@@ -1,3 +1,5 @@
1
+ require "grit"
2
+
1
3
  module Grit
2
4
  class Commit
3
5
  # this lets us add a link between commits and refs directly
@@ -30,7 +32,7 @@ module Ginatra
30
32
 
31
33
  # Return a commit corresponding to the commit to the repo,
32
34
  # but with the refs already attached.
33
- #
35
+ #
34
36
  # @see Ginatra::Repo#add_refs
35
37
  #
36
38
  # @raise [Ginatra::InvalidCommit] if the commit doesn't exist.
@@ -56,10 +58,10 @@ module Ginatra
56
58
  def commits(start = 'master', max_count = 10, skip = 0)
57
59
  raise(Ginatra::Error.new("max_count cannot be less than 0")) if max_count < 0
58
60
  @repo.commits(start, max_count, skip).each do |commit|
59
- add_refs(commit)
61
+ add_refs(commit)
60
62
  end
61
63
  end
62
-
64
+
63
65
  # Adds the refs corresponding to Grit::Commit objects to the respective Commit objects.
64
66
  #
65
67
  # @todo Perhaps move into commit class.
@@ -67,10 +69,7 @@ module Ginatra
67
69
  # @param [Grit::Commit] commit the commit you want refs added to
68
70
  # @return [Array] the array of refs added to the commit. they are also on the commit object.
69
71
  def add_refs(commit)
70
- commit.refs = []
71
- refs = @repo.refs.select { |ref| ref.commit.id == commit.id }
72
- commit.refs << refs
73
- commit.refs.flatten!
72
+ commit.refs = @repo.refs.select {|ref| ref.commit.id == commit.id }
74
73
  end
75
74
 
76
75
  # Catch all
data/rackup.ru CHANGED
@@ -1,9 +1,7 @@
1
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/lib")
2
-
1
+ require "bundler"
2
+ Bundler.setup(:default)
3
3
  require "ginatra"
4
4
 
5
-
6
-
7
5
  map '/' do
8
6
  run Ginatra::App
9
7
  end
@@ -1,4 +1,3 @@
1
- $:.unshift File.dirname(__FILE__)
2
1
  require "spec_helper"
3
2
 
4
3
  describe "Ginatra" do
@@ -1,4 +1,3 @@
1
- $:.unshift File.dirname(__FILE__)
2
1
  require "spec_helper"
3
2
 
4
3
  describe "Ginatra" do
@@ -12,7 +11,7 @@ describe "Ginatra" do
12
11
  @repo_list = Ginatra::RepoList
13
12
  @ginatra_repo = @repo_list.find("test")
14
13
  @grit_repo = Grit::Repo.new(File.join(current_path, "..", "repos", "test"), {})
15
- @commit = @ginatra_repo.commit("910ff56f585bcdfc3ba105c8846b1df0a6abf069")
14
+ @commit = @ginatra_repo.commit("095955b6402c30ef24520bafdb8a8687df0a98d3")
16
15
  end
17
16
 
18
17
  it "should have a name" do
@@ -1,27 +1,13 @@
1
- require 'rubygems'
2
1
 
3
- #gem 'rspec'
4
- require 'spec'
5
-
6
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
2
+ require 'bundler'
3
+ Bundler.setup(:default, :test)
4
+ require 'rspec'
7
5
  require "ginatra"
8
-
9
- #gem 'webrat', '>=0.4.4'
10
- begin
11
- # When using webrat 0.6.0, there is no webrat/sinatra.rb file.
12
- # Looking at the gem's code, it looks like it autoloads the sinatra adapter at webrat/adapters/sinatra.rb.
13
- # So requiring just 'webrat' will also load the sinatra adapater, which is done in the rescue clause.
14
- require 'webrat/sinatra'
15
- rescue LoadError
16
- STDERR.puts "WARNING: could not load webrat/sinatra: #{__FILE__}:#{__LINE__}"
17
- require 'webrat'
18
- end
19
-
20
- #gem 'rack-test', '>=0.3.0'
6
+ require 'webrat'
21
7
  require 'rack/test'
22
8
 
23
9
  Webrat.configure do |config|
24
- config.mode = :sinatra
10
+ config.mode = :rack
25
11
  end
26
12
 
27
13
  current_path = File.expand_path(File.dirname(__FILE__))
@@ -29,7 +15,7 @@ current_path = File.expand_path(File.dirname(__FILE__))
29
15
  Ginatra::App.set :environment, :test
30
16
  Ginatra::Config[:git_dirs] = ["#{current_path}/../repos/*"]
31
17
 
32
- Spec::Runner.configure do |config|
18
+ RSpec.configure do |config|
33
19
  def app
34
20
  Ginatra::App
35
21
  end
@@ -3,7 +3,7 @@
3
3
  <div class="active">
4
4
  <div class="blob">
5
5
  <h4><img src="<%= prefix_url("img/doc.png") %>" /><%= @blob.name %></h4>
6
- <%= pygmentize(@blob.data, @blob.name) %>
6
+ <pre><code><%= @blob.data %></code></pre>
7
7
  </div>
8
8
  <div class="clearfix">&nbsp;</div>
9
- </div>
9
+ </div>
@@ -13,7 +13,7 @@
13
13
  <% @commit.diffs.select { |d| !d.deleted_file && !d.new_file }.each do |diff| %>
14
14
  <% count += 1 %>
15
15
  <h4><img src="<%= prefix_url("img/doc.png") %>" /><a name='file_<%= count %>'><code><%= diff.b_path %></code></a></h4>
16
- <div class="diff"><%= pygmentize(diff.diff) %></div>
16
+ <pre><code class="diff"><%= diff.diff %></code></pre>
17
17
  <% end %>
18
18
  </div>
19
19
  </div>
@@ -1,36 +1,28 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html>
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>Ginatra</title>
7
- <link rel="stylesheet" href="<%= prefix_url("src/index.css") %>" type="text/css" media="screen" />
8
- <link rel="stylesheet" href="<%= prefix_url("src/default.css") %>" type="text/css" media="screen" />
9
-
10
- <script type="text/javascript" src="<%= prefix_url("src/highlight.pack.js") %>"></script>
3
+ <htm
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Ginatra</title>
7
+ <link rel="stylesheet" href="<%= prefix_url("src/index.css") %>" type="text/css" media="screen" />
8
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
9
+ <script src="<%= prefix_url("src/ginatra.js") %>" type="text/javascript"></script>
10
+ <script type="text/javascript" src="<%= prefix_url("src/highlight.pack.js") %>"></script>
11
11
  <script type="text/javascript">
12
12
  hljs.initHighlightingOnLoad();
13
13
  </script>
14
- <script src="<%= prefix_url("src/jquery-1.3.2.min.js") %>" type="text/javascript"></script>
15
- <script src="<%= prefix_url("src/ginatra.js") %>" type="text/javascript"></script>
16
-
17
- <!--[if lt IE 8]>
18
- <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
19
- <style type="text/css" media="screen">
20
- * { behavior: url("<%= prefix_url("src/iepngfix.htc") %>") }
21
- </style>
22
- <![endif]-->
23
- </head>
24
- <body>
25
- <div id="content">
26
- <div id="inner">
27
- <h1><a href="<%= prefix_url %>">Ginatra</a></h1>
28
- <%= yield %>
29
- </div>
30
- <div id="footer-spacer">&nbsp;</div>
31
- </div>
32
- <div id="footer">
33
- Ginatra &mdash; &copy; 2009 Samuel Elliott &mdash; <a href="http://www.opensource.org/licenses/mit-license.php">MIT Licence</a>
34
- </div>
35
- </body>
14
+ <link rel="stylesheet" href="<%= prefix_url("src/github.css") %>" type="text/css" media="screen" />
15
+ </head>
16
+ <body>
17
+ <div id="content">
18
+ <div id="inner">
19
+ <h1><a href="<%= prefix_url %>">Ginatra</a></h1>
20
+ <%= yield %>
21
+ </div>
22
+ <div id="footer-spacer">&nbsp;</div>
23
+ </div>
24
+ <div id="footer">
25
+ Ginatra &mdash; &copy; 2009 Samuel Elliott &mdash; <a href="http://www.opensource.org/licenses/mit-license.php">MIT Licence</a>
26
+ </div>
27
+ </body>
36
28
  </html>
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ginatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ hash: 1
5
+ prerelease: false
6
+ segments:
7
+ - 2
8
+ - 2
9
+ - 3
10
+ version: 2.2.3
5
11
  platform: ruby
6
12
  authors:
7
13
  - Sam Elliott
@@ -10,49 +16,73 @@ autorequire:
10
16
  bindir: bin
11
17
  cert_chain: []
12
18
 
13
- date: 2010-01-06 00:00:00 +00:00
19
+ date: 2011-07-01 00:00:00 +01:00
14
20
  default_executable:
15
21
  dependencies:
16
22
  - !ruby/object:Gem::Dependency
17
- name: sinatra
23
+ name: bundler
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ hash: 9
31
+ segments:
32
+ - 1
33
+ - 0
34
+ - 15
35
+ version: 1.0.15
18
36
  type: :runtime
19
- version_requirement:
20
- version_requirements: !ruby/object:Gem::Requirement
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: sinatra
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
21
43
  requirements:
22
- - - ">="
44
+ - - ~>
23
45
  - !ruby/object:Gem::Version
24
- version: 0.9.4
25
- version:
46
+ hash: 19
47
+ segments:
48
+ - 1
49
+ - 2
50
+ - 6
51
+ version: 1.2.6
52
+ type: :runtime
53
+ version_requirements: *id002
26
54
  - !ruby/object:Gem::Dependency
27
55
  name: grit
28
- type: :runtime
29
- version_requirement:
30
- version_requirements: !ruby/object:Gem::Requirement
56
+ prerelease: false
57
+ requirement: &id003 !ruby/object:Gem::Requirement
58
+ none: false
31
59
  requirements:
32
- - - ">="
60
+ - - ~>
33
61
  - !ruby/object:Gem::Version
34
- version: 1.1.1
35
- version:
62
+ hash: 29
63
+ segments:
64
+ - 2
65
+ - 4
66
+ - 1
67
+ version: 2.4.1
68
+ type: :runtime
69
+ version_requirements: *id003
36
70
  - !ruby/object:Gem::Dependency
37
71
  name: vegas
38
- type: :runtime
39
- version_requirement:
40
- version_requirements: !ruby/object:Gem::Requirement
72
+ prerelease: false
73
+ requirement: &id004 !ruby/object:Gem::Requirement
74
+ none: false
41
75
  requirements:
42
- - - ">="
76
+ - - ~>
43
77
  - !ruby/object:Gem::Version
44
- version: 0.1.0
45
- version:
46
- - !ruby/object:Gem::Dependency
47
- name: open4
78
+ hash: 11
79
+ segments:
80
+ - 0
81
+ - 1
82
+ - 8
83
+ version: 0.1.8
48
84
  type: :runtime
49
- version_requirement:
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 0.9.6
55
- version:
85
+ version_requirements: *id004
56
86
  description: Host your own git repository browser through the power of Sinatra and Grit
57
87
  email: sam@lenary.co.uk
58
88
  executables:
@@ -62,11 +92,11 @@ executables:
62
92
  - ginatra-server
63
93
  extensions: []
64
94
 
65
- extra_rdoc_files:
66
- - README.md
95
+ extra_rdoc_files: []
96
+
67
97
  files:
68
- - .gitattributes
69
98
  - .gitignore
99
+ - Gemfile
70
100
  - README.md
71
101
  - Rakefile
72
102
  - bin/ginatra
@@ -75,8 +105,10 @@ files:
75
105
  - bin/ginatra-server
76
106
  - config.ru
77
107
  - features/pages.feature
108
+ - features/step_definitions/app_steps.rb
78
109
  - features/step_definitions/page_steps.rb
79
110
  - features/support/env.rb
111
+ - ginatra.gemspec
80
112
  - lib/ginatra.rb
81
113
  - lib/ginatra/config.rb
82
114
  - lib/ginatra/helpers.rb
@@ -89,13 +121,10 @@ files:
89
121
  - public/img/doc.png
90
122
  - public/img/rm.png
91
123
  - public/img/tree.png
92
- - public/src/blank.gif
93
124
  - public/src/colour.css
94
125
  - public/src/commit.css
95
126
  - public/src/ginatra.js
96
- - public/src/iepngfix.htc
97
127
  - public/src/index.css
98
- - public/src/jquery-1.3.2.min.js
99
128
  - public/src/lists.css
100
129
  - public/src/reset.css
101
130
  - public/src/table.css
@@ -117,30 +146,36 @@ files:
117
146
  - views/log.erb
118
147
  - views/tree.erb
119
148
  has_rdoc: true
120
- homepage: http://lenary.github.com/ginatra
149
+ homepage: http://lenary.co.uk/ginatra
121
150
  licenses: []
122
151
 
123
152
  post_install_message:
124
- rdoc_options:
125
- - --charset=UTF-8
153
+ rdoc_options: []
154
+
126
155
  require_paths:
127
156
  - lib
128
157
  required_ruby_version: !ruby/object:Gem::Requirement
158
+ none: false
129
159
  requirements:
130
160
  - - ">="
131
161
  - !ruby/object:Gem::Version
162
+ hash: 3
163
+ segments:
164
+ - 0
132
165
  version: "0"
133
- version:
134
166
  required_rubygems_version: !ruby/object:Gem::Requirement
167
+ none: false
135
168
  requirements:
136
169
  - - ">="
137
170
  - !ruby/object:Gem::Version
171
+ hash: 3
172
+ segments:
173
+ - 0
138
174
  version: "0"
139
- version:
140
175
  requirements: []
141
176
 
142
177
  rubyforge_project:
143
- rubygems_version: 1.3.5
178
+ rubygems_version: 1.3.7
144
179
  signing_key:
145
180
  specification_version: 3
146
181
  summary: A Gitweb Clone in Sinatra and Grit
@@ -1,2 +0,0 @@
1
- *.doc diff=doc
2
- *.png diff=exif