Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
derekgreer committed Jun 4, 2012
0 parents commit 2712d53
Show file tree
Hide file tree
Showing 139 changed files with 6,547 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
@@ -0,0 +1,19 @@
build/
reports/
[Bb]in/
[Oo]bj/
TestResults/
PrecompiledWeb/
src/CommonAssemblyInfo.cs
artifacts
lib
*.gpState
*.suo
*.user
*[Rr]e[Ss]harper*
*.cache
UpgradeLog.XML
_UpgradeReport_Files/
*.bak
*.log
*.log.*
19 changes: 19 additions & 0 deletions BUILD_README.txt
@@ -0,0 +1,19 @@
RabbitBus Build Instructions
----------------------------

1. Download the latest version of the NuGet Command Line bootstrapper from
http://nuget.codeplex.com/releases/view/58939 and add the executable to
your PATH environment variable.

1. Download and install the latest Ruby Installer from http://rubyinstaller.org/.


2. Run the following commands to install the ruby gems used by the rake build:

gem install albacore
gem install configatron

(Note: If you are behind a firewall, set the HTTP_PROXY environment variable.)

3. Run 'rake' from project root. This will retrieve the required project dependencies and
create the CommonAssemblyInfo.cs referenced by the project.
19 changes: 19 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,19 @@
Copyright (c) 2012 Derek B. Greer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
23 changes: 23 additions & 0 deletions README.md
@@ -0,0 +1,23 @@
# Welcome to the RabbitBus project.

RabbitBus is a .Net client API for RabbitMQ.

## How To Use RabbitBus

