Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ayende/RaccoonBlog
Browse files Browse the repository at this point in the history
Conflicts:
	src/RaccoonBlog.Web/Commands/AddCommentCommand.cs
	src/RaccoonBlog.Web/Controllers/PostDetailsController.cs
	src/RaccoonBlog.Web/RaccoonBlog.Web.csproj
  • Loading branch information
ayende committed May 8, 2011
2 parents 1e8c378 + 803ecd9 commit 6924006
Show file tree
Hide file tree
Showing 253 changed files with 174,443 additions and 4,684 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ build/
*.suo
*.sln.cache
_ReSharper.*/
Output/
*.resharper
resharper.settings.xml
*.user
Expand All @@ -20,6 +21,7 @@ ProfilerMessage.java
temp-war-deps
/.gitversion.tmp
/.gitversion.short.tmp
StyleCop.Cache
StyleCop.Cache
/Server
App_Data/
App_Data/
/src/RaccoonBlog.Web/RaccoonBlog.Web.Publish.xml
2 changes: 1 addition & 1 deletion OpenSolution.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
src\RavenDbBlog.sln
src\RaccoonBlog.sln
23 changes: 17 additions & 6 deletions src/RaccoonBlog.ImportFromSubtext/App.Config
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="SubtextEntities" connectionString="metadata=res://*/SubtextModel.csdl|res://*/SubtextModel.ssdl|res://*/SubtextModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;initial catalog=ayende;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient"/>
</connectionStrings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SubtextEntities" connectionString="metadata=res://*/SubtextModel.csdl|res://*/SubtextModel.ssdl|res://*/SubtextModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;initial catalog=ayende;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
53 changes: 38 additions & 15 deletions src/RaccoonBlog.ImportFromSubtext/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,40 @@ private static void Main(string[] args)
Url = "http://localhost:8080",
}.Initialize())
{
CreateSections(store);
ImportDatabase(store);
CreateSections(store);
CreateConfig(store);
}
}

private static void CreateSections(IDocumentStore store)
Console.WriteLine("Done importing");
}

private static void CreateConfig(IDocumentStore store)
{
using (IDocumentSession s = store.OpenSession())
{
s.Store(new BlogConfig
{
Id = "Blog/Config",
CustomCss = "ayende",
Subtitle = "Unnatural acts on source code",
Title = "Ayende @ Rahien",
Copyright = "Ayende Rahien",
AkismetKey = "43f0db211711",
});
s.SaveChanges();
}
}

