<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -19,7 +19,7 @@ In #merb on Freenode:
 
 == Usage:
 
-  $ bludgeon rspec git://github.com/dchelimsky/rspec.git
+  $ bludgeon git://github.com/dchelimsky/rspec.git
   == rspec (git://github.com/dchelimsky/rspec.git)
     Lines: 38698
     Pages: 773
@@ -33,13 +33,13 @@ In #merb on Freenode:
 
 == Install:
 
-  $ sudo gem install technomancy-bludgeon --source=http://gems.github.com
+  $ sudo gem install bludgeon
 
 == Todo:
 
 * Research actual weight needed to bludgeon someone to death.
 * Allow calculations to take font size into account.
-* Calculate by wrapping long lines instead of truncating.
+* Calculate by wrapping long lines instead of truncating. (use pr utility?)
 * Allow for portrait-orientation printouts when extremely long
   lines are common. (*ahem* Rails.)
 </diff>
      <filename>README.txt</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,7 @@ require 'hoe'
 require './lib/bludgeon.rb'
 
 Hoe.new('bludgeon', Bludgeon::VERSION) do |p|
+  p.rubyforge_name = &quot;seattlerb&quot;
   p.developer('Phil Hagelberg', 'technomancy@gmail.com')
   p.extra_dev_deps &lt;&lt; ['minitest', '&gt;= 1.3.0']
 end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -2,5 +2,5 @@
 
 require File.dirname(__FILE__) + '/../lib/bludgeon'
 
-abort &quot;Usage: bludgeon NAME GIT_REPO_URL&quot; if ARGV.size != 2
+abort &quot;Usage: bludgeon URL&quot; if ARGV.empty? or ARGV.include?('--help')
 Bludgeon.calculate(*ARGV)</diff>
      <filename>bin/bludgeon</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,13 @@
+require 'fileutils'
+
 module Bludgeon
   VERSION = '0.0.1'
   DOWNLOAD_LOCATION = '/tmp/bludgeon-project'
-  LINES_PER_PAGE = 50  # TODO: calculate based on font-size
+  # LINES_PER_PAGE = 50  # TODO: calculate based on font-size
   BLUDGEON_PAGES = 500 # TODO: is this accurate?
 
-  def self.calculate(name, url)
-    project = Project.new(name, url)
+  def self.calculate(*args)
+    project = Project.new(*args)
     project.download
     project.calculate
     report(project)
@@ -13,37 +15,69 @@ module Bludgeon
 
   def self.report(project)
     puts [&quot;== #{project.name} (#{project.url})&quot;,
-          &quot;  Lines: #{project.lines}&quot;,
           &quot;  Pages: #{project.pages}&quot;,
           &quot;You &quot; + (project.bludgeon? ? &quot;could&quot; : &quot;could not&quot;) +
           &quot; bludgeon someone to death with a printout.&quot;].join(&quot;\n&quot;)
   end
 
   class Project
-    def initialize(name, url)
-      @name, @url = name, url
+    def initialize(*args)
+      @url = args.pop
+      @name = args.pop || extract_name(@url)
+      @type = if url =~ /^git:\/\// or url =~ /\.git$/
+                :git
+              elsif url =~ /^svn:\/\// or url =~ /^http:\/\//
+                :svn
+              else
+                :gem
+              end
     end
 
-    attr_reader :name, :url, :lines, :pages
+    attr_reader :name, :url, :pages, :type
 
-    # TODO: wrap long lines?
+    # TODO: wrap long lines? (look into the &quot;pr&quot; unix tool; may be able to do this)
     def calculate
-      line_counts = `find #{DOWNLOAD_LOCATION} -type f | xargs wc -l`.split &quot;\n&quot;
-      @lines = line_counts.pop.to_i # last line is total
-      @pages = @lines / LINES_PER_PAGE
+      @pages = 0
+      last_file = ''
+      `find #{DOWNLOAD_LOCATION} -type f | xargs pr | egrep &quot;Page [0-9]+$&quot;`.split(&quot;\n&quot;).each do |line|
+        time, file, page = line.split(/\s+/)
+      end
+      @pages = page_counts.map{ |c| c[/Page (\d+)$/, 1].to_i }.inject(0){ |sum, x| sum + x }
     end
 
     def bludgeon?
       self.pages &gt;= BLUDGEON_PAGES
     end
 
-    # TODO: allow for other repository types. gems maybe?
     def download
       puts &quot;Downloading #{url}...&quot;
       system &quot;rm -rf #{DOWNLOAD_LOCATION}&quot;
+      send &quot;download_#{@type}&quot;
+      puts &quot;...Done!&quot;
+    end
+
+    def download_git
       system &quot;git clone --depth=1 #{@url} #{DOWNLOAD_LOCATION} &gt; /dev/null&quot; or
-        raise &quot;Could not download #{@url}&quot;
+        raise &quot;Could not clone #{@url}&quot;
       system &quot;rm -rf #{DOWNLOAD_LOCATION}/.git&quot;
     end
+
+    def download_svn
+      system &quot;svn checkout #{@url} #{DOWNLOAD_LOCATION} &gt; /dev/null&quot; or
+        raise &quot;Could not checkout #{@url}&quot;
+      system &quot;find #{DOWNLOAD_LOCATION} -type d -name .svn | xargs rm -rf&quot;
+    end
+
+    def download_gem
+      Dir.mkdir DOWNLOAD_LOCATION
+      FileUtils.cd DOWNLOAD_LOCATION
+      system &quot;gem fetch #{@name} &amp;&amp; gem unpack #{@name}*.gem&quot; or
+        raise &quot;Could not fetch and unpack gem #{@name}&quot;
+      system &quot;rm #{@name}*.gem&quot;
+    end
+
+    def extract_name(url)
+      url[/\/([^\/]*?)(\.git)?$/, 1] or url
+    end
   end
 end</diff>
      <filename>lib/bludgeon.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 require 'rubygems'
 require 'minitest/unit'
+require File.dirname(__FILE__) + '/../lib/bludgeon'
 
 class TestBludgeon &lt; MiniTest::Unit::TestCase
   def test_bludgeon_bus_scheme
@@ -13,6 +14,13 @@ git://github.com/technomancy/bus-scheme.git`
 git://github.com/dchelimsky/rspec.git`
     assert_match /could bludgeon someone to death/, output
   end
+
+  def test_initialize
+    p = Bludgeon::Project.new 'http://github.com/technomancy/bus-scheme.git'
+    assert_equal :git, p.type
+    assert_equal 'bus-scheme', p.extract_name(p.url)
+    assert_equal 'bus-scheme', p.name
+  end
 end
 
 MiniTest::Unit.autorun</diff>
      <filename>test/test_bludgeon.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a8da76b4643073d4e62a02e56613a48ea02c868e</id>
    </parent>
  </parents>
  <author>
    <name>Phil Hagelberg</name>
    <email>technomancy@gmail.com</email>
  </author>
  <url>http://github.com/technomancy/bludgeon/commit/cdb44e9545c70d4b9f336d59dd3ef8ebd1665ebf</url>
  <id>cdb44e9545c70d4b9f336d59dd3ef8ebd1665ebf</id>
  <committed-date>2008-11-27T09:42:21-08:00</committed-date>
  <authored-date>2008-11-27T09:42:21-08:00</authored-date>
  <message>Extract name from URL instead of explictly passing it. Support svn, gems.</message>
  <tree>4313eb9b5328f911237f5fd495a886beaad85698</tree>
  <committer>
    <name>Phil Hagelberg</name>
    <email>technomancy@gmail.com</email>
  </committer>
</commit>
