<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,2 @@
 # I use this to make life easier when installing and testing from source:
-rm -rf subdomain-fu-*.gem &amp;&amp; gem build subdomain-fu.gemspec &amp;&amp; sudo gem uninstall subdomain-fu &amp;&amp; sudo gem install subdomain-fu-0.3.0.gem --no-ri --no-rdoc
+rm -rf subdomain-fu-*.gem &amp;&amp; gem build subdomain-fu.gemspec &amp;&amp; sudo gem uninstall subdomain-fu &amp;&amp; sudo gem install subdomain-fu-0.4.1.gem --no-ri --no-rdoc</diff>
      <filename>install.sh</filename>
    </modified>
    <modified>
      <diff>@@ -137,14 +137,24 @@ module SubdomainFu
     end
   end
 
+  def self.current_domain(request)
+    domain = &quot;&quot;
+    domain &lt;&lt; request.subdomains[1..-1].join(&quot;.&quot;) + &quot;.&quot; if request.subdomains.length &gt; 1
+    domain &lt;&lt; request.domain + request.port_string
+  end
+
   module Controller
     def self.included(controller)
       controller.helper_method(:current_subdomain)
+      controller.helper_method(:current_domain)
     end
 
     protected
     def current_subdomain
       SubdomainFu.current_subdomain(request)
     end
+    def current_domain
+      SubdomainFu.current_domain(request)
+    end
   end
 end</diff>
      <filename>lib/subdomain-fu.rb</filename>
    </modified>
    <modified>
      <diff>@@ -159,6 +159,33 @@ describe &quot;SubdomainFu&quot; do
     end
   end
 
+  describe &quot;#current_domain&quot; do
+    it &quot;should return the current domain if there is one&quot; do
+      request = mock(&quot;request&quot;, :subdomains =&gt; [], :domain =&gt; &quot;example.com&quot;, :port_string =&gt; &quot;&quot;)
+      SubdomainFu.current_domain(request).should == &quot;example.com&quot;
+    end
+
+    it &quot;should return empty string if there is no domain&quot; do
+      request = mock(&quot;request&quot;, :subdomains =&gt; [], :domain =&gt; &quot;&quot;, :port_string =&gt; &quot;&quot;)
+      SubdomainFu.current_domain(request).should == &quot;&quot;
+    end
+
+    it &quot;should return the current domain if there is only one level of subdomains&quot; do
+      request = mock(&quot;request&quot;, :subdomains =&gt; [&quot;www&quot;], :domain =&gt; &quot;example.com&quot;, :port_string =&gt; &quot;&quot;)
+      SubdomainFu.current_domain(request).should == &quot;example.com&quot;
+    end
+
+    it &quot;should return everything but the first level of subdomain when there are multiple levels of subdomains&quot; do
+      request = mock(&quot;request&quot;, :subdomains =&gt; [&quot;awesome&quot;,&quot;rad&quot;,&quot;cheese&quot;,&quot;chevy&quot;,&quot;ford&quot;], :domain =&gt; &quot;example.com&quot;, :port_string =&gt; &quot;&quot;)
+      SubdomainFu.current_domain(request).should == &quot;rad.cheese.chevy.ford.example.com&quot;
+    end
+
+    it &quot;should return the domain with port if port is given&quot; do
+      request = mock(&quot;request&quot;, :subdomains =&gt; [&quot;awesome&quot;,&quot;rad&quot;,&quot;cheese&quot;,&quot;chevy&quot;,&quot;ford&quot;], :domain =&gt; &quot;example.com&quot;, :port_string =&gt; &quot;:3000&quot;)
+      SubdomainFu.current_domain(request).should == &quot;rad.cheese.chevy.ford.example.com:3000&quot;
+    end
+  end
+
   describe &quot;#same_subdomain?&quot; do
     it { SubdomainFu.same_subdomain?(&quot;www&quot;,&quot;www.localhost&quot;).should be_true }
     it { SubdomainFu.same_subdomain?(&quot;www&quot;,&quot;localhost&quot;).should be_true }</diff>
      <filename>spec/subdomain_fu_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
 
 Gem::Specification.new do |s|
   s.name = %q{subdomain-fu}
-  s.version = &quot;0.4.0&quot;
+  s.version = &quot;0.4.1&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Michael Bleigh&quot;]</diff>
      <filename>subdomain-fu.gemspec</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c01ed8e6fd8d439bb2839cc2e387c1ff3c386ba5</id>
    </parent>
  </parents>
  <author>
    <name>pboling</name>
    <email>peter.boling@peterboling.com</email>
  </author>
  <url>http://github.com/mbleigh/subdomain-fu/commit/a4fed2d0d7b24c38eeabfccc14bea943f740f6ea</url>
  <id>a4fed2d0d7b24c38eeabfccc14bea943f740f6ea</id>
  <committed-date>2009-09-13T05:20:35-07:00</committed-date>
  <authored-date>2009-09-13T05:20:35-07:00</authored-date>
  <message>added current_domain method</message>
  <tree>53b922c600a652f40ef80dfdc5167a3d7f405d6a</tree>
  <committer>
    <name>pboling</name>
    <email>peter.boling@peterboling.com</email>
  </committer>
</commit>
