Skip to content
Browse files

Merge pull request #142 from Aaronontheweb/rake-file-squash

Rake-based build system and new NuGet package
  • Loading branch information...
2 parents b7011ea + b295375 commit 06c60574912b05417202f2a152e6452d111be604 @Aaronontheweb Aaronontheweb committed Nov 27, 2013
Showing with 328 additions and 53 deletions.
  1. +4 −0 .gitignore
  2. +7 −0 Gemfile
  3. +18 −1 README.md
  4. +177 −0 Rakefile.rb
  5. +29 −0 SharedAssemblyInfo.cs
  6. +1 −0 VERSION
  7. +0 −11 build.cmd
  8. +53 −0 buildscripts/paths.rb
  9. +35 −0 buildscripts/projects.rb
  10. +3 −0 src/FluentCassandra.csproj
  11. +0 −23 src/FluentCassandra.nuspec
  12. +1 −18 src/Properties/AssemblyInfo.cs
View
4 .gitignore
@@ -4,6 +4,10 @@ msbuild.log
# nuget package files
*.nupkg
+# Build system output
+Gemfile.lock
+build/
+
# Don't include NuGet Packages
packages/
View
7 Gemfile
@@ -0,0 +1,7 @@
+source 'http://rubygems.org'
+source 'http://gemcutter.org'
+
+gem "rake", "<10"
+gem "rubyzip", "0.9.9"
+gem "albacore", "0.3.5"
+gem "version_bumper"
View
19 README.md
@@ -40,4 +40,21 @@ Your First Fluent Cassandra Application
There was an indepth 2 part series of blog posts made on the subject of creating your first Fluent Cassandra application.
1. [Your First Fluent Cassandra Application](http://coderjournal.com/2010/06/your-first-fluent-cassandra-application/)
-2. [Your First Fluent Cassandra Application (part 2)](http://coderjournal.com/2010/06/your-first-fluent-cassandra-application-part-2/)
+2. [Your First Fluent Cassandra Application (part 2)](http://coderjournal.com/2010/06/your-first-fluent-cassandra-application-part-2/)
+
+Building FluentCassandra
+--------------------
+
+If you need to build FluentCassandra locally, know that FluentCassandra uses [Albacore][0] - a Ruby-based build system for Windows.
+
+To build FluentCassandra, [install Ruby][1] onto your machine and then open a new command prompt to your local FluentCassandra directory and execute the following command:
+
+````
+$: rake
+````
+
+And that's it! The build will automatically run for you. You can also execute `rake -T` to see a list of additional commands.
+
+[0]: https://github.com/Albacore/albacore "Albacore is a professional quality suite of Rake tasks for building .NET or Mono based systems."
+
+[1]: http://www.railsinstaller.org/ "Rails Installer for Windows"
View
177 Rakefile.rb
@@ -0,0 +1,177 @@
+$: << './'
+require "rubygems"
+require "bundler"
+Bundler.setup
+
+require 'albacore'
+require 'version_bumper'
+
+#-----------------------
+# Local dependencies
+#-----------------------
+require File.expand_path(File.dirname(__FILE__)) + '/buildscripts/projects'
+require File.expand_path(File.dirname(__FILE__)) + '/buildscripts/paths'
+
+#-----------------------
+# Environment variables
+#-----------------------
+@env_buildconfigname = "Release"
+
+def env_buildversion
+ bumper_version.to_s
+end
+
+def env_nuget_version
+ version = env_buildversion.split(".")
+ "#{version[0]}.#{version[1]}.#{version[2]}"
+end
+
+#-----------------------
+# Control Flow (meant to be called directly)
+#-----------------------
+
+desc "Creates a new Release build of FluentCassandra locally"
+task :default => [:build]
+
+desc "Creates a new Debug build of FluentCassandra locally"
+task :debug => [:set_debug_config, :build]
+
+desc "Packs a Release build of FluentCassandra for NuGet"
+task :nuget => [:build, :pack]
+
+desc "Packs a Debug build of FluentCassandra for NuGet"
+task :nuget_debug => [:debug, :pack]
+
+#-----------------------
+# Environment variables
+#-----------------------
+desc "Sets the build environment to Debug"
+task :set_debug_config do
+ @env_buildconfigname = "Debug"
+end
+
+#-----------------------
+# MSBuild
+#-----------------------
+
+desc "Does a release build of everything in the solution"
+msbuild :build => [:assemblyinfo] do |msb|
+ msb.properties :configuration => @env_buildconfigname
+ msb.targets :Clean, :Build #Does the equivalent of a "Rebuild Solution"
+ msb.solution = File.join(Folders[:root], Files[:solution])
+end
+
+#-----------------------
+# Version Management
+#-----------------------
+
+assemblyinfo :assemblyinfo do |asm|
+ assemblyInfoPath = File.join(Folders[:root], Files[:assembly_info])
+
+ asm.input_file = assemblyInfoPath
+ asm.output_file = assemblyInfoPath
+
+ asm.version = env_buildversion
+ asm.file_version = env_buildversion
+end
+
+desc "Increments the build number for the project"
+task :bump_build_number do
+ bumper_version.bump_build
+ bumper_version.write(File.join(Folders[:root], Files[:version]))
+end
+
+desc "Increments the revision number for the project"
+task :bump_revision_number do
+ bumper_version.bump_revision
+ bumper_version.write(File.join(Folders[:root], Files[:version]))
+end
+
+desc "Increments the minor version number for the project"
+task :bump_minor_version_number do
+ bumper_version.bump_minor
+ bumper_version.write(File.join(Folders[:root], Files[:version]))
+end
+
+desc "Increments the major version number for the project"
+task :bump_major_version_number do
+ bumper_version.bump_major
+ bumper_version.write(File.join(Folders[:root], Files[:version]))
+end
+
+#-----------------------
+# Output
+#-----------------------
+desc "Sets the output / bin folders based on the current build configuration"
+task :set_output_folders do
+ #.NET 4.0
+ Folders[:bin][:fluentcassandra_net40] = File.join(Folders[:src], Projects[:fluentcassandra_net40][:dir],"bin", @env_buildconfigname)
+end
+
+desc "Wipes out the build folder so we have a clean slate to work with"
+task :clean_output_folders => :set_output_folders do
+ puts "Flushing build folder..."
+ flush_dir(Folders[:nuget_out])
+end
+
+desc "Creates all of the output folders we need for ILMerge / NuGet"
+task :create_output_folders => :clean_output_folders do
+ create_dir(Folders[:out])
+
+ #Nuget folders
+ create_dir(Folders[:nuget_out])
+ create_dir(Folders[:fluentcassandra_nuspec][:root])
+ create_dir(Folders[:fluentcassandra_nuspec][:lib])
+ create_dir(Folders[:fluentcassandra_nuspec][:net40])
+end
+
+#-----------------------
+# NuGet Output
+#-----------------------
+output :fluentcassandra_net40_nuget_output => [:create_output_folders] do |out|
+ out.from Folders[:bin][:fluentcassandra_net40]
+ out.to Folders[:fluentcassandra_nuspec][:net40]
+ out.file Files[:fluentcassandra_net40][:bin]
+ out.file Files[:fluentcassandra_net40][:pdb]
+end
+
+desc "Executes all file/copy tasks"
+task :all_output => [:fluentcassandra_net40_nuget_output]
+
+#-----------------------
+# NuSpec
+#-----------------------
+desc "Builds a nuspec file for FluentCassandra"
+nuspec :nuspec => [:all_output] do |nuspec|
+ nuspec.id = Projects[:fluentcassandra_net40][:id]
+ nuspec.title = Projects[:fluentcassandra_net40][:title]
+ nuspec.version = env_nuget_version
+ nuspec.authors = Projects[:fluentcassandra_net40][:authors]
+ nuspec.owners = Projects[:fluentcassandra_net40][:company]
+ nuspec.description = Projects[:fluentcassandra_net40][:description]
+ nuspec.iconUrl = Projects[:iconUrl]
+ nuspec.projectUrl = Projects[:projectUrl]
+ nuspec.licenseUrl = Projects[:licenseUrl]
+ #nuspec.require_license_acceptance = false #causes an issue with Albacore 0.3.5
+ nuspec.language = Projects[:language]
+ nuspec.tags = Projects[:fluentcassandra_net40][:nuget_tags]
+ nuspec.output_file = File.join(Folders[:nuget_out], "#{Projects[:fluentcassandra_net40][:id]}-v#{env_nuget_version}(#{@env_buildconfigname}).nuspec");
+
+ #framework assemblies
+ Projects[:fluentcassandra_net40][:framework_assemblies].each do |key, array|
+ nuspec.framework_assembly array[:assemblyName], array[:targetFramework]
+ end
+end
+
+#-----------------------
+# NuGet Pack
+#-----------------------
+desc "Packs a build of FluentCassandra into a NuGet package"
+nugetpack :pack => [:nuspec] do |nuget|
+ nuget.command = Commands[:nuget]
+ nuget.nuspec = File.join(Folders[:nuget_out], "#{Projects[:fluentcassandra_net40][:id]}-v#{env_nuget_version}(#{@env_buildconfigname}).nuspec")
+ nuget.base_folder = Folders[:fluentcassandra_nuspec][:root]
+ nuget.output = Folders[:nuget_out]
+ nuget.symbols = true
+end
+
View
29 SharedAssemblyInfo.cs
@@ -0,0 +1,29 @@
+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: AssemblyCompany("Managed Fusion, LLC")]
+[assembly: AssemblyCopyright("Copyright © Nick Berardi, Managed Fusion, LLC 2011-2013")]
+[assembly: AssemblyTrademark("")]
+
+#if DEBUG
+[assembly: AssemblyConfiguration("Debug")]
+#else
+[assembly: AssemblyConfiguration("Release")]
+#endif
+
+// 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.2.3.0")]
+[assembly: AssemblyFileVersion("1.2.3.0")]
View
1 VERSION
@@ -0,0 +1 @@
+1.2.3.0
View
11 build.cmd
@@ -1,11 +0,0 @@
-@echo Off
-set config=%1
-if "%config%" == "" (
- set config=Debug
-)
-
-%WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild .\src\FluentCassandra.csproj /p:Configuration="%config%" /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false
-
-if "%config%" == "Release" (
- nuget pack .\src\FluentCassandra.csproj -Build -Symbols -Properties Configuration=Release
-)
View
53 buildscripts/paths.rb
@@ -0,0 +1,53 @@
+#----------------------------------
+# Paths and file system functions for FluentCassandra
+#----------------------------------
+root_folder = File.expand_path("#{File.dirname(__FILE__)}/..")
+
+Folders = {
+ :root => root_folder,
+ :src => File.join(root_folder, "src"),
+ :out => File.join(root_folder, "build"),
+ :nuget_bin => File.join(root_folder, ".nuget"),
+ :nuget_out => File.join(root_folder, "build", "nuget"),
+
+ #Output folder for creating FluentCassandra nuget distributions
+ :fluentcassandra_nuspec => {
+ :root => File.join(root_folder, "build", "nuget", "FluentCassandra"),
+ :lib => File.join(root_folder, "build", "nuget", "FluentCassandra", "lib"),
+ :net40 => File.join(root_folder, "build", "nuget", "FluentCassandra", "lib", "net40"),
+ },
+
+ #specifies the locations of the binary DLLs we want to use in NuGet / XUnit
+ :bin => {
+ :fluentcassandra_net40 => 'placeholder - specify build environment',
+ }
+}
+
+Files = {
+ :solution => "FluentCassandra.sln",
+ :version => "VERSION",
+ :assembly_info => "SharedAssemblyInfo.cs",
+
+ :fluentcassandra_net40 => {
+ :bin => "#{Projects[:fluentcassandra_net40][:id]}.dll",
+ :pdb => "#{Projects[:fluentcassandra_net40][:id]}.pdb"
+ }
+}
+
+Commands = {
+ :nuget => File.join(Folders[:nuget_bin], "NuGet.exe"),
+}
+
+#safe function for creating output directories
+def create_dir(dirName)
+ if !File.directory?(dirName)
+ FileUtils.mkdir(dirName) #creates the /build directory
+ end
+end
+
+#Deletes a directory from the tree (to keep the build folder clean)
+def flush_dir(dirName)
+ if File.directory?(dirName)
+ FileUtils.remove_dir(dirName, true)
+ end
+end
View
35 buildscripts/projects.rb
@@ -0,0 +1,35 @@
+#----------------------------------
+# Project data for FluentCassandra
+#----------------------------------
+
+Projects = {
+ :language => "en-US",
+ :licenseUrl => "https://github.com/fluentcassandra/fluentcassandra/blob/master/LICENSE.txt",
+ :projectUrl => "https://github.com/fluentcassandra/fluentcassandra",
+ :iconUrl => "https://github.com/fluentcassandra/fluentcassandra/raw/master/nuget/FluentCassandra.Logo.png",
+
+ :fluentcassandra_net40 => {
+ :id => "FluentCassandra",
+ :dir => "",
+ :title => "Fluent Cassandra",
+ :description => "FluentCassandra is a .NET library for accessing Cassandra, which wraps the Thrift client library and provides a more fluent POCO interface for accessing and querying the objects in Cassandra.",
+ :copyright => "Copyright Nick Berardi, Managed Fusion, LLC 2011-2013",
+ :authors => "Nick Berardi, Aaron Stannard",
+ :company => "Managed Fusion, LLC",
+ :nuget_tags => "fluent cassandra apache nosql database managedfusion .net40 cql cql3",
+ :framework_assemblies => {
+ :system_core => {
+ :assemblyName => "System.Core",
+ :targetFramework => "net40"
+ },
+ :system_numerics => {
+ :assemblyName => "System.Numerics",
+ :targetFramework => "net40"
+ },
+ :system_web => {
+ :assemblyName => "System.Web",
+ :targetFramework => "net40"
+ }
+ }
+ }
+}
View
3 src/FluentCassandra.csproj
@@ -50,6 +50,9 @@
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\SharedAssemblyInfo.cs">
+ <Link>Properties\SharedAssemblyInfo.cs</Link>
+ </Compile>
<Compile Include="Apache\Cassandra\AuthenticationException.cs" />
<Compile Include="Apache\Cassandra\AuthenticationRequest.cs" />
<Compile Include="Apache\Cassandra\AuthorizationException.cs" />
View
23 src/FluentCassandra.nuspec
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<package>
- <metadata>
- <id>FluentCassandra</id>
- <version>1.2.2</version>
- <title>Fluent Cassandra</title>
- <authors>Nick Berardi</authors>
- <owners>Managed Fusion, LLC</owners>
- <description>FluentCassandra is a .NET library for accessing Cassandra, which wraps the Thrift client library and provides a more fluent POCO interface for accessing and querying the objects in Cassandra.</description>
- <summary>FluentCassandra is a .NET library for accessing Cassandra, which wraps the Thrift client library and provides a more fluent POCO interface for accessing and querying the objects in Cassandra.</summary>
- <language>en-US</language>
- <projectUrl>https://github.com/managedfusion/fluentcassandra</projectUrl>
- <licenseUrl>https://github.com/managedfusion/fluentcassandra/raw/master/LICENSE.txt</licenseUrl>
- <iconUrl>https://github.com/managedfusion/fluentcassandra/raw/master/nuget/FluentCassandra.Logo.png</iconUrl>
- <requireLicenseAcceptance>false</requireLicenseAcceptance>
- <tags>fluent cassandra apache nosql database managedfusion .net40</tags>
- <frameworkAssemblies>
- <frameworkAssembly assemblyName="System.Core" targetFramework="net40" />
- <frameworkAssembly assemblyName="System.Numerics" targetFramework="net40" />
- <frameworkAssembly assemblyName="System.Web" targetFramework="net40" />
- </frameworkAssemblies>
- </metadata>
-</package>
View
19 src/Properties/AssemblyInfo.cs
@@ -7,10 +7,6 @@
[assembly: AssemblyTitle("FluentCassandra")]
[assembly: AssemblyDescription("FluentCassandra is a .NET library for accessing Cassandra, which wraps the Thrift client library and provides a more fluent POCO interface for accessing and querying the objects in Cassandra.")]
[assembly: AssemblyProduct("FluentCassandra")]
-[assembly: AssemblyCompany("Managed Fusion, LLC")]
-[assembly: AssemblyCopyright("Copyright © Nick Berardi, Managed Fusion, LLC 2011")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
@@ -19,17 +15,4 @@
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("f2fac76e-0d80-4099-a64f-2686d4d99b6b")]
-
-// 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.2.3.0")]
-[assembly: AssemblyFileVersion("1.2.3.0")]
+[assembly: Guid("f2fac76e-0d80-4099-a64f-2686d4d99b6b")]

0 comments on commit 06c6057

Please sign in to comment.
Something went wrong with that request. Please try again.