<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/gem_this.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -34,7 +34,7 @@ end
 spec = Gem::Specification.new do |s|
   
   # Change these as appropriate
-  s.name              = &quot;&lt;%= gem_name %&gt;&quot;
+  s.name              = &quot;&lt;%= name %&gt;&quot;
   s.version           = &quot;0.1.0&quot;
   s.summary           = &quot;What this thing does&quot;
   s.author            = &quot;&lt;%= author_name %&gt;&quot;
@@ -74,7 +74,7 @@ spec = Gem::Specification.new do |s|
 
   # If you want to publish automatically to rubyforge, you'll may need
   # to tweak this, and the publishing task below too.
-  s.rubyforge_project = &quot;&lt;%= gem_name %&gt;&quot;
+  s.rubyforge_project = &quot;&lt;%= name %&gt;&quot;
 end
 
 # This task actually builds the gem. We also regenerate a static 
@@ -133,7 +133,7 @@ begin
         )
  
         host = &quot;#{config['username']}@rubyforge.org&quot;
-        remote_dir = &quot;/var/www/gforge-projects/&lt;%= gem_name %&gt;/&quot; # Should be the same as the rubyforge project name
+        remote_dir = &quot;/var/www/gforge-projects/&lt;%= name %&gt;/&quot; # Should be the same as the rubyforge project name
         local_dir = 'rdoc'
  
         Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload</diff>
      <filename>Rakefile.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,86 +1,20 @@
 #!/usr/bin/env ruby
 
-require 'etc'
+require 'gem_this'
 
 args = ARGV.dup
 
 if args.first =~ /-?-h/
-  puts &quot;Creates a Rakefile suitable for turning the current project into a gem.&quot;
+  puts GemThis::SUMMARY
   puts &quot;Usage: #{__FILE__} [-d -h] [gem name]&quot;
   puts &quot;If a gem name is not given, the name of the current directory will be used as the gem&quot;
   puts &quot;-h    help, prints out this message.&quot;
-  puts &quot;-d    debug, only prints out the generated Rakefile.&quot;
-  exit(0)
+  puts &quot;-d    #{GemThis::DEBUG_MESSAGE}&quot;
+  exit
 end
 
 debug = args.delete(&quot;-d&quot;)
 
-gem_name = args.first || File.basename(Dir.pwd)
+GemThis.new(args.first || File.basename(Dir.pwd), debug).create_rakefile
 
-def author_name
-  Etc.getpwnam(ENV['USER']).gecos rescue ENV['USER'] #&#160;for Windows
-end
-
-def author_email
-  &quot;youremail@example.com&quot;
-end
-
-def author_url
-  &quot;http://yoursite.example.com&quot;
-end
-
-def using_rspec?
-  File.directory?('spec')
-end
-
-def using_test_unit?
-  File.directory?('test')
-end
-
-def has_executables?
-  File.directory?('bin')
-end
-
-def dirs_to_include
-  %w(bin test spec lib).select { |d| File.directory?(d) }.join(&quot;,&quot;)
-end
-
-def readme
-  Dir['*'].find { |f| f =~ /readme/i }
-end
-
-def files_in_root
-  Dir['*'].reject { |f| File.directory?(f) }.join(&quot; &quot;)
-end
-
-def using_git?
-  File.exist?(&quot;.git&quot;)
-end
-
-def add_to_gitignore
-  return unless File.exist?(&quot;.gitignore&quot;)
-  ignores = File.readlines(&quot;.gitignore&quot;)
-  ignores += [&quot;pkg&quot;, &quot;rdoc&quot;]
-  File.open(&quot;.gitignore&quot;, &quot;w&quot;) { |f| f.write ignores.map { |l| l.strip }.uniq.join(&quot;\n&quot;) }
-end
-
-require 'erb'
-
-template = ERB.new File.read(File.join(File.dirname(__FILE__), '..', 'Rakefile.erb')), nil, '&lt;&gt;'
-rakefile = template.result(binding)
-
-if debug
-  puts rakefile
-  exit(0)
-else
-  if File.exist?('Rakefile')
-    puts &quot;Appended to existing Rakefile&quot;
-    File.open('Rakefile', 'a') { |f| 2.times { f.puts }; f.write rakefile }
-  else
-    puts &quot;Writing new Rakefile&quot;
-    File.open('Rakefile', 'w') { |f| f.write rakefile }
-  end
-  add_to_gitignore if using_git?
-end
-
-exit(0)
\ No newline at end of file
+exit
\ No newline at end of file</diff>
      <filename>bin/gem-this</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
   s.default_executable = %q{gem-this}
   s.email = %q{james@lazyatom.com}
   s.executables = [&quot;gem-this&quot;]
-  s.files = [&quot;Rakefile&quot;, &quot;Readme.markdown&quot;, &quot;Rakefile.erb&quot;, &quot;bin/gem-this&quot;, &quot;lib/rubygems_plugin.rb&quot;]
+  s.files = [&quot;Rakefile&quot;, &quot;Readme.markdown&quot;, &quot;Rakefile.erb&quot;, &quot;bin/gem-this&quot;, &quot;lib/gem_this.rb&quot;, &quot;lib/rubygems_plugin.rb&quot;]
   s.homepage = %q{http://github.com/lazyatom/gem-this}
   s.require_paths = [&quot;bin&quot;, &quot;lib&quot;]
   s.rubyforge_project = %q{gem-this}</diff>
      <filename>gem-this.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,21 @@
 require 'rubygems/command_manager' 
 require 'rubygems/command'
- 
+require 'gem_this'
+
 class Gem::Commands::ThisCommand &lt; Gem::Command
   def initialize
-    super 'this', &quot;Creates a Rakefile suitable for turning the current project into a gem.&quot;
+    super 'this', GemThis::SUMMARY, :debug =&gt; false
+    add_option('-d', '--debug', GemThis::DEBUG_MESSAGE) do |debug, options|
+      options[:debug] = debug
+    end
+  end
+  
+  def summary
+    GemThis::SUMMARY
   end
   
   def execute
-    `gem-this`
+    GemThis.new(options[:args].first || File.basename(Dir.pwd), options[:debug]).create_rakefile
   end
 end
 </diff>
      <filename>lib/rubygems_plugin.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>628a9c063f753a8d42597dcfb944812cd39d5ba1</id>
    </parent>
  </parents>
  <author>
    <name>James Adam</name>
    <email>james@lazyatom.com</email>
  </author>
  <url>http://github.com/lazyatom/gem-this/commit/bbbc08216ad62d8544dce35dd60f9527d0bccc12</url>
  <id>bbbc08216ad62d8544dce35dd60f9527d0bccc12</id>
  <committed-date>2009-07-23T05:47:50-07:00</committed-date>
  <authored-date>2009-07-23T05:36:54-07:00</authored-date>
  <message>Extracted rakefile logic into its own class</message>
  <tree>bbfaa8cc999b4ca4a91f6e87de6226addf2e5f01</tree>
  <committer>
    <name>James Adam</name>
    <email>james@lazyatom.com</email>
  </committer>
</commit>
