commit c3e2180189c370991b9cbcfd281a8799853b7c2b Author: Tommy Parnell Date: Thu Apr 21 20:28:03 2016 -0400 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61fdd38 --- /dev/null +++ b/.gitignore @@ -0,0 +1,252 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# 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 + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml \ No newline at end of file diff --git a/ProgrammerExcusesApi.sln b/ProgrammerExcusesApi.sln new file mode 100644 index 0000000..1d5728e --- /dev/null +++ b/ProgrammerExcusesApi.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3542AB75-23F7-4A78-B403-850A226D0F15}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{45C68F8A-EB5B-4F28-8A8E-90BB722D1E0C}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ProgrammerExcusesApi", "src\ProgrammerExcusesApi\ProgrammerExcusesApi.xproj", "{13C0906F-3A74-4AFE-87E0-363392FDCBD6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {13C0906F-3A74-4AFE-87E0-363392FDCBD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {13C0906F-3A74-4AFE-87E0-363392FDCBD6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13C0906F-3A74-4AFE-87E0-363392FDCBD6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {13C0906F-3A74-4AFE-87E0-363392FDCBD6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {13C0906F-3A74-4AFE-87E0-363392FDCBD6} = {3542AB75-23F7-4A78-B403-850A226D0F15} + EndGlobalSection +EndGlobal diff --git a/global.json b/global.json new file mode 100644 index 0000000..5ba986f --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "projects": [ "src", "test" ], + "sdk": { + "version": "1.0.0-rc1-update1" + } +} diff --git a/src/ProgrammerExcusesApi/Controllers/HomeController.cs b/src/ProgrammerExcusesApi/Controllers/HomeController.cs new file mode 100644 index 0000000..3b03d80 --- /dev/null +++ b/src/ProgrammerExcusesApi/Controllers/HomeController.cs @@ -0,0 +1,27 @@ +using AngleSharp; +using Microsoft.AspNet.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 + +namespace ProgrammerExcusesApi.Controllers +{ + [Route("api/[Controller]")] + public class HomeController : Controller + { + // GET: // + + public async Task Index() + { + var config = Configuration.Default.WithDefaultLoader(); + var address = "http://programmingexcuses.com/"; + var document = await BrowsingContext.New(config).OpenAsync(address); + var cells = document.QuerySelectorAll("a"); + var data = cells.First().TextContent; + return new JsonResult(new { content = data, title = document.Title }); + } + } +} \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/ProgrammerExcusesApi.xproj b/src/ProgrammerExcusesApi/ProgrammerExcusesApi.xproj new file mode 100644 index 0000000..8ad0632 --- /dev/null +++ b/src/ProgrammerExcusesApi/ProgrammerExcusesApi.xproj @@ -0,0 +1,18 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 13c0906f-3a74-4afe-87e0-363392fdcbd6 + ProgrammerExcusesApi + ..\..\artifacts\obj\$(MSBuildProjectName) + ..\..\artifacts\bin\$(MSBuildProjectName)\ + + + 2.0 + + + diff --git a/src/ProgrammerExcusesApi/Project_Readme.html b/src/ProgrammerExcusesApi/Project_Readme.html new file mode 100644 index 0000000..0fc12df --- /dev/null +++ b/src/ProgrammerExcusesApi/Project_Readme.html @@ -0,0 +1,188 @@ + + + + + Welcome to ASP.NET 5 + + + + + + + + + + diff --git a/src/ProgrammerExcusesApi/Properties/PublishProfiles/tparnellexcuseapi-publish.ps1 b/src/ProgrammerExcusesApi/Properties/PublishProfiles/tparnellexcuseapi-publish.ps1 new file mode 100644 index 0000000..f0ce721 --- /dev/null +++ b/src/ProgrammerExcusesApi/Properties/PublishProfiles/tparnellexcuseapi-publish.ps1 @@ -0,0 +1,101 @@ +[cmdletbinding(SupportsShouldProcess=$true)] +param($publishProperties, $packOutput, $nugetUrl) + +# to learn more about this file visit http://go.microsoft.com/fwlink/?LinkId=524327 +$publishModuleVersion = '1.0.1' +function Get-VisualStudio2015InstallPath{ + [cmdletbinding()] + param() + process{ + $keysToCheck = @('hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0', + 'hklm:\SOFTWARE\Microsoft\VisualStudio\14.0', + 'hklm:\SOFTWARE\Wow6432Node\Microsoft\VWDExpress\14.0', + 'hklm:\SOFTWARE\Microsoft\VWDExpress\14.0' + ) + [string]$vsInstallPath=$null + + foreach($keyToCheck in $keysToCheck){ + if(Test-Path $keyToCheck){ + $vsInstallPath = (Get-itemproperty $keyToCheck -Name InstallDir -ErrorAction SilentlyContinue | select -ExpandProperty InstallDir -ErrorAction SilentlyContinue) + } + + if($vsInstallPath){ + break; + } + } + + $vsInstallPath + } +} + +$vsInstallPath = Get-VisualStudio2015InstallPath +$publishModulePath = "{0}Extensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath, $publishModuleVersion + +if(!(Test-Path $publishModulePath)){ + $publishModulePath = "{0}VWDExpressExtensions\Microsoft\Web Tools\Publish\Scripts\{1}\" -f $vsInstallPath, $publishModuleVersion +} + +$defaultPublishSettings = New-Object psobject -Property @{ + LocalInstallDir = $publishModulePath +} + +function Enable-PackageDownloader{ + [cmdletbinding()] + param( + $toolsDir = "$env:LOCALAPPDATA\Microsoft\Web Tools\Publish\package-downloader-$publishModuleVersion\", + $pkgDownloaderDownloadUrl = 'http://go.microsoft.com/fwlink/?LinkId=524325') # package-downloader.psm1 + process{ + if(get-module package-downloader){ + remove-module package-downloader | Out-Null + } + + if(!(get-module package-downloader)){ + if(!(Test-Path $toolsDir)){ New-Item -Path $toolsDir -ItemType Directory -WhatIf:$false } + + $expectedPath = (Join-Path ($toolsDir) 'package-downloader.psm1') + if(!(Test-Path $expectedPath)){ + 'Downloading [{0}] to [{1}]' -f $pkgDownloaderDownloadUrl,$expectedPath | Write-Verbose + (New-Object System.Net.WebClient).DownloadFile($pkgDownloaderDownloadUrl, $expectedPath) + } + + if(!$expectedPath){throw ('Unable to download package-downloader.psm1')} + + 'importing module [{0}]' -f $expectedPath | Write-Output + Import-Module $expectedPath -DisableNameChecking -Force + } + } +} + +function Enable-PublishModule{ + [cmdletbinding()] + param() + process{ + if(get-module publish-module){ + remove-module publish-module | Out-Null + } + + if(!(get-module publish-module)){ + $localpublishmodulepath = Join-Path $defaultPublishSettings.LocalInstallDir 'publish-module.psm1' + if(Test-Path $localpublishmodulepath){ + 'importing module [publish-module="{0}"] from local install dir' -f $localpublishmodulepath | Write-Verbose + Import-Module $localpublishmodulepath -DisableNameChecking -Force + $true + } + } + } +} + +try{ + + if (!(Enable-PublishModule)){ + Enable-PackageDownloader + Enable-NuGetModule -name 'publish-module' -version $publishModuleVersion -nugetUrl $nugetUrl + } + + 'Calling Publish-AspNet' | Write-Verbose + # call Publish-AspNet to perform the publish operation + Publish-AspNet -publishProperties $publishProperties -packOutput $packOutput +} +catch{ + "An error occurred during publish.`n{0}" -f $_.Exception.Message | Write-Error +} \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/Properties/launchSettings.json b/src/ProgrammerExcusesApi/Properties/launchSettings.json new file mode 100644 index 0000000..75ca6e8 --- /dev/null +++ b/src/ProgrammerExcusesApi/Properties/launchSettings.json @@ -0,0 +1,26 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:29549/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "Hosting:Environment": "Development" + } + }, + "web": { + "commandName": "web", + "environmentVariables": { + "Hosting:Environment": "Development" + } + } + } +} \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/Startup.cs b/src/ProgrammerExcusesApi/Startup.cs new file mode 100644 index 0000000..678d96a --- /dev/null +++ b/src/ProgrammerExcusesApi/Startup.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace ProgrammerExcusesApi +{ + public class Startup + { + public Startup(IHostingEnvironment env) + { + // Set up configuration sources. + var builder = new ConfigurationBuilder() + .AddJsonFile("appsettings.json") + .AddEnvironmentVariables(); + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; set; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + // Add framework services. + services.AddMvc(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(Configuration.GetSection("Logging")); + loggerFactory.AddDebug(); + + app.UseIISPlatformHandler(); + + app.UseStaticFiles(); + + app.UseMvc(); + } + + // Entry point for the application. + public static void Main(string[] args) => WebApplication.Run(args); + } +} diff --git a/src/ProgrammerExcusesApi/appsettings.json b/src/ProgrammerExcusesApi/appsettings.json new file mode 100644 index 0000000..cc127a8 --- /dev/null +++ b/src/ProgrammerExcusesApi/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Verbose", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/src/ProgrammerExcusesApi/project.json b/src/ProgrammerExcusesApi/project.json new file mode 100644 index 0000000..a3c62d8 --- /dev/null +++ b/src/ProgrammerExcusesApi/project.json @@ -0,0 +1,36 @@ +{ + "version": "1.0.0-*", + "compilationOptions": { + "emitEntryPoint": true + }, + + "dependencies": { + "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", + "Microsoft.AspNet.Mvc": "6.0.0-rc1-final", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", + "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final", + "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final", + "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", + "Microsoft.Extensions.Logging": "1.0.0-rc1-final", + "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", + "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final", + "AngleSharp": "0.9.5" + }, + + "commands": { + "web": "Microsoft.AspNet.Server.Kestrel" + }, + + "frameworks": { + "dnxcore50": { } + }, + + "exclude": [ + "wwwroot", + "node_modules" + ], + "publishExclude": [ + "**.user", + "**.vspscc" + ] +} \ No newline at end of file diff --git a/src/ProgrammerExcusesApi/wwwroot/web.config b/src/ProgrammerExcusesApi/wwwroot/web.config new file mode 100644 index 0000000..8485f67 --- /dev/null +++ b/src/ProgrammerExcusesApi/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + +