You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2007/03/31 06:06:25 UTC

svn commit: r524363 - /tapestry/tapestry5/tapestry-project/trunk/support/new-project.rb

Author: hlship
Date: Fri Mar 30 21:06:24 2007
New Revision: 524363

URL: http://svn.apache.org/viewvc?view=rev&rev=524363
Log:
Add Ruby script to make it easier to create new projects.

Added:
    tapestry/tapestry5/tapestry-project/trunk/support/new-project.rb   (with props)

Added: tapestry/tapestry5/tapestry-project/trunk/support/new-project.rb
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-project/trunk/support/new-project.rb?view=auto&rev=524363
==============================================================================
--- tapestry/tapestry5/tapestry-project/trunk/support/new-project.rb (added)
+++ tapestry/tapestry5/tapestry-project/trunk/support/new-project.rb Fri Mar 30 21:06:24 2007
@@ -0,0 +1,81 @@
+#!/usr/bin/ruby
+
+require 'optparse'
+
+$group = nil
+$artifact = nil
+$package = nil
+$version = "1.0.0-SNAPSHOT"
+$archetypeVersion = "5.0.4-SNAPSHOT"
+$offline = false
+
+$opts = OptionParser.new do |opts|
+  
+  opts.banner = "Usage: new-project.rb [options]"
+  
+  opts.on("-g", "--group GROUP", "The group id for the new project") do |value|
+    $group = value
+  end
+
+  opts.on("-a", "--artifact ARTIFACT", "The artifact for the new project") do |value|
+    $artifact = value
+  end
+  
+  opts.on("-p", "--package PACKAGE", "The root package for source code in the new project") do |value|
+    $package = value
+  end
+  
+  opts.on("-v", "--version VERSION", "The version number of the new project") do |value|
+    $version = value
+  end
+  
+  opts.on("-o", "--offline", "Execute Maven in offline mode") { $offline = true }
+  
+  opts.on("-V", "--archetype-version VERSION", "Version of the Tapestry quickstart archetype") do |value|
+    $archtypeVersion = value
+  end
+  
+  opts.on("-h", "--help", "Help for this command") do
+    puts opts
+    exit
+  end
+end
+
+def fail(message)
+  puts "Error: #{message}"
+  puts $opts
+  exit
+end
+
+
+begin
+  $opts.parse!
+rescue OptionParser::InvalidOption
+  fail $!
+end
+
+fail "Unexpected command line argument" if ARGV.length > 0
+fail "Must specify group" unless $group
+fail "Must specify artifact" unless $artifact
+
+$package = $package || "#$group.#$artifact"
+
+command = ["mvn"]
+
+command << "-o" if $offline
+
+command << [
+  "archetype:create",
+  "-DarchetypeGroupId=org.apache.tapestry",
+  "-DarchetypeArtifactId=quickstart",
+  "-DarchetypeVersion=#$archetypeVersion",
+  "-DgroupId=#$group",
+  "-DartifactId=#$artifact",
+  "-DartifactVersion=#$version",
+  "-DpackageName=#$package"]
+
+command = command.join ' '
+
+exec command
+
+

Propchange: tapestry/tapestry5/tapestry-project/trunk/support/new-project.rb
------------------------------------------------------------------------------
    svn:executable = *