SilverSmith: The Open Road Ahead
28 Aug
Followers of my Github profile may have noticed the arrival of a new member of the family a few weeks ago. SilverSmith is now open source! (UPDATE: Documentation has been added to README.md)
Gone is the monolithic, single file that sat way upstream in your filesystem. The newest version of SilverSmith looks much more like a standard SilverStripe module. Here’s what’s new:
- SilverSmith is now for SS 3.0+ only.
- SilverSmith is now broken into many separate files and adheres to a much more logical organization of code.
- SilverSmith can be installed on a per-project basis, offering a command-line executable within its own directory structure (/silversmith/bin/silversmith)
- The executable can be installed globally so all your projects can have access to SilverSmith CLI tools. (/silversmith/bin/cli_install). By open sourcing the install script, my hope is that we can refine it to a point where there are few, if any, installation issues.
- The dreaded MAMP failure “Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock” will be detected and addressed with the new “fix-mamp” command
- SilverSmith will auto-update with Git, and will soon follow the more conventional Composer.
The 3.0 Quandary
I would never say that it’s anything permanent, but for now it makes the most sense to me to make SilverSmith a 3.0 tool. Most users are not going to install SilverSmith retroactively on an existing project. Rather, it’s something they’ll try for new work, which is much more likely to be in the current version of SilverStripe. Adding 2.4 support is entirely possible using a new branch, but it raises questions about how to handle the global installation of the executable (would there be a “silversmith2″ script?). It seems like we’re at a perfect juncture to embrace 3.0 and get people using SilverSmith on their new projects.
The Roadmap
Up ahead are a series of improvements to the SilverSmith ecosystem to make it a more viable tool.
Priority #1: Documentation and Resources
Silversmithproject.org will get a makeover and become a space for a variety of how-to’s and other resources for SilverSmith including:
- Documentation
- Examples
- Screencasts
- Getting started
- YAML library (see below)
Priority #2: The GUI
Now that SilverSmith is a true SilverStripe module, we now have the foundation to build a SilverSmith GUI right in the SS3 backend. It will loosely follow the original GUI for SilverSmith, without the code editing tools. The main features will include:
- Visual YAML builder
- Template Genius
- Translations editor
- Content seeding/population
Priority #3: A Plugin System
In earlier iterations of SilverSmith, the application depended heavily on thirdparty tools — in fact, it knew nothing about how to create a ComplexTableField or FileIFrameField. It lived in a world where everyone used DOM and Uploadify, and even its own custom form fields, forcing the user to deploy the SilverSmith application into production. That’s too much dependency for an application that markets itself as a time-saving, lightweight project kickstarter.
Rather than having SilverSmith talk to thirdparty modules, the reverse should be the case. Developers of thirdparty modules should make their code SilverSmith aware. SilverSmith will detect the existence of specific configuration files that tell SilverSmith about a new form field or new snippet of code that can be abstracted into YAML. Plugins should be installable globally or on a per-site basis.
Example plugins could include SortableGridField, or the GridField Bulk Editing Tools.
Priority #4: The Community
One of the visions I’ve had all along for SilverSmith is the idea of free-flowing code that could be painlessly shared and modified. Because the main diet of SilverSmith is plain text (YAML), it follows easily that this code could be shared with almost no overhead. I would love to see data models shared the same way frontend themes are today — get 90% of what you need in a single download, and refine the details inexpensively and intuitively. Both the CLI and the GUI tool should have exposure to some sort of central repository of these snippets.




