octobercms / october

Self-hosted CMS platform based on the Laravel PHP Framework.
https://octobercms.com/
Other
11.03k stars 2.21k forks source link

Using october/october as a Composer dependency #2256

Closed pedzed closed 7 years ago

pedzed commented 8 years ago

Running composer require october/october gives the following error:

[InvalidArgumentException]                                                   
  Could not find package october/october at any version for your minimum-stab  
  ility (stable). Check the package spelling or your minimum-stability 

Adding a version number should fix this issue.

daftspunk commented 8 years ago

@acasar, any idea how we can overcome this?

pedzed commented 8 years ago

I managed to (hopefully temporarily) hack through the error, but this is of course far from ideal:

"require": {
    "php": ">=5.5.9",
    "october/october": "dev-master",
    "october/rain": "~1.0@dev",
    "october/system": "~1.0@dev",
    "october/backend": "~1.0@dev",
    "october/cms": "~1.0@dev",
    "laravel/framework": "5.1.*",
    "wikimedia/composer-merge-plugin": "dev-master"
}

The @dev should not be used of course, but it is a working workaround.

Ideally, the list would look like this:

"require": {
    "php": ">=5.5.9",
    "october/october": "~1.0",
    "wikimedia/composer-merge-plugin": "dev-master"
}

(Correct me if I am wrong, but wikimedia/composer-merge-plugin is necessary for the extras.)

"extra": {
    "merge-plugin": {
        "include": [
            "plugins/*/*/composer.json"
        ],
        "recurse": true,
        "replace": false,
        "merge-dev": false
    }
}
acasar commented 8 years ago

@pedzed @daftspunk The first step would be to add a tag (1.0.0) to https://github.com/octobercms/october/releases and all dependencies (rain, system, backend, cms).

Currently I'm just using this:

composer create-project october/october newproject dev-master
daftspunk commented 8 years ago

Tagging is not compatible with the release life cycle, which is continuous. It would create a lot of tag spam. The October project is unique in this way. Is it possible without tagging?

acasar commented 8 years ago

It may be possible by adding an alias https://getcomposer.org/doc/articles/aliases.md but never tried it myself.

acasar commented 8 years ago

Maybe @GrahamCampbell would be able to help here.

pedzed commented 8 years ago

Tagging is not compatible with the release life cycle, which is continuous. It would create a lot of tag spam. The October project is unique in this way. Is it possible without tagging?

Yeah, aliasing like @acasar mentioned. Or this: https://getcomposer.org/doc/02-libraries.md#specifying-the-version

Specifying the version

When you publish your package on Packagist, it is able to infer the version from the VCS (git, svn, hg, fossil) information. This means you don't have to explicitly declare it. Read tags and branches to see how version numbers are extracted from these.

If you are creating packages by hand and really have to specify it explicitly, you can just add a version field:

{
    "version": "1.0.0"
}

Note: You should avoid specifying the version field explicitly, because for tags the value must match the tag name.

daftspunk commented 8 years ago

We use aliases already. Can we specify the version manually like that?

"version": "1.0.0"
pedzed commented 8 years ago

Can we specify the version manually like that?

That's what the Composer docs say, yeah.

daftspunk commented 8 years ago

Someone try this on a test package and confirm if we can do this.

daftspunk commented 7 years ago

It looks like there is no other way around this, so tags have been created for every build from stable onwards (Build 319+)

https://github.com/octobercms/october/releases https://github.com/octobercms/library/releases

This should enable composer to find a "stable" version. Can someone test if this was successful and submit a PR to composer.json to utilize it.

darylteo commented 7 years ago

Seems to work. But just to make sure you're aware of this: because composer.json for october/october is not locked to the same tags, the following command doesn't necessarily achieve the "expected" result, but the latest version of the october core. Which could be what you're intending.

> composer create-project october/october v1.0.380 v1.0.380
Installing october/october (v1.0.380)
  - Installing october/october (v1.0.380)
    Downloading: 100%         

Created project in v1.0.380
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 77 installs, 0 updates, 0 removals
  - Installing wikimedia/composer-merge-plugin (dev-master e8aa6a9)
    Loading from cache

