Permalink
Browse files

Reorganizing solution. Splitting out nested class for the DynamicMeta…

…Object. Removing prototype.ps parts.
  • Loading branch information...
1 parent 6c6682d commit 619859060d0adc27449fc675776e7228e70baf25 @idavis committed Sep 12, 2012
Showing with 304 additions and 1,116 deletions.
  1. +11 −0 Archetype.1.2.dotCover
  2. +2 −2 src/Prototype.Ps/Prototype.Ps.sln → Archetype.sln
  3. +3 −3 LICENSE.txt
  4. +1 −1 NuGetPackageBuilder.cmd
  5. +1 −65 README.md
  6. +0 −3 RunTests.cmd
  7. +0 −26 RunTests.ps1
  8. +0 −10 init.ps1
  9. +15 −0 nuget/Archetype.nuspec
  10. +0 −15 nuget/prototype.nuspec
  11. +4 −10 src/{Prototype.Ps.Tests/Prototype.Ps.Tests.csproj → Archetype.Tests/Archetype.Tests.Tests.csproj}
  12. +79 −0 src/Archetype.Tests/Archetype.Tests.csproj
  13. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/Constants.cs
  14. +2 −2 src/{Prototype.Ps.Tests → Archetype.Tests}/MethodTests/NestedPrototypeWithMethods.cs
  15. +2 −2 src/{Prototype.Ps.Tests → Archetype.Tests}/MethodTests/PrototypalObjectTestsDefinedMethods.cs
  16. +2 −2 src/{Prototype.Ps.Tests → Archetype.Tests}/Properties/AssemblyInfo.cs
  17. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/PrototypalMethodHolder.cs
  18. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/PrototypalObjectTests.cs
  19. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/PrototypalObjectTestsExpandoObjectPrototypes.cs
  20. +2 −2 src/{Prototype.Ps.Tests → Archetype.Tests}/PrototypalObjectTestsInheritanceOrder.cs
  21. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/PrototypalObjectTestsNotImplementedCalls.cs
  22. +2 −2 src/{Prototype.Ps.Tests → Archetype.Tests}/StaticTests/StaticMethodTests.cs
  23. +2 −2 src/{Prototype.Ps.Tests → Archetype.Tests}/StaticTests/StaticMethodsOnDynamicObjectPrototypeTests.cs
  24. +2 −2 src/{Prototype.Ps.Tests → Archetype.Tests}/StaticTests/StaticMethodsOnObjectPrototypeTests.cs
  25. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/TestObjects/DynamicObjectWithMethods.cs
  26. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/TestObjects/ObjectWithMethods.cs
  27. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/TestObjects/Person.cs
  28. +1 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/TestObjects/ProtoTypalObjectWithMethods.cs
  29. +0 −1 src/{Prototype.Ps.Tests → Archetype.Tests}/packages.config
  30. +4 −5 src/{Prototype.Ps/Prototype.Ps.csproj → Archetype/Archetype.csproj}
  31. +2 −2 src/{Prototype.Ps → Archetype}/Properties/AssemblyInfo.cs
  32. +158 −0 src/Archetype/PrototypalMetaObject.cs
  33. +1 −142 src/{functions → Archetype}/Prototype.cs
  34. +0 −17 src/examples/AddingFunctionsToPrototypes.ps1
  35. +0 −17 src/examples/Circle.ps1
  36. +0 −18 src/examples/Cylinder.ps1
  37. +0 −44 src/examples/HashBasedObject.ps1
  38. +0 −30 src/examples/Mixins.ps1
  39. +0 −37 src/examples/PsObjectBasedObject.ps1
  40. +0 −44 src/functions/add-function.ps1
  41. +0 −64 src/functions/add-property.ps1
  42. +0 −87 src/functions/add-scriptproperty.ps1
  43. +0 −45 src/functions/add-staticinstance.ps1
  44. +0 −34 src/functions/add-staticproperty.ps1
  45. +0 −94 src/functions/new-prototype.ps1
  46. +0 −28 src/functions/update-typename.ps1
  47. +0 −40 src/prototype.psm1
  48. +0 −4 src/tests/_Common.ps1
  49. +0 −37 src/tests/add-function.tests.ps1
  50. +0 −20 src/tests/add-property.tests.ps1
  51. +0 −57 src/tests/add-scriptproperty.tests.ps1
  52. +0 −49 src/tests/add-staticproperty.tests.ps1
  53. +0 −42 src/tests/new-prototype.tests.ps1
