From 366cc829f208a6a3286e6aa5dcf2b476e52cc2ab Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Wed, 17 Jun 2015 15:08:38 -0700 Subject: [PATCH] see if I can get travis to work --- .gitignore | 5 +- .travis.yml | 13 +++++ Gemfile | 5 ++ Rakefile | 54 +++++++++++++++++++ assets/puppet/init.pp | 12 +++++ assets/puppet/site.pp | 3 ++ assets/tools.rake | 37 +++++++++++++ .../Exception/TestBaseUntappdException.cs | 3 +- .../Request/TestRepository.cs | 2 +- 9 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 .travis.yml create mode 100644 Gemfile create mode 100644 Rakefile create mode 100644 assets/puppet/init.pp create mode 100644 assets/puppet/site.pp create mode 100644 assets/tools.rake diff --git a/.gitignore b/.gitignore index cee0cb8..e30f673 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,8 @@ *.DotSettings # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs - +*.lock +tools/ **/.settings NDependOut *.ndproj @@ -132,7 +133,7 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2daf098 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: ruby +install: + - sudo apt-get update + - sudo apt-get install puppet + - puppet module install puppetlabs-apt + - puppet apply assets/puppet/site.pp + - bundle +script: + - bundle exec rake preflight +notifications: + email: + - tparnell8@gmail.com +gemfile: Gemfile diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..0f793be --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +source 'http://rubygems.org' +gem 'rake' +gem 'os' +gem 'albacore' +gem 'nokogiri' diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..466d753 --- /dev/null +++ b/Rakefile @@ -0,0 +1,54 @@ +require 'bundler/setup' +require 'rake/clean' +require 'albacore' +require 'open-uri' +require 'fileutils' +require 'os' +require 'nokogiri' +import 'assets/tools.rake' + + +PACKAGES = File.expand_path("packages") +TOOLS = File.expand_path("tools") +NUGET = File.expand_path("#{TOOLS}/nuget") +Configuration = ENV['CONFIGURATION'] || 'Release' + +desc 'retrieve dependencies' +task :retrieve => ['tools:nuget_fetch'] + +desc 'build the project' +task :build => [:compile] + +desc 'Run the tests' +task :test => [:nunit] + +desc 'Retrieve, Build, Test' +task :preflight => [:retrieve, :build, :test] + + + +build :compile => ['tools:nuget_fetch'] do |b| + b.prop 'Configuration', Configuration + b.sln = 'Untappd.Net.sln' +end + +task :tp do + puts NUNIT +end + +test_runner :nunit do |tests| + tests.files = FileList["src/**/*UnitTests/bin/#{Configuration}/*UnitTests.dll"] # dll files with test + tests.exe = "packages/NUnit.Runners.2.6.4/tools/nunit-console.exe" # executable to run tests with +end + +# task :tests => :'tests:unit' + +#task :ensure_nuget_key do +# raise 'missing env NUGET_KEY value' unless ENV['NUGET_KEY'] +#end + +#Albacore::Tasks::Release.new :release, +# pkg_dir: 'build/pkg', +# depend_on: [:create_nugets, :ensure_nuget_key], +# nuget_exe: 'packages/NuGet.CommandLine/tools/NuGet.exe', +# api_key: ENV['NUGET_KEY'] diff --git a/assets/puppet/init.pp b/assets/puppet/init.pp new file mode 100644 index 0000000..1634259 --- /dev/null +++ b/assets/puppet/init.pp @@ -0,0 +1,12 @@ +include apt +class mono { + package { "mono-devel" : + ensure => "installed" + } + package { "mono-gmcs" : + ensure => "installed" + } + package { "mono-vbnc" : + ensure => "installed" + } +} diff --git a/assets/puppet/site.pp b/assets/puppet/site.pp new file mode 100644 index 0000000..a1a3c92 --- /dev/null +++ b/assets/puppet/site.pp @@ -0,0 +1,3 @@ +import 'init.pp' + +include mono diff --git a/assets/tools.rake b/assets/tools.rake new file mode 100644 index 0000000..f5ed8c9 --- /dev/null +++ b/assets/tools.rake @@ -0,0 +1,37 @@ +namespace :tools do + + # If we don't have a copy of nuget, download it + task :nuget_bootstrap do + puts 'Ensuring NuGet exists in tools/NuGet' + + if !FileTest.exist?("#{NUGET}/nuget.exe") + puts 'Downloading nuget from nuget.org' + + FileUtils.mkdir_p("#{NUGET}") + File.open("#{NUGET}/nuget.exe", "wb") do |file| + file.write open('http://nuget.org/nuget.exe').read + end + end + end + + # Fetch nuget dependencies for all packages + task :nuget_fetch => :nuget_bootstrap do + + # If we aren't running under windows, assume we're using mono + CMD_PREFIX = "" + if !OS.windows? + CMD_PREFIX = "mono" + begin + sh "mozroots --import --sync" #attempt to sync ssl things... + rescue + end + end + + # Make sure we get solution-level deps + sh "#{CMD_PREFIX} #{NUGET}/nuget.exe i .nuget/packages.config -o packages" + + FileList["**/packages.config"].each { |filepath| + sh "#{CMD_PREFIX} #{NUGET}/nuget.exe i #{filepath} -o packages" + } + end +end diff --git a/src/Untappd.Net.UnitTests/Exception/TestBaseUntappdException.cs b/src/Untappd.Net.UnitTests/Exception/TestBaseUntappdException.cs index 04b0064..b115a88 100644 --- a/src/Untappd.Net.UnitTests/Exception/TestBaseUntappdException.cs +++ b/src/Untappd.Net.UnitTests/Exception/TestBaseUntappdException.cs @@ -1,6 +1,5 @@ using NUnit.Framework; using Untappd.Net.Exception; - namespace Untappd.Net.UnitTests.Exception { [TestFixture] @@ -24,5 +23,7 @@ namespace Untappd.Net.UnitTests.Exception { throw new BaseUntappdException("messageHere", new System.Exception("innerException!")); } + + } } diff --git a/src/Untappd.Net.UnitTests/Request/TestRepository.cs b/src/Untappd.Net.UnitTests/Request/TestRepository.cs index 7f170ae..25ec1e3 100644 --- a/src/Untappd.Net.UnitTests/Request/TestRepository.cs +++ b/src/Untappd.Net.UnitTests/Request/TestRepository.cs @@ -31,7 +31,7 @@ namespace Untappd.Net.UnitTests.Request request.Setup(a => a.AddParameter(It.IsAny(), It.IsAny())); var response = new Mock(); - response.Setup(a => a.Content).Returns(File.ReadAllText("../../Responses/json/BeerInfo.json")); + response.Setup(a => a.Content).Returns(File.ReadAllText("../../Responses/Json/BeerInfo.json")); client.Setup(a => a.Execute(It.IsAny())).Callback(() => { }).Returns(response.Object);