PhpStorm: SCSS File Watcher Settings - sass

I need help setting up my SCSS file watcher in PhpStorm. I'm on Ubuntu, I have PhpStorm 6, I have RVM with Ruby 1.9.3p194 and Sass 3.2.5. I've set my File Watcher options in, Settings >> File Watcher as follows:
Once I had done that, I changed something in my .SCSS file but I got this error.
...-1.9.3-p194/bin/sass --no-cache --update style_update.scss:style_update.css
/usr/bin/env: ruby: No such file or directory
(I added three dots at the begin of the first line to make the line shorter) So what might be the problem?

The problem is that IDE is not able to find ruby in the PATH. Note that it may be different in terminal and in applications that you start from Ubuntu launchpad.
Use the Environment variables option in the file watcher configuration to specify custom PATH value with a directory containing the required executables.

A quote from an answer/comment before:
"[...] ... just do what is written, add PATH variable ... [...]"
... That's exactly a common misunderstanding between helping people (who are mostly not teachers), who do the tasks on a daily basis, and asking people on the other hand, who can imagine 3 different things behind standartized answers and their words. Stackoverflow should extend on this, not repeat manuals or documentations.
In PHPstorm for example, you have 2 empty fields after hitting the plus on the right corner of the Enviroment variable settings window. The left field has the header "Variable", the right field the header "Value". So, if somebody is not familiar with PATH and ENVIROMENT variables of desktop or server systems, this person will be slidely confused about what has to be placed in the first field. Is it "ruby"? Is it "PATH"? Wouldn't it override the whole PATH variable of the system? Is it a custom given NAME I can choose and how does the system knows about it? No explanation can be found.
If you don't know the logic behind, you cannot assume the right steps from this standart formulated advice. While I am very excited about the feature set of PHPstorm I find the documentation slidely too standartized and unexplainable. Thats why many entries have bad votes from readers below. Like if somebody would ask: "how do I bake bred?" and the answerer says: "First you have to prepare flour and create dough, then you can bake bred." So what do the asker has learned from this answer? Exactly. Nothing what he didn't knew already before. Ok, maybe the question was not clear enough, but this is also a common case: how to ask correctly if you don't know what you actually ask for? From where can the person know, that there is a need to understand how to set PATH variables? I think this is what differs between makers and teachers. Teachers learn to communicate that gap. Documentation often lacks of better teachers writing it. People who work in the support team should be better in thinking like teachers.
To become more constructive: The documentation of PHPstorm says in its example: "choose PATH_TO_LIB as NAME and the path to the library for the VALUE field." Again: from where does this PATH_TO_LIB comes? Is it an own given Name, or a prepared empty VARIABE name PHPstorm watches? If something wents wrong and you start to look for issues which may cause this and start to worry about wrong settings you are lost on this questions even as an experienced PHP developer.
I generally prefer using tools like guard and RVM based ruby installations ATM over build in watch file solutions like these from PHPstorm, which mostly look for a system wide ruby and such first. But with rvm we have project based paths to ruby and such. RVM prevents breaking the compiling-chain of long term theme or module developments based on certain gem versions. Watch here http://www.youtube.com/watch?v=CmTuvzbPduI where Sebastian Siemssen (well known Drupal developer) explains why this is a good concept. But to nicely implement this with PHPstorm features, you need a better low level entry to path editing in PHPstorm.
Sadly this involves pressing save again, since this needs the save file event to be triggered. I would love to see a better implementation, flexibility and better explanation of how to go with the PHPstorm in-build watchers to have a refresh on edit at hand.

Related

Modify user and system variables in Visual Studio 2017 installer

