Sha256: 96a36aa9f0f007bd30a404561c76ba5d0bbceb993d450a9d87f253d21f876af6

Contents?: true

Size: 996 Bytes

Versions: 8

Compression:

Stored size: 996 Bytes

Contents

#! /usr/bin/env ruby

# = New Form Wizzard
#
# Leverages the FormBuilder functionality to generate a scaffold
# form for the given managed object
#
# Example usage:
#
# ./new_form.rb N::Article lib/articles.rb [article_form.xhtml]
# 
# code:
# * George Moschovitis  <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
# $Id: new_app.rb 188 2004-12-10 14:14:17Z gmosx $

$LOAD_PATH.unshift 'lib'

require 'glue/property'
require 'glue/inflector'
require 'nitro/builders/form'
require 'og'

def die(str)
	puts str
	exit!
end

if klass_name = ARGV[0] and lib_filename = ARGV[1]

require lib_filename
klass = nil
eval "klass = #{klass_name}"
dst_dir = File.dirname(lib_filename)
dst_filename = ARGV[3] || File.join(dst_dir, "#{N::Inflector.name(klass_name)}_form.xhtml")

# p klass, lib_filename, dst_filename

form = N::FormBuilder.render(klass.new)

File.open(dst_filename, 'w') do |file|
	file.write(form)
end

else

puts %{
USAGE:
	new_form class_name library_filename [base_filename]
}

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nitro-0.10.0 bin/new_form.rb
nitro-0.12.0 bin/new_form.rb
nitro-0.11.0 bin/new_form.rb
nitro-0.13.0 bin/new_form.rb
nitro-0.14.0 bin/new_form.rb
nitro-0.9.3 bin/new_form.rb
nitro-0.8.0 bin/new_form.rb
nitro-0.9.5 bin/new_form.rb