When I install my app from a clean checkout, It always grabs my packages from my local repository as opposed to installing from cache like the remote packages.
My composer file:
{
"name": "app/name",
"description": "Desc",
"homepage": "http://homepage.com",
"repositories": [
{
"type": "composer",
"url": "http://packages.localrepository.com/",
"options": {
"http": {
"proxy": ""
}
}
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"guzzlehttp/guzzle": "4.*",
"local/health-check": "1.*",
"local/file-upload": "1.*",
"rediska/rediska": "dev-master"
}
}
This produces:
[exec] - Installing guzzle/guzzle (v3.9.2)
[exec] Loading from cache
[exec]
[exec] - Installing local/health-check (1.2.0)
[exec] Cloning f62651a1e2328a03ab7fd3fa8f84239ce7ee3a7c
This would be to accommodate the current build process that does a clean checkout each time. Any ideas?
The remote packages are hosted on Github or other hosting services that do provide a means to download ZIP or TGZ files of tagged releases. Composer knows the API of these services and tries to download the ZIP when appropriate (and you can try to force it by using --prefer-dist if it chose badly).
Your own hosted code isn't on Github, I assume. So if Composer doesn't know where to get a ZIP, the only other way is to clone the repository, no matter what the command line says (on the other hand, you can try to force cloning by using --prefer-source).
Note that neither of those two options guarantee anything - if Composer cannot download a ZIP it will clone - if it cannot clone, e.g. when the meta data of that package only mentions ZIP downloads, but no repository, it will download a ZIP.
Switching from one method to the other usually requires deleting the vendor folder as well as the composer.lock file, and then running Composer again. This will act as an update operation, so be warned that you will have to deal with this if it destroys your dependencies (i.e. you rely on branch names like "dev-master" instead of tagged versions).
Related
I'm trying to set up a local dev environment for a Silverstripe build which was set up by someone else. I'm not all that familiar with Silverstripe so am a bit lost as to how to do this. I can't share much of the code for security reasons but I can see that gulp is used for watching the local changes. Happy to provide what ever else is needed to get this going just cant provide specifics obviously.
Here is what I've done so far:
installed MAMP
cloned Repo to the htdocs folder within MAMP
run composer install in the root and npm install in the theme directory
turned on the MAMP server - am redirected to localhost:8888
have gone to the localhost:8888/repo and am shown the error - cannot find index.php
When I run gulp the browser opens a localhost:3000 page but it never completes loading, rather it hangs.
I understand the index.php error but the previous dev had this running with the current set up so I am hoping to not move anything around just yet. There is a 'public' folder with an index.php file in it if there is a way I can tell the server to look here for it.
composer.json Contents:
{
"name": "silverstripe/installer",
"type": "silverstripe-recipe",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.6.0",
"silverstripe/recipe-plugin": "^1.2",
"silverstripe/recipe-cms": "4.2.1#stable",
"silverstripe-themes/simple": "~3.2.0",
"loeken/cryptocompare-api-php-wrapper": "dev-master",
"zendesk/zendesk_api_client_php": "^2.2",
"intercom/intercom-php": "^3.2",
"tractorcow/silverstripe-fluent": "^4",
"silverstripe/googlesitemaps": "dev-master",
"ryanpotter/silverstripe-cms-theme": "^3.3"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"deployer/deployer": "^6.2",
"lekoala/silverstripe-debugbar": "^2.0"
},
"extra": {
"project-files-installed": [
"app/.htaccess",
"app/_config.php",
"app/_config/mysite.yml",
"app/src/Page.php",
"app/src/PageController.php"
],
"public-files-installed": [
".htaccess",
"index.php",
"install-frameworkmissing.html",
"install.php",
"web.config"
]
},
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}
Any suggestions of what to try next would be greatly appreciated. Nothing I can find online seems to mention using gulp and MAMP in tandem - unsure If I'm just understand their purpose incorrectly.
Cheers
I need '50 reputation' to comment so I will instead reply as an answer.
It sounds like you are using SilverStripe version ^4.1, since you got the 'public' folder.
Do the following:
Make sure you got a .htaccess file in the root (outside public folder) which redirects all requests to the public folder:
(root .htaccess)
RewriteEngine On
RewriteRule ^(.*)$ public/$1
Run composer vendor-expose in the root to expose all files which should be accessed by the visitors, (custom css, js, images etc...). The files & folders that gets exposed are specified in the composer.json file under "expose": [...]. The files gets copied over to the public folder
I have installed mdm extension for admin in basic version of Yii2, that is located in vendor directory and I want to override some files into extension directory for UI changes, I referred this link and added some code in web and console file as:
'aliases' => [
'#mdm/admin' => '#app/extensions/mdm/yii2-admin',
],
But no changes are reflected after doing this.
Most likely version installed by Composer conflicts with version which you unpacked manually. Instruction in documentation are for installing extension without using Composer, so they're definitely not considering the fact, that you have the same extension installed in two different places.
If you want to edit this extension you should uninstall composer version and copy whole extension into extensions/mdm/yii2-admin.
But probably better option would be to fork it, and add repository to your composer.json which will point to your fork:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/yourname/yii2-admin.git"
}
],
And change dependency constraints to use master branch:
"require": {
"mdmsoft/yii2-admin": "dev-master as 2.8.0",
// ...
},
Then all necessary changes you're preforming in your fork (at https://github.com/yourname/yii2-admin.git) and fetching changes to main project using composer update mdmsoft/yii2-admin. It will simplify syncing changes from upstream - you just need to merge changes for upstream if you want to update your fork with lates changes from original extension repository.
I am building an IOS app using Firebase. I have an error when I try to deploy
"Error: Specified public directory does not exist, can't deploy hosting"
I have been following the hosting guide here Guide Link But being new learner, I am not understanding what should I put in firebase.json
So my code in firebase.json
{
"firebase": "xxxxxx", //(my app name)
"public": "/usr/local", //(I am not sure what should i put in here)
"ignore": [
"firebase.json",
"**.*",
"**/node_modules/**"
]
}
I am not sure what should I put in "public" property. I think that is the reason why I get the error. I don't understand what public directory mean in here.
Easily deploy and host your app's static assets (HTML, CSS,
JavaScript, etc) with our production-grade hosting service. All of
your content is served over HTTPS and backed by a global CDN.
It cleary states only static thing is expected to be hosted.
In "public" you are supposed to put dist (distribution) folder distination, In web apps Its a folder that contains all assets to keep app up and running on firebase hosting service.
Above answer is to clear Concept, Provide more details of your app and structure for further help.
what are you building your app with?
I imagine the cause of the error is that you need to generate a 'dist' folder for your app and you haven't done that yet before running 'firebase deploy'.
Check the firebase.json file in your project directory, it will show you that Firebase is looking for a dist folder to read from.
IF it can't find it, you will get the error that you have.
For instance, if it is an Angular2 application and you use the Angular-cli, just do the following:
Run the command 'ng build' in your project's root directory.
This command will generate a 'dist' folder from the 'src' folder where you wrote your application code.
Then run '
firebase deploy'.
I just installed yii2 (advanced) using composer. I've setup nginx, etc.
But it doesn't work:
Invalid Parameter – yii\base\InvalidParamException
The file or directory to be published does not exist: /srv/www/site/vendor/bower/jquery/dist
In the folder 'vendor/bower' there is the only subfolder 'bower-assets' with 'jquery', etc in it. But no jquery in vendor/bower.
How to solve this issue?
Please, refer the installation guide. It seems that you are missing asset plugin:
composer global require "fxp/composer-asset-plugin:~1.2.0"
Make sure you have executed this command:
composer global require "fxp/composer-asset-plugin:~1.2.0"
Also, check your composer.json for these followings:
Deprecated, but default option from Yii2:
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
New option
"config": {
"fxp-asset": {
"installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
},
}
},
Then run either composer update if you already have a composer.lock file, or composer install if you don't have composer.lock file yet.
Check your composer.json file in the root of your project. You should have a section that look slike this;
"asset-installer-paths": {
"bower-asset-library": "vendor/bower-assets"
}
This tells composer where to locate the bower files library. You may need to run composer update afterwards to get hte locations updated.
I was facing same issue,
this is how I fixed it-
go to vender .
$ cd projectFile/vendor/
Rename bower-asset with bower
$ mv bower-asset/ bower
Restart mamp/xamp
That fixed the issue and http://localhost:8888/ is working well.
It seems your jquery/distis under bower/bower-asset instead under bower.
In order to solve your problem, please move all bower-assetcontent including jquery subfolder and others like: bootstrap, yii2-pjax, puny code, etc. in bower folder (one level up). All these subfolders will be at the same level with bower-asset under bower folder. Now you can delete bower-asset folder if you want.
Before you had:
vendor/bower/bower-asset/jquery/dist/...
Now you have:
vendor/bower/jquery/dist...
There shouldn't be any bower-asset subfolder.
This will solve your problem and yii2 app will work as it should.
I'm trying to create a local Bolt extension that uses extra libraries. Here is a snippet of my composer.json:
"type": "bolt-extension",
"require": {
"bolt/bolt": ">=2.0.0,<3.0.0",
"oyejorge/less.php": "~1.7"
}
First, is it even possible/advisable to manage dependencies this way in local Bolt extensions? Or, do I need to manually include the library and autoload the files?
Secondly, what is the mechanism by which I should update the composer.json file in my extension? Should I browse to the directory and run composer update, or is there a more Bolt-y way of doing it?
At present, we disable the packagist repo in you extensions/composer.json by default — due to performance.
However, in the CLI, if you change to your extension's installed directory, a composer update will pull in/update the dependency for you.
All that doesn't mean this mightn't change, I am reworking the Composer code at present, so keep an eye on the changelog.