I would like to use Guard inside of custom rake tasks for different needs. Instead of loading the Guardfile to configure the gem, equivalent configuration would be defined within the tasks themselves.
I would prefer not to depend on a Guardfile. However, the Guardfile itself appears to be a requirement for the gem to work. I have not found a workaround in the Wiki or in various articles demonstrating Guard trickery.
Is this possible using existing parts of the Guard gem, or would it need to be extended in order programmatically configure it?
There's an up-to-date wiki entry on this here:
https://github.com/guard/guard/wiki/Use-Guard-programmatically-cookbook
If something doesn't work, just file an issue here: https://github.com/guard/guard/issues/new
Related
I'm trying to implement a content management website, in many ways, it's like a simplified github.
the version control and collaboration part is based on git using libgit2.
But I can't find how to implement merge conflict preview, that would tell an user if her change is clean to merge or not and which lines have conflict.
the example here https://github.com/libgit2/libgit2/blob/master/examples/merge.c
performs merging with the git_merge function, however, this function would directly alter the current index.
I also checked a github open source alternative, but I forgot its name now. That project used a library from the eclipse ide, which provides a conflict preview feature.
How should I implement this with libgit2 and is there an example code?
As you noted, the git_merge function mutates the working directory and the index. You can use the git_merge_commits function to do an in-memory merge of two commits and return the resulting index.
You can then iterate over the index looking for conflicts or simply call git_index_has_conflicts if you only want to know if conflicts exist.
I want to check if Qt5 was compiled with or without some options, regarding supported image formats. I know about the QImageReader supportedImageFormats function but I want to know the configure options.
Is there a way to retrieve the used commandline options of the configure call dynamically?
Cheers.
No, there is not. You could fake it, if you still have the source tree. In qt5/qtbase you find two files: config.summary and config.status. Those contain the info you seek. However, these files are not part of a normal installation.
is anyone ever tried implementing the dojo toolkit AMD with laravel 4, or could anyone please point me to a simple sample.
just a simple AMD implemetation on laravel?
What asset manager or the default is ok. how to use it with dojo?
Please help. thanks
For 1. I suggest you may try this Laravel 4 bootstrap suite it gives you RequireJS implementation out of the box.
For 2. You can use dojo with any asset manager you want, or even without it (although it is not a good way) - just by putting its .js files in your /public directory and including them as you do in usual html from inside your view templates. If you are using Blade templates make sure the template syntax is not colliding with your js syntax. If it is, then use #include of .php file with your js code section in your .blade.php view template.
Asset manager gives you a more elegant and correct way of doing the same thing. It maybe extremely useful if you are dealing with LESS or Coffee things to be compiled into regular JS and styles.
If you want advanced asset manager I would suggest your to look at /CodeSleeve/asset-pipeline on github - it's one of many asset managers for Laravel, but one the few keeping alive (take a look at basset or laravel-grunt options on github for instance).
Asset Pipeline makes a good job making asset management similar to the one in Rails. Here is an article on how and why to use it: http://culttt.com/2013/11/04/add-asset-pipeline-laravel-4/
I am using the SDWebImage component in my project. Recently, I also decided to add MWPhotoBrowser (which uses SDWebImage). After installing MWPhotoBrowser I can no longer compile without receiving numerous errors. I am certain this is because the SDWebImage version is different across components I use.
As soon as I add the location of the header files for MWPhotoBrowser (which include SDWebImage) to my user search path I start getting these errors.
Any guidance / help as to how I can sandbox the libraries that MWPhotoBrowser needs so it doesn't affect the rest of my app ?
Rather than modifying any of the browser code I decided to eliminate my copies of SdWebimage and leverage those included in MWPhotobrowser instead. Not ideal, but I think the proper solution is to modify MWPhotobrowser to use these libraries as sub modules.
In a Rails 3.1 app, one controller needs to have all its views compile whatever Sass stylesheets they might need per request using a set of custom variables. Ideally, the compilation must happen via the asset pipeline so that content-based asset names (ones that include an MD5 hash of the content) are generated. It is important for the solution to use pure Sass capabilities as opposed to resorting to, for example, ERB processing of Sass stylesheets.
From the research I've done here and elsewhere, the following seems like a possible approach:
Set up variable access
Create some type of variable accessor bridge using custom Sass functions, e.g., as described by Konstantin Haase here (gist). This seems pretty easy to do.
Configure all variable access via a Sass partial, e.g., in _base.sass which is the Compass way. The partial can use the custom functions defined above. Also easy.
Capture all asset references
Decorate the asset_path method of the view object. I have this working well.
Resolve references using a custom subclass of Sprockets::Environment. This is also working well.
Force asset recompilation, regardless of file modification times
I have not found a good solution for this yet.
I've seen examples of kicking off Sass processing manually by instantiating a new Sass::Engine and passing custom data that will be available in Sass::Script::Functions::EvaluationContext. The problem with this approach is that I'd have to manage file naming and paths myself and I'd always run the risk of possible deviation from what Sprockets does.
I wasn't able to find any examples of forcing Sprockets processing on a per-request basis, regardless of file mod times, that also allows for custom variable passing.
I'd appreciate comments on the general approach as well as any specific pointers/suggestions on how to best handle (3).
Sim.
It is possible. Look here SASS: Set variable at compile time
I wrote a solution to address it, I'll post soon and push it here, in case you or someone else still need it.
SASS is designed to be pre-compiled to CSS. Having Sprockets do this for every request for a view on a per request basis is not going to perform very well. Every request is going to have to wait for the compilation to be done, and it is not fast (from a serving-pages point of view).
The MD5 generation is within Sprockets, so if you are changing custom variables you are going to have to force a compilation on every single request to make sure that changes are seen because the view is (probably) not going to know.
It sounds as though this is not really in the sweet-spot of the asset-pipeline, and you should look at doing something more optimised for truly dynamic CSS.
Sorry. :-)