Icing on the Cake – reviewing the recipe for 2016

As 2016 is just about to be fully baked, the year has been packed with many ingredients, with this post we would like to take the opportunity to reflect on a few of the essences of what's been a truly amazing and eventful Cake year.

Community

First of all we must highlight, and send a big THANK YOU to, the amazing community that has formed around Cake!

There are now over one hundred individual contributors to the various Cake projects, helping out with documentation, adding new features, raising issues and fixing bugs. In addition, over a quarter of a million downloads of the main Cake NuGet package! Together, with you, during 2016 we released no less than fifteen releases!

As maintainers of an open source project it's both amazing and humbling so see how people are getting a taste for your project and going out speaking, blogging, tweeting and helping out fellow bakers on the Gitter chat, Stack Overflow, forums and social media.

Debugging support

In May we added support for debugging your Cake scripts with Visual Studio, enabling you to do things like stepping through code, setting break points and watch variables. In September we added debugging in VSCode as well.

.NET Foundation

One of the bigger announcements of 2016, was in June when Gary at NDC Oslo announced that Cake joins the .NET foundation. Joining the foundation ensures the longevity of the Cake project, making sure it's here to stay and has the resources to do so.

Cake Contribution Organization

In August we launched the Cake Contribution Organization to ensure that any addins and modules that are created, can continue to be maintained, should the original developer no longer be in a position to maintain it. It has been very well received and there's now almost one hundred NuGet packages that have adopted the cake-contrib as a co-maintainer of the package and twenty-six projects that have chosen to move their repositories into the GitHub organization.

.NET Core support

Cake was early to support the .NET Core tooling, but in September we announced Cake v0.16.0 released. With this release finally Cake itself was able to run cross platform on .NET Core. This was the largest refactoring we've ever done and it was a great feeling to get that out the door!

The Team

In December we added an additional member to the team, Alistair Chapman, he's been an amazing asset, contributing directly to Cake, surrounding tooling and in supporting the community. He's been the mastermind behind the Cake for Visual Studio extension and Cake for Yeoman.

In the spotlight

2016 certainly feels like the year awareness of the project exponentially increased, Cake core team members appeared on no less than six podcasts, a number of conference presentations, articles in the news and blog posts. It's truly amazing and humbling feeling that so many have found and appreciate the project.

Closing words

Yet again a big thanks do all that have contributed to Cake, 2016 has been a great journey and we're really looking forward to what 2017 will bring!

The Cake Team thanks you for 2016 and wishes you Happy New Year!

happy new year

Email addins released

There are many scenarios where you need to send notifications during your build process, such as notifying colleagues that a build has passed/failed, notifying stakeholders that a package has been published to nuget, etc. One of the most popular ways to send such notification is, of course, email. That's why we recently released three new addins to send emails.

Cake.Email

The first addin allows you to send emails via your own SMTP server.

When invoking the Email.SendEmail alias, you must specify the name and email address of the sender (this is what the recipient will see in the from field when they receive your email). Typically, you would use your name and email address but you could use a generic address such as notifications@yourcompany.com), the name and email address of the recipient, the subject and content of the email, a boolean value indicating if the content should be sent as HTML or plain text and finally you must also specify the settings that are necessary to establish a connection to your SMTP server.

The source is available on GitHub.

Here's a code sample that demonstrates how you can send an email from a Cake task:

#addin Cake.Email

Task("SendEmail")
    .Does(() =>
{
    try
    {
        var result = Email.Send(
                senderName: "Bob Smith", 
                senderAddress: "bob@example.com",
                recipientName: "Jane Doe",
                recipientAddress: "jane@example.com",
                subject: "This is a test",
                content: "<html><body>This is a test</body></html>",
                sendAsHtml: true,
                settings: new EmailSettings 
                {
                    SmtpHost = "smtp.gmail.com",
                    Port = 587,
                    EnableSsl = true,
                    Username = "my_gmail_address@gmail.com",
                    Password = "my_password"
                }
        );

        if (result.Ok)
        {
            Information("Email succcessfully sent");
        }
        else
        {
            Error("Failed to send email: {0}", result.Error);
        }
    }
    catch(Exception ex)
    {
        Error("{0}", ex);
    }
});

