Skip to content

Commit

Permalink
Lay groundwork for multiple default templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mkmurray committed Nov 12, 2011
1 parent f8af933 commit 14f1659
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 120 deletions.
10 changes: 0 additions & 10 deletions fubuTemplate/fubuDependencies.txt

This file was deleted.

11 changes: 0 additions & 11 deletions fubuTemplate/packages.config

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions fubuTemplate/src/FUBUPROJECTNAME/Views/Home/Welcome.spark

This file was deleted.

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FUBUPROJECTNAME", "src\FUBUPROJECTNAME\FUBUPROJECTNAME.csproj", "{FACEFACE-FACE-FACE-FACE-FACEFACEFACE}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FUBUPROJECTNAME", "FUBUPROJECTNAME\FUBUPROJECTNAME.csproj", "{FACEFACE-FACE-FACE-FACE-FACEFACEFACE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Expand Up @@ -34,32 +34,32 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Bottles">
<HintPath>..\..\lib\Bottles\lib\Bottles.dll</HintPath>
<HintPath>..\packages\Bottles\lib\Bottles.dll</HintPath>
</Reference>
<Reference Include="FubuCore">
<HintPath>..\..\lib\FubuCore\lib\FubuCore.dll</HintPath>
<HintPath>..\packages\FubuCore\lib\FubuCore.dll</HintPath>
</Reference>
<Reference Include="FubuMVC.Core">
<HintPath>..\..\lib\FubuMVC.References\lib\FubuMVC.Core.dll</HintPath>
<HintPath>..\packages\FubuMVC.References\lib\net40\FubuMVC.Core.dll</HintPath>
</Reference>
<Reference Include="FubuMVC.Spark">
<HintPath>..\..\lib\FubuMVC.Spark\lib\net40\FubuMVC.Spark.dll</HintPath>
<HintPath>..\packages\FubuMVC.Spark\lib\net40\FubuMVC.Spark.dll</HintPath>
</Reference>
<Reference Include="FubuMVC.StructureMap">
<HintPath>..\..\lib\FubuMVC.References\lib\FubuMVC.StructureMap.dll</HintPath>
<HintPath>..\packages\FubuMVC.References\lib\net40\FubuMVC.StructureMap.dll</HintPath>
</Reference>
<Reference Include="HtmlTags">
<HintPath>..\..\lib\HtmlTags\lib\4.0\HtmlTags.dll</HintPath>
<HintPath>..\packages\HtmlTags\lib\4.0\HtmlTags.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\..\lib\CommonServiceLocator\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
<HintPath>..\packages\CommonServiceLocator\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="Spark">
<HintPath>..\..\lib\Spark\lib\NET40\Spark.dll</HintPath>
<HintPath>..\packages\Spark\lib\NET40\Spark.dll</HintPath>
</Reference>
<Reference Include="StructureMap">
<HintPath>..\..\lib\structuremap\lib\StructureMap.dll</HintPath>
<HintPath>..\packages\structuremap\lib\StructureMap.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand All @@ -76,25 +76,23 @@
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Conent Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\Home\HomeController.cs" />
<Compile Include="FUBUPROJECTSHORTNAMEHtmlConventions.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="FUBUPROJECTSHORTNAMERegistry.cs" />
<Compile Include="Models\View\WelcomeViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Views\Home\Welcome.spark" />
</ItemGroup>
<ItemGroup>
<Folder Include="Content\images\" />
<Folder Include="Content\scripts\" />
<Folder Include="Content\styles\" />
<Folder Include="Models\Input\" />
<Folder Include="Models\View\" />
<Folder Include="Controllers\" />
<Folder Include="Views\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
Expand All @@ -115,11 +113,6 @@
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
<MonoDevelop>
<Properties VerifyCodeBehindFields="true" VerifyCodeBehindEvents="true">
<XspParameters Port="34343" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="true" />
</Properties>
</MonoDevelop>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand All @@ -128,4 +121,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
@@ -1,6 +1,5 @@
using FubuMVC.Core;
using FubuMVC.Spark;
using FUBUPROJECTNAME.Controllers.Home;

namespace FUBUPROJECTNAME
{
Expand All @@ -17,15 +16,12 @@ public FUBUPROJECTSHORTNAMERegistry()
.IncludeClassesSuffixedWithController();

Routes
.HomeIs<HomeController>(c => c.Welcome())
.IgnoreControllerNamespaceEntirely();

this.UseSpark();

Views
.TryToAttachWithDefaultConventions();

HtmlConvention<FUBUPROJECTSHORTNAMEHtmlConventions>();
}
}
}
@@ -1,5 +1,4 @@
using System.Web;
using System.Web.Routing;
using Bottles;
using FubuMVC.Core;
using StructureMap;
Expand All @@ -14,7 +13,7 @@ protected void Application_Start()
FubuApplication
.For<FUBUPROJECTSHORTNAMERegistry>()
.StructureMap(() => new Container(SetupContainer))
.Bootstrap(RouteTable.Routes);
.Bootstrap();

