Skip to content

Cake.Hosts addon for Cake Build: manipulation of hosts file from Cake

License

Notifications You must be signed in to change notification settings

cake-contrib/Cake.Hosts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cake.Hosts

Cake.Hosts addon for Cake Build: manipulation of hosts file from Cake. This addon provides the following functionality:

  • Check if a record already exists in your hosts file
  • Add a new record to your hosts file
  • Remove a record from hosts file

Release Notes

This addon is aimed on automation and helping setting up of local development environment rather than for anything else. I can not see a need to change hosts file on any server in a production environment/build. However, please let me know if you do use it in production - I'm interested to hear your story.

You can add this addon added to your cake script via nuget:

#addin "Cake.Hosts"

Check if Record Exists

HostsRecordExists("127.0.0.1", "myproject.dev");

This does regex match through your hosts file and checks if there is a corresponding record.

Add New Record

AddHostsRecord("127.0.0.1", "myproject.dev");

This appends a new corresponding line to your hosts file.

Remove Recrod

RemoveHostsRecord("127.0.0.1", "myproject.dev");

Discussion

For questions and to discuss ideas & feature requests, use the GitHub discussions on the Cake GitHub repository, under the Extension Q&A category.

Join in the discussion on the Cake repository