<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,4 @@
-Copyright (c) 2008 Nicolas M&#233;rouze
+Copyright (c) 2008-2009 Nicolas M&#233;rouze
  
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the</diff>
      <filename>LICENSE</filename>
    </modified>
    <modified>
      <diff>@@ -1,21 +1,23 @@
-h1. Qt::JRuby Core
+h1. Qt::JRuby
 
-h2. Description
+Build crossplatform applications with Qt and Ruby.
 
-Qt::JRuby core contains all you need to run Qt Jambi with JRuby.
+h1. Create a new application
 
-h2. Requirements
+*NB*: Java must be installed on your system.
 
-* Java 1.5+
-* Qt Jambi 4.4+
-* JRuby 1.1.6+
+&lt;pre&gt;&lt;code&gt;gem install thor
+thor install http://qtjruby.org/qtjruby.thor
+thor qtjruby:app:create myapp
+cd myapp
+java -jar java -jar lib/jruby-complete-$VERSION.jar main.rb&lt;/code&gt;&lt;/pre&gt;
 
-h2. Installation
+h1. Installation from sources
 
-Download Qt Jambi for your platform. Put qtjambi-$VERSION.jar and qtjambi-$PLATFORM-$VERSION.jar into JRUBY_HOME/lib folder. Then :
+Download Qt Jambi for your platform. Put qtjambi-$VERSION.jar and qtjambi-$PLATFORM-$VERSION.jar into $JRUBY_HOME/lib folder. Then :
 
 &lt;pre&gt;&lt;code&gt;jruby -S gem install extlib
-git clone git://github.com/nmerouze/qtjruby.git
+git clone git://github.com/nmerouze/qtjruby-core.git
 cd /path/to/qtjruby-core
 jruby -S rake install&lt;/code&gt;&lt;/pre&gt;
 
@@ -32,29 +34,22 @@ hello = Qt::PushButton.new 'Hello World!'
 hello.show
 Qt::Application.exec&lt;/code&gt;&lt;/pre&gt;
 
-h2. Thor tasks (experimental)
+h1. Where does it work ?
 
-&lt;pre&gt;&lt;code&gt;thor install http://github.com/nmerouze/qtjruby-core/raw/master/tasks/qtjruby.thor
-thor qtjruby:stack:install myapp&lt;/code&gt;&lt;/pre&gt;
+Tested under:
 
-h2. Where does it work ?
+* Mac OS X Tiger &amp; Leopard
+* Ubuntu 8.10 with Java 6 &amp; OpenJDK
+* Windows XP SP3
 
-I've tested Qt::JRuby under Mac OS X 10.4 and 10.5 and Ubuntu 8.04 (Java 5 and 6). Windows has not been tested yet but it's probably working.
+h1. Links
 
-Please send me a mail if you have a problem elsewhere.
-
-h2. Links
-
-* Qt::JRuby : http://qtjruby.org
-* Qt::JRuby sources : http://github.com/nmerouze/qtjruby
-* JRuby : http://jruby.codehaus.org/
-* Install JRuby : http://wiki.jruby.org/wiki/Getting_Started
-* Qt Jambi 4.4 : http://trolltech.com/downloads
+* Qt::JRuby : http://qtjruby.org &amp; http://qtjruby.googlecode.com
+* Qt::JRuby sources : http://github.com/nmerouze/qtjruby-core
 * Qt Jambi Documentation : http://doc.trolltech.com
-* Git : http://git.or.cz/
 
-h2. License and support
+h1. License and support
 
-(C) 2008 Nicolas M&#233;rouze, under an MIT licence. http://www.opensource.org/licenses/mit-license.php
+(C) 2008-2009 Nicolas M&#233;rouze, under an MIT licence. http://www.opensource.org/licenses/mit-license.php
 
 Please leave any bugs or feedback at nicolas.merouze [at] gmail [dot] com
\ No newline at end of file</diff>
      <filename>README.textile</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,11 @@ require 'thor'
 require 'net/http'
 require 'open-uri'
 
+JRUBY_VERSION   = '1.1.6'
+QTJAMBI_VERSION = '4.4.3_01'
+QTJRUBY_VERSION = '0.3.0'
+EXTLIB_VERSION  = '0.9.9'
+
 ##############################################################################
 
 module ColorfulMessages
@@ -36,54 +41,106 @@ module ColorfulMessages
   
 end
 
+module Helpers
+  def download(source, dir)
+    filename    = File.basename(source)
+    destination = &quot;#{dir}/#{filename}&quot;
+    
+    if File.exist?(destination)
+      message &quot;[EXIST] #{destination}&quot;
+    else
+      File.open(destination, &quot;wb&quot;) do |file|
+        info &quot;Downloading #{filename}...&quot;
+        file.write(open(source).read)
+      end
+
+      success &quot;[ADDED] #{destination}&quot;
+    end
+  end
+  
+  def install_gem(name, dir)
+    Dir.chdir(dir) do
+      info &quot;Installing #{name} gem...&quot;
+      `java -jar lib/jruby-complete-#{JRUBY_VERSION}.jar -S gem install #{name} -i gems`
+    end
+    success &quot;[ADDED] #{name} gem in #{dir}/gems&quot;
+  end
+  
+  def create_dir(dir)
+    if File.exist?(dir)
+      message &quot;[EXIST] #{dir}&quot;
+    else
+      FileUtils.mkdir(dir)
+      success &quot;[ADDED] #{dir}&quot;
+    end
+  end
+  
+  def create_file(name, dir, &amp;block)
+    destination = &quot;#{dir}/#{name}&quot;
+    
+    if File.exist?(destination)
+      message &quot;[EXIST] #{destination}&quot;
+    else
+      File.open(destination, &quot;w&quot;, &amp;block)
+      success &quot;[ADDED] #{destination}&quot;
+    end
+  end
+end
+
 ##############################################################################
 
 class Qtjruby &lt; Thor
   