View
@@ -0,0 +1,11 @@
+<Configuration>
+ <SnapshotDialog>
+ <InitialDirectory>C:\Dev\Archetype</InitialDirectory>
+ </SnapshotDialog>
+ <CoverageFilters>
+ <IncludeFilters>
+ <Filter ModuleMask="*" ClassMask="*" FunctionMask="*" />
+ </IncludeFilters>
+ <ExcludeFilters />
+ </CoverageFilters>
+</Configuration>
@@ -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
View
@@ -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.
-----
View
@@ -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
View
@@ -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.
View
@@ -1,3 +0,0 @@
-@echo off
-
-powershell -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -Command "& { .\RunTests.ps1 %* }"
View
@@ -1,26 +0,0 @@
-
-$scriptPath = (Split-Path -parent $MyInvocation.MyCommand.Definition)
-
-function Load-Pester() {
- if(get-module pester) { return }
-
- $pesterModule = @(Get-ChildItem $scriptPath\* -recurse -include pester.psm1)
- if($pesterModule.Length -eq 0) {
- Write-Host "Could not find Pester, installing from nuget" -ForegroundColor Yellow
- nuget install pester -x -outputdirectory lib
- if(!(Test-Path $scriptPath\lib\Pester)) {
- Write-Host "Could not load Pester" -ForegroundColor Red
- return
- }
- Load-Pester
- return
- }
- Write-Host "Loading Pester: $pesterModule" -ForegroundColor Blue
- import-module $pesterModule
-}
-
-# Load Pester if needed
-Load-Pester
-
-# Run Pester
-Invoke-Pester .\src\tests
View
@@ -1,10 +0,0 @@
-param($installPath, $toolsPath, $package)
-
-$prototypeModule = Join-Path $toolsPath\src prototype.psm1
-import-module $prototypeModule
-
-@"
-========================
-Prototype.ps - PowerShell Object Prototype Builder
-========================
-"@ | Write-Host
View
@@ -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>
View
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
- <metadata>
- <id>prototype.ps</id>
- <version>0.1.0</version>
- <authors>idavis</authors>
- <owners>Ian Davis</owners>
- <projectUrl>https://github.com/idavis/prototype.ps</projectUrl>
- <requireLicenseAcceptance>false</requireLicenseAcceptance>
- <summary>prototype is a base for creating functions that behave like object prototypes</summary>
- <description>prototype is a base for creating functions that behave like object prototypes</description>
- <language>en-US</language>
- <tags>powershell</tags>
- </metadata>
-</package>
@@ -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>
@@ -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" />
@@ -59,15 +56,12 @@
<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\" />
</ItemGroup>
@@ -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>
@@ -1,4 +1,4 @@
-namespace Prototype.Ps.Tests
+namespace Archetype.Tests
{
internal static class Constants
{
@@ -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 )]
@@ -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 )]
@@ -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( "" )]
@@ -1,6 +1,6 @@
using System.Dynamic;
-namespace Prototype.Ps.Tests
+namespace Archetype.Tests
{
public class ObjectMethodHolder
{
@@ -4,7 +4,7 @@
#endregion
-namespace Prototype.Ps.Tests
+namespace Archetype.Tests
{
[TestFixture]
public abstract class PrototypalObjectTests
@@ -5,7 +5,7 @@
#endregion
-namespace Prototype.Ps.Tests
+namespace Archetype.Tests
{
[TestFixture]
[Timeout( Constants.TestTimeOutInMs )]
Oops, something went wrong.

0 comments on commit 6198590

Please sign in to comment.