According to:
http://plone.org/products/dexterity/documentation/how-to/install
To use grok-style declarations in Plone 4.3 one must install Dexterity via buildout with setuptools extras requirements: grok and relations (referring to extras_require definitions in plone.app.dexterity's setup.py). But what should add-on developers who want to perform this configuration on behalf of end users do?
With my collective.project add-on, I have copied the extras_require from plone.app.dexterity:
setup(
author='Alex Clark',
author_email='aclark#aclark.net',
description='Demo app: project management with dexterity content types.',
entry_points={
'z3c.autoinclude.plugin': 'target = plone',
},
extras_require = {
'test': [
'plone.app.testing',
'unittest2'
],
'grok': [
'five.grok',
'plone.directives.dexterity',
'plone.directives.form >=1.1dev',
],
'relations': [
'plone.app.relationfield',
'plone.app.intid',
'z3c.relationfield',
]
},
This allows end users to install collective.project simply by adding to a list of eggs e.g.
[plone]
recipe = plone.recipe.zope2instance
eggs =
Pillow
Plone
collective.project
Is this a reasonable approach?
No, it is not. Do not copy the extras_require from plone.app.dexterity, it doesn't help (though maybe including the extras_require as install_requires would work, but that would defeat the purpose of extras_require)
However, you can use a similar syntax as Buildout uses to specify extras_require in setup.py:
install_requires=[
'setuptools',
'plone.app.dexterity[grok]',
],
Related
My team is working on an older AngularJS project that we have recently upgraded to .Net Core 3.1 while the project works fine without it we would like to start upgrading our scripts to use TypeScript. None of us have actually used Typescript before and I'm sure we have something very basic messed up in our config.
I've set up a demo project which can be found here:
https://github.com/ExcaliburVT/TypeScriptBasic
The project has libman references for angularjs, angular material, bootstrap etc along with their appropriate TypeScript "typings" (at least I think they are correct).
Here: https://github.com/ExcaliburVT/TypeScriptBasic/blob/master/libman.json
Our tsconfig.json is exactly like this:
https://github.com/ExcaliburVT/TypeScriptBasic/blob/master/tsconfig.json
{
"compilerOptions": {
"noImplicitAny": true,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es6",
"moduleResolution": "Node",
"baseUrl": "wwwroot",
"typeRoots": ["./lib/types"]
},
"include": [
"wwwroot/Scripts/**/*"
],
"exclude": [ "node_modules", "**/*.spec.ts" ],
"compileOnSave": true
}
Finally I have created two example ts files with different ways of trying to reference angular.
https://github.com/ExcaliburVT/TypeScriptBasic/blob/master/wwwroot/Scripts/exampleOne.ts
//TS2304(TS) Cannot find name 'angular'
//TS2503(TS) Cannot find namespace 'ng'
https://github.com/ExcaliburVT/TypeScriptBasic/blob/master/wwwroot/Scripts/exampleTwo.ts
//TS2688(TS) Cannot find type definition file for 'angular'
Going to the extreme if we ADD the path to the types folders in the "include" of tsconfig.json the libraries appear to be found, but then we get compiler errors for the types themselves.
I'm certain its something quite simple that we have setup wrong but i'm out of ideas.
Thanks in advance!
Additional Testing. Note that setting the paths directly doesn't appear to work either.
"baseUrl": "wwwroot",
"paths": {
"angular": [ "lib/types/angular" ],
"angular-material": [ "lib/types/angular-material" ],
"bootstrap": [ "lib/types/bootstrap" ],
"jquery": [ "lib/types/jquery" ]
}
Well it appears the root problem is that I was trying to use libman when typescript expects everything to work through node. I started a brand new project using the .net core angular template and lo and behold it doesn't use libman, it simply uses node with a package json that works JUST fine.
I took this same pattern and applied it to my test project and amazingly everything works just fine now.... Shocking.
Bottom line it looks like the documentation suggesting to use libman for javascript package management https://learn.microsoft.com/en-us/aspnet/core/client-side/libman/libman-vs?view=aspnetcore-3.1 is really misleading, especially for those that are not familiar with the whole ecosystem.
I guess it is a viable alternative if you want to do basic development without node as a dependency.
Note: I'm updating the git repo with the "working" version in case anyone wants to see the difference.
I would like to be able to create a custom override to add a VcpkgConfiguration Property based on our current configuration.
We have a C++ project that uses Premake and vcpkg. We have found vcpkg to conflict with other projects that include their own versions of similar libraries, so we cannot use the global integration that it provides. Instead we have added it as a sub-module to our project and linked it through premake with a custom override:
p.override(p.vstudio.vc2010, "importExtensionTargets", function(base, prj)
p.push('<ImportGroup Label="ExtensionTargets">')
p.callArray(p.vstudio.vc2010.elements.importExtensionTargets, prj)
p.pop('</ImportGroup>')
p.push('<ImportGroup Label="ExtensionTargets">')
p.w('<Import Project="$(SolutionDir)External/vcpkg/scripts/buildsystems/msbuild/vcpkg.targets"/>')
p.pop('</ImportGroup>')
end)
Unfortunately we do not use the regular "Debug" or "Release" configurations in our project, so vcpkg by default does not link correctly. To get past that problem, we modified the vcpkg.targets file to recognize our configuration in a local branch. This is not ideal, as it forces us to rebase our branch off vcpkg in order to update it, and could potentially conflict if that file is ever modified in their repo.
The targets file allows you to set the VcpkgConfiguration property before including the target, which is what we would like to do.
Basically what we would like is to be able to call a command through the filters like this:
filter {"configurations:<SomeConfiguration>"}
VcpkgConfig "Debug"
Which would add this inside the propertygroup
<VcpkgConfiguration>Debug</VcpkgConfiguration>
How can we accomplish this?
The problem seems to be that importExtensionTargets is per project but you want this per configuration.
You can try to register your key word
api.register {
name= "VcpkgConfig",
scope = "config",
kind = "string",
}
then in your custom function
-- loop over all configurations
for _, cfgName in ipairs(prj.configurations) do
-- find config
local cfg = project.findClosestMatch(prj, cfgName)
if cfg.VcpkgConfig then
p.push('<ImportGroup Label="ExtensionTargets">')
p.push('<VcpkgConfiguration>'.. cfg.VcpkgConfig .. '</VcpkgConfiguration>')
p.w('<Import Project="$(SolutionDir)External/vcpkg/scripts/buildsystems/msbuild/vcpkg.targets"/>')
p.pop('</ImportGroup>')
end
Not tested.
Would this work ?
I'm opening files in Atom with a new file extension, a file extension that is not recognized by any of the existing grammars (i.e. Plain Test, C, C#, etc.). How can I associate my new file extension with one of the already-available grammars?
Success is being able to open a file with my new file extension and have Atom default to my chosen grammar automatically.
I tried the suggestion but Atom bounced it back at me:
customFileTypes:
"source.fs": [
"*.seedsource"
]
For personal use, you can register a custom file type in the Atom config file (config.cson by default).
Here's a minimal example of what config.cson might look like. Make sure to insert the customFileTypes part at the correct indentation, since CSON files are indentation-sensitive.
"*":
core:
customFileTypes:
"source.c": [
"*.custom-extension"
]
If you want to share this configuration with other users, it's probably better to create a package that contains a grammar file (e.g. grammars/custom.cson):
fileTypes: [
"custom-extension"
]
patterns: [
{
include: "source.c"
}
]
scopeName: "source.c.custom"
In both cases, example.custom-extension would be opened with C syntax highlighting.
I am a newbie in composer and Heroku cloud and here has a may-be-stupid question about the path in composer.
I am trying to deploy a Wordpress on Heroku, following the code/instruction here: https://github.com/ellefsen/wordpress-heroku-php
In concept, I should use S3 to store any media content. However, my case is quite special: there are two and only two images for my site, now and in future. So I:
removed all S3 related code and configs;
add two images in public/content/uploads/ as: public/content/uploads/2016/08/one.png and public/content/uploads/2016/08/another.png;
adjust the .gitignore accordingly (remove the public/content/uploads);
Modify the composer.json as:
"extra": {
"webroot-dir": "public/wp",
"webroot-package": "wordpress",
"installer-paths": {
"public/content/plugins/{$name}/": [
"type:wordpress-plugin"
],
"public/content/mu-plugins/{$name}/": [
"type:wordpress-muplugin"
],
"public/content/uploads/{$name}/": [
"public/wp/wp-content/uploads/{$name}"
],
"public/content/themes/{$name}/": [
"type:wordpress-theme"
]
}
},
For item "public/content/uploads/{$name}/", I tried:
public/wp/wp-content/uploads/{$name}
wp-content/uploads/{$name}
But in any case, within the WP dashboard, I cannot see any image in the media lib. Could someone please give me a hand? Thanks!
I would not bother with the Media Library in WP as long as you are only dealing with two images. Just put them in your theme directory and reference them directly.
That way you won't have to deal with S3 or Heroku's ephemeral file storage as they would all be committed and included with your repository as part of your project.
I need to develop a dexterity content type with a particular field/widget.
This widget is like a multiselection widget but I need to give the
possibility to upload a file for every choosen option. Something like this:
[] option 1 Upload a file: [ ] [ Browse ]
[X] option 2 Upload a file: [ ] [ Browse ]
[] option 3 Upload a file: [ ] [ Browse ]
Any idea/pointer on how to implement this on dexterity? I think it has to do with z3c.form mostly. Any example of similar widget/field is welcome, as any pointer to existing packages :)
I would also manage the vocabulary TTW, if possible, so users with a particular role can update the list.
Though I haven't used this myself I suspect you could look at collective.z3cform.datagridfield and the related demo code on github for pointers on how to use subforms and widget factories.