public void SetUp()
        {
            theSolution = new Solution();
            theSolution.ClearFeeds();

            theSolution.AddFeed(Feed.Fubu);
            theSolution.AddFeed(Feed.NuGetV2);

            theSolution.AddDependency(fubucore = new Dependency("FubuCore", "1.0.1.201"));

            var theProject = new Project("Test.csproj");
            theSolution.AddProject(theProject);

            theProject.AddDependency(bottles = new Dependency("Bottles"));
            theProject.AddDependency(rhinomocks = new Dependency("RhinoMocks", "3.6.1", UpdateMode.Fixed));
            theProject.AddDependency(structuremap = new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed));

            theFubuFeed = MockRepository.GenerateStub<IFloatingFeed>();
            theFubuFeed.Stub(x => x.GetLatest()).Return(new IRemoteNuget[]
            {
                new StubNuget("Bottles", "1.0.2.2"),
                new StubNuget("FubuCore", "1.0.2.232"),
                new StubNuget("StructureMap", "2.6.4.71"),
            });

            theNugetFeed = MockRepository.GenerateStub<INugetFeed>();
            theNugetFeed.Stub(x => x.Find(rhinomocks)).Return(new StubNuget("RhinoMocks", "3.6.1"));
            theNugetFeed.Stub(x => x.Find(structuremap)).Return(new StubNuget("StructureMap", "2.6.3"));

            theFeedProvider = MockRepository.GenerateStub<IFeedProvider>();
            theFeedProvider.Stub(x => x.For(Feed.Fubu)).Return(theFubuFeed);
            theFeedProvider.Stub(x => x.For(Feed.NuGetV2)).Return(theNugetFeed);

            FeedRegistry.Stub(theFeedProvider);
        }
		public void can_read_and_write_the_packages_config()
		{
			var theFileSystem = new FileSystem();

			theFileSystem.WriteStringToFile(NuGetDependencyStrategy.PackagesConfig, "<?xml version=\"1.0\" encoding=\"utf-8\"?><packages></packages>");
			
			var theSolution = new Solution();
			theSolution.AddDependency(new Dependency("Bottles", "1.0.1.1"));
			theSolution.AddDependency(new Dependency("FubuCore", "1.2.0.1"));

			var theProject = new Project("Test.csproj");
			theProject.AddDependency("Bottles");
			theProject.AddDependency("FubuCore");

			theSolution.AddProject(theProject);

			var theStrategy = new NuGetDependencyStrategy();
			theStrategy.Write(theProject);

			theStrategy
				.Read(theProject)
				.ShouldHaveTheSameElementsAs(
					new Dependency("Bottles", "1.0.1.1"),
					new Dependency("FubuCore", "1.2.0.1")
				);

			theFileSystem.DeleteFile(NuGetDependencyStrategy.PackagesConfig);
		}
Exemplo n.º 3
0
        public void Write(Project project)
        {
            var file = Path.Combine(project.Directory, PackagesConfig);
            XElement document;
            if (_fileSystem.FileExists(file))
            {
                document = XElement.Load(file);
                document.RemoveAll();
            }
            else
            {
                document = new XElement("packages");
            }

            project.Dependencies.Each(x =>
            {
                var package = new XElement("package");
                package.SetAttributeValue("id", x.Name);

                // TODO -- Make this easier to query
                var solutionLevel = project.Solution.Dependencies.Find(x.Name);
                package.SetAttributeValue("version", solutionLevel.Version.ToString());

                // TODO -- Probably shouldn't hardcode this...
                package.SetAttributeValue("targetFramework", "net40");

                document.Add(package);
            });

            document.Save(file);
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            theSolution = new Solution();
            p1 = theSolution.AddProject("MyProject");

            p1.AddDependency("Bottles");
            p1.AddDependency("FubuCore");
            p1.AddDependency("FubuLocalization");

            p2 = theSolution.AddProject("MyOtherProject");
            p2.AddDependency("FubuMVC.Core");

            theSolution.AddDependency(new Dependency("Bottles", "1.0.0.0", UpdateMode.Fixed));
            theSolution.AddDependency(new Dependency("FubuCore", "1.1.0.0", UpdateMode.Float));
            theSolution.AddDependency(new Dependency("FubuLocalization", "1.2.0.0", UpdateMode.Fixed));
            theSolution.AddDependency(new Dependency("FubuMVC.Core", "1.4.0.0", UpdateMode.Fixed));

            theNugetSpec = new NugetSpec("MyProject", "myproject.nuspec");

            theGroup = new NuspecTemplate(theNugetSpec, new[]
            {
                new ProjectNuspec(p1, new NugetSpec("MyProject", "MyProject.nuspec")), 
                new ProjectNuspec(p2, new NugetSpec("MyOtherProject", "MyOtherProject.nuspec"))
            });
        }
Exemplo n.º 5
0
        public IEnumerable<Dependency> Read(Project project)
        {
            var document = new XmlDocument();
            document.Load(Path.Combine(project.Directory, PackagesConfig));

            return ReadFrom(document);
        }