private static void CreateSections(IDocumentStore store)
{
Console.WriteLine("Creating sections");
using (IDocumentSession s = store.OpenSession())
{
var sections = new[]
{
new Section {Title = "Title", Body = string.Format("Text 1{0}{0}Text 2{0}{0}", Environment.NewLine)},
new Section {Title = "Recent Comments", Body = "Recent Comments"},
new Section {Title = "Future Posts", ControllerName = "Section", ActionName = "FuturePosts"},
new Section {Title = "Tags", ControllerName = "Section", ActionName = "TagsList"},
new Section {Title = "Archive", ControllerName = "Section", ActionName = "ArchivesList"},
new Section {Title = "Login", ControllerName = "Login", ActionName = "CurrentUser"},
};

var i = 0;
Expand Down Expand Up @@ -75,8 +92,8 @@ private static void ImportDatabase(IDocumentStore store)
{
var users = new[]
{
new {Email = "ayende@ayende.com", FullName = "Ayende Rahien"},
new {Email = "fitzchak@ayende.com", FullName = "Fitzchak Yitzchaki"},
new {Email = "ayende@ayende.com", FullName = "Ayende Rahien", TwitterNick = "ayende", RelatedTwitterNick=(string)null},
new {Email = "fitzchak@ayende.com", FullName = "Fitzchak Yitzchaki", TwitterNick = "fitzchak", RelatedTwitterNick="ayende"},
};
for (int i = 0; i < users.Length; i++)
{
Expand All @@ -85,6 +102,8 @@ private static void ImportDatabase(IDocumentStore store)
Id = "users/" + (i + 1),
Email = users[i].Email,
FullName = users[i].FullName,
TwitterNick = users[i].TwitterNick,
RelatedTwitterNick = users[i].RelatedTwitterNick,
Enabled = true,
};
user.SetPassword("123456");
Expand All @@ -98,10 +117,11 @@ private static void ImportDatabase(IDocumentStore store)
{
var ravenPost = new Web.Models.Post
{
Author = usersList
AuthorId = usersList
.Where(u=> u.FullName == post.Author)
.Select(u => new Web.Models.Post.AuthorReference{FullName = u.FullName, Id = u.Id})
.FirstOrDefault(),
.Select(u => u.Id)
.FirstOrDefault() ??
usersList.First().Id,
CreatedAt = new DateTimeOffset(post.DateAdded),
PublishAt = new DateTimeOffset(post.DateSyndicated ?? post.DateAdded),
Body = post.Text,
Expand All @@ -126,8 +146,10 @@ private static void ImportDatabase(IDocumentStore store)
Body = ConvertCommentToMarkdown(comment.Body),
CreatedAt = comment.DateCreated,
Email = comment.Email,
Important = comment.IsBlogAuthor ?? false,
Url = comment.Url,
Important = comment.IsBlogAuthor ?? false,
UserAgent = comment.UserAgent,
UserHostAddress = comment.IpAddress,
IsSpam = false
}
).ToList();
Expand All @@ -142,8 +164,10 @@ private static void ImportDatabase(IDocumentStore store)
Body = ConvertCommentToMarkdown(comment.Body),
CreatedAt = comment.DateCreated,
Email = comment.Email,
Important = comment.IsBlogAuthor ?? false,
Url = comment.Url,
Important = comment.IsBlogAuthor ?? false,
UserAgent = comment.UserAgent,
UserHostAddress = comment.IpAddress,
IsSpam = true
}
).ToList();
Expand Down Expand Up @@ -226,7 +250,6 @@ private static string ConvertCommentToMarkdown(string body)
case "img":
break;
default:
Console.WriteLine(sgmlReader.LocalName);
outputEndElement = true;
sb.Append("<").Append(sgmlReader.LocalName);
break;
Expand Down
177 changes: 93 additions & 84 deletions src/RaccoonBlog.ImportFromSubtext/RaccoonBlog.ImportFromSubtext.csproj
Original file line number Diff line number Diff line change
@@ -1,91 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B8756E91-C4CB-4E8F-ACE1-B455DE31C4C4}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RaccoonBlog.ImportFromSubtext</RootNamespace>
<AssemblyName>RaccoonBlog.ImportFromSubtext</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Raven.Client.Lightweight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=37f41c7f99471593, processorArchitecture=MSIL">
<HintPath>..\packages\raven\Client\Raven.Client.Lightweight.dll</HintPath>
</Reference>
<Reference Include="SgmlReaderDll">
<HintPath>..\..\lib\SgmlReaderDll.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SubtextModel.Designer.cs">
<DependentUpon>SubtextModel.edmx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.Config" />
<None Include="packages.config" />
<EntityDeploy Include="SubtextModel.edmx">
<Generator>EntityModelCodeGenerator</Generator>
<LastGenOutput>SubtextModel.Designer.cs</LastGenOutput>
</EntityDeploy>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RaccoonBlog.Web\RaccoonBlog.Web.csproj">
<Project>{58CCD7A4-503D-467D-8DC4-4D310BD42774}</Project>
<Name>RaccoonBlog.Web</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B8756E91-C4CB-4E8F-ACE1-B455DE31C4C4}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RaccoonBlog.ImportFromSubtext</RootNamespace>
<AssemblyName>RaccoonBlog.ImportFromSubtext</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="MissingBitsFromClientProfile">
<HintPath>..\packages\RavenDB.1.0.0.360\lib\net40\MissingBitsFromClientProfile.dll</HintPath>
</Reference>
<Reference Include="Raven.Abstractions">
<HintPath>..\packages\RavenDB.1.0.0.360\lib\net40\Raven.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Raven.Client.Lightweight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=37f41c7f99471593, processorArchitecture=MSIL">
<HintPath>..\packages\raven\Client\Raven.Client.Lightweight.dll</HintPath>
</Reference>
<Reference Include="Raven.Json">
<HintPath>..\packages\RavenDB.1.0.0.360\lib\net40\Raven.Json.dll</HintPath>
</Reference>
<Reference Include="SgmlReaderDll">
<HintPath>..\..\lib\SgmlReaderDll.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SubtextModel.Designer.cs">
<DependentUpon>SubtextModel.edmx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.Config" />
<None Include="packages.config" />
<EntityDeploy Include="SubtextModel.edmx">
<Generator>EntityModelCodeGenerator</Generator>
<LastGenOutput>SubtextModel.Designer.cs</LastGenOutput>
</EntityDeploy>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RaccoonBlog.Web\RaccoonBlog.Web.csproj">
<Project>{58CCD7A4-503D-467D-8DC4-4D310BD42774}</Project>
<Name>RaccoonBlog.Web</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-->
</Project>
Loading

0 comments on commit 6924006

Please sign in to comment.