diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-05-17 15:13:58 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-05-17 15:13:58 +0200 |
commit | 4da867e42eca6264ca59a6ac999f49aa684385ba (patch) | |
tree | 2e4b6dfcc50539d91206d1c9beeb0096e0a815e0 /lib/Kratos/DFADriver.pm | |
parent | 458cf889e6ed331d9e5084cf8e199166ce983286 (diff) |
Use JSON models instead of XML
JSON is easier to (de)serialize and the manual editing possibilities of XML
don't matter after the switch to model file autogeneration using attributes and
aspects
Diffstat (limited to 'lib/Kratos/DFADriver.pm')
-rw-r--r-- | lib/Kratos/DFADriver.pm | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Kratos/DFADriver.pm b/lib/Kratos/DFADriver.pm index 7ceaa4a..c94101a 100644 --- a/lib/Kratos/DFADriver.pm +++ b/lib/Kratos/DFADriver.pm @@ -38,7 +38,7 @@ sub new { $self->{repo} = AspectC::Repo->new; $self->{lp}{iteration} = 1; - if ( -r $opt{xml_file} ) { + if ( -r $opt{model_file} ) { $self->{model} = Kratos::DFADriver::Model->new(%opt); $self->{class_name} = $self->{model}->class_name; } @@ -46,11 +46,11 @@ sub new { $self->{model} = Kratos::DFADriver::Model->new_from_repo( repo => $self->{repo}, class_name => $opt{class_name}, - xml_file => $opt{xml_file}, + model_file => $opt{model_file}, ); } else { - die('Neither driver.xml nor class name specified, cannot continue'); + die('Neither driver.json nor class name specified, cannot continue'); } bless( $self, $class ); @@ -64,10 +64,10 @@ sub new { sub set_paths { my ($self) = @_; - my $xml_path = $self->{xml_file}; - $xml_path =~ s{ /?+dfa-driver/[^/]+[.]xml $ }{}x; + my $model_path = $self->{model_file}; + $model_path =~ s{ /?+dfa-driver/[^/]+[.] ( xml | json ) $ }{}x; - my $prefix = $self->{prefix} = cwd() . "/${xml_path}/src"; + my $prefix = $self->{prefix} = cwd() . "/${model_path}/src"; my $class_prefix = $self->repo->get_class_path_prefix( $self->{class_name} ); $self->{ah_file} = "${prefix}/${class_prefix}_dfa.ah"; @@ -1087,7 +1087,7 @@ sub archive_files { my @mim_files = grep { m{ \. mim }x } read_dir('.'); - $tar->add_files( $self->{xml_file}, @eval_files, @mim_files ); + $tar->add_files( $self->{model_file}, @eval_files, @mim_files ); $tar->add_data( 'setup.json', |