Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed May 2, 2017
2 parents e3c6726 + c935ff1 commit 5b74bca
Show file tree
Hide file tree
Showing 35 changed files with 963 additions and 320 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ branches:
# Build Cache #
#---------------------------------#
cache:
- Source\packages -> Source\**\packages.config
- src\packages -> src\**\packages.config
- tools -> setup.cake
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This Addin for the Cake Build Automation System allows you to generate a documen

## Information

||Stable|Pre-release|
| |Stable|Pre-release|
|:--:|:--:|:--:|
|GitHub Release|-|[![GitHub release](https://img.shields.io/github/release/cake-contrib/Cake.DocFx.svg)](https://github.com/cake-contrib/Cake.DocFx/releases/latest)|
|NuGet|[![NuGet](https://img.shields.io/nuget/v/Cake.DocFx.svg)](https://www.nuget.org/packages/Cake.DocFx)|[![NuGet](https://img.shields.io/nuget/vpre/Cake.DocFx.svg)](https://www.nuget.org/packages/Cake.DocFx)|
Expand Down
56 changes: 56 additions & 0 deletions docs/input/_Bottom.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<div class="github-button">
<a href="https://github.com/cake-contrib/Cake.DocFx" target="_blank"><i class="fa fa-github"></i> GitHub</a>
</div>
<script>
((window.gitter = {}).chat = {}).options = {
room: 'cake-contrib/Lobby'
};
</script>
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>

<script type="text/javascript" src="@Context.GetLink("/assets/js/anchor.min.js")"></script>
<script type="text/javascript" src="@Context.GetLink("/assets/js/clipboard.min.js")"></script>
<script type="text/javascript">
anchors.options.placement = 'left';
anchors.add('#content > h1,h2,h3,h4');
var snippets = document.querySelectorAll("pre > code");
[].forEach.call(snippets, function(snippet) {
snippet.insertAdjacentHTML("beforebegin", "<button class='btn-copy' data-clipboard-snippet><img class='clippy' width=13 src='@Context.GetLink("/assets/images/clippy.svg")' alt='Copy to clipboard'></button>");
});
var clipboardSnippets = new Clipboard('[data-clipboard-snippet]', {
target: function(trigger) {
return trigger.nextElementSibling;
}
});
clipboardSnippets.on('success', function(e) {
e.clearSelection();
showTooltip(e.trigger, "Copied!");
});
clipboardSnippets.on('error', function(e) {
showTooltip(e.trigger, fallbackMessage(e.action));
});
var btns = document.querySelectorAll('.btn-copy');
for (var i = 0; i < btns.length; i++) {
btns[i].addEventListener('mouseleave', function(e) {
e.currentTarget.setAttribute('class', 'btn-copy');
e.currentTarget.removeAttribute('aria-label');
});
}
function showTooltip(elem, msg) {
elem.setAttribute('class', 'btn-copy tooltipped tooltipped-s');
elem.setAttribute('aria-label', msg);
}
function fallbackMessage(action) {
var actionMsg = '';
var actionKey = (action === 'cut' ? 'X' : 'C');
if (/iPhone|iPad/i.test(navigator.userAgent)) {
actionMsg = 'No support :(';
} else if (/Mac/i.test(navigator.userAgent)) {
actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;
} else {
actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;
}
return actionMsg;
}
</script>
20 changes: 0 additions & 20 deletions docs/input/assets/css/override.css

This file was deleted.

122 changes: 122 additions & 0 deletions docs/input/assets/css/override.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/* Control the margin for bootstrap alert boxes */
.alert > p {
margin-top: 0px;
}

/* Control the look and feel of the copy box applied to code sections */
.btn-copy[disabled] .clippy {
opacity: .3;
}
pre .btn-copy {
-webkit-transition: opacity 0.3s ease-in-out;
-o-transition: opacity 0.3s ease-in-out;
transition: opacity 0.3s ease-in-out;
opacity: 0;
padding: 2px 6px;
float: right;
}
pre:hover .btn-copy {
opacity: 1;
}
.tooltipped {
position: relative
}
.tooltipped:after {
position: absolute;
z-index: 1000000;
display: none;
padding: 5px 8px;
font: normal normal 11px/1.5 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
color: #fff;
text-align: center;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-wrap: break-word;
white-space: pre;
pointer-events: none;
content: attr(aria-label);
background: rgba(0, 0, 0, 0.8);
border-radius: 3px;
-webkit-font-smoothing: subpixel-antialiased
}
.tooltipped:before {
position: absolute;
z-index: 1000001;
display: none;
width: 0;
height: 0;
color: rgba(0, 0, 0, 0.8);
pointer-events: none;
content: "";
border: 5px solid transparent
}
.tooltipped:hover:before, .tooltipped:hover:after, .tooltipped:active:before, .tooltipped:active:after, .tooltipped:focus:before, .tooltipped:focus:after {
display: inline-block;
text-decoration: none
}
.tooltipped-s:after, .tooltipped-se:after, .tooltipped-sw:after {
top: 100%;
right: 50%;
margin-top: 5px
}
.tooltipped-s:before, .tooltipped-se:before, .tooltipped-sw:before {
top: auto;
right: 50%;
bottom: -5px;
margin-right: -5px;
border-bottom-color: rgba(0, 0, 0, 0.8)
}

@font-family-sans-serif: "Roboto", Helvetica, Arial, sans-serif;

/* For Gitter and GitHub */
.bottom-footer {
margin-bottom: 40px !important; // Make room for Gitter and GitHub buttons
}

.gitter-open-chat-button {
background-color: #3c8dbc;
font-family: @font-family-sans-serif;
letter-spacing: normal;
right: 90px;
}

.gitter-open-chat-button:focus, .gitter-open-chat-button:hover,
.github-button:focus, .github-button:hover,
{
background-color: #4EABDD;
color: #fff;
}

.gitter-chat-embed {
top: 49px;
border-top: 1px solid #000;
z-index: 10000;
}

.github-button {
z-index: 100;
position: fixed;
bottom: 0px;
right: 240px;
padding: 1em 3em;
background-color: #367fa9;
border: 0;
border-top-left-radius: 0.5em;
border-top-right-radius: 0.5em;
font-family: sans-serif;
font-size: 9pt;
text-transform: uppercase;
text-align: center;
text-decoration: none;
cursor: pointer;
cursor: hand;
-webkit-transition: all .3s ease;
transition: all .3s ease;
color: #fff;
a, a:active, a:hover, a:focus {
color: #fff;
}
}
2 changes: 1 addition & 1 deletion docs/input/docs/index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Title: Documentation
---
<p>This user guide, like Cake.DocFx itself, is under very active development. Some parts of it aren't
documented as completely as they need to be, but we glady accept your contributions.</p>
documented as completely as they need to be, but we gladly accept your contributions.</p>

<p>We need your help to improve the documentation for Cake.DocFx, so if there is something that you
would like to add then you can edit the content directly on GitHub.</p>
Expand Down
10 changes: 5 additions & 5 deletions docs/input/docs/usage/examples.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Build Script

To use docfx in your cake file simply import it and the docfx tool. Then define a doc task.
To use DocFX in your Cake file simply import it and the DocFX tool. Then define a doc task.

```cake
#addin "Cake.DocFx"
#tool "docfx.console"

Task("doc").Does(() => DocFx());
Task("doc").Does(() => DocFxBuild());
```

:::{.alert .alert-info}
**IMPORTANT** Do not forget to load '#tool "docfx.console"' at top of your cake file. Otherwise, you can not run the `DocFx()` command.
**IMPORTANT** Do not forget to load '#tool "docfx.console"' at top of your Cake file. Otherwise, you can not run the `DocFx()` command.
:::

If the `docfx.json` file is anywhere else then the root directory you can pass in the location as parameter.
Expand All @@ -19,9 +19,9 @@ If the `docfx.json` file is anywhere else then the root directory you can pass i
#addin "Cake.DocFx"
#tool "docfx.console"

Task("doc").Does(() => DocFx("./docs/docfx.json"));
Task("doc").Does(() => DocFxBuild("./docs/docfx.json"));
```

:::{.alert .alert-info}
**IMPORTANT** The `DocFx` command requires an existing `docfx.json` file. To bootstrap docfx use `docfx init` or `./tools/docfx.console/tools/docfx.exe init`.
**IMPORTANT** The `DocFx` command requires an existing `docfx.json` file. To bootstrap DocFX use `docfx init` or `./tools/docfx.console/tools/docfx.exe init`.
:::
1 change: 1 addition & 0 deletions nuspec/nuget/Cake.DocFx.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<copyright>Copyright (c) Cake Contributions 2016 - Present</copyright>
<tags>Cake Script DocFx</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.DocFx/releases/tag/0.3.0</releaseNotes>
</metadata>
<files>
<file src="Cake.DocFx.dll" target="lib\net45" />
Expand Down
2 changes: 1 addition & 1 deletion setup.cake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BuildParameters.SetParameters(context: Context,
repositoryName: "Cake.DocFx",
appVeyorAccountName: "cakecontrib");

BuildParameters.PrintParamters(Context);
BuildParameters.PrintParameters(Context);

ToolSettings.SetToolSettings(context: Context,
dupFinderExcludePattern: new string[] {
Expand Down
20 changes: 20 additions & 0 deletions src/Cake.DocFx.Tests/Build/DocFxBuildRunnerFixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Cake.Core.IO;
using Cake.DocFx.Build;

namespace Cake.DocFx.Tests.Build
{
internal sealed class DocFxBuildRunnerFixture : DocFxFixture<DocFxBuildSettings>
{
public DocFxBuildRunnerFixture()
{
}

public FilePath ConfigFilePath { get; set; }

protected override void RunTool()
{
var tool = new DocFxBuildRunner(FileSystem, Environment, ProcessRunner, Tools);
tool.Run(ConfigFilePath, Settings);
}
}
}
56 changes: 56 additions & 0 deletions src/Cake.DocFx.Tests/Build/DocFxBuildRunnerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
namespace Cake.DocFx.Tests.Build
{
using Xunit;

public class DocFxBuildRunnerTests
{
public sealed class ThePackMethod
{
[Fact]
public void Should_Throw_If_Settings_Are_Null()
{
// Given
var fixture = new DocFxBuildRunnerFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());

// Then
result.IsArgumentNullException("settings");
}

[Fact]
public void Should_Add_GlobalMetadata_To_Arguments_If_Not_Empty()
{
// Given
var fixture = new DocFxBuildRunnerFixture();
fixture.Settings.GlobalMetadata.Add("foo", "bar");

// When
var result = fixture.Run();

// Then
Assert.Equal("build --globalMetadata \"{\\\"foo\\\": \\\"bar\\\"}\"", result.Args);
}

[Fact]
public void Should_Add_Serve_To_Arguments_If_True()
{
// Given
var fixture = new DocFxBuildRunnerFixture
{
Settings = {Serve = true}
};

// When
var result = fixture.Run();

// Then
Assert.Equal("build --serve", result.Args);
}
}
}
}
Loading

0 comments on commit 5b74bca

Please sign in to comment.