Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / Experiments / Generator / Generators / Project / ProjectGenerator.boo
blob4e14364cee517c2b3ac0641bcad78b6a3270a30a
1 import System
2 import System.IO
4 class ProjectGenerator(NamedGeneratorBase):
5 [Property(DotNet1), Option('net-1.1', '1', 'Set the target framework to .NET 1.1/Mono 1.0. (Default 2.0)')]
6 _dotNet11 as bool
7 [Property(VSFiles), Option('vs', 'v', 'Generates Visual Studio project files [BETA]')]
8 _vsFiles as bool
10 [Property(AppGuid)] _appGuid = "{${Guid.NewGuid().ToString().ToUpper()}}"
11 [Property(TestGuid)] _testGuid = "{${Guid.NewGuid().ToString().ToUpper()}}"
13 def Run():
14 MkDir(Name)
16 MkDir("${Name}/app/controllers")
17 Process("app/controllers/ApplicationController.cs", "${Name}/app/controllers/ApplicationController.cs")
18 MkDir("${Name}/app/helpers")
19 MkDir("${Name}/app/models")
20 MkDir("${Name}/app/views")
21 MkDir("${Name}/app/views/layouts")
22 MkDir("${Name}/app/views/rescues")
24 MkDir("${Name}/config")
25 Process("config/Boot.cs", "${Name}/config/Boot.cs")
26 MkDir("${Name}/config/databases")
27 Process("config/databases/development.xml", "${Name}/config/databases/development.xml")
28 Process("config/databases/test.xml", "${Name}/config/databases/test.xml")
30 Process("default.build", "${Name}/default.build")
32 MkDir("${Name}/doc")
33 Process("doc/readme.txt", "${Name}/doc/readme.txt")
35 CopyDir("lib", "${Name}/lib")
36 CopyDir("../../../bin", "${Name}/lib/generator/bin")
37 CopyDir("../../../Generators", "${Name}/lib/generator/Generators")
38 FileInfo("${Name}/lib/generator/Generators/Config.boo").Delete()
39 Process("Config.boo", "${Name}/lib/generator/Generators/Config.boo")
41 MkDir("${Name}/log")
43 MkDir("${Name}/db")
45 MkDir("${Name}/public/content")
46 CopyDir("public/content", "${Name}/public/content")
47 Process("public/global.asax", "${Name}/public/global.asax")
48 Process("public/index.html", "${Name}/public/index.html")
49 Process("public/web.config", "${Name}/public/web.config")
51 MkDir("${Name}/script")
52 Process("script/console.boo", "${Name}/script/console.boo")
53 Copy("script/console", "${Name}/script")
54 Copy("script/console.bat", "${Name}/script")
55 Copy("script/generate", "${Name}/script")
56 Copy("script/generate.bat", "${Name}/script")
57 Copy("script/server", "${Name}/script")
58 Copy("script/server.bat", "${Name}/script")
59 Process("script/server.boo", "${Name}/script/server.boo")
60 Copy("script/migrate", "${Name}/script")
61 Copy("script/migrate.bat", "${Name}/script")
63 MkDir("${Name}/test/controllers")
64 Process("test/controllers/ControllerTestCase.cs", "${Name}/test/controllers/ControllerTestCase.cs")
65 MkDir("${Name}/test/helpers")
66 MkDir("${Name}/test/models")
67 Process("test/models/ActiveRecordTestCase.cs", "${Name}/test/models/ActiveRecordTestCase.cs")
69 if VSFiles:
70 vsVersion = '2005'
71 vsVersion = '2003' if DotNet1
72 Process("vs/${vsVersion}/app.csproj", "${Name}/app/app.csproj")
73 Process("vs/${vsVersion}/test.csproj", "${Name}/test/test.csproj")
74 Process("vs/${vsVersion}/solution.sln", "${Name}/${Name}.sln")
76 print "Run 'nant setup' from the base directory to setup the environment"
78 def Help():
79 return 'Generates a new MonoRail project'
81 def Usage():
82 return "ProjectName"
84 TargetFramework:
85 get:
86 if DotNet1:
87 return "net-1.1"
88 else:
89 return "net-2.0"