...

  - Installing october/rain (v1.0.389)
    Loading from cache

  - Installing october/system (v1.0.389)
    Loading from cache

  - Installing october/backend (v1.0.389)
    Loading from cache

  - Installing october/cms (v1.0.389)
    Loading from cache

...

Writing lock file
Generating autoload files
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 0 removals
Generating autoload files
> php artisan key:generate
Application key [QX4nCQJaE6X0N1QpgYHqq2jBl03Nt4XB] set successfully.

Note how creating project against v1.0.380 yields v1.0.389 libraries.

daftspunk commented 7 years ago

Interesting, I'm not sure why this is happening. If someone can suggest ways we can improve, let's hear it.

darylteo commented 7 years ago

@daftspunk isn't it because in composer.json they're all locked to ~1.0 not 1.0.xxx, so it will always pull the latest from packagist?

daftspunk commented 7 years ago

Submit a PR to fix this perhaps, make sure it has been tested first.

darylteo commented 7 years ago

@daftspunk lol unfortunately I don't even know how one would go about fixing it... I mean, the composer.json would need to be pegged to the build number that it would have no idea about until the build happens, if i understand your build correctly? :D

daftspunk commented 7 years ago

The joys of composer. Just leave it @darylteo, someone else will figure it out...

darylteo commented 7 years ago

thinking aloud Maybe a string replace on the composer.json definition whilst doing the build...

Yeh all moot now. I've decided vendoring everything into source is the best solution.

LukeTowers commented 7 years ago

Closing as it has been over a month since any activity on this occurred.

Harti commented 7 years ago

@LukeTowers this issue was a continuation of #2119, the integration of OctoberCMS into Laravel projects. Up to this date, I haven't seen a clean solution and it would be great if it could be further pursued. Making OctoberCMS installable via Composer would be a good first step.

LukeTowers commented 7 years ago

OctoberCMS is installable via composer. What exactly are you trying to do?

pedzed commented 7 years ago

@LukeTowers the entire problem was that OctoberCMS couldn't be added as a dependency. This was one of the major annoyances I had with OctoberCMS (as I like to version control it with Git, ignoring the unnecessary directories), which led me to stop using OctoberCMS.

Maybe things are changed now, I didn't follow.

LukeTowers commented 7 years ago

@pedzed What do you mean exactly by add it as a dependency? If you want to version control it with Git, then use the octobercms/october repository as is and add /modules to your .gitignore because they're pulled in via composer.

Harti commented 6 years ago

@LukeTowers I'm looking to run OctoberCMS alongside Laravel. Say, I want to benefit from OctoberCMS's super easy static pages and blog plugins, while not having to waive Laravel for very complex applications. I understand that OctoberCMS builds upon Laravel and hence contains a lot of its functionality, but I also read that a lot of the core principles were changed so that OctoberCMS could work.

Scenario

What I'm aiming for: Running both on the same server. Possible but wonky workarounds include catching 404 errors in Laravel to then include OctoberCMS (in that thread, it's Wordpress). I want to know if there is an easier and more resource friendly solution to this, as OctoberCMS already builds upon Laravel.

Thank you in advance for your time!

LukeTowers commented 6 years ago

@Harti October is perfectly fine for very complex applications, if not even better than Laravel because of the backend framework it gives you to build off of. Which core principles are you thinking of specifically?

Perhaps you should hit me up on Slack so we could discuss your project requirements in more detail and I could get a better understanding of why you're thinking October couldn't do both.

Harti commented 6 years ago

@LukeTowers How do I access the Slack channel?

munxar commented 6 years ago

@Harti https://octobercms.slack.com and register

Harti commented 6 years ago

@munxar appreciate it, I've already tried that though. My Slack credentials don't work.

Below it says:

Don't have an account on this workspace yet? Contact the workspace administrator for an invitation

So I figured I need to sign up somewhere else so that they can invite me.

LukeTowers commented 6 years ago

@Harti http://octobercms-slack.herokuapp.com/. Please do not comment on this issue for unrelated messages anymore.