Skip to content

Commit

Permalink
Initial commit to a public repo
Browse files Browse the repository at this point in the history
  • Loading branch information
iafan committed Oct 12, 2015
0 parents commit 7991ce6
Show file tree
Hide file tree
Showing 576 changed files with 26,583 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
~*
vendor/*
*.bak
MANIFEST
_build
META.*
MYMETA.*
Makefile.PL
*.gz
Build
Build.bat
8 changes: 8 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
AUTHOR / MAINTAINER

Igor Afanasyev <[email protected]>

CONTRIBUTORS

Taras Semenenko <[email protected]>
Julen Ruiz Aizpuru <[email protected]>
35 changes: 35 additions & 0 deletions Build.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use 5.010_001;
use strict;
use warnings FATAL => 'all';
use Module::Build;

my $builder = Module::Build->new(
module_name => 'Serge',
license => 'perl',
dist_author => 'Igor Afanasyev <[email protected]>',
dist_version_from => 'lib/Serge.pm',
release_status => 'stable',
configure_requires => {
'Module::Build' => 0,
},
build_requires => {
'Test::More' => '0.94',
'File::Copy::Recursive' => 0,
},
requires => {
'Authen::SASL' => 0,
'Config::Neat' => '1.204',
'DBD::SQLite' => 0,
'JSON' => 0,
'MIME::Lite' => 0,
'Net::SMTP::SSL' => 0,
'XML::Parser' => 0,
'XML::Parser::Style::IxTree' => 0,
'XML::Twig' => 0,
'YAML::XS' => 0,
},
add_to_cleanup => ['Serge-*', 'Makefile.PL', 'MYMETA.*', 'META.*', 'MANIFEST.bak', 'MANIFEST'],
create_makefile_pl => 'traditional',
);

$builder->create_build_script();
13 changes: 13 additions & 0 deletions CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CONTRIBUTING

Your contributions to the project mean a lot to us. Bugfixes are accepted in the form of pull requests (one per bug). Before filing a bug, please make sure it still appears in the bleeding edge version published on Github. CPAN versions may lag behind the code on Github.

CLONING THE GITHUB REPOSITORY

git clone [email protected]:evernote/serge.git

DISCUSSING BUGS / FEATURES

We encourage you to file issues to discuss bugs and enhancements prior to making a pull request. This will make sure that your changes are something we want to see in the mainstream version and understand what they are about.

You can also reach us on #serge IRC channel on freenode.net.
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Copyright (C) 2008-2015, Evernote Corp.
All Rights Reserved.

LICENSE INFORMATION

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl 5.10.0.

For more details, see http://dev.perl.org/licenses/
14 changes: 14 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
^~
\/~
\.git\/
\.gitignore
_build\/
cpanfile
MANIFEST.SKIP
MANIFEST.bak
\/test-output\/
^vendor\/
setup.pl^MYMETA\.yml$
^MYMETA\.json$
^MYMETA\.yml$
\.tar\.gz$
8 changes: 8 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Serge (*String Extraction and Resource Generation Engine*) is a free,
open-source tool that helps you set up a seamless continuous localization
process for your software and marketing assets in a fully automated
and scalable fashion.

For complete documentation and installation instructions, see:

https://serge.io/
17 changes: 17 additions & 0 deletions bin/serge
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/perl

use strict;

BEGIN {
use File::Basename;
use File::Spec::Functions qw(rel2abs catfile);
map { unshift(@INC, catfile(dirname(rel2abs(__FILE__)), $_)) } qw(../extlibs/lib/perl5 ../lib ../vendor/lib);
}

use Serge::Application;

$| = 1; # disable buffered output
binmode(STDOUT, ':utf8'); # to avoid 'Wide character in print' warning

my $app = Serge::Application->new();
exit($app->run); # exit with the value returned by the command processor
1 change: 1 addition & 0 deletions bin/serge.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@perl %~dp0serge %*
2 changes: 2 additions & 0 deletions bin/tools/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory contains miscellaneous tools that work with Serge datbase directly.
See each script source for the embedded documentation.
134 changes: 134 additions & 0 deletions bin/tools/clear_merge_flags.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#!/usr/bin/perl

=head1 NAME
clear_merge_flags.pl - Clear all merge flags from the database.
=head1 DESCRIPTION
B<clear_merge_flags.pl> will clear all merge flags from the specified database.
This is useful for cleaning up flags from no longer active jobs/languages.
=head1 SYNOPSIS
clear_merge_flags.pl
--database=DBI:SQLite:dbname=/path/to/translate.db3
Use C<--help> option for more information.
Use C<--man> for the full documentation.
=head1 OPTIONS
=over 8
=item B<-db DSN>, B<--database=DSN>
Database to read statistics from.
This parameter is required.
=item B<-u user>, B<--user=user>
Database username (optional; not needed for SQLite databases).
=item B<-p [password]>, B<--password[=password]>
Database password (optional; not needed for SQLite databases).
If password is ommitted, you will be prompted to enter it securely
(with no echo).
=item B<-?>, B<--help>
Show help on program usage and options.
For a more verbose output, use C<--man>
=item B<--man>
Show all available documentation on this program.
=back
=cut

use strict;

# Make script find the plugins properly
# no matter what directory it is running from

BEGIN {
use File::Spec::Functions qw(rel2abs catfile);
use File::Basename;
map { unshift(@INC, catfile(dirname(rel2abs($0)), $_)) } qw(../../lib lib);
}

use Getopt::Long;
use Serge::DB;

use cli;

$| = 1; # autoflush output
binmode(STDOUT, ':utf8'); # to avoid 'Wide character in print' warning

my ($database, $user, $password);
my @email_to;

my $result = GetOptions(
"database|db=s" => \$database,
"user|u=s" => \$user,
"password|p:s" => \$password,
);

if (!$result) {
cli::error("Failed to parse some command-line parameters.");
}

if (@ARGV > 0) {
cli::error("Unknown command-line arguments: ".join(' ', @ARGV));
}

if (!$database) {
cli::error("You must provide the --database parameter.");
}

print "\nDatabase: $database\n";
print "User: $user\n" if $user;
print "Password: ********\n" if $password;

if (defined($password) && ($password eq '')) {
$password = cli::read_password("Password: ");
}

my $db = Serge::DB->new();

$db->open($database, $user, $password);

my $sqlquery =
"SELECT COUNT(*) as n ".
"FROM translations ".
"WHERE merge = 1";

my $sth = $db->prepare($sqlquery);
$sth->execute || die $sth->errstr;

my $count = 0;
if (my $hr = $sth->fetchrow_hashref()) {
$count = $hr->{n};
}

if ($count) {
print "Clearing $count flags...";

my $sqlquery =
"UPDATE translations ".
"SET merge = 0 ".
"WHERE merge = 1";

my $sth = $db->prepare($sqlquery);
$sth->execute || die $sth->errstr;

print " Done\n";
} else {
print "No merge flags found\n";
}

print "All done.\n";
Loading

0 comments on commit 7991ce6

Please sign in to comment.