DEV Community

Alexey Melezhik
Alexey Melezhik

Posted on

Sparrowdo support for Windows

Hello, I am Sparrowdo

Sparrowdo is a universal task runner and CM tool written on Perl6/Perl5. It enables configuration and automation tasks with efficient and simple way.

My latest commits makes it possible to run historically Linux-only Sparrowodo tool on Windows. The reasons why people might need it:

  • Alternatives like Ansible and Chef are not way too friendly to the Windows world.

  • Ansible requires hacking with cygwin during an installation process and so does not provide seamless install path.

  • Chef seems too heavy as in a default mode takes client-server installation method bringing overheads when you just need to run automation tasks without maintaining remote cookbooks server.

  • So why not use something more natural and light?

Underneath Sparrowdo is a task runner which only requires Perl5/Perl6 installed on your system, and I will show in a few paragraphs that is so easy!

Installing Sparrowdo

Today Sparrowdo's Windows support is experimental, as soon as I see it gets stable I will merge the code back to mainstream repositories. For now that means we are going install the application from the branches, which is not that hard though.

Installing Perl5

The most simple way to install Perl on Windows is ActiveState Perl or you may try Strawberry Perl which is also very popular among people using Perl on Windows. Both approaches should work. We will need Perl5 to intstall Sparrowdo client called Sparrow.

Installing Perl6

Once Perl is installed, we need to install Perl6 part, as Sparrowdo itself is written on Perl6. Perl6 is provided as Rakudo compiler and installation process also should be pretty straightforward.

Installing Sparrow

Sparrow is a lightweight client to run Sparrowdo tasks, we are going to install 2 Sparrow components from GitHub branches, as soon as I find things stable I will merge the "Windows" code back to mainstream branches, meanwhile it's just a few more commands in comparison with mainstream version install.

First, lets install cpanm client as it's very handy tool to install CPAN modules:

$ cpan install App::Cpanminus
Enter fullscreen mode Exit fullscreen mode

Then lets install Outthentic and Sparrow modules form GitHub branches:

$ git clone https://github.com/melezhik/outthentic
$ cd otthentic 
$ git checkout windows
$ cpanm . --notest


$ git clone https://github.com/melezhik/sparrow
$ cd sparrow
$ git checkout windows
$ cpanm . --notest
Enter fullscreen mode Exit fullscreen mode

After those steps, If everything goes ok we will be able to run Sparrow client from command line:

$ SET USER=melezhik
$ sparrow 
Enter fullscreen mode Exit fullscreen mode

The command should exits without error.

Now, the last bit we need to install is a Sparrowdo for Windows:

Installing Sparrowdo

$ git clone https://github.com/melezhik/sparrowdo
$ cd sparrowdo
$ git checkout windows
$ zef install --/test .
Enter fullscreen mode Exit fullscreen mode

At this point we are ready to test our Sparrowdo/Sparrow installation, let's run our first task. What about just creation of directory? Not a rocket science, but an example:

$ notepad.exe sparrowfile

#!perl6

directory 'C:\Users\melezhik\Hello-Sparrowdo';


$ sparrowind --no_color
running sparrow tasks on localhost ...
target OS is - windows
push [task] create directory C:\Users\melezhik\Hello-Sparrowdo OK
sparrow root: [C:/.sparrowind/sparrow]
C:/.sparrowind/sparrow/sparrow.index updated OK from https://sparrowhub.org
set up task box file - C:/.sparrowind/cache/task-box.json - OK
sparrow root: [C:/.sparrowind/sparrow]
public@directory is uptodate (0.2.0)
running task box from C:/.sparrowind/cache/task-box.json ...
@ directory manager
2018-09-10 22:00:12 : [task] create directory C:\Users\melezhik\Hello-Sparrowdo [path] modules/windows/create/
ok      scenario succeeded
STATUS  SUCCEED

Enter fullscreen mode Exit fullscreen mode

Ok, like I said the process is pretty simple. As for the things left to do, see the last section.

Further plans

Adapt Sparrow plugins

Sparrowdo comes with quite a few plugins to solve many generic tasks out of the box, many of these plugins are written only for Linux. Its is not that hard to add windows support, but it takes time. If someone interested let me know.

Polish rough corners

Like ansi color output and so on. Meanwhile just use no_color option. (-; But I promise I am going to make things prettier.

Merge code back to the main repo

Probably the easiest part.

So ...

If anyone is passionate about Windows automation using Perl - welcome to Sparrowdo project!

Send you feedback, request or issues through comments here or GH pages.

Best.

Alexey

Top comments (0)