<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,4 @@
-repos/*.git
+repos/*/
 public/*.esproj
 tmp/*
 .DS_Store</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -7,14 +7,6 @@ require &quot;#{current_path}/lib/ginatra&quot;
 
 task :default =&gt; ['rake:spec', 'rake:features']
 
-desc &quot;Adds a Git Repository to Ginatra. Usage: `rake add repo='&lt;git-repo-url&gt;' [name='&lt;name-in-ginatra&gt;']`&quot;
-task &quot;add&quot; do |t|
-  raise ArgumentError, &quot;FATAL: You Must Specify a Git Repository to Clone&quot; if ENV['repo'].empty?
-  FileUtils.cd(repo_dir) do
-    puts %x(git clone --bare #{ENV['repo']} #{(ENV['name'] + &quot;.git&quot;) unless ENV['name'].nil?})
-  end
-end
-
 desc &quot;Runs the Cucumber Feature Suite&quot;
 Cucumber::Rake::Task.new(:features) do |t|
   t.cucumber_opts = &quot;--format pretty&quot;
@@ -55,8 +47,8 @@ namespace :setup do
 
   desc &quot;Clones the Test Repository&quot;
   task :repo do |t|
-    FileUtils.cd(repo_dir) do
-      puts `git clone --bare git://github.com/atmos/hancock-client.git test.git`
+    FileUtils.cd(File.join(current_path, &quot;repos&quot;)) do
+      puts `git clone git://github.com/atmos/hancock-client.git test`
     end
   end
 
@@ -73,35 +65,3 @@ namespace :setup do
   end
 
 end
-
-namespace :test do
-
-  task :spec =&gt; ['rake:spec'] do
-    puts &quot;&quot;
-    puts &quot;DEPRECIATION WARNING: `rake test:spec` has been replaced with `rake spec` -- I'm making your life easier&quot;
-    puts &quot;&quot;
-  end
-
-  task :features =&gt; ['rake:features'] do
-    puts &quot;&quot;
-    puts &quot;DEPRECIATION WARNING: `rake test:features` has been replaced with `rake features` -- I'm making your life easier&quot;
-    puts &quot;&quot;
-  end
-
-end
-
-def repo_dir
-  if Ginatra::App.git_dir
-    File.expand_path( Ginatra::App.git_dir )
-  elsif Ginatra::App.git_dirs
-    a = Dir.glob(Ginatra::App.git_dirs.first).first
-    if Dir.entries(a).include?&quot;refs&quot;
-      a = File.dirname(a)
-    else
-      a
-    end
-    File.expand_path( a )
-  else
-    raise ArgumentError, &quot;You need to set `git_dir` or `git_dirs` for this rake task to work&quot;
-  end
-end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -7,27 +7,27 @@ Feature: Page
     When I open '/'
     Then I should see &quot;Ginatra&quot;
     And I should see &quot;View My Git Repositories&quot;
-    And I should see &quot;Test&quot;
-    And I should see &quot;Please edit the test.git/description file for this repository and set the description for it.&quot;
+    And I should see &quot;test&quot;
+    And I should see &quot;description file for this repository and set the description for it.&quot;
   Scenario:
     When I open '/test'
     Then I should see &quot;Ginatra&quot;
-    And I should see &quot;Test&quot;
-    And I should see &quot;Please edit the test.git/description file for this repository and set the description for it.&quot;
+    And I should see &quot;test&quot;
+    And I should see &quot;description file for this repository and set the description for it.&quot;
     And I should see &quot;Commits&quot;
     And I should see &quot;(author)&quot;
   Scenario:
     When I open '/test/commit/eefb4c3'
     Then I should see &quot;Ginatra&quot;
-    And I should see &quot;Test&quot;
-    And I should see &quot;Please edit the test.git/description file for this repository and set the description for it.&quot;
+    And I should see &quot;test&quot;
+    And I should see &quot;description file for this repository and set the description for it.&quot;
     And I should see &quot;Commit: eefb4c3&quot;
     And I should see &quot;doh, thanks lenary for reminding me of the files i'd forgotten&quot;
   Scenario:
     When I open '/test/tree/24f701fd'
     Then I should see &quot;Ginatra&quot; 
-    And I should see &quot;Test&quot;
-    And I should see &quot;Please edit the test.git/description file for this repository and set the description for it.&quot;
+    And I should see &quot;test&quot;
+    And I should see &quot;description file for this repository and set the description for it.&quot;
     And I should see &quot;Tree: 24f701fd&quot;
     And I should see &quot;README.md&quot;
     And I should see &quot;.gitignore&quot;</diff>
      <filename>features/pages.feature</filename>
    </modified>
    <modified>
      <diff>@@ -31,9 +31,6 @@ module Ginatra
     configure do
       current_path = File.expand_path(File.dirname(__FILE__))
       Config.load!
-      Config.each_pair do |k, v|
-        set k, v
-      end
       set :raise_errors, Proc.new { test? }
       set :show_exceptions, Proc.new { development? }
       set :dump_errors, true</diff>
      <filename>lib/ginatra.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,9 +4,8 @@ module Ginatra
     current_path = File.expand_path(&quot;#{File.dirname(__FILE__)}&quot;)
     CONFIG_PATH = File.expand_path(&quot;~/.ginatra&quot;)
     DEFAULT_CONFIG = {
-      :git_dir =&gt; File.expand_path(&quot;#{current_path}/../../repos&quot;),
-      :git_dirs =&gt; [File.expand_path(&quot;#{current_path}/../../repos/*.git&quot;)],
-      :ignored_files =&gt; ['.', '..', 'README.md'],
+      :git_dirs =&gt; [File.expand_path(&quot;#{current_path}/../../repos/*&quot;)],
+      :ignored_files =&gt; ['README.md'],
       :description =&gt; &quot;View My Git Repositories&quot;,
       :port =&gt; 9797
     }</diff>
      <filename>lib/ginatra/config.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,10 +13,10 @@ module Ginatra
 
     def initialize(path)
       @repo = Grit::Repo.new(path)
-      @param = File.split(path).last.gsub(/\.git$/, '')
-      @name = @param.capitalize
+      @param = File.split(path).last
+      @name = @param
       @description = @repo.description
-      @description = &quot;Please edit the #{@param}.git/description file for this repository and set the description for it.&quot; if /^Unnamed repository;/.match(@description)
+      @description = &quot;Please edit the #{@repo.path}/description file for this repository and set the description for it.&quot; if /^Unnamed repository;/.match(@description)
       @repo
     end
 
@@ -47,13 +47,4 @@ module Ginatra
     end
 
   end
-
-  class MultiRepo &lt; Repo
-
-    attr_reader :name, :param, :description
-
-    def self.create!(param)
-      @repo = MultiRepoList.find { |r| r.param =~ /^#{Regexp.escape param }$/ }
-    end
-  end
 end
\ No newline at end of file</diff>
      <filename>lib/ginatra/repo.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,5 @@
+require 'singleton'
+
 module Ginatra
   # Convenience class for me!
   class RepoList
@@ -15,19 +17,20 @@ module Ginatra
     end
 
     def refresh
-      entries = Dir.entries(Ginatra::Config.git_dir)
-      entries.each { |e| add(e) unless Ginatra::Config.ignored_files.include?(e) }
+      Ginatra::Config.git_dirs.map! do |git_dir|
+        files = Dir.glob(git_dir)
+        files.each { |e| add(e) unless Ginatra::Config.ignored_files.include?(File.split(e).last) }
+      end
     end
 
-    def add(e, path = File.expand_path(e, Ginatra::Config.git_dir))
-      unless self.has_repo?(e)
+    def add(path, param = File.split(path).last)
+      unless self.has_repo?(param)
         list &lt;&lt; Repo.new(path)
       end
     end
 
     def has_repo?(local_param)
-      l = local_param.sub(/\.git$/,'')
-      !list.find { |r| r.param == l }.nil?
+      !list.find { |r| r.param == local_param }.nil?
     end
 
     def find(local_param)</diff>
      <filename>lib/ginatra/repo_list.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,6 @@
-require File.join(File.dirname(__FILE__), &quot;spec_helper&quot;)
+current_path = File.expand_path(File.dirname(__FILE__))
+require File.join(current_path, &quot;spec_helper&quot;)
+
 describe &quot;Ginatra&quot; do
   
   describe &quot;RepoList&quot; do</diff>
      <filename>spec/repo_list_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
-require File.join(File.dirname(__FILE__), &quot;spec_helper&quot;)
+current_path = File.expand_path(File.dirname(__FILE__))
+require File.join(current_path, &quot;spec_helper&quot;)
 
 describe &quot;Ginatra&quot; do
   describe &quot;Repo&quot; do
@@ -6,12 +7,12 @@ describe &quot;Ginatra&quot; do
     before do
       @repo_list = Ginatra::RepoList
       @ginatra_repo = @repo_list.find(&quot;test&quot;)
-      @grit_repo = Grit::Repo.new(File.join(Ginatra::App.git_dir, &quot;test.git&quot;), {})
+      @grit_repo = Grit::Repo.new(File.join(current_path, &quot;..&quot;, &quot;repos&quot;, &quot;test&quot;), {})
       @commit = @ginatra_repo.commit(&quot;910ff56f585bcdfc3ba105c8846b1df0a6abf069&quot;)
     end
 
     it &quot;should have a name&quot; do
-      @ginatra_repo.name == &quot;Test&quot;
+      @ginatra_repo.name == &quot;test&quot;
     end
 
     it &quot;should have a param for urls&quot; do
@@ -19,20 +20,16 @@ describe &quot;Ginatra&quot; do
     end
 
     it &quot;should have a description&quot; do
-      @ginatra_repo.description == &quot;Unnamed repository; edit this file to name it for gitweb.&quot;
+      @ginatra_repo.description =~ /description file for this repository and set the description for it./
     end
 
-    it &quot;should have a descripton that matches the grit description&quot; do
-      @ginatra_repo.description == @grit_repo.description
-    end
-
-    it &quot;should have an array of commits that match the grit array of commits limited to 25 items&quot; do
+    it &quot;should have an array of commits that match the grit array of commits limited to 10 items&quot; do
       @ginatra_repo.commits === @grit_repo.commits
       @ginatra_repo.commits.length == 10
     end
 
     it &quot;should be the same thing using #find or #new&quot; do
-      @repo_list.find(&quot;test&quot;) == Ginatra::Repo.new(File.join(Ginatra::App.git_dir, &quot;test.git&quot;))
+      @repo_list.find(&quot;test&quot;) == Ginatra::Repo.new(File.join(current_path, &quot;..&quot;, &quot;repos&quot;, &quot;test&quot;))
     end
     
     it &quot;should contain this commit&quot; do</diff>
      <filename>spec/repo_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,6 +16,7 @@ Webrat.configure do |config|
 end
 
 Ginatra::App.set :environment, :test
+Ginatra::Config[:git_dirs] = [&quot;#{current_path}/../repos/*&quot;]
  
 Spec::Runner.configure do |config|
   def app</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 &lt;h3&gt;Repositories&lt;/h3&gt;
 &lt;div class=&quot;active repo-list&quot;&gt;
   &lt;div class=&quot;commit-info&quot;&gt;
-    &lt;%=h Ginatra::App.description %&gt;
+    &lt;%=h Ginatra::Config.description %&gt;
   &lt;/div&gt;
   &lt;dl&gt;
     &lt;% Ginatra::RepoList.list.each do |repo| %&gt;</diff>
      <filename>views/index.erb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/ginatra/multi_repo_list.rb</filename>
    </removed>
    <removed>
      <filename>lib/ginatra/requires.rb</filename>
    </removed>
    <removed>
      <filename>spec/ginatra_spec.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>d4510b565ab427cf1c2377c936ed06b0b2cff114</id>
    </parent>
  </parents>
  <author>
    <name>Samuel Elliott</name>
    <email>sam@lenary.co.uk</email>
  </author>
  <url>http://github.com/lenary/ginatra/commit/e50e8fbc9f18b7b90c4990976f2e869480758bca</url>
  <id>e50e8fbc9f18b7b90c4990976f2e869480758bca</id>
  <committed-date>2009-08-19T00:26:19-07:00</committed-date>
  <authored-date>2009-08-19T00:26:19-07:00</authored-date>
  <message>Implemented Multiple Repository Directories! Closes GH-2

This brings the functionality of MultiRepoList into RepoList itself, and updates everything around it including:

- Rakefile: This now no longer has many of the tasks related to adding git repositories.
- lib/ginatra/config.rb: This has been updated to remove the :git_dir option. Instead use the :git_dirs array for telling ginatra where to look for a repository. You now access all ginatra-related variables through Ginatra::Config.var, and any sinatra-related variables through Ginatra::App.var
- lib/ginatra/repo.rb: This reconfigures the Ginatra::Repo object slightly, including non-capitalised title and path initialisation (i think)
- lib/ginatra/repo_list.rb: This is where the main change has been: now a lot of the methods have to take path rather than param, and other things like that. look at the #refresh method to see the main change in working.
- spec/spec_helper.rb: This file now sets the Ginatra::Config.git_dirs to ['./repos/*'] so that all the tests work. use 'rake setup:repo' to create the test repository.

All tests have been updated or removed due to obsolete functionality.</message>
  <tree>1010de1bfc58a948c2878f8c9b0c71e91831a7a0</tree>
  <committer>
    <name>Samuel Elliott</name>
    <email>sam@lenary.co.uk</email>
  </committer>
</commit>
