Permalink
Browse files

cleanup / renames, finishing project / remote implementation for sync…

… and add, and added the default xml format in use in repositories
  • Loading branch information...
1 parent ea9db52 commit 7893cc6c7cb0ea0e173090594633e7f8051e3b12 @serialseb serialseb committed Jun 23, 2010
Showing with 595 additions and 406 deletions.
  1. +24 −0 etc/index.wraplist
  2. +1 −1 src/OpenWrap.Build.Tasks/PackageWrap.cs
  3. +2 −2 src/OpenWrap.Build.Tasks/ResolveWrapReferences.cs
  4. +1 −1 src/OpenWrap.Commands/Core/HelpCommand.cs
  5. +0 −2 src/OpenWrap.Commands/OpenWrap.Commands.csproj
  6. +11 −8 src/OpenWrap.Commands/Wrap/AddWrapCommand.cs
  7. +0 −43 src/OpenWrap.Commands/Wrap/GenericError.cs
  8. +28 −4 src/OpenWrap.Commands/Wrap/SyncWrapCommand.cs
  9. +4 −4 src/OpenWrap.Commands/Wrap/UpdateWrapCommand.cs
  10. +1 −1 src/OpenWrap.Resharper/ResharperIntegrationService.cs
  11. +1 −1 src/OpenWrap.Resharper/ResharperProjectUpdater.cs
  12. +1 −1 src/OpenWrap.Tests/Commands/InMemoryEnvironment.cs
  13. +10 −1 src/OpenWrap.Tests/Commands/addWrapCommand.cs
  14. +3 −2 src/OpenWrap.Tests/Commands/context/command_context.cs
  15. +0 −1 src/OpenWrap.Tests/Commands/setupWrapCommand.cs
  16. +0 −1 src/OpenWrap.Tests/Commands/updateWrapCommand.cs
  17. +1 −1 src/OpenWrap.Tests/Dependencies/reading_wraplists.cs
  18. +2 −0 src/OpenWrap.Tests/IO/FileSystem_context.cs
  19. +2 −1 src/OpenWrap.Tests/Repositories/current_directory_repository.cs
  20. +1 −1 src/OpenWrap.Tests/Slow/ZipPackages.cs
  21. +0 −1 src/OpenWrap/Commands/CommandInputDescriptor.cs
  22. +15 −2 src/OpenWrap/Commands/CommandLineProcessor.cs
  23. +18 −0 src/OpenWrap/Commands/ExceptionError.cs
  24. +20 −0 src/OpenWrap/Commands/GenericError.cs
  25. +22 −0 src/OpenWrap/Commands/GenericMessage.cs
  26. +1 −1 src/OpenWrap/Commands/ICommandRepository.cs
  27. +0 −12 src/OpenWrap/Commands/NotEnoughParameters.cs
  28. +1 −1 src/OpenWrap/Commands/Result.cs
  29. +15 −0 src/OpenWrap/Commands/Success.cs
  30. +1 −1 src/OpenWrap/ConsoleRunner.cs
  31. +2 −2 src/OpenWrap/CurrentDirectoryEnvironment.cs
  32. +0 −18 src/OpenWrap/Dependencies/GreaterThenOrEqualVersionVertice.cs
  33. +23 −0 src/OpenWrap/Dependencies/GreaterThenVersionVertice.cs
  34. +7 −0 src/OpenWrap/Dependencies/IWrapDescriptorLineParser.cs
  35. +0 −4 src/OpenWrap/Dependencies/WrapDependencyParser.cs
  36. +43 −0 src/OpenWrap/EnumerableExtensions.cs
  37. +1 −1 src/OpenWrap/EventHandlerExtensions.cs
  38. 0 src/OpenWrap/Exports/{ExportManager.cs → IExportManager.cs}
  39. +1 −1 src/OpenWrap/IEnvironment.cs
  40. +13 −0 src/OpenWrap/IO/FileSystem/AbstractDirectory.cs
  41. +1 −3 src/OpenWrap/IO/{ → FileSystem}/AbstractFileSystem.cs
  42. +3 −14 src/OpenWrap/IO/FileSystem/{ → InMemory}/InMemoryDirectory.cs
  43. +50 −0 src/OpenWrap/IO/FileSystem/InMemory/InMemoryFile.cs
  44. +8 −9 src/OpenWrap/IO/FileSystem/{ → InMemory}/InMemoryFileSystem.cs
  45. +1 −1 src/OpenWrap/IO/FileSystem/{ → InMemory}/InMemoryTemporaryDirectory.cs
  46. +1 −1 src/OpenWrap/IO/FileSystem/{ → InMemory}/InMemoryTemporaryFile.cs
  47. +2 −3 src/OpenWrap/IO/{ → FileSystem/Local}/LocalDirectory.cs
  48. +2 −2 src/OpenWrap/IO/{ → FileSystem/Local}/LocalFile.cs
  49. +3 −4 src/OpenWrap/IO/{ → FileSystem/Local}/LocalFileSystem.cs
  50. +2 −2 src/OpenWrap/IO/{ → FileSystem/Local}/LocalPath.cs
  51. +1 −1 src/OpenWrap/IO/{ → FileSystem/Local}/TemporaryLocalDirectory.cs
  52. +1 −1 src/OpenWrap/IO/{ → FileSystem/Local}/TemporaryLocalFile.cs
  53. +2 −47 src/OpenWrap/IO/FileSystem/{InMemoryFile.cs → NonDisposableStream.cs}
  54. +4 −2 src/OpenWrap/IO/{FileSystem.cs → FileSystems.cs}
  55. +3 −1 src/OpenWrap/InternalServices.cs
  56. +9 −0 src/OpenWrap/MoveNextResult.cs
  57. +30 −14 src/OpenWrap/OpenWrap.csproj
  58. +0 −1 src/OpenWrap/ReflectionExtensions.cs
  59. +25 −0 src/OpenWrap/Repositories/CommandExport.cs
  60. +48 −0 src/OpenWrap/Repositories/CommandExportBuilder.cs
  61. +21 −0 src/OpenWrap/Repositories/CommandExportItem.cs
  62. +1 −1 src/OpenWrap/Repositories/CurrentDirectoryRepository.cs
  63. +1 −83 src/OpenWrap/Repositories/ExportBuilders.cs
  64. +9 −0 src/OpenWrap/Repositories/ICommandExportItem.cs
  65. +1 −1 src/OpenWrap/Repositories/IPackageManager.cs
  66. +11 −10 src/{OpenWrap.Commands/Wrap → OpenWrap/Repositories}/PackageManagerExtensions.cs
  67. +0 −62 src/OpenWrap/Repositories/ZipPackage.cs
  68. +69 −0 src/OpenWrap/Repositories/ZipWrapperFile.cs
  69. +1 −1 src/OpenWrap/Services/IService.cs
  70. +2 −1 src/OpenWrap/Services/IWrapDescriptorMonitoringService.cs
  71. +2 −1 src/OpenWrap/Services/WrapDependencyResolver.cs
  72. +3 −2 src/OpenWrap/Services/WrapDescriptorMonitor.cs
  73. +1 −4 src/OpenWrap/Services/WrapServices.cs
  74. +1 −1 src/OpenWrap/SharedReflectionExtensions.cs
  75. +0 −13 src/OpenWrap/StreamExtensions.cs