// If there is an error during bootstrapping, it will not automatically be considered
// fatal and there will be no YSOD. This is to help during initial debugging and
Expand All @@ -27,4 +26,4 @@ private static void SetupContainer(ConfigurationExpression x)
{
}
}
}
}
File renamed without changes.
14 changes: 14 additions & 0 deletions fubuTemplates/default/src/FUBUPROJECTNAME/packages.config
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.0" />
<package id="FubuCore" version="0.9.2.93" />
<package id="HtmlTags" version="1.0.0.23" />
<package id="Bottles" version="0.9.1.151" />
<package id="FubuLocalization" version="0.9.2.93" />
<package id="structuremap" version="2.6.3" />
<package id="FubuMVC.References" version="0.9.1.635" />
<package id="WebActivator" version="1.1.0.0" />
<package id="FubuMVC" version="0.9.1.635" />
<package id="Spark" version="1.6" />
<package id="FubuMVC.Spark" version="0.9.1.637" />
</packages>
Expand Up @@ -3,4 +3,3 @@ obj
*.suo
*ReSharper*
*.user
FubuMVC/*.dll
3 changes: 2 additions & 1 deletion packaging/nuget/fubumvc.references.nuspec
Expand Up @@ -30,5 +30,6 @@
<file src="..\..\src\fubu\bin\release\StructureMap.dll" target="tools" />
<file src="..\..\src\fubu\bin\release\Bottles*.*" target="tools" />
<file src="..\..\build\fubumvc-deployers.zip" target="tools" />
<file src="..\..\build\*Template.zip" target="tools" />
</files>
</package>
</package>
70 changes: 47 additions & 23 deletions rakefile.rb
Expand Up @@ -158,47 +158,61 @@ def self.storyteller(args)

def self.fubu(args)
fubu = Platform.runtime("src/fubu/bin/#{COMPILE_TARGET}/fubu.exe")
sh "#{fubu} #{args}"
sh "#{fubu} #{args}"
end

FUBUTEMPLATE_DIR = 'fubuTemplate'
FUBUTEMPLATE_DIR = 'fubuTemplates'
namespace :template do

desc "Cleans, Updates, and Zips fubuTemplate"
task :build => ["template:clean", "template:update", "template:nugetclean", "template:zip"]
nuget = "buildsupport/nuget.exe"
desc 'Cleans, Updates, and Zips Fubu templates'
task :build => ['template:clean', 'template:update', 'template:slimdown_nuget_pkgs', 'template:zip_all', 'template:build_artifacts_cleanup']
nuget = 'buildsupport/nuget.exe'

desc "Updates and zips default FubuTemplate"
zip :zip do |zip|
zip.directories_to_zip = [FUBUTEMPLATE_DIR]
zip.output_file = 'fubuTemplate.zip'

desc 'Updates and zips default Fubu templates'
task :zip_all do
# first clear out old templates
Dir['build/*Template.zip'].each {|zip_file| rm_rf zip_file}

Dir["#{FUBUTEMPLATE_DIR}/*/"].each do |template_dir|
Rake::Task['template:zip'].execute template_dir
end
end

