Commit fcaccfa2 authored by Naba Kumar's avatar Naba Kumar

Added system tools.

	* (new) plugins/tools/scripts/find-fixmes.pl,
	(new) plugins/tools/scripts/tools-2.xml.in,
	(new) plugins/tools/scripts/Makefile.am,
	(new) plugins/tools/scripts/prepare-changelog.pl,
	plugins/tools/plugin.h, plugins/tools/fileop.c,
	plugins/tools/Makefile.am, configure.in: Added system tools.
parent 35da8dc3
2005-06-14 Naba Kumar <naba@gnome.org>
* (new) plugins/tools/scripts/find-fixmes.pl,
(new) plugins/tools/scripts/tools-2.xml.in,
(new) plugins/tools/scripts/Makefile.am,
(new) plugins/tools/scripts/prepare-changelog.pl,
plugins/tools/plugin.h, plugins/tools/fileop.c,
plugins/tools/Makefile.am, configure.in: Added system tools.
2005-06-11 Sebastien Granjoux <seb.sfo@free.fr>
* plugins/tools/editor.c:
......
......@@ -873,6 +873,8 @@ packagemenudir=`eval echo ${datadir}/gnome/apps`
ANJUTA_PIXMAPS_DIR=${packagepixmapsdir}
AC_SUBST(ANJUTA_PIXMAPS_DIR)
ANJUTA_DATA_DIR=${packagedatadir}
AC_SUBST(ANJUTA_DATA_DIR)
prefix="$anjuta_save_prefix"
exec_prefix="$anjuta_save_exec_prefix"
......@@ -953,6 +955,8 @@ plugins/project-wizard/Makefile
plugins/macro/Makefile
plugins/subversion/Makefile
plugins/tools/Makefile
plugins/tools/scripts/Makefile
plugins/tools/scripts/tools-2.xml
plugins/class-inheritance/Makefile
plugins/project-import/Makefile
plugins/project-wizard/templates/Makefile
......
......@@ -52,3 +52,7 @@ EXTRA_DIST = \
$(tools_plugin_DATA) \
$(tools_glade_DATA) \
$(tools_ui_DATA)
SUBDIRS = \
scripts
......@@ -31,6 +31,7 @@
#include "tool.h"
#include <glib.h>
#include <libanjuta/anjuta-debug.h>
#include <string.h>
#include <stdarg.h>
......@@ -516,6 +517,7 @@ atp_anjuta_tools_load(ATPPlugin* plugin)
/* First, load global tools */
file_name = g_build_filename (ANJUTA_TOOLS_DIRECTORY, TOOLS_FILE, NULL);
DEBUG_PRINT ("Loading system tools: %s", file_name);
ok = atp_tool_list_load_from_file (atp_plugin_get_tool_list(plugin), file_name, ATP_TSTORE_GLOBAL);
g_free (file_name);
......
......@@ -31,7 +31,7 @@
#define MENU_PLACEHOLDER "/MenuMain/PlaceHolderToolMenus/Tools"
#define ANJUTA_TOOLS_DIRECTORY PACKAGE_DATA_DIR
#define ANJUTA_TOOLS_DIRECTORY PACKAGE_DATA_DIR"/tools"
#define LOCAL_ANJUTA_TOOLS_DIRECTORY "/.anjuta"
#define TOOLS_FILE "tools-2.xml"
#define LOCAL_ANJUTA_SCRIPT_DIRECTORY "/.anjuta/script"
......
## File created by the gnome-build tools
toolsdir = $(anjuta_data_dir)/tools
tools_SCRIPTS = \
prepare-changelog.pl \
find-fixmes.pl
tools_DATA = tools-2.xml
#!/usr/bin/perl -w
## Prepare ChangeLog
my ($project_root) = @ARGV;
if (!defined ($project_root) || $project_root eq "") {
print STDERR "Error: No project\n";
exit(1);
}
if ($project_root !~ /^\//) {
print STDERR "Error: Project root is not absolute path\n";
exit(1);
}
unless (-f "$project_root/ChangeLog") {
print STDERR "Error: Project does not have a ChangeLog file\n";
exit(1);
}
unless (-d "$project_root/CVS" || -d "$project_root/.svn") {
print STDERR "Error: Project is in neither cvs or subversion working copy.\n";
exit(1);
}
sub process_directory
{
my ($dir, $data_hr) = @_;
if ($dir ne "") {
print STDERR "Scanning $dir\n";
} else {
print STDERR "Scanning .\n";
}
open (ENTRIES, "$project_root/$dir/CVS/Entries") or
die "Can not open $project_root/$dir/CVS/Entries for reading";
my @lines = <ENTRIES>;
@lines = sort @lines;
foreach my $line (@lines) {
chomp($line);
if ($line =~ /^\/([^\/]+)\/([^\/]+)\/([^\/]+)/) {
my $file = $1;
my $repo_time = $3;
my $file_time = `date -u -r $project_root/$dir/$file`;
$file_time =~ s/\s+$//sg;
$file_time =~ s/\w+\s+(\d+)$/$1/;
## print "Comparing '$repo_time' and '$file_time'\n";
if ($file_time ne $repo_time) {
my $path = "$dir/$file";
$path =~ s/^\///;
$data_hr->{$path} = "modified";
}
}
}
foreach my $line (@lines) {
chomp($line);
if ($line =~ /^D\/([^\/]+)/) {
if (-d "$project_root/$dir/$1") {
if ($dir ne "") {
process_directory ("$dir/$1", $data_hr);
} else {
process_directory ("$1", $data_hr);
}
}
}
}
}
#!/usr/bin/perl -w
## Prepare ChangeLog
my ($project_root) = @ARGV;
if (!defined ($project_root) || $project_root eq "") {
print STDERR "Error: No project\n";
exit(1);
}
if ($project_root !~ /^\//) {
print STDERR "Error: Project root is not absolute path\n";
exit(1);
}
unless (-f "$project_root/ChangeLog") {
print STDERR "Error: Project does not have a ChangeLog file\n";
exit(1);
}
unless (-d "$project_root/CVS") {
print STDERR "Error: Project is in not a CVS working copy.\n";
exit(1);
}
my %data_hash;
print STDERR "Preparing ChangeLog for $project_root\n";
process_directory ("", \%data_hash);
my @files = keys (%data_hash);
if (@files <= 0) {
print STDERR "No changes made to project\n";
exit(0);
}
my ($a, $b, $c, $mday, $month, $year) = gmtime(time());
$year += 1900;
my $date_str = sprintf ("%04d-%02d-%02d", $year, $month, $mday);
my $changelog = "$date_str $ENV{USER} <$ENV{USER}\@$ENV{HOSTNAME}>\n\n";
my $first = 1;
foreach my $file (@files) {
if ($first == 1) {
$changelog .= "\t* $file";
$first = 0;
} else {
$changelog .= ",\n\t$file";
}
}
$changelog .= ":\n\n";
print $changelog;
sub process_directory
{
my ($dir, $data_hr) = @_;
if ($dir ne "") {
print STDERR "Scanning $dir\n";
} else {
print STDERR "Scanning .\n";
}
open (ENTRIES, "$project_root/$dir/CVS/Entries") or
die "Can not open $project_root/$dir/CVS/Entries for reading";
my @lines = <ENTRIES>;
@lines = sort @lines;
foreach my $line (@lines) {
chomp($line);
if ($line =~ /^\/([^\/]+)\/([^\/]+)\/([^\/]+)/) {
my $file = $1;
my $repo_time = $3;
my $file_time = `date -u -r $project_root/$dir/$file`;
$file_time =~ s/\s+$//sg;
$file_time =~ s/\w+\s+(\d+)$/$1/;
## print "Comparing '$repo_time' and '$file_time'\n";
if ($file_time ne $repo_time) {
my $path = "$dir/$file";
$path =~ s/^\///;
$data_hr->{$path} = "modified";
}
}
}
foreach my $line (@lines) {
chomp($line);
if ($line =~ /^D\/([^\/]+)/) {
if (-d "$project_root/$dir/$1") {
if ($dir ne "") {
process_directory ("$dir/$1", $data_hr);
} else {
process_directory ("$1", $data_hr);
}
}
}
}
}
<?xml version="1.0"?>
<anjuta-tools>
<tool name="Find with grep">
<command>grep -r -e</command>
<parameter>$(ask_user_string) .</parameter>
<working_dir>$(project_root_directory)</working_dir>
<enabled>1</enabled>
<autosave>0</autosave>
<run_in_terminal>0</run_in_terminal>
<output>1</output>
<error>0</error>
<input_type>4</input_type>
<input>$(file_manager_current_full_filename)</input>
<shortcut>&lt;Control&gt;grave</shortcut>
<icon>/usr/share/pixmaps/gnome-question.png</icon>
</tool>
<tool name="Find FIXMEs">
<command>sh -c</command>
<parameter>&apos;tree -if | egrep \&apos;\\.(c|cpp|cxx|h|hpp|idl)$\&apos; | xargs grep -n \&apos;FIXME:\&apos;&apos;</parameter>
<working_dir>$(project_root_directory)</working_dir>
<enabled>1</enabled>
<autosave>0</autosave>
<run_in_terminal>0</run_in_terminal>
<output>1</output>
<error>0</error>
<input_type>0</input_type>
<shortcut></shortcut>
</tool>
<tool name="Translation status">
<command>sh -c</command>
<parameter>&apos;cd po &amp;&amp; ./status.pl&apos;</parameter>
<working_dir>$(project_root_directory)</working_dir>
<enabled>1</enabled>
<autosave>0</autosave>
<run_in_terminal>0</run_in_terminal>
<output>3</output>
<error>0</error>
<input_type>0</input_type>
<shortcut></shortcut>
</tool>
<tool name="Make distribution">
<command>make dist</command>
<parameter></parameter>
<working_dir>$(project_root_directory)</working_dir>
<enabled>1</enabled>
<autosave>0</autosave>
<run_in_terminal>0</run_in_terminal>
<output>1</output>
<error>0</error>
<input_type>0</input_type>
<shortcut></shortcut>
</tool>
<tool name="Make RPMs">
<command>make rpm</command>
<parameter></parameter>
<working_dir>$(project_root_directory)</working_dir>
<enabled>1</enabled>
<autosave>0</autosave>
<run_in_terminal>0</run_in_terminal>
<output>1</output>
<error>0</error>
<input_type>0</input_type>
<shortcut></shortcut>
</tool>
<tool name="Prepare ChangeLog">
<command>@ANJUTA_DATA_DIR@/anjuta/tools/prepare-change-log.pl</command>
<parameter>$(project_root_directory)</parameter>
<working_dir></working_dir>
<enabled>1</enabled>
<autosave>0</autosave>
<run_in_terminal>0</run_in_terminal>
<output>3</output>
<error>1</error>
<input_type>0</input_type>
<shortcut></shortcut>
</tool>
</anjuta-tools>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment