Skip to content

Commit

Permalink
[#389 state:resolved] Updating to Config Assistant 2.1.4 which resolv…
Browse files Browse the repository at this point in the history
…es an error encountered upon upgrade: _"Can't call method 'error' without a package or object reference"_. See http://github.com/endevver/mt-plugin-configassistant/commit/533a1f60e4be22fddea3eb17ad96f4daec504e23 for more details
  • Loading branch information
jayallen committed Oct 24, 2010
1 parent e520945 commit 551943b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion addons/ConfigAssistant.plugin/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ key: ConfigAssistant
author_link: http://www.majordojo.com/
author_name: Byrne Reese
description: This plugin provides a simple YAML based framework for creating plugin and theme configuration options.
version: 2.1.3
version: 2.1.4
static_version: 4
schema_version: 2

Expand Down
6 changes: 4 additions & 2 deletions addons/ConfigAssistant.plugin/lib/ConfigAssistant/Prefs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use strict;

sub apply {
my $app = shift;
my $q = $app->can('query') ? $app->query : $app->param;
my ($param) = @_;

$app->validate_magic or return;

my $q = $app->can('query') ? $app->query : $app->param;
Expand All @@ -28,6 +30,7 @@ sub apply {

sub chooser {
my $app = shift;
my $q = $app->can('query') ? $app->query : $app->param;
my ($param) = @_;
my $q = $app->can('query') ? $app->query : $app->param;
my $blog = MT->model('blog')->load( $q->param('blog_id') );
Expand All @@ -36,7 +39,6 @@ sub chooser {

my $prefs = MT->registry('blog_preferences');
my @data;
my $selected = $blog->selected_config ? $blog->selected_config : '';
foreach my $pid ( keys %$prefs ) {
my $pref = $prefs->{$pid};
push @data,
Expand All @@ -45,7 +47,7 @@ sub chooser {
name => &{ $pref->{'label'} },
description => $pref->{'description'},
order => $pref->{'order'} || 10,
selected => $selected eq $pid
selected => $blog->selected_config eq $pid
};
}
@data = sort { $a->{order} <=> $b->{order} } @data;
Expand Down
5 changes: 2 additions & 3 deletions addons/ConfigAssistant.plugin/lib/ConfigAssistant/Static.pm
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ sub _traverse_hash {
# Create the specified directory
my $dir = File::Spec->catfile($dir, $cur_item);
my $dir_w_plugin = File::Spec->catfile($plugin->id, $dir);
$message = _make_dir($dir_w_plugin);
$message = _make_dir($dir_w_plugin, $self);
push @messages, $message;
# Now investigate the next level of the registry, to see if
# another directory is needed, or if there are files to copy.
Expand Down Expand Up @@ -151,9 +151,8 @@ sub _make_dir {
return "<nobr>Created folder: $dir</nobr>";
}
else {
$self->error($fmgr->errstr);
return $self ? $self->error($fmgr->errstr) : $fmgr->errstr;
}
return;
}

sub _write_file {
Expand Down
12 changes: 6 additions & 6 deletions tools/static-copy
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ sub _traverse_hash {
}
if ($process_file) {
my $src = File::Spec->catfile($plugin->path, 'static', $dir, $cur_item);
my $dest = File::Spec->catfile($app->config('StaticFilePath'),
my $dest = File::Spec->catfile($app->static_file_path,
'support', 'plugins', $plugin->id, $dir, $cur_item);
_write_file($src, $dest);
}
Expand All @@ -97,13 +97,13 @@ sub _make_dir {
or return MT::FileMgr->errstr;

my $app = MT->instance;
$dir = File::Spec->catfile($app->config('StaticFilePath'), 'support', 'plugins', $dir);
$dir = File::Spec->catfile($app->static_file_path, 'support', 'plugins', $dir);
if ( $fmgr->mkpath($dir) ) {
# Success!
my $app = MT->instance;
my $static_file_path = $app->config('StaticFilePath');
my $static_file_path = $app->static_file_path;
$dir =~ s!$static_file_path/support/plugins/(.*)!$1!;
print "Created folder $dir/.\n";
print "Created folder $dir/\n";
}
else {
die $fmgr->errstr."\n";
Expand All @@ -127,9 +127,9 @@ sub _write_file {
# Only provide a "copied" message if the file was successfully written.
if ($bytes) {
my $app = MT->instance;
my $static_file_path = $app->config('StaticFilePath');
my $static_file_path = $app->static_file_path;
$dest =~ s!$static_file_path/support/plugins/(.*)!$1!;
print "Copied $dest.\n";
print "Copied $dest\n";
}
}
return;
Expand Down

0 comments on commit 551943b

Please sign in to comment.