Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / Experiments / Generator / Generators / Controller / ControllerGenerator.boo
blobc51edc8cad5d6e95498edd845cb6ed50157db6ec
1 class ControllerGenerator(NamedGeneratorBase):
2 [Property(Actions)] _actions as (string)
3 [Property(Action)] _action as string
5 def Run():
6 _actions = Argv[0:]
8 MkDir(ControllersBasePath)
9 Process('Controller.cs', "${ControllersBasePath}/${ClassName}Controller.cs")
11 MkDir(ControllersTestsBasePath)
12 Process('Test.cs', "${ControllersTestsBasePath}/${ClassName}ControllerTest.cs")
14 MkDir("${ViewsBasePath}/layouts")
15 Process("layout.${ViewEngineExtension}", "${ViewsBasePath}/layouts/${FileName}.${ViewEngineExtension}")
17 MkDir(ViewPath)
18 for a in Actions:
19 Action = a
20 Process("View.${ViewEngineExtension}", "${ViewsBasePath}/${FileName}/${Action.ToFileName()}.${ViewEngineExtension}")
22 def Usage() as string:
23 return 'ControllerName [Action1, Action2, ...]'
25 def Help() as string:
26 return 'Generates a controller'
28 Namespace:
29 get:
30 return ControllersNamespace
32 TestsNamespace:
33 get:
34 return ControllersTestsNamespace
36 Extension:
37 get:
38 return ActionExtension
40 ViewPath:
41 get:
42 return "${ViewsBasePath}/${FileName}"