-  class Stack &lt; Thor
+  class App &lt; Thor
     
     include ColorfulMessages
+    include Helpers
     
-    desc 'install name', 'Install an application with the full stack'             
-    def install(dir)
+    desc 'create name', 'Create a Qt::JRuby application'             
+    def create(dir)
       # Create application dir
-      FileUtils.mkdir(dir)
-      puts &quot;[ADDED] #{dir}&quot;
+      create_dir(dir)
       # Create lib dir
-      lib_dir = FileUtils.mkdir(dir + '/lib')
-      puts &quot;[ADDED] #{dir}/lib&quot;
+      create_dir(lib_dir = dir + '/lib')
       # Create main.rb
-      File.open(&quot;#{dir}/main.rb&quot;, &quot;w&quot;) do |file|
+      create_file('main.rb', dir) do |file|
         file.write &lt;&lt;-RUBY
+# java -jar lib/jruby-complete-#{JRUBY_VERSION}.jar main.rb
+Dir.glob(File.dirname(__FILE__) + '/lib/qtjambi-*.jar') { |jar| require jar }
 require 'rubygems'
 
-if File.exist?(gem_dir = File.join(Dir.pwd, 'gems'))
-  Gem.clear_paths
-  Gem.path.unshift(gem_dir)
-end
+Gem.clear_paths
+Gem.path.unshift(File.dirname(__FILE__) + '/gems')
 
-gem 'extlib', '~&gt; 0.9.9'
+gem 'extlib', '~&gt; #{EXTLIB_VERSION}'
 require 'extlib'
 
-Dir.glob(Dir.pwd / 'lib' / 'qtjambi-*.jar') { |jar| require jar }
-
+gem 'qtjruby-core', '~&gt; #{QTJRUBY_VERSION}'
 require 'qtjruby-core'
+
+Qt::Application.initialize(ARGV)
+hello = Qt::PushButton.new 'Hello World!'
+hello.resize(120, 40)
+hello.window_title = 'Hello World'
+hello.show
+Qt::Application.exec
         RUBY
       end
-      puts &quot;[ADDED] #{dir}/main.rb&quot;
       # Download jruby-complete
-      jar_version = '1.1.6'
-      File.open(&quot;#{lib_dir}/jruby-complete-#{jar_version}.jar&quot;, &quot;wb&quot;) do |file|
-        file.write(open(&quot;http://repository.codehaus.org/org/jruby/jruby-complete/#{jar_version}/jruby-complete-#{jar_version}.jar&quot;).read)
-      end
-      puts &quot;[ADDED] #{dir}/lib/jruby-complete-#{jar_version}.jar&quot;
-      # Install extlib
-      Dir.chdir(dir) do
-        `java -jar lib/jruby-complete-#{jar_version}.jar -S gem install extlib -i gems`
+      download(&quot;http://repository.codehaus.org/org/jruby/jruby-complete/#{JRUBY_VERSION}/jruby-complete-#{JRUBY_VERSION}.jar&quot;, lib_dir)
+      # Download qtjambi
+      download(&quot;http://qtjruby.googlecode.com/files/qtjambi-#{QTJAMBI_VERSION}.jar&quot;, lib_dir)
+      # Download qtjambi specific files
+      case RUBY_PLATFORM
+      when /win32|mingw|bccwin|cygwin/
+        download(&quot;http://qtjruby.googlecode.com/files/qtjambi-win32-msvc2005-#{QTJAMBI_VERSION}.jar&quot;, lib_dir)
+      when /darwin/
+        download(&quot;http://qtjruby.googlecode.com/files/qtjambi-macosx-gcc-#{QTJAMBI_VERSION}.jar&quot;, lib_dir)
+      else
+        download(&quot;http://qtjruby.googlecode.com/files/qtjambi-linux32-gcc-#{QTJAMBI_VERSION}.jar&quot;, lib_dir)
       end
-      puts &quot;[ADDED] extlib gems in #{dir}/gems&quot;
-      # TODO: Download qtjambi jar
-      # TODO: Handle errors and exceptions
+      # Install qtjruby
+      install_gem('qtjruby-core', dir)
     end
     
   end</diff>
      <filename>tasks/qtjruby.thor</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0706df3ac44f07947d75a0a7b552755bc55518a9</id>
    </parent>
  </parents>
  <author>
    <name>Nicolas M&#233;rouze</name>
    <email>nicolas.merouze@gmail.com</email>
  </author>
  <url>http://github.com/nmerouze/qtjruby-core/commit/658911277e5a7b87c8c5f5a74893dafdc2672038</url>
  <id>658911277e5a7b87c8c5f5a74893dafdc2672038</id>
  <committed-date>2009-01-06T02:34:39-08:00</committed-date>
  <authored-date>2009-01-06T02:34:39-08:00</authored-date>
  <message>Update README and the thor task.</message>
  <tree>4986b8c6d4d6a73b832a3a5d27e3331b08fc129d</tree>
  <committer>
    <name>Nicolas M&#233;rouze</name>
    <email>nicolas.merouze@gmail.com</email>
  </committer>
</commit>