Looks good. I’d like to give it a try. It seems there are no installation istructions yet?
Just check it out from Git and drop it in your project just like any module, in a directory named “silversmith”. From there you can run silversmith/bin/cli_install to install the script globally, or just run it from your project, silversmith/bin/silversmith
A good place to start is:
silversmith init –example
silversmith build-code
silversmith build-templates
silversmith help
silversmith spec
I have added documentation to the README on Github.
Sweet, that makes it a lot easier to get started!
Thanks Uncle Cheese, I like the direction and ethos you’re envisioning here, feels good!
I’d been backing of from SS in general, until this v3 transition got a little more stable…
This looks well worth a dive in to explore and do some developing with, a good point to reignite my interest within the SS world : )
Best wishes
~ Sean
Awesome! Glad this project is still alive and kicking
Great stuff! Thanks for this project. Very well chosen priorities in your list, as well
Hehe im really happy about all of this, i know that silversmith will hit the ground of development in the same way DOM did it for all of us. thank you UC for releasing this amazing module!!
PD: feeling important right now
– i know i was the guy you talked about in SScoop #4 xD
I install the latest Silverstripe 3.02 into Window7 running WAMP. Than I follow the instruction to install sivlersmith.
(a) It works, except I have to figure out a right shell to execute the script so that it will appear exactly as shown in video. Any suggestion.
(b) I am trying to figure out a way to have the example project run in a specified director instead of mysite. Likewise for the template. In this way, I can test different projects using one Silverstripe 3.02 installation
(c) Since I am using Window 7 and programming in dot net c#, it should feasible to come out with a C# GUI that generate both the _project yaml and the fixture.txt file needed for building code and templates. Anyone thinking of the same direction.
Hey, Jim,
I’m not a big Windows guy, so I can only answer your second question. SilverSmith does take a “module” argument to target a specific folder for code generation. By default, it is the value of “global $project”, but if you want to work outside of your project directory, just add a -module flag.
silversmith build-code -module my_module
silversmith build-templates -theme my_theme
See “silversmith help” for more information.
In window, the bash output contains ” [0m|[0m[0m[0m” as format inforamtion for cell or table.
It is not possible to get properly layout or formated output for silversmith –help.
Example of the output in bash:
The module directory in which to build [0m|[0m[0m
[0m [0m|[0m[0m silversmith build-code -module mymodule
Do you have suggestion how to modified the code so that fancy color text can be properly formated
Thank you again to your response.
I have now figured out how to address the questions I asked you before. The framework is really well designed. How I am testing which Yaml.net library works with your yml file format.
Hi Uncle Cheese – SilverSmith looks brilliant and I can’t wait to test it.
Unfortunately I’m getting a recurring “Could not connect to MySQL Database” error, even after running silversmith fix-mamp. The fix-mamp script comes up ‘fixed’ but as soon as I run another command it’s the same issue.
Running on my dev copy of mamp, OSX 10.6.8.
Any suggestions?
Cheers and thanks!
I have a question about the yaml.
How can i create a HasOne relation in a Component? Do you have an example? I can’t figure it out.
By the way.
SilverSmith is a great tool.
Thanks
Hi, Pascal,
There’s no need for has_one with SilverSmith. That is all abstracted into the Fields node. What are you trying to create a has_one to? Here are some examples:
Fields:
Photo: {CMSField: Image}
RelatedPage: {CMSField: RelationDropdown, Map: SiteTree}
I want to create an Offer dataobject and an Application dataobject.
Based on youre example i created a Offer HasOne Application with:
Fields:
Application: {CMSField: RelationDropdown, Map:Application}
Thanks for that.
To complete my picture on how to create relations in the yaml file how to add for example an Application HasMany Offers and/or Application HasManyMany Offers.
Many Thanks
Right now i’m writing a little tool to create the basic project yaml based on an existing database. Do you have plans to add such tooling (DB to Yaml) to SilverSmith?
Greetings
Actually, I would make the plugin system a higher priority. Documentation is definitely required and a GUI would be nice. However, I’ve figured out quite a bit by just browsing the code and watching the videos. Adding a way to extend SilverSmith to allow modules like the SortableGridField and custom code to work is pretty critical. Otherwise, you run the risk of having to do away with using SilverSmith midway into a project due to requirements that SilverSmith won’t allow. Not fun.