View
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wraplist>
+ <wrap name="castle-dynamicproxy" title="Castle DynamicProxy" version="2.1.0">
+ <description>blah</description>
+ <link rel="package" href="wraps/castle-dynamicproxy-2.1.0.wrap" />
+ <depends>castle-core = 1.1.0</depends>
+ </wrap>
+ <wrap name="castle-core" title="Castle core components" version="1.1.0" hidden="true">
+ <description>Castle core functionality</description>
+ <link rel="package" href="wraps/castle-core-1.1.0.wrap" />
+ </wrap>
+ <wrap name="nhibernate-core" title="NHibernate core module" version="2.1.2" hidden="true">
+ <description>
+ The core nhibernate data
+ </description>
+ <link rel="package" href="wraps/nhibernate-core-2.1.2.wrap" />
+ </wrap>
+ <wrap name="nhibernate-castle" title="NHibernate with Castle lazy loading" version="2.1.2">
+ <description>The core nhibernate data</description>
+ <link rel="package" href="wraps/nhibernate-core-2.1.2.wrap" />
+ <depends>nhibernate-core = 2.1.2</depends>
+ <depends>castle-dynamicproxy = 2.1.0</depends>
+ </wrap>
+</wraplist>
@@ -15,7 +15,7 @@ public class PackageWrap : Task
{
readonly IFileSystem _fileSystem;
- public PackageWrap() : this(FileSystem.Local)
+ public PackageWrap() : this(FileSystems.Local)
{
}
@@ -7,11 +7,11 @@
using Microsoft.Build.Utilities;
using OpenWrap.Exports;
using OpenWrap.Build;
-using OpenWrap.Build.Services;
using OpenWrap.Dependencies;
using OpenWrap.IO;
using OpenWrap.Repositories;
using OpenWrap.Resharper;
+using OpenWrap.Services;
namespace OpenWrap.Build.Tasks
{
@@ -25,7 +25,7 @@ public class ResolveWrapReferences : Task, IWrapAssemblyClient
public ResolveWrapReferences()
{
InternalServices.Initialize();
- _fileSystem = FileSystem.Local;
+ _fileSystem = FileSystems.Local;
}
[Required]
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using OpenWrap.Build.Services;
using OpenWrap.Commands;
+using OpenWrap.Services;
namespace OpenWrap.Commands.Core
{
@@ -50,9 +50,7 @@
<Compile Include="Core\QuitCommand.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Wrap\AddWrapCommand.cs" />
- <Compile Include="Wrap\GenericError.cs" />
<Compile Include="Wrap\NewWrapCommand.cs" />
- <Compile Include="Wrap\PackageManagerExtensions.cs" />
<Compile Include="Wrap\PackageRepositoryExtensions.cs" />
<Compile Include="Wrap\SyncWrapCommand.cs" />
<Compile Include="Wrap\UpdateWrapCommand.cs" />
@@ -3,19 +3,17 @@
using System.IO;
using System.Linq;
using System.Text;
-using OpenWrap.Build.Services;
-using OpenWrap.Commands.Core;
using OpenWrap.Dependencies;
using OpenWrap.IO;
using OpenWrap.Repositories;
+using OpenWrap.Services;
namespace OpenWrap.Commands.Wrap
{
[Command(Verb = "add", Noun = "wrap")]
public class AddWrapCommand : ICommand
{
IEnvironment _environment;
- IFileSystem _fileSystem;
IPackageManager _packageManager;
[CommandInput(IsRequired = true, Position = 0)]
@@ -35,11 +33,12 @@ public class AddWrapCommand : ICommand
public IEnumerable<ICommandResult> Execute()
{
_environment = WrapServices.GetService<IEnvironment>();
- _fileSystem = WrapServices.GetService<IFileSystem>();
+ WrapServices.GetService<IFileSystem>();
_packageManager = WrapServices.GetService<IPackageManager>();
yield return VerifyWrapFile();
yield return VeryfyWrapRepository();
+
if (_environment.Descriptor != null && !SystemOnly)
{
AddInstructionToWrapFile();
@@ -48,7 +47,7 @@ public IEnumerable<ICommandResult> Execute()
}
else
{
- var resolvedDependencies = _packageManager.TryResolveDependencies(GetDescriptor(), _environment.RepositoriesToReadFrom());
+ var resolvedDependencies = _packageManager.TryResolveDependencies(GetDescriptor(), _environment.RepositoriesForRead());
if (!resolvedDependencies.IsSuccess)
{
@@ -59,9 +58,9 @@ public IEnumerable<ICommandResult> Execute()
{
_environment.CurrentDirectoryRepository,
ProjectOnly ? null : _environment.SystemRepository,
- _environment.ProjectRepository
+ SystemOnly ? null : _environment.ProjectRepository
});
- foreach(var msg in _packageManager.CopyResolvedDependenciesToRepositories(resolvedDependencies, repositoriesToCopyTo))
+ foreach(var msg in _packageManager.CopyPackagesToRepositories(resolvedDependencies, repositoriesToCopyTo))
yield return msg;
}
}
@@ -104,6 +103,10 @@ string GetDependsLine()
IEnumerable<ICommandResult> SyncWrapFileWithWrapDirectory()
{
return new SyncWrapCommand()
+ {
+ ProjectOnly = ProjectOnly,
+ SystemOnly = SystemOnly
+ }
.Execute();
}
@@ -118,7 +121,7 @@ ICommandResult VeryfyWrapRepository()
{
return _environment.ProjectRepository != null
? new GenericMessage("Project repository found.")
- : new GenericMessage("Project rep[ository not found, installing to system repository.");
+ : new GenericMessage("Project repository not found, installing to system repository.");
}
}
}
@@ -1,43 +0,0 @@
-using System;
-using OpenWrap.Commands;
-
-namespace OpenWrap.Commands.Wrap
-{
- public class GenericMessage : ICommandResult
- {
- public string Message { get; set; }
-
- public GenericMessage(string message)
- {
- Message = message;
- }
-
- public bool Success
- {
- get { return true; }
- }
-
- public ICommand Command
- {
- get {return null; }
- }
- }
-
- public class GenericError : Error
- {
- public GenericError()
- {
- }
- public GenericError(string message)
- {
- Message = message;
- }
-
- public string Message { get; set; }
-
- public override string ToString()
- {
- return "An error has occurred: " + Message;
- }
- }
-}
@@ -1,11 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using OpenWrap.Build.Services;
+using OpenWrap;
using OpenWrap.Commands;
using OpenWrap.Commands.Core;
using OpenWrap.Dependencies;
using OpenWrap.Repositories;
+using OpenWrap.Services;
namespace OpenWrap.Commands.Wrap
{
@@ -21,18 +22,41 @@ protected IPackageManager PackageManager
{
get { return WrapServices.GetService<IPackageManager>(); }
}
+ [CommandInput]
+ public bool SystemOnly { get; set; }
+
+ [CommandInput]
+ public bool ProjectOnly { get; set; }
public IEnumerable<ICommandResult> Execute()
{
+ if (SystemOnly && ProjectOnly)
+ {
+ yield return new GenericError("Cannot have both SystemOnly and ProjectOnly as parameters, they are mutually exclusive.");
+ yield break;
+ }
+ if (Environment.Descriptor == null)
+ {
+ yield return new GenericError("Cannot sync when no descriptor file is present.");
+ yield break;
+ }
yield return new Result("Synchronizing all packages.");
// TODO: Check if not in project repository and fail nicely
var descriptor = Environment.Descriptor;
- var dependencyResolveResult = PackageManager.TryResolveDependencies(descriptor, Environment.RepositoriesToReadFrom());
+ var dependencyResolveResult = PackageManager.TryResolveDependencies(descriptor, Environment.RepositoriesForRead());
+ var repositoriesToWriteTo = Environment.RemoteRepositories.Concat(Environment.CurrentDirectoryRepository);
+
+ bool all = !SystemOnly && !ProjectOnly;
+ if (SystemOnly || all)
+ repositoriesToWriteTo = repositoriesToWriteTo.Concat(Environment.SystemRepository);
+ if (ProjectOnly || all)
+ repositoriesToWriteTo = repositoriesToWriteTo.Concat(Environment.ProjectRepository);
+
- foreach (var result in PackageManager
- .CopyResolvedDependenciesToRepositories(dependencyResolveResult,Environment.RepositoriesToWriteTo()))
+ foreach (var result in PackageManager.CopyPackagesToRepositories(
+ dependencyResolveResult, repositoriesToWriteTo))
yield return result;
}
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using OpenWrap.Build.Services;
using OpenWrap.Commands.Core;
using OpenWrap.Dependencies;
using OpenWrap.Repositories;
+using OpenWrap.Services;
namespace OpenWrap.Commands.Wrap
{
@@ -41,7 +41,7 @@ IEnumerable<ICommandResult> UpdateSystemPackages()
var resolveResult = PackageManager.TryResolveDependencies(packagesToSearch, Environment.RemoteRepositories);
- foreach (var message in PackageManager.CopyResolvedDependenciesToRepositories(
+ foreach (var message in PackageManager.CopyPackagesToRepositories(
resolveResult, Environment.SystemRepository))
yield return message;
}
@@ -69,9 +69,9 @@ IEnumerable<ICommandResult> UpdateProjectPackages()
{
var resolvedPackages = PackageManager.TryResolveDependencies(Environment.Descriptor, Environment.RemoteRepositories.Concat(new[] { Environment.SystemRepository }));
- return PackageManager.CopyResolvedDependenciesToRepositories(
+ return PackageManager.CopyPackagesToRepositories(
resolvedPackages,
- Environment.RepositoriesToWriteTo()
+ Environment.RepositoriesForWrite()
);
}
}
@@ -1,8 +1,8 @@
using System.Collections.Generic;
-using OpenWrap.Build.Services;
using OpenWrap.Dependencies;
using OpenWrap.IO;
using OpenWrap.Repositories;
+using OpenWrap.Services;
namespace OpenWrap.Resharper
{
@@ -7,10 +7,10 @@
using JetBrains.Util;
using OpenWrap.Exports;
using OpenWrap.Build;
-using OpenWrap.Build.Services;
using OpenWrap.Dependencies;
using OpenWrap.IO;
using OpenWrap.Repositories;
+using OpenWrap.Services;
namespace OpenWrap.Resharper
{
@@ -3,10 +3,10 @@
using System.IO;
using System.Linq;
using OpenRasta.Wrap.Tests.Dependencies.context;
-using OpenWrap.Build.Services;
using OpenWrap.Dependencies;
using OpenWrap.IO;
using OpenWrap.Repositories;
+using OpenWrap.Services;
namespace OpenWrap.Tests.Commands
{
@@ -9,6 +9,15 @@
namespace OpenWrap.Tests.Commands
{
+ class adding_wrap_with_incompatible_arguments : context.command_context<AddWrapCommand>
+ {
+ public adding_wrap_with_incompatible_arguments()
+ {
+ given_project_repository();
+
+ when_executing_command("-System", "-Project");
+ }
+ }
class adding_wrap_from_local_package_in_project_path : context.command_context<AddWrapCommand>
{
public adding_wrap_from_local_package_in_project_path()
@@ -66,7 +75,7 @@ class adding_wrap_from_local_package_in_project_path_with_project_only_parameter
Version SAURON_VERSION = new Version(1, 0, 0);
public adding_wrap_from_local_package_in_project_path_with_project_only_parameter()
{
- given_currentdirectory_package("sauron", new Version(1,0,0));
+ given_currentdirectory_package(SAURON_NAME, SAURON_VERSION);
given_project_repository();
when_executing_command("-Name", "sauron", "-Project");
@@ -3,12 +3,13 @@
using System.IO;
using System.Linq;
using OpenRasta.Wrap.Tests.Dependencies.context;
-using OpenWrap.Build.Services;
using OpenWrap.Commands;
using OpenWrap.Commands.Wrap;
using OpenWrap.Dependencies;
using OpenWrap.IO;
+using OpenWrap.IO.FileSystem.InMemory;
using OpenWrap.Repositories;
+using OpenWrap.Services;
using OpenWrap.Testing;
namespace OpenWrap.Tests.Commands.context
@@ -94,7 +95,7 @@ protected void given_currentdirectory_package(string packageName, Version versio
protected void package_is_not_in_repository(InMemoryRepository repository, string packageName, Version packageVersion)
{
- (repository.PackagesByName.Contains("packageName")
+ (repository.PackagesByName.Contains(packageName)
? repository.PackagesByName[packageName].FirstOrDefault(x => x.Version.Equals(packageVersion))
: null).ShouldBeNull();
@@ -4,7 +4,6 @@
using System.Text;
using NUnit.Framework;
using OpenRasta.Wrap.Tests.Dependencies.context;
-using OpenWrap.Build.Services;
using OpenWrap.Commands;
using OpenWrap.Commands.Wrap;
using OpenWrap.Dependencies;
@@ -4,7 +4,6 @@
using System.Text;
using NUnit.Framework;
using OpenRasta.Wrap.Tests.Dependencies.context;
-using OpenWrap.Build.Services;
using OpenWrap.Commands;
using OpenWrap.Commands.Wrap;
using OpenWrap.Dependencies;
@@ -65,7 +65,7 @@ public class wrap_list : Testing.context
{
protected void given_repository()
{
- Repository = new XmlRepository(FileSystem.Local, new InMemoryNavigator(), new IExportBuilder[0]);
+ Repository = new XmlRepository(FileSystems.Local, new InMemoryNavigator(), new IExportBuilder[0]);
}
class InMemoryNavigator : IHttpNavigator
{
Oops, something went wrong.

0 comments on commit 7893cc6

Please sign in to comment.