Skip to content

Commit

Permalink
Reorganizing solution. Splitting out nested class for the DynamicMeta…
Browse files Browse the repository at this point in the history
…Object. Removing prototype.ps parts.
  • Loading branch information
idavis committed Sep 12, 2012
1 parent 6c6682d commit 6198590
Show file tree
Hide file tree
Showing 53 changed files with 304 additions and 1,116 deletions.
11 changes: 11 additions & 0 deletions Archetype.1.2.dotCover
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Configuration>
<SnapshotDialog>
<InitialDirectory>C:\Dev\Archetype</InitialDirectory>
</SnapshotDialog>
<CoverageFilters>
<IncludeFilters>
<Filter ModuleMask="*" ClassMask="*" FunctionMask="*" />
</IncludeFilters>
<ExcludeFilters />
</CoverageFilters>
</Configuration>
4 changes: 2 additions & 2 deletions src/Prototype.Ps/Prototype.Ps.sln → Archetype.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Prototype.Ps", "Prototype.Ps.csproj", "{74AAF77C-A943-489A-A78C-3612FA2CC938}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Archetype", "src\Archetype\Archetype.csproj", "{74AAF77C-A943-489A-A78C-3612FA2CC938}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Prototype.Ps.Tests", "..\Prototype.Ps.Tests\Prototype.Ps.Tests.csproj", "{ECC39D5A-879B-45CF-85DF-3BDD60C58EEF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Archetype.Tests", "src\Archetype.Tests\Archetype.Tests.csproj", "{ECC39D5A-879B-45CF-85DF-3BDD60C58EEF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
6 changes: 3 additions & 3 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Prototype.Ps is intended to be used in both open-source and commercial environments. To allow its use in as many
situations as possible, Prototype.Ps is dual-licensed. You may choose to use Prototype.Ps under either the Apache License,
Archetype is intended to be used in both open-source and commercial environments. To allow its use in as many
situations as possible, Archetype is dual-licensed. You may choose to use Archetype under either the Apache License,
Version 2.0, or the Microsoft Public License (Ms-PL). These licenses are essentially identical, but you are
encouraged to evaluate both to determine which best fits your intended use. Some components used by Prototype.Ps
encouraged to evaluate both to determine which best fits your intended use. Some components used by Archetype
are licensed under different terms. You are encouraged to review the licenses for the individual components.

-----
Expand Down
2 changes: 1 addition & 1 deletion NuGetPackageBuilder.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ robocopy %DIR% %DESTDIR%\tools /E /B /NP /R:0 /W:0 /NJH /NJS /NS /NFL /NDL /XF "
robocopy %DIR%nuget %DESTDIR% /E /B /NP /R:0 /W:0 /NJH /NJS /NS /NFL /NDL

:build
nuget pack %DESTDIR%\prototype.nuspec
nuget pack %DESTDIR%\Archetype.nuspec
if %ERRORLEVEL% NEQ 0 goto errors

goto :eof
Expand Down
66 changes: 1 addition & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,2 @@
prototype.ps
Archetype
============

Prototype.ps provides domain specific language enhancements to PowerShell creating prototypal objects.

An simple example:
```
function New-SapiVoice {
$prototype = New-Prototype
$prototype | Update-TypeName
$prototype | New-Function say {
param([string]$message)
$speaker = new-object -com SAPI.SpVoice
($speaker.Speak($message, 1)) | out-null
}
# Add a new property to this prototype
$prototype | New-Property Message1 "This is Message 1"
$prototype | New-ScriptProperty Message2 {"This is Message 2"}
# Add a proxy property to this prototype
$prototype | New-ScriptProperty Message3 {$this.Message1} {param([String]$value); $this.Message1 = $value}
# always return the base prototype
$prototype
}
$voice = New-SapiVoice
$voice.say($voice.Message1)
```

Inheritance:
```
function new-circle {
param($radius = 3)
$prototype = New-Prototype
$prototype | Update-TypeName
$prototype | New-Property Pi 3.14159 Readonly
$prototype | New-Property Radius $radius
$prototype | New-ScriptProperty Diameter {$this.Radius * 2}
$prototype | New-ScriptProperty Circumference {$this.Diameter * $this.Pi}
$prototype | New-ScriptProperty Area {$this.Radius * $this.Radius * $this.Pi}
$prototype
}
function new-cylinder {
param($radius = 3, $height = 4)
$prototype = new-circle($radius)
$prototype | Update-TypeName
$prototype | New-Property Height $height
$prototype | New-ScriptProperty LateralArea {$this.Radius * $this.Radius * $this.Pi}
# override/replace Area
$prototype | New-ScriptProperty Area {2 * $this.LateralArea + 2 * $this.Pi * $this.Radius * $this.Height}
$prototype
}
$cylinder = new-cylinder -radius 5.0 -height 4.0
$cylinder.Radius
$cylinder.Diameter
$cylinder.Height
$cylinder.Circumference
$cylinder.LateralArea
$cylinder.Area
```

See the examples folder for more usages and tips.
3 changes: 0 additions & 3 deletions RunTests.cmd

This file was deleted.

26 changes: 0 additions & 26 deletions RunTests.ps1

This file was deleted.

10 changes: 0 additions & 10 deletions init.ps1

This file was deleted.

15 changes: 15 additions & 0 deletions nuget/Archetype.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Archetype</id>
<version>1.0.0</version>
<authors>idavis</authors>
<owners>Ian Davis</owners>
<projectUrl>https://github.com/idavis/Archetype</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>Adding support for non-classical inheritance to .NET </summary>
<description>Adding support for non-classical inheritance to .NET </description>
<language>en-US</language>
<tags>C# patterns</tags>
</metadata>
</package>
15 changes: 0 additions & 15 deletions nuget/prototype.nuspec

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{ECC39D5A-879B-45CF-85DF-3BDD60C58EEF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Prototype.Ps.Tests</RootNamespace>
<AssemblyName>Prototype.Ps.Tests</AssemblyName>
<RootNamespace>Archetype.Tests</RootNamespace>
<AssemblyName>Archetype.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
Expand All @@ -30,9 +30,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\Prototype.Ps\packages\NUnit.2.6.1\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand All @@ -59,14 +56,11 @@
<Compile Include="TestObjects\ObjectWithMethods.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Prototype.Ps\Prototype.Ps.csproj">
<ProjectReference Include="..\Archetype\Archetype.csproj">
<Project>{74aaf77c-a943-489a-a78c-3612fa2cc938}</Project>
<Name>Prototype.Ps</Name>
<Name>Archetype</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="OverrideTests\" />
<Folder Include="PropertyTests\" />
Expand Down
79 changes: 79 additions & 0 deletions src/Archetype.Tests/Archetype.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{ECC39D5A-879B-45CF-85DF-3BDD60C58EEF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Archetype.Tests</RootNamespace>
<AssemblyName>Archetype.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.6.1.12217, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\NUnit.2.6.1\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="Constants.cs" />
<Compile Include="PrototypalObjectTestsExpandoObjectPrototypes.cs" />
<Compile Include="PrototypalObjectTestsInheritanceOrder.cs" />
<Compile Include="StaticTests\StaticMethodTests.cs" />
<Compile Include="StaticTests\StaticMethodsOnDynamicObjectPrototypeTests.cs" />
<Compile Include="StaticTests\StaticMethodsOnObjectPrototypeTests.cs" />
<Compile Include="TestObjects\DynamicObjectWithMethods.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="TestObjects\ProtoTypalObjectWithMethods.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PrototypalObjectTests.cs" />
<Compile Include="MethodTests\PrototypalObjectTestsDefinedMethods.cs" />
<Compile Include="MethodTests\NestedPrototypeWithMethods.cs" />
<Compile Include="PrototypalObjectTestsNotImplementedCalls.cs" />
<Compile Include="TestObjects\ObjectWithMethods.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Archetype\Archetype.csproj">
<Project>{74aaf77c-a943-489a-a78c-3612fa2cc938}</Project>
<Name>Archetype</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="OverrideTests\" />
<Folder Include="PropertyTests\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</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>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Prototype.Ps.Tests
namespace Archetype.Tests
{
internal static class Constants
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#region Using Directives

using NUnit.Framework;
using Prototype.Ps.Tests.TestObjects;
using Archetype.Tests.TestObjects;

#endregion

namespace Prototype.Ps.Tests.MethodTests
namespace Archetype.Tests.MethodTests
{
[TestFixture]
[Timeout( Constants.TestTimeOutInMs )]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#region Using Directives

using NUnit.Framework;
using Prototype.Ps.Tests.TestObjects;
using Archetype.Tests.TestObjects;

#endregion

namespace Prototype.Ps.Tests.MethodTests
namespace Archetype.Tests.MethodTests
{
[TestFixture]
[Timeout( Constants.TestTimeOutInMs )]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly : AssemblyTitle( "Prototype.Ps.Tests" )]
[assembly : AssemblyTitle( "Archetype.Tests" )]
[assembly : AssemblyDescription( "" )]
[assembly : AssemblyConfiguration( "" )]
[assembly : AssemblyCompany( "" )]
[assembly : AssemblyProduct( "Prototype.Ps.Tests" )]
[assembly : AssemblyProduct( "Archetype.Tests" )]
[assembly : AssemblyCopyright( "Copyright © 2012" )]
[assembly : AssemblyTrademark( "" )]
[assembly : AssemblyCulture( "" )]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Dynamic;

namespace Prototype.Ps.Tests
namespace Archetype.Tests
{
public class ObjectMethodHolder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#endregion

namespace Prototype.Ps.Tests
namespace Archetype.Tests
{
[TestFixture]
public abstract class PrototypalObjectTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#endregion

namespace Prototype.Ps.Tests
namespace Archetype.Tests
{
[TestFixture]
[Timeout( Constants.TestTimeOutInMs )]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#region Using Directives

using NUnit.Framework;
using Prototype.Ps.Tests.TestObjects;
using Archetype.Tests.TestObjects;

#endregion

namespace Prototype.Ps.Tests
namespace Archetype.Tests
{
[TestFixture]
[Timeout( Constants.TestTimeOutInMs )]
Expand Down
Loading

0 comments on commit 6198590

Please sign in to comment.