App-Adenosine

 view release on metacpan or  search on metacpan

bin/adenosine  view on Meta::CPAN

#!/usr/bin/env perl

# PODNAME: adenosine

use strict;
use warnings;

use FindBin '$Bin';
use lib "$Bin/../lib";
use lib "$Bin/../extlib/lib/perl5";

use App::Adenosine;
use File::HomeDir;
use Config::Any;
use YAML 'LoadFile';
my $conf = Config::Any->load_files({
   files   => [File::HomeDir->my_home . '/.adenosinerc.yml'],
   use_ext => 1,
});

($conf) = values %{$conf->[0]||{}};
$conf = $conf || {};
$conf->{argv} = \@ARGV;
App::Adenosine->new($conf);

__END__

=pod

=encoding UTF-8

=head1 NAME

adenosine

=head1 VERSION

version 2.002000

=head1 Description

Adenosine is a tiny script wrapper for L<curl|http://curl.haxx.se/>. It
provides a simple, concise shell interface for interacting with
L<REST|http://en.wikipedia.org/wiki/Representational_State_Transfer> services.
Since it is just a command you run in your shell and not in its own separate
command environment you have access to all the powerful shell tools, such
as perl, awk, grep, sed, etc. You can use adenosine in pipelines to process data
from REST services, and PUT or POST the data right back.  You can even pipe
the data in and then edit it interactively in your text editor prior to PUT
or POST.

Cookies are supported automatically and stored in a file locally. Most of
the arguments are remembered from one call to the next to save typing. It
has pretty good defaults for most purposes. Additionally, adenosine allows you
to easily provide your own options to be passed directly to curl, so even
the most complex requests can be accomplished with the minimum amount of
command line pain.

L<Here is a nice screencast showing adenosine (née resty) in action|http://jpmens.net/2010/04/26/resty/>
(by Jan-Piet Mens).

=head1 Quick Start

=head2 From git

Grab the files from github:

      $ git clone http://github.com/frioux/app-adenosine-prefab

Source the exports before using it. (You can put this line in your F<~/.bashrc>
file if you want.)

      $ . app-adenosine-prefab/adenosine-exports

=head2 From CPAN

If you are a Perl user you can install adenosine from CPAN as follows:

      $ cpanm App::Adenosine

And then source the function wrappers as follows:

      $ eval $(adenosine exports)

Set the REST host to which you will be making your requests (you can do this
whenever you want to change hosts, anytime).

      $ adenosine http://127.0.0.1:8080/data
      http://127.0.0.1:8080/data*

Make some HTTP requests.

      $ GET /blogs.json
      [ {"id" : 1, "title" : "first post", "body" : "This is the first post"}, ... ]

      $ PUT /blogs/2.json '{"id" : 2, "title" : "updated post", "body" : "This is the new."}'
      {"id" : 2, "title" : "updated post", "body" : "This is the new."}

      $ DELETE /blogs/2

      $ POST /blogs.json '{"title" : "new post", "body" : "This is the new new."}'
      {"id" : 204, "title" : "new post", "body" : "This is the new new."}

=head1 What's Next?

Check out some of the plugins available for adenosine!  Right now there's just
two, C<Rainbow> and C<Stopwatch>.  To use them, edit the F<bin/adenosine> file and
uncomment the plugin lines.

=head1 Hacking!

Want to add some features?  Fork the C<frioux/app-adenosine> repository and send



( run in 1.313 second using v1.01-cache-2.11-cpan-39bf76dae61 )