Skip to content

Commit

Permalink
exclude tom cache. add version action
Browse files Browse the repository at this point in the history
  • Loading branch information
melezhik committed Dec 21, 2018
1 parent aba82c5 commit 5e58147
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.3.10

* Add --version action to print Sparrow installed version
* `plg upload` - Skip .tom directory when creating plugin distribution file

0.3.9 2018-12-15

* Remove tomtit's cache from distro
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ See [sparrow command line API](#api) below.

Think about it as of `cpan client` for CPAN modules or `gem client` for Ruby gems.

You run Sparrow client by using `sparrow` command.

To print out Sparrow currently installed version, run this:

$ sparrow --version

# Sparrow basic entities

Sparrow architecture comprises of 4 basic parts:
Expand Down Expand Up @@ -925,6 +931,8 @@ instead of plugin execution when `sparrow plg run` command is invoked.

That's it!

If you want to troubleshoot upload plugin errors use `--verbose` flag, when upload plugin.

# Publishing private sparrow plugins

The process is almost the same as for public plugins, except you don't have to provide SparrowHub credentials
Expand Down
8 changes: 6 additions & 2 deletions bin/sparrow
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ my $object = shift @ARGV;

init_sparrow_env();

if ($object eq 'plg'){
if ($object eq '--version' ){

print "$Sparrow::VERSION\n";

}elsif ($object eq 'plg'){

my $action = shift @ARGV;

Expand All @@ -51,7 +55,7 @@ if ($object eq 'plg'){

} elsif( $action eq 'upload'){

upload_plugin();
upload_plugin(@ARGV);

} elsif ( $action eq 'show'){

Expand Down
2 changes: 1 addition & 1 deletion lib/Sparrow.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Sparrow;

our $VERSION = '0.3.9';
our $VERSION = '0.3.10';

1;

Expand Down
17 changes: 14 additions & 3 deletions lib/Sparrow/Commands/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,15 @@ sub read_plugin_list {

sub upload_plugin {

my @args = @_;

my $verbose_mode;

my $args_st = GetOptionsFromArray(
\@args,
"verbose" => \$verbose_mode,
);

# get user/token by environment variables
# usefull when making tests

Expand Down Expand Up @@ -708,13 +717,15 @@ sub upload_plugin {

print "sparrow.json file validated ... \n";

execute_shell_command('tar --exclude=.cache/ --exclude=local --exclude=*.log --exclude=log --exclude Gemfile.lock --exclude local/ --exclude-vcs -zcf /tmp/archive.tar.gz .' );
execute_shell_command('tar --exclude=.tom --exclude=local --exclude=*.log --exclude=log --exclude Gemfile.lock --exclude local/ --exclude-vcs -zcf /tmp/archive.tar.gz .', debug => $verbose_mode );

my $unsecure_flag = $ENV{SPARROW_UNSECURE} ? "-k" : "";
execute_shell_command(
"curl $unsecure_flag -H 'sparrow-user: $cred->{user}' " .
"curl -s -k $unsecure_flag -H 'sparrow-user: $cred->{user}' " .
"-H 'sparrow-token: $cred->{token}' " .
'-f -X POST '.sparrow_hub_api_url().'/api/v1/upload -F archive=@/tmp/archive.tar.gz',
silent => 1,
silent => ($verbose_mode ? 0 : 1),
debug => ($verbose_mode ? 1 : 0)
);

}
Expand Down
8 changes: 6 additions & 2 deletions lib/Sparrow/Misc.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ sub execute_shell_command {

my $st = ( system($cmd) == 0 );

print "run cmd: $cmd ...\n" if $opts{debug};

if ($opts{silent}){
die "failed to execute shell command" unless $st;
} else {
Expand Down Expand Up @@ -100,8 +102,10 @@ sub usage {
sub init_sparrow_env {

make_path(sparrow_root());
print "sparrow root: [", sparrow_root(),"]\n";
make_path(sparrow_root().'/plugins', { verbose => 1 } ); #

print "sparrow root: [", sparrow_root(),"]\n";

make_path(sparrow_root().'/plugins', { verbose => 1 } ); #
make_path(sparrow_root().'/plugins/private');
make_path(sparrow_root().'/plugins/public');
make_path(sparrow_root().'/projects');
Expand Down

0 comments on commit 5e58147

Please sign in to comment.