Check out the [RabbitBus Wiki](http://wiki.github.com/derekgreer/rabbitBus) for instructions on using RabbitBus.

If you are new to RabbitMQ, head over to my [RabbitMQ for Windows](http://aspiringcraftsman.com/series/rabbitmq-for-windows/) series.

## Supported Versions Of RabbitMQ

RabbitBus was written to work with RabbitMQ version 0.9.1

## Dependencies

The RabbitBus distribution has the following dependencies:

* RabbitMQ.Client

## MIT License

RabbitBus is released under the [MIT License](https://github.com/derekgreer/rabbitBus/blob/master/LICENSE.txt).
1 change: 1 addition & 0 deletions VERSION.txt
@@ -0,0 +1 @@
VERSION = "1.0.0"
9 changes: 9 additions & 0 deletions packages.rb
@@ -0,0 +1,9 @@
packages = [
[ "Machine.Specifications", "0.5.6.0" ],
[ "ExpectedObjects", "1.0.0.2" ],
[ "Moq", "4.0.10827" ],
[ "RabbitMQ.Client", "2.8.1" ],
[ "Newtonsoft.Json", "4.5.3" ]
]

configatron.packages = packages
20 changes: 20 additions & 0 deletions packaging/nuget/rabbitBus.nuspec
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>RabbitBus</id>
<version>0.0.0</version>
<authors>Derek Greer</authors>
<owners>Derek Greer</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>RabbitMQ client library.</description>
<tags>RabbitBus RabbitMQ Client AMQP Queue,Bus</tags>
<dependencies>
<dependency id="RabbitMQ.Client" version="2.8.1" />
</dependencies>
</metadata>
<files>
<file src="build\RabbitBus.dll" target="lib\net40" />
<file src="build\RabbitBus.pdb" target="lib\net40" />
<file src="src\RabbitBus\**\*.cs" target="src" />
</files>
</package>
21 changes: 21 additions & 0 deletions packaging/nuget/rabbitBusSerializationJson.nuspec
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>RabbitBus.Serialization.Json</id>
<version>0.0.0</version>
<authors>Derek Greer</authors>
<owners>Derek Greer</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>RabbitBus JSON serialization provider.</description>
<tags>RabbitBus RabbitMQ Client AMQP Queue Bus JSON</tags>
<dependencies>
<dependency id="RabbitBus" version="" />
<dependency id="Newtonsoft.Json" version="4.5.3" />
</dependencies>
</metadata>
<files>
<file src="build\RabbitBus.Serialization.Json.dll" target="lib\net40" />
<file src="build\RabbitBus.Serialization.Json.pdb" target="lib\net40" />
<file src="src\RabbitBus.Serialization.Json\**\*.cs" target="src" />
</files>
</package>
104 changes: 104 additions & 0 deletions rakefile.rb
@@ -0,0 +1,104 @@
require 'rubygems'
require 'erb'
require 'fileutils'
require 'configatron'
require 'albacore'

MSBUILD_PATH = "C:/Windows/Microsoft.NET/Framework/v4.0.30319/"
BUILD_PATH = File.expand_path('build')
ARTIFACTS_PATH = File.expand_path('artifacts')
LIB_PATH = File.expand_path('lib')
SOLUTION = 'src/RabbitBus.sln'
COMPILE_TARGET = 'Release'
NUGET_CACHE= File.join(ENV['LOCALAPPDATA'], '/NuGet/Cache/')
FEEDS = ['https://go.microsoft.com/fwlink/?LinkID=206669' ]
nuget = 'nuget'
SHELL_DEPENDENCIES = ['nuget.exe']
load 'VERSION.txt'
load 'packages.rb'
if(ENV['BUILD_NUMBER']) then VERSION="#{VERSION}" + '.' + ENV['BUILD_NUMBER'] end


task :default => ["all"]

task :all => [:verify, :clean, :dependencies, :compile, :specs, :package]

task :verify do

puts "Verifying dependencies ..."
SHELL_DEPENDENCIES.each do |dep|
verify(dep) or fail "Could not find #{dep} in the system path."
end
end

assemblyinfo :versioning do |asm|
asm.output_file = "src/CommonAssemblyInfo.cs"
asm.version = "#{VERSION}"
end

task :clean do
rm_rf "#{BUILD_PATH}"
rm_rf "#{ARTIFACTS_PATH}"
end

task :compile => [:versioning] do

mkdir "#{BUILD_PATH}"
sh "#{MSBUILD_PATH}msbuild.exe /p:Configuration=#{COMPILE_TARGET} #{SOLUTION}"
copyOutputFiles "src/RabbitBus/bin/#{COMPILE_TARGET}", "*.{dll,pdb}", "#{BUILD_PATH}"
copyOutputFiles "src/RabbitBus.Serialization.Json/bin/#{COMPILE_TARGET}", "*.{dll,pdb}", "#{BUILD_PATH}"
end

task :specs do
specs = FileList.new("src/RabbitBus.Specs/bin/#{COMPILE_TARGET}/*.Specs.dll")
puts specs
sh "lib/Machine.Specifications/tools/mspec-x86-clr4.exe -x integration #{specs}"
end

task :package do
mkdir_p "#{ARTIFACTS_PATH}"
rm Dir.glob("#{ARTIFACTS_PATH}/*.nupkg")
FileList["packaging/nuget/*.nuspec"].each do |spec|
sh "#{nuget} pack #{spec} -o #{ARTIFACTS_PATH} -Version #{VERSION} -Symbols -BasePath ."
end
end

task :dependencies do
feeds = FEEDS.map {|x|"-Source " + x }.join(' ')
configatron.packages.each do | name,version |
packageFeeds = "-Source #{NUGET_CACHE} " + feeds unless !version
packageExists = File.directory?("#{LIB_PATH}/#{name}")
versionInfo="#{LIB_PATH}/#{name}/version.info"
currentVersion=IO.read(versionInfo) if File.exists?(versionInfo)
if(!packageExists or !version or !versionInfo or currentVersion != version) then
versionArg = "-Version #{version}" unless !version
sh "nuget Install #{name} #{versionArg} -o #{LIB_PATH} #{packageFeeds} -ExcludeVersion" do | ok, results |
File.open(versionInfo, 'w') {|f| f.write(version) } unless !ok
end
end
end
end

task :publish => [:all] do
FileList["#{ARTIFACTS_PATH}/*.nupkg"].gsub(File::SEPARATOR,
File::ALT_SEPARATOR || File::SEPARATOR).each do | file |
sh "nuget push #{file}"
end
end

def verify(command)
ENV['PATH'].split(/;/).each do | path |
if(File.exists?(File.join("#{path}", command)))
return true
end
end

return false
end

def copyOutputFiles(fromDir, filePattern, outDir)
Dir.glob(File.join(fromDir, filePattern)){|file|
copy(file, outDir) if File.file?(file)
}
end

56 changes: 56 additions & 0 deletions src/RabbitBus.Serialization.Json/JsonSerializationStrategy.cs
@@ -0,0 +1,56 @@
using System;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Text;
using Newtonsoft.Json;
using RabbitBus.Configuration;
using RabbitBus.Configuration.Internal;
using RabbitBus.Logging;

namespace RabbitBus.Serialization.Json
{
public class JsonSerializationStrategy : ISerializationStrategy
{
public string ContentType
{
get { return "application/json; charset=utf-8"; }
}

public string ContentEncoding
{
get { return "utf-8"; }
}

public byte[] Serialize<T>(T message)
{
try
{
string json = JsonConvert.SerializeObject(message);
return Encoding.UTF8.GetBytes(json);
}
catch (Exception e)
{
Console.WriteLine(e);
var error = "An error occurred attempting to serialize the provided message: " + e.Message;
Logger.Current.Write(new LogEntry {Message = error, Severity = TraceEventType.Error});
throw new SerializationException(error, e);
}
}

public T Deserialize<T>(byte[] bytes)
{
try
{
var message = Encoding.UTF8.GetString(bytes);
return JsonConvert.DeserializeObject<T>(message);
}
catch (Exception e)
{
Console.WriteLine(e);
var error = "An error occurred attempting to deserialize the provided data: " + e.Message;
Logger.Current.Write(new LogEntry {Message = error, Severity = TraceEventType.Error});
throw new SerializationException(error, e);
}
}
}
}
36 changes: 36 additions & 0 deletions src/RabbitBus.Serialization.Json/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RabbitBus.Serialization.Json")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RabbitBus.Serialization.Json")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f936765b-4216-4a02-afe8-aa4d035fc823")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

0 comments on commit 2712d53

Please sign in to comment.