Cake.SendGrid

The second addin allows you to send emails via a third-party Email Service Provider (ESP) called SendGrid. The parameters you pass to the SendGrid.SendEmail alias are very similar to what we described earlier except that it accepts both the HTML and the plain text versions which will be sent in the same "multi-part" email, and also the only setting expected by SendGrid is your API Key.

The source is available on GitHub.

Please note that this addin has a dependency on a library I created which allows using SendGrid's v3 API. The library is called StrongGrid and source is available on GitHub.

Here's a code sample that demonstrates how you can send an email via SendGrid from a Cake task:

#addin Cake.SendGrid

var sendGridApiKey = EnvironmentVariable("SENDGRID_API_KEY");

Task("SendEmail")
    .Does(() =>
{
    try
    {
        var result = SendGrid.SendEmail(
                senderName: "Bob Smith", 
                senderAddress: "bob@example.com",
                recipientName: "Jane Doe",
                recipientAddress: "jane@example.com",
                subject: "This is a test",
                htmlContent: "<html><body>This is a test</body></html>",
                textContent: "This is a test",
                settings: new SendGridEmailSettings { ApiKey = sendGridApiKey }
        );

        if (result.Ok)
        {
            Information("Email succcessfully sent");
        }
        else
        {
            Error("Failed to send email: {0}", result.Error);
        }
    }
    catch(Exception ex)
    {
        Error("{0}", ex);
    }
});

Cake.CakeMail

And finally, the third addin allows you to send emails via another ESP called CakeMail (the fact that their name contains 'Cake' is totally coincidental!). Once again, the expected parameters are very similar except that they do not allow setting the name of the recipient and they expect a username and password in addition to an API key.

The source is available on GitHub.

Please note that this addin has a dependency on a library I created which allows using CakeMail's API. The library is called CakeMail.RestClient and source is available on GitHub.

Here's a code sample that demonstrates how you can send an email via CakeMail from a Cake task:

#addin Cake.CakeMail

var apiKey = EnvironmentVariable("CAKEMAIL_API_KEY");
var userName = EnvironmentVariable("CAKEMAIL_USERNAME");
var password = EnvironmentVariable("CAKEMAIL_PASSWORD");

Task("SendEmail")
    .Does(() =>
{
    try
    {
        var result = CakeMail.SendEmail(
                senderName: "Bob Smith", 
                senderAddress: "bob@example.com",
                recipientAddress: "jane@example.com",
                subject: "This is a test",
                htmlContent: "<html><body>This is a test</body></html>",
                textContent: "This is a test",
                settings: new CakeMailEmailSettings
                {
                    ApiKey = apiKey,
                    UserName = userName,
                    Password = password
                }
        );

        if (result.Ok)
        {
            Information("Email succcessfully sent");
        }
        else
        {
            Error("Failed to send email: {0}", result.Error);
        }
    }
    catch(Exception ex)
    {
        Error("{0}", ex);
    }
});

Cake joins the .NET foundation

It’s been an amazing journey since the push of the first public commit of Cake in May 2014, in just two years we’ve seen 72 releases, had more than 60 contributors, over a thousand issues and pull requests proposed. And on top of that a small eco system of more than 50 community provided Cake addins.

So firstly a huge thank you to all our contributors and adopters! This wouldn’t have been possible without you! It’s truly amazing to see the increase in contribution and adoption of Cake.

Today we’re really excited and happy to share that Cake is joining the .NET foundation!

So what does this mean for Cake? It’ll still be maintained and governed by the same team as now, but with the support and guidance of the .NET foundation, ensuring the longevity of the project.

Read more about Cake joining on the .NET foundation blog.

Read more...