Exemplo n.º 6
0
        public void SetUp()
        {
            theSolution = new Solution();
            theProject = theSolution.AddProject("Project1");

            theRunner = new NugetStepRunner(theSolution);
        }
        public void SetUp()
        {
            theSolution = new Solution();
            theSolution.ClearFeeds();

            theSolution.AddFeed(Feed.Fubu);
            theSolution.AddFeed(Feed.NuGetV2);

            theSolution.AddDependency(fubucore = new Dependency("FubuCore", "1.0.1.201"));

            var theProject = new Project("Test.csproj");
            theSolution.AddProject(theProject);

            theProject.AddDependency(bottles = new Dependency("Bottles"));
            theProject.AddDependency(rhinomocks = new Dependency("RhinoMocks", "3.6.1", UpdateMode.Fixed));
            theProject.AddDependency(structuremap = new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed));

            FeedScenario.Create(scenario =>
            {
                scenario.For(Feed.Fubu)
                    .Add("Bottles", "1.0.2.2")
                    .Add("FubuCore", "1.0.2.232")
                    .Add("StructureMap", "2.6.4.71");

                scenario.For(Feed.NuGetV2)
                    .Add("RhinoMocks", "3.6.1")
                    .Add("StructureMap", "2.6.3");

                scenario.For(theSolution.Cache.ToFeed());

                scenario.Online();
            });
        }
Exemplo n.º 8
0
        public void Write(Project project)
        {
            var dependencies = new StringBuilder();
            project.Dependencies.Each(dependency => dependencies.AppendLine(dependency.ToString()));

            _fileSystem.WriteStringToFile(FileFor(project), dependencies.ToString());
        }
			public ScenarioDefinition()
			{
				theProjects = new Cache<string, Project>(name =>
				{
					var project = new Project(name);
					Solution.AddProject(project);

					return project;
				});
			}
Exemplo n.º 10
0
        public void adding_a_project_sets_the_solution()
        {
            var solution = new Solution();
            var project = new Project("MyProject.csproj");

            solution.AddProject(project);
            solution.Projects.ShouldHaveTheSameElementsAs(project);

            project.Solution.ShouldBeTheSameAs(solution);
        }
Exemplo n.º 11
0
		private static IEnumerable<NugetPlanRequest> projectRequests(Solution solution, Project project, IEnumerable<string> tokens)
		{
			return tokens.Select(token => new NugetPlanRequest
			{
				Batched = true,
				Operation = OperationType.Install,
				Project = project.Name,
				Dependency = parseDependency(token),
				Solution = solution
			});
		}
		public void SetUp()
		{
			theDependencyStrategy = new RippleDependencyStrategy();
			theProject = new Project("TestProject.csproj");

			var content = new StringBuilder()
				.AppendLine("Bottles")
				.AppendLine("FubuCore,1.0.1.250")
				.AppendLine("FubuMVC.Core,1.0.1.252")
				.ToString();

			new FileSystem().WriteStringToFile(RippleDependencyStrategy.RippleDependenciesConfig, content);
		}
		public void SetUp()
		{
			theSolution = new Solution();

			theProject = new Project("TestProject.csproj");
			theProject.AddDependency(new Dependency("Bottles", "1.0.0.0", UpdateMode.Fixed));
			theProject.AddDependency(new Dependency("FubuCore", "1.0.0.0", UpdateMode.Fixed));

			theSolution.AddProject(theProject);

			theSolution.Update("Bottles", "1.1.0.0");
			theSolution.Update("FubuCore", "1.2.0.1");
		}
Exemplo n.º 14
0
        public Project Read(string projectFile)
        {
            var project = new Project(projectFile);

            var reader = _dependencies.FirstOrDefault(x => x.Matches(project));
            if (reader == null) return project;

            var dependencies = reader.Read(project);

            dependencies.Each(d => project.Dependencies.Add(d));

            return project;
        }
Exemplo n.º 15
0
        private void fixProject(Project project)
        {
            project.Dependencies.Each(dep =>
            {
                var package = _packages[dep.Name];
                if (package == null)
                {
                    RippleLog.Debug("Could not find the IPackage for " + dep.Name);
                    return;
                }

                var assemblies = package.AssemblyReferences;
                if (assemblies == null) return;

                project.Proj.AddAssemblies(dep, assemblies);
            });
        }
Exemplo n.º 16
0
        public void SetUp()
        {
            theConfig = new SolutionConfig();

            theSolution = new Solution();
            p1 = theSolution.AddProject("Project1");
            p2 = theSolution.AddProject("Project2");

            p1.AddDependency(new Dependency("Bottles"));
            p1.AddDependency(new Dependency("FubuCore", "1.1.2.3", UpdateMode.Fixed));

            p2.AddDependency(new Dependency("FubuCore", "1.1.2.3", UpdateMode.Fixed));
            p2.AddDependency(new Dependency("FubuLocalization"));
            p2.AddDependency(new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed));

            theLoader = new NuGetSolutionLoader();
            theLoader.ExtractSolutionLevelConfiguration(theConfig, theSolution);
        }
Exemplo n.º 17
0
		public void SetUp()
		{
			r1 = MockRepository.GenerateStub<IDependencyStrategy>();
			r2 = MockRepository.GenerateStub<IDependencyStrategy>();

			d1 = new Dependency("FubuCore", "1.0.0.215");
			d2 = new Dependency("Bottles", "1.0.0.212");

			var project = new Project("MyProject.csproj");

			r1.Stub(x => x.Matches(project)).Return(false);
			r2.Stub(x => x.Matches(project)).Return(true);

			r2.Stub(x => x.Read(project)).Return(new[] {d1, d2});

			theReader = new ProjectReader(new[] {r1, r2});
			theProject = theReader.Read("MyProject.csproj");
		}
        public void SetUp()
        {
            theSolution = Solution.NuGet("Test");
            p1 = theSolution.AddProject("Project1");
            p2 = theSolution.AddProject("Project2");

            p1.AddDependency(new Dependency("NuGetA", "1.0.0.0", UpdateMode.Fixed));
            p1.AddDependency(new Dependency("NuGetB", "1.1.0.0", UpdateMode.Fixed));
            p1.AddDependency(new Dependency("NuGetC", "1.4.5.0", UpdateMode.Fixed));

            p2.AddDependency(new Dependency("NuGetD", "1.3.0.0", UpdateMode.Fixed));
            p2.AddDependency(new Dependency("NuGetE", "3.3.0.0", UpdateMode.Fixed));
            p2.AddDependency(new Dependency("NuGetF", "2.1.0.0", UpdateMode.Fixed));

            p2.AddDependency(new Dependency("NuGetB", "1.2.0.0", UpdateMode.Fixed)); // Conflict

            new NuGetSolutionLoader().SolutionLoaded(theSolution);
        }
Exemplo n.º 19
0
        public IEnumerable<Dependency> Read(Project project)
        {
            var dependencies = new List<Dependency>();
            _fileSystem.ReadTextFile(FileFor(project), line =>
            {
                if (line.IsEmpty()) return;

                var values = line.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                var version = string.Empty;

                if (values.Length == 2)
                {
                    version = values[1].Trim();
                }

                dependencies.Add(new Dependency(values[0].Trim(), version));
            });

            return dependencies;
        }
Exemplo n.º 20
0
 public void RemoveDependencyConfigurations(Project project)
 {
     _fileSystem.DeleteFile(FileFor(project));
 }
Exemplo n.º 21
0
 public void Write(Project project)
 {
     _strategy.Write(project);
     project.Proj.Write();
 }
Exemplo n.º 22
0
        public void SetUp()
        {
            theConfig = new SolutionConfig();
            theConfig.FloatNuget("Bottles");
            theConfig.FloatNuget("FubuCore");
            theConfig.FloatNuget("FubuLocalization");

            theSolution = new Solution();
            p1 = theSolution.AddProject("Project1");
            p2 = theSolution.AddProject("Project2");

            p1.AddDependency(new Dependency("Bottles", "1.1.2.3", UpdateMode.Fixed));
            p1.AddDependency(new Dependency("FubuCore", "1.1.2.3", UpdateMode.Fixed));

            p2.AddDependency(new Dependency("FubuLocalization", "1.0.0.1", UpdateMode.Fixed));
            p2.AddDependency(new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed));

            theLoader = new NuGetSolutionLoader();
            theLoader.MarkFloatingDependencies(theConfig, theSolution);
        }
Exemplo n.º 23
0
 public ProjectNuspec(Project project, NugetSpec publishes)
 {
     _project = project;
     _publishes = publishes;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Mostly for testing
 /// </summary>
 /// <param name="project"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static ProjectNuspec For(Project project)
 {
     return new ProjectNuspec(project, new NugetSpec(project.Name, project.Name + ".nuspec"));
 }
Exemplo n.º 25
0
 public string FileFor(Project project)
 {
     return Path.Combine(project.Directory, RippleDependenciesConfig);
 }
Exemplo n.º 26
0
		public void Write(Project project)
		{
		}
Exemplo n.º 27
0
 public bool Matches(Project project)
 {
     return _fileSystem.FileExists(FileFor(project));
 }
Exemplo n.º 28
0
 private void installToProject(NugetPlan plan, Project project, Dependency target)
 {
     if (!project.Dependencies.Has(target.Name))
     {
         plan.AddStep(new InstallProjectDependency(project.Name, Dependency.FloatFor(target.Name)));
     }
 }
Exemplo n.º 29
0
 public void AddProjectReference(Project project)
 {
     _references.Fill(project);
 }
Exemplo n.º 30
0
 protected bool Equals(Project other)
 {
     return string.Equals(FilePath, other.FilePath);
 }