Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Started preparing the repository for CI and Nuget

  • Loading branch information...
commit 5c162999e0b28c82579c0596d7f31691c0b9868b 1 parent 655a2f0
@thecodejunkie thecodejunkie authored
2  dependencies/Nancy
@@ -1 +1 @@
-Subproject commit 249d93d65bbbc5924a3eead0bca36253833f1479
+Subproject commit f3130aa9f2a28870f81a7de0d7c6f9f459978cc3
View
49 how_to_build.txt
@@ -0,0 +1,49 @@
+How to build Nancy
+==================
+
+*NOTE* These instructions are *only* for building with Rake - if you just want to build Nancy manually you can do so just by loading the solution into Visual Studio 2010 and pressing build :-)
+
+Prerequisites
+-------------
+
+1. Download and install Ruby 1.8.7+ from http://www.ruby-lang.org/en/downloads
+2. At the command prompt run the following to update RubyGems to the latest version:
+
+ gem update --system
+
+3. You will need the albacore gem, install this at the command prompt with:
+
+ gem install albacore
+
+If you have already installed albacore, please update to the lastest version (0.2.6+):
+
+ gem update albacore
+
+
+Building Nancy
+--------------
+
+1. At the command prompt, navigate to the Nancy root folder (should contain rakefile.rb)
+2. To run the default build (which will compile, test and package Nancy) type the following command:
+
+ rake
+
+In addition, you can see the full list of all the build tasks by running:
+
+ rake -T
+
+To run a particular task ('test' for example), use the following command:
+
+ rake test
+
+You can run multiple tasks by listing them ('test' then 'nuget' for example):
+
+ rake test nuget_package
+
+After the build has completed, there will be a new folder in the root called "build". It contains the following folders:
+
+* binaries -> All the Nancy assembilies and their dependencies
+* packages -> Zip file containing the binaries (other configurations might be added in the future)
+* nuget -> NuGet packages generated from this build
+* documentation -> Generated documentation (todo)
+* coverage -> Test coverage reports (todo)
View
133 rakefile.rb
@@ -0,0 +1,133 @@
+require 'rubygems'
+require 'albacore'
+require 'rake/clean'
+require 'rexml/document'
+
+NANCY_VERSION = "0.6.0"
+OUTPUT = "build"
+CONFIGURATION = 'Release'
+SHARED_ASSEMBLY_INFO = 'src/SharedAssemblyInfo.cs'
+SOLUTION_FILE = 'src/Nancy.Bootstrappers.Ninject.sln'
+
+Albacore.configure do |config|
+ config.log_level = :verbose
+ config.msbuild.use :net4
+ config.xunit.command = "dependencies/Nancy/tools/xunit/xunit.console.clr4.x86.exe"
+end
+
+desc "Compiles solution and runs unit tests"
+task :default => [:clean, :version, :compile, :xunit, :publish, :package]
+
+#Add the folders that should be cleaned as part of the clean task
+CLEAN.include(OUTPUT)
+CLEAN.include(FileList["src/**/#{CONFIGURATION}"])
+
+desc "Update shared assemblyinfo file for the build"
+assemblyinfo :version => [:clean] do |asm|
+ asm.version = NANCY_VERSION
+ asm.company_name = "Nancy"
+ asm.product_name = "Nancy.Bootstrappers.Ninject"
+ asm.title = "Nancy.Bootstrappers.Ninject"
+ asm.description = "An Ninject Bootstrapper for the Nancy web framework"
+ asm.copyright = "Copyright (C) Andreas Hakansson, Steven Robbins and contributors"
+ asm.output_file = SHARED_ASSEMBLY_INFO
+end
+
+desc "Compile solution file"
+msbuild :compile => [:version] do |msb|
+ msb.properties :configuration => CONFIGURATION
+ msb.targets :Clean, :Build
+ msb.solution = SOLUTION_FILE
+end
+
+desc "Gathers output files and copies them to the output folder"
+task :publish => [:compile] do
+ Dir.mkdir(OUTPUT)
+ Dir.mkdir("#{OUTPUT}/binaries")
+
+ FileUtils.cp_r FileList["src/**/#{CONFIGURATION}/*.dll", "src/**/#{CONFIGURATION}/*.pdb"].exclude(/obj\//).exclude(/.Tests/), "#{OUTPUT}/binaries"
+end
+
+desc "Executes xUnit tests"
+xunit :xunit => [:compile] do |xunit|
+ tests = FileList["src/**/#{CONFIGURATION}/Nancy.Bootstrappers.Ninject.Tests.dll"].exclude(/obj\//)
+ xunit.assemblies = tests
+end
+
+desc "Zips up the built binaries for easy distribution"
+zip :package => [:publish] do |zip|
+ Dir.mkdir("#{OUTPUT}/packages")
+
+ zip.directories_to_zip "#{OUTPUT}/binaries"
+ zip.output_file = "Nancy.Bootstrappers.Ninject-Latest.zip"
+ zip.output_path = "#{OUTPUT}/packages"
+end
+
+desc "Generates NuGet packages for each project that contains a nuspec"
+task :nuget_package => [:publish] do
+ Dir.mkdir("#{OUTPUT}/nuget")
+ nuspecs = FileList["src/nancy.bootstrappers.Ninject/*.nuspec"]
+ root = File.dirname(__FILE__)
+
+ # Copy all project *.nuspec to nuget build folder before editing
+ FileUtils.cp_r nuspecs, "#{OUTPUT}/nuget"
+ nuspecs = FileList["#{OUTPUT}/nuget/nancy.bootstrappers.Ninject.nuspec"]
+
+ # Update the copied *.nuspec files to correct version numbers and other common values
+ nuspecs.each do |nuspec|
+ update_xml nuspec do |xml|
+ # Override the version number in the nuspec file with the one from this rake file (set above)
+ xml.root.elements["metadata/version"].text = NANCY_VERSION
+
+ # Override the Nancy dependencies to match this version
+ nancy_dependencies = xml.root.elements["metadata/dependencies/dependency[contains(@id,'Nancy')]"]
+ nancy_dependencies.attributes["version"] = "[#{NANCY_VERSION}]" unless nancy_dependencies.nil?
+
+ # Override common values
+ xml.root.elements["metadata/authors"].text = "Andreas Håkansson, Steven Robbins and contributors"
+ xml.root.elements["metadata/summary"].text = "Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications."
+ xml.root.elements["metadata/licenseUrl"].text = "https://github.com/NancyFx/Nancy.Bootstrappers.Ninject/blob/master/license.txt"
+ xml.root.elements["metadata/projectUrl"].text = "http://nancyfx.org"
+ end
+ end
+
+ # Generate the NuGet packages from the newly edited nuspec fileiles
+ nuspecs.each do |nuspec|
+ nuget = NuGetPack.new
+ nuget.command = "dependencies/Nancy/tools/nuget/nuget.exe"
+ nuget.nuspec = "\"" + root + '/' + nuspec + "\""
+ nuget.output = "#{OUTPUT}/nuget"
+ nuget.parameters = "-Symbols", "-BasePath \"#{root}\"" #using base_folder throws as there are two options that begin with b in nuget 1.4
+ nuget.execute
+ end
+end
+
+desc "Pushes the nuget packages in the nuget folder up to the nuget gallary and symbolsource.org. Also publishes the packages into the feeds."
+task :nuget_publish do
+ nupkgs = FileList["#{OUTPUT}/nuget/*#{NANCY_VERSION}.nupkg"]
+ nupkgs.each do |nupkg|
+ puts "Pushing #{nupkg}"
+ nuget_push = NuGetPush.new
+ nuget_push.command = "dependencies/Nancy/tools/nuget/nuget.exe"
+ nuget_push.package = "\"" + nupkg + "\""
+ nuget_push.create_only = false
+ nuget_push.execute
+ end
+end
+
+def update_xml(xml_path)
+ #Open up the xml file
+ xml_file = File.new(xml_path)
+ xml = REXML::Document.new xml_file
+
+ #Allow caller to make the changes
+ yield xml
+
+ xml_file.close
+
+ #Save the changes
+ xml_file = File.open(xml_path, "w")
+ formatter = REXML::Formatters::Default.new(5)
+ formatter.write(xml, xml_file)
+ xml_file.close
+end
View
1  readme.md
@@ -1,6 +1,7 @@
## Contributors
* [Andreas Håkansson](http://github.com/thecodejunkie)
+* [Andy Pike](http://github.com/andypike)
* [Guido Tapia](http://github.com/gatapia)
* [Steven Robbins](http://github.com/grumpydev)
View
2  ...strappers.Ninject/Nancy.Bootstrappers.Ninject.sln → src/Nancy.Bootstrappers.Ninject.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy.Bootstrappers.Ninject", "Nancy.Bootstrappers.Ninject\Nancy.Bootstrappers.Ninject.csproj", "{760A88F1-7CEA-47FE-86AC-4F75609100F2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy", "..\..\dependencies\Nancy\src\Nancy\Nancy.csproj", "{34576216-0DCA-4B0F-A0DC-9075E75A676F}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nancy", "..\dependencies\Nancy\src\Nancy\Nancy.csproj", "{34576216-0DCA-4B0F-A0DC-9075E75A676F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
View
0  ...nject/Binaries/Ninject.Extensions.ChildKernel.dll → ...nject/Binaries/Ninject.Extensions.ChildKernel.dll
File renamed without changes
View
0  .../Nancy.Bootstrappers.Ninject/Binaries/Ninject.dll → src/Nancy.Bootstrappers.Ninject/Binaries/Ninject.dll
File renamed without changes
View
8 ...appers.Ninject/Nancy.Bootstrappers.Ninject.csproj → ...appers.Ninject/Nancy.Bootstrappers.Ninject.csproj
@@ -49,14 +49,14 @@
<Compile Include="NinjectNancyBootstrapper.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\..\dependencies\Nancy\src\Nancy\Nancy.csproj">
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\dependencies\Nancy\src\Nancy\Nancy.csproj">
<Project>{34576216-0DCA-4B0F-A0DC-9075E75A676F}</Project>
<Name>Nancy</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <Folder Include="Properties\" />
- </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.
View
17 ...Bootstrappers.Ninject/NinjectNancyBootStrapper.cs → ...Bootstrappers.Ninject/NinjectNancyBootStrapper.cs
@@ -11,15 +11,16 @@
/// </summary>
public class NinjectNancyBootstrapper : NancyBootstrapperWithRequestContainerBase<IKernel>
{
- /// <summary>
- /// Gets all registered startup tasks
- /// </summary>
- /// <returns>An <see cref="System.Collections.Generic.IEnumerable{T}"/> instance containing <see cref="IStartup"/> instances. </returns>
- protected override IEnumerable<IStartup> GetStartupTasks() {
- return this.ApplicationContainer.GetAll<IStartup>();
- }
+ /// <summary>
+ /// Gets all registered startup tasks
+ /// </summary>
+ /// <returns>An <see cref="System.Collections.Generic.IEnumerable{T}"/> instance containing <see cref="IStartup"/> instances. </returns>
+ protected override IEnumerable<IStartup> GetStartupTasks()
+ {
+ return this.ApplicationContainer.GetAll<IStartup>();
+ }
- /// <summary>
+ /// <summary>
/// Configures the container by registrating of default
/// INancyModuleCatalog and IRouteResolver.
/// </summary>
View
23 src/Nancy.Bootstrappers.Ninject/nancy.bootstrappers.ninject.nuspec
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <id>Nancy.Bootstrappers.Ninject</id>
+ <version>0.6.0</version> <!-- Overridden by rake nuget task but a default is required in nuspec files -->
+ <authors>Andreas Håkansson, Steven Robbins and contributors</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>An Ninject bootstrapper for the Nancy web framework.</description>
+ <summary>Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aim at delivering a low ceremony approach to building light, fast web applications.</summary>
+ <language>en-US</language>
+ <licenseUrl>https://github.com/NancyFx/Nancy/blob/master/license.txt</licenseUrl>
+ <projectUrl>http://nancyfx.org</projectUrl>
+ <dependencies>
+ <dependency id="Nancy" version="[0.6.0]" />
+ </dependencies>
+ <tags>Nancy Ninject</tags>
+ </metadata>
+ <files>
+ <file src="build\binaries\Nancy.Bootstrappers.Ninject.dll" target="lib\net40" />
+ <file src="build\binaries\Nancy.Bootstrappers.Ninject.pdb" target="lib\net40" />
+ <file src="src\Nancy.Bootstrappers.Ninject\**\*.cs" target="src" />
+ </files>
+</package>
Please sign in to comment.
Something went wrong with that request. Please try again.