zip :zip do |zip, subdir|
folder_name = File.basename subdir
zip.directories_to_zip = [subdir]
zip.output_file = "#{folder_name}Template.zip"
zip.output_path = ['build']
end

desc "Update fubuTemplate dependencies"
desc 'Update Fubu templates dependencies'
task :update do
packages_config = File.join(FUBUTEMPLATE_DIR, "/packages.config")
dependencies_dir = File.join(FUBUTEMPLATE_DIR, 'lib')
unless File.exists?(packages_config)
puts "No fubuDependencies.txt file"
return
Dir["#{FUBUTEMPLATE_DIR}/*/"].each do |template_dir|
packages_config = File.join(template_dir, 'src/FUBUPROJECTNAME/packages.config')
dependencies_dir = File.join(template_dir, 'src/packages')
unless File.exists?(packages_config)
puts "No packages.config file for brining in dependencies into template #{template_dir}"
return
end
mkdir_p(dependencies_dir)
# Run nuget here
sh "#{nuget} install #{packages_config} -o #{dependencies_dir} -ExcludeVersion"
cp_r "#{template_dir}src/packages/FubuMVC/content/fubu-content/", "#{template_dir}src/FUBUPROJECTNAME/fubu-content"
end
mkdir_p(dependencies_dir)
# Run nuget here
sh "#{nuget} install #{packages_config} -o #{dependencies_dir} -ExcludeVersion"
end

desc "Cleans nuget install downloading source"
task :nugetclean, [:dry_run] do |t,args|
desc 'Cleans nuget install downloading source'
task :slimdown_nuget_pkgs, [:dry_run] do |t, args|
Dir.chdir(FUBUTEMPLATE_DIR) do
files = Dir.glob("lib/**/src")
nupkg = Dir.glob("lib/**/*.nupkg")
files = Dir.glob('*/src/packages/**/src')
nupkg = Dir.glob('*/src/packages/**/*.nupkg')
files << nupkg
args[:dry_run] ? puts(files) : rm_r(files)
end
end

desc "Cleans matching files in fubuTemplateIgnore.txt"
desc 'Cleans matching files in fubuTemplateIgnore.txt'
task :clean, [:dry_run] do |t, args|
Dir.chdir(FUBUTEMPLATE_DIR) do
files = IO.readlines('fubuTemplateIgnore.txt')
Expand All @@ -208,5 +222,15 @@ def self.fubu(args)
args[:dry_run] ? puts(files) : rm_r(files)
end
end

task :build_artifacts_cleanup do
Dir["#{FUBUTEMPLATE_DIR}/*/src/"].each do |template_dir|
nuget_pkg_dirs = File.join(template_dir, 'packages/*/')
fubu_content_dir = File.join(template_dir, 'FUBUPROJECTNAME/fubu-content')

Dir[nuget_pkg_dirs].each {|nuget_pkg_dir| rm_rf nuget_pkg_dir}
rm_rf fubu_content_dir
end
end
end

4 changes: 2 additions & 2 deletions src/Fubu/NewCommand.cs
Expand Up @@ -18,7 +18,7 @@ public class NewCommand : FubuCommand<NewCommandInput>
{
// Error code for file exists http://msdn.microsoft.com/en-us/library/aa232676(v=vs.60).aspx
public const int DIRECTORY_ALREADY_EXISTS = 58;
private static readonly string TemplateZip = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "fubuTemplate.zip");
private static readonly string TemplateZip = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "defaultTemplate.zip");
private static readonly FileSet TopLevelFileSet = new FileSet
{
DeepSearch = false,
Expand Down Expand Up @@ -125,4 +125,4 @@ public void ParseFile(string file)
}
}
}
}
}

0 comments on commit 14f1659

Please sign in to comment.