diff --git a/Changelog b/Changelog index 994562c..8e4470d 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,7 @@ +1.3.10: +FIXED: the YAML export/import change were missing too. grml... +FIXED: NOTEDB::general backend fixed loading Config::General +================================================================================ 1.3.9: FIXED: bin/note were missing. for whatever reason, I don't know. ================================================================================ diff --git a/NOTEDB/general.pm b/NOTEDB/general.pm index 31671d6..dd2ab5c 100644 --- a/NOTEDB/general.pm +++ b/NOTEDB/general.pm @@ -4,12 +4,12 @@ package NOTEDB::general; -$NOTEDB::general::VERSION = "1.01"; +$NOTEDB::general::VERSION = "1.02"; use strict; #use Data::Dumper; use File::Spec; -use Config::General; +use Config::General qw(ParseConfig SaveConfig SaveConfigString); use MIME::Base64; use FileHandle; use NOTEDB; diff --git a/README b/README index e1564ca..e585346 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -note 1.3.8 by Thomas Linden, 02/01/2012 +note 1.3.10 by Thomas Linden, 02/09/2012 ======================================= Introduction @@ -214,4 +214,4 @@ and I'll add you. Last changed ============ -02/01/2012 +02/09/2012 diff --git a/VERSION b/VERSION index d4c4950..0c00f61 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.9 +1.3.10 diff --git a/bin/note b/bin/note index 0c198ac..021309c 100755 --- a/bin/note +++ b/bin/note @@ -35,6 +35,7 @@ no strict 'refs'; use Getopt::Long; use FileHandle; use File::Spec; +use YAML; #use Data::Dumper; @@ -140,7 +141,7 @@ $CONF = File::Spec->catfile($ENV{HOME}, ".noterc"); $USER = getlogin || getpwuid($<); chomp $USER; $TOPIC = 1; -$version = "1.3.9"; +$version = "1.3.10"; $CurDepth = 1; # the current depth inside the topic "directory" structure... $maxlen = "auto"; $timelen = 22; @@ -909,7 +910,6 @@ sub edit { $db->unlock(); } - sub dump { my(%res, $num, $DUMP); # $dump_file @@ -922,16 +922,24 @@ sub dump { } select $DUMP; %res = $db->get_all(); + # FIXME: prepare hashing in NOTEDB class foreach $num (sort { $a <=> $b } keys %res) { print STDOUT "dumping note number $num to $dump_file\n" if($dump_file ne "-"); - print "Number: $num\n" - ."Timestamp: $res{$num}->{'date'}\n" - ."$res{$num}->{'note'}\n"; + my($title, $path, $body); + if ($res{$num}->{note} =~ /^\//) { + ($path, $title, $body) = split /\n/, $res{$num}->{note}, 3; + } + else { + ($title, $body) = split /\n/, $res{$num}->{note}, 2; + $path = ''; + } + my $date = $res{$num}->{date}; + $res{$num} = { body => $body, title => $title, path => $path, date => $date}; } - print "\n"; + print Dump(\%res); close(DUMPFILE); select STDOUT; - } +} sub import { my($num, $start, $complete, $dummi, $note, $date, $time, $number, $stdin, $DUMP, %data); @@ -945,51 +953,32 @@ sub import { $DUMP = *DUMPFILE; } - $complete = $start = 0; - $number = 1; - while (<$DUMP>) { - chomp $_; - if ($_ =~ /^Number:\s\d+/) { - if ($start == 0) { - # we have no previous record - $start = 1; - } - else { - # we got a complete record, save it! - $data{$number} = { - date => $date, - note => &add_ticket($note) - }; - print "fetched note number $number from $dump_file from $date.\n" if(!$stdin); - $complete = 0; - $note = ""; - $date = ""; - $number++; - } - } - elsif ($_ =~ /^Timestamp:\s\d+/ && $complete == 0) { - ($dummi,$date,$time) = split(/\s/,$_); - $date = "$date $time"; - $complete = 1; + my $yaml = join '', <$DUMP>; + + my $res = Load($yaml); + + foreach my $number (keys %{$res}) { + my $note; + if ($res->{$number}->{path}) { + $note = "$res->{$number}->{path}\n$res->{$number}->{title}\n$res->{$number}->{body}"; } else { - $note .= $_ . "\n"; + $note = "$res->{$number}->{title}\n$res->{$number}->{body}"; } - } - - if ($note ne "" && $date ne "") { - # the last record, if existent $data{$number} = { - date => $date, - note => &add_ticket($note) - }; - print "fetched note number $number from $dump_file from $date.\n" if(!$stdin); + date => $res->{$number}->{date}, + note => &add_ticket($note) + }; + print "fetched note number $number from $dump_file from $res->{$number}->{date}.\n" if(!$stdin); + $number++; } $db->set_del_all() if($ImportType ne ""); $db->import_data(\%data); } + + sub determine_width { # determine terminal wide, if possible if ($maxlen eq "auto") { diff --git a/note.pod b/note.pod index 6bd3249..a39eaca 100644 --- a/note.pod +++ b/note.pod @@ -535,6 +535,6 @@ Thomas Linden =head1 VERSION -1.3.8 (02/01/2012) +1.3.10 (02/09/2012) =cut