LulububuSoftwareGmbH / boltredirector

Handles 301 redirects in Bolt CMS.
16 stars 8 forks source link

Error on current build #8

Closed GwendolenLynch closed 9 years ago

GwendolenLynch commented 10 years ago

`PHP Fatal error: Class 'Bolt\Extension\FoundryCode\Redirector' not found in /var/www/sites/sandbox/extensions/vendor/foundry-code/bolt-redirector/init.php on line 11

The PSR4 auto loader expects the filename to match the class name. So in Extension.php we've been using:

class Extension extends \Bolt\BaseExtension

And in init.php:

$app['extensions']->register(new Extension($app));

I guess you could also rename Extension.php to Redirector.php, but you'll have to juggle class namespaces around a bit

mikerockett commented 10 years ago

Thanks, Gawain. So, I get the file rename for the auto-loader, but not sure what you mean with the namespace-juggling... Surely it is correct as it is, and a simple rename will do the trick?

Once again, I'm terrible with Composer...

GwendolenLynch commented 10 years ago

Ignore the 'juggling' I was just trying to be completionist.

But yes, the rename (you've already done) and the init.php change should make it work.

GwendolenLynch commented 10 years ago

By the way, if you want to test yourself... The documentation is not up yet, but if you set up a master version of Bolt and edit extensions/composer.json to something like this:

{
    "require": {
        "foundry-code/bolt-redirector": "dev-master"
    },
    "repositories": {
        "bolt": {
            "type": "composer",
            "url": "http://beta.extensions.bolt.cm/satis/"
        },
        "redirector": {
             "type": "git",
             "url": "https://github.com/foundry-code/bolt-redirector.git"
        },
        "packagist": false
    },
    "provide": {
        "bolt/bolt": "2.0.0"
    }
}

Then change directory to extensions/ and run curl -sS https://getcomposer.org/installer | php you can then manually run php composer.phar update on the command line and it will install Bolt Redirector for you from git.

If you make changes in git you can just rerun php composer.phar update in the extensions/ directory to continue testing.

mikerockett commented 10 years ago

Perfect, thanks. Will test it out soonest. :)

mikerockett commented 10 years ago

@GawainLynch - Just when I try to do an import and update, the Bolt build fails. (Something about bolt/thumbs) Will wait for a passing build before I test it out...

mikerockett commented 10 years ago

Weird: I pulled in the dev-master, per your config, and it seems to pull an outdated version. I've renamed Extension.php to Redirector.php, but it pulled the former... After a manual rename in the install, it seems to work fine (albeit a few fixes are needed).

mikerockett commented 10 years ago

@GawainLynch - Right, so the only fix I needed to do was with regards to tabs being used instead of spaces. Now, the extension manager in admin says that the extension is not installed, but it does work:

boltredirector20140830

Perhaps it's just something wrong with the extension manager?

GwendolenLynch commented 10 years ago

I think there were some 'fix up' commits that Ross pushed recently... I do it all on the command-line with a system-wise Composer.

What do you get when you click the "Install all Packages" button?

mikerockett commented 10 years ago

Just says that there was an error installing the package. No reason or details.

I'm also using a system-wide composer. It uses Git. In my mind, it's supposed to get the latest master.

mikerockett commented 10 years ago

boltredirector20140830_1

GwendolenLynch commented 10 years ago

Yeah, my suspicion is the order of the repos in the composer.json file... Update to this one and try Composer on the CLI

{
    "require": {
        "foundry-code/bolt-redirector": "dev-master"
    },
    "repositories": {
        "redirector": {
             "type": "git",
             "url": "https://github.com/foundry-code/bolt-redirector.git"
        },        
        "bolt": {
            "type": "composer",
            "url": "http://beta.extensions.bolt.cm/satis/"
        },
        "packagist": false
    },
    "provide": {
        "bolt/bolt": "2.0.0"
    }
}
mikerockett commented 10 years ago

Nope, that didn't do it...

mikerockett commented 10 years ago

What's interesting is that the extension does work... So I can't figure out exactly what's going on in the backend.

GwendolenLynch commented 10 years ago

Composer is a weird beast... I am trying to do stuff with it at the moment via the API directly and am being forced to drink alcohol to cope :-)

I do know that Bolt's Satis server is doing weird stuff sometimes too, and it might be related to what you're seeing. I'll but Ross some more.

mikerockett commented 10 years ago

Hehe, alcohol works! :beers:

I'm sure that's the case. At least I know the extension works.

That said, I am not a Git/Composer master. As such, what do I need to do to register the extension/repo as stable? Obviously, working with dev-master for production is not a good idea...

GwendolenLynch commented 10 years ago

Composer just uses git tags for versioning:

git tag 1.0.0
git push --tags

That will set the tag to 1.0.0 (or whatever you want to set it as), and the --tags pushes it upstream as a normal git push ignores the local tags.

GwendolenLynch commented 10 years ago

Oh, you also need to click update on your Profile page on beta.extensions.bolt.cm

mikerockett commented 10 years ago

Thanks. :+1:

Did a tag push, but the update says:

'name' in composer.json must be set, must be lowercase and contain only alphanumerics

GwendolenLynch commented 10 years ago

I'm guessing that it is the - in the name bolt-redirector... Ross added some checks a few days ago as people kept using CamelCase which breaks Composer in weird ways.

GwendolenLynch commented 10 years ago

Mind you, I was able to add it to my composer.json and composer update pulled 1.0.0 just fine

mikerockett commented 10 years ago

That's what I thought too. Seems a tad impractical, don't you think? But if Ross has a point, I'll move the repo over to FoundryCode\BoltRedirector.

GwendolenLynch commented 10 years ago

That's what I thought too. Seems a tad impractical, don't you think?

Yes, Ross probably had an idea with the -, but I don't know... He's not online at the moment to ask though :-)

To work around it you just need to update the composer.json to:

"name": "foundrycode/boltredirector",
mikerockett commented 10 years ago

So his site is then trimming the extra chars out? If so, I think it should be done like that automagically (instead of scrutinising the name). This is more of a hack to me... Anyways, I shall do that. :+1:

mikerockett commented 10 years ago

Okay, done. Extension site says all is good. Manager in Bolt backend still has issues - though that the removal of the dashes might have fixed it, but it didn't. Let's see what happens when the whole Extensions system goes production-ready.