I want to append the installation folder of my program as value to the path variable of user and system variables.
I followed michaelmoo's instruction.
https://stackoverflow.com/a/21390793/9678802
The problem is that the existing value of path variable will be removed.
Digression: Adding to the Path involves some security risks, some performance issues, and can cause application interference - and probably a few other things. It is best avoided in general. It is a "known risk" avoided by deployment professionals - if they can help it.
The concept of AppPaths is a (partial) alternative to
updating the Path environment variable. It allows your application to
be started from the Start => Run dialog, but it does not work
from the command line.
Seems to not work from command prompts.
Warning: Ouch, that answer is very bad indeed (with apologies to the author who clearly tried to help others). That procedure should not be followed in any shape or form though! It is so dangerous that I have seen people sent out the door for far less. Wiping out a whole developer teams' environment path with a package deployment will cause drama - that you can be sure of. The warning really needs to be that strong in this case. I have seen it happen, and even by packages made by experienced professionals.
Built-In Support: As far as I am concerned, the correct answer from the above "thread" is this one. Windows Installer has built-in support for adding environment variable that takes care of all merging and update issues - and it even has rollback support - meaning your environment variable will be restored to its original state should the package installation fail. This built-in feature is a "must use" functionality.
Deployment Tool: So the built-in feature has to be used, but how when the tool does not support it? The best option is to get a "real deployment tool", especially since there are several further problems with the Visual Studio Installer Projects (Note: this is not pitching products, it is telling people about serious pitfalls that will cause real problems in almost all cases - what product you choose is up to you - obviously - but the VS Installer Project just isn't a complete solution).
WiX: Updating the Path variable using WiX is simple enough. And the documentation for the Environment element.
Orca: Though it is possible to "post-process" your compiled MSI and create the required entry in the Environment table, I would recommend that you use a proper tool instead that has been tested and designed to help you succeed in general. A comma wrong or a star wrong in the Environment table and you get completely wrong behavior.

SASS autocompile on debian

i couldn't find any information on google for this so i thought i will just ask this general question.
we are developing a web app for customers who can change colors, fonts and stuff in their account through a simplified CustomDesigner (the name) Tab where they can pick colors from a color picker and fonts from a select-box and all this stuff.
currently all these dynamic changes are written through PHP in the CSS but we are working on a complete redesign and rework of the app and want to use the power of SASS for this.
my question is: is it possible to run ruby on a debian server and everytime a user changes some preferences in their account that ruby will compile the generated sass file or the "changed" variables into a new css file completely automatically?
if yes: how? i couldn't find anything at all about this topic.
if my using-example is not good enough and you can't imagine what i want:
think about the custom-bootstrap-builder, where you can simply change all the stuff from viewport-grid-size, fonts, font-sizes, border-radius and all that kind of stuff, and if you click on "download" it delivers a complete bootstrap version with your preselected preferences and downloads it completely automatically.
the download for my use-case is not necessary, instead i want the server to store that "compiled" file in a specific directory on the server and of course import it to the generated HTML.
after some more research and investing more time i found some "module" for nginx which is capable of processing less/sass/scss server side with nginx/LUA
https://github.com/titpetric/nginx-lesscss
i also found a PHP variant to use
https://github.com/leafo/scssphp/
i couldn't try any of these two, but it looks quite promising and i wanted to share if someone else has the same problem.

How to check if an extension is really used in Joomla

I want to know if a extension (for example: joomfish) is really used or not used at all before i disable it / uninstall it.
Is there a way to check ?
First, in Joomla plugin has a specific meaning, so what you want to know is whether a component, module or plugin is used.
This is a common problem when you inherit sites. A lot of times users install tons of extensions and never use or uninstall them.
The simplest first step with modules and plugins is to see if they are published or not. Also you can look at modules and see if they are assigned to any positions or menu items.
In terms of extensions, if they are a kind of extension that would be used to create content and you look at the manager you can see if any content was ever created. If not it is probably safe to uninstall. IF there is content then you will want to figure out whether you need o preserve it.
The problem with Mike's answer is .. how do you know if you have tried every possible combination of things or possible events with enough certainty to say for sure that something is not running ever. For example you may have a component that you never use as a menu item but then some module is running a query against its data.
Well you cannot know that. To be absolutely shure you could write a system plugin which gets triggered on plugin calls and logs the triggering plugin names.

Appropriate/best practice way to execute some PHP unrelated to database when a module is first installed?

I'm creating a module that requires a few things to be done (once only) when the module is installed. There may be a number of things that need to be done, but the most basic thing that I need to do is make an API call to a server to let the external server know that the module was installed, and to get a few updated configuration items.
I read this this question on stackoverflow however in my situation I truly am interested in executing code that has nothing to do with the database, fixtures, updating tables, etc. Also, just to be clear this module has no affect (effect?) on the front end. FYI, I've also read this spectacular article by Alan Storm, but this really only drives home the point in my mind that the install/upgrade scripts are not for executing random PHP.
In my mind, I have several possible ways to accomplish this:
I do what I fear is not a best practice and add some PHP to my setup/install script to execute this php
I create some sort of cronjob that will execute the task I need once only (not sure how this would work, but it seems like it might be a "creative" solution - of course if cron is not setup properly then this will fail, which is not good
I create a core_config_data flag ('mynamespace/mymodule/initialized') that I set once my script has run, and I check on every area of the adminhtml that my module touches (CMS/Pages and my own custom adminhtml controller). This seems like a good solution except for all of the extra overhead every time CMS/Pages is hit or my controller is hit, checking this core_config_data setting. The GOOD thing about this solution would be that if something were to fail with my API call, I can set this flag to false and it will run again, display the appropriate message, and continue to run until it succeeds (or have additional logic that will stop the initialization code after XX number of attempts)
Are any of these options the "best" way, and is there any sort of precedent for this somewhere, such as a respected extension or from Magento themselves?
Thanks in advance for your time!
You raise an interesting question.
At the moment, I am not aware of a means to go about executing any arbitrary PHP on module installation, the obvious method (rightly/wrongly) would be to use the installer setup/upgrade script as per 1 of your Q.
2 and 3 seem like a more resource intensive approach, ie. needlessly checking on every page load (cache or not).
There is also the approach of using ./pear to install your module (assuming you packaged it using Magento). I had a very quick look through ./downloader/pearlib/php/pearmage.php but didn't see any lines which execute (vs copying files). I would have imagined this is the best place to execute something on install (other than 1 mentioned above).
But, I've never looked into this, so I'm fairly interested in other possible answers.

TYPO3 extensions and symlinks

Can I create a symlink to the local extension from aonther project folder? I have a common local-server and i need to implement same extension on all local project-installations. I tried to put the symlink, but some times i do not get expected output. I get it only after clearing the cache of that perticular project.
Your scenario is a common one I guess. But as Omar said, linking to the same code base of the extension through several typo3 instances is not a good practice.
But we have the same structure as yours, we realize this through SVN. All of our projects got a SVN repository and common extensions have their own repository. Through svn:externals the extensions are linked into the concrete project. This has the advantage that you can change the extension in the concrete project and after committing all other projects (that do have to update from svn though) contribute from it. I Think this would fit your needs, too.
If I understand your question correctly you have several Typo3 sites on the same server and want to share an extension between them using a symlink. I don't think that is a very great idea because many extensions use tables and every site normally has it's own database so you would have to do a lot of tinkering to get that to work.
Instead you could make all the modifications to the extension files in the typo3conf/ext/extension_name folder and then export the extension to a t3x file (Ext Manager in the Backend). This t3x file can be installed as a extension (Import extension) on all your other sites.
If you extension does not use a database and you are planning to make frequent changes then I guess you should be able to make that work (the symlink). Otherwise I recommend you use the first approach I described.
I have not tried this, but you should be able to install extensions globally in Typo3. What this means is that the given extension is placed inside '(typo3_src/)typo3/ext/' instead of 'typo3conf/ext/', presuming both sites use the same Typo3 Core/Source (and thus typo3_src is a symlink to the location of the core).
You can enable installing global extensions via the Install Tool. Once inside the tool, click on 'All Configuration', then search for allowGlobalInstall. Or put the following line into your localconf.php:
$TYPO3_CONF_VARS['EXT']['allowGlobalInstall'] = '1';
At last, but not least, you need to make sure the 'typo3/ext/' directory is writeable.
Hope this will be to some help. If you have any further questions, let me know :)
As Björn mentioned, I'd sugegst to install them globally. Mind you, updating the source will require to move the extensions accordingly..
As for "expected output": be aware that the code in these folders is cached in various ways (mainly page content and config settings), and hence not always run. This is the reason a change done from "outside" the current installation is likely not to propagate to your output without clearing these caches (as you have observed).
When you actually install an extension via the extension manager, the cache should (if correctly configured) be cleared (interested parties may search for clearCacheOnLoad in class.em_index.php to reveal a clear_cacheCmd('all')). There is a small checkbox, which is normally checked, during the installation process to accomplish this.
Omar's first approach is therefore, as I see it, the more easy way to get "expected output" and less jumbling around with global extensions.

Resources