-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganizing solution. Splitting out nested class for the DynamicMeta…
…Object. Removing prototype.ps parts.
- Loading branch information
Showing
53 changed files
with
304 additions
and
1,116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
2 changes: 1 addition & 1 deletion
2
src/Prototype.Ps.Tests/Constants.cs → src/Archetype.Tests/Constants.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
|
4 changes: 2 additions & 2 deletions
4
...MethodTests/NestedPrototypeWithMethods.cs → ...MethodTests/NestedPrototypeWithMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ts/PrototypalObjectTestsDefinedMethods.cs → ...ts/PrototypalObjectTestsDefinedMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...totype.Ps.Tests/PrototypalMethodHolder.cs → ...Archetype.Tests/PrototypalMethodHolder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../PrototypalObjectTestsInheritanceOrder.cs → .../PrototypalObjectTestsInheritanceOrder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.