Skip to content

Instantly share code, notes, and snippets.

@kristianmandrup
Created February 10, 2010 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristianmandrup/300201 to your computer and use it in GitHub Desktop.
Save kristianmandrup/300201 to your computer and use it in GitHub Desktop.
DRAFT
-----
The idea is to find the fingerprint over every type of 'application' and sign the app with a signature, using configurable application matchers.
An application can have multiple application signatures.
Fx a client-server app My-Blog could consist of
- client app = Sproutcore
- server app = Rails app
The My-Blog app would then contain both a Sproutcore and Rails signature file
The directory for the Rails app would contain a Rails signature file.
The directory for the Sproutcore app would contain a Sproutcore signature file.
The resulting directory structure with signature files could look like the following
- My-Blog
- sproutcore-apps
- my-blog
- .signatures
APP.WEB.SPROUTCORE
- rails-apps
- my-blog
- .signatures
APP.WEB.RUBY.RAILS
- .signatures
APP.WEB.SPROUTCORE
APP.WEB.RUBY.RAILS
Create new application
----------------------
When creating any kind of application using any kind of generator, the generator should ensure it is setup with appropriate signature files.
A configuration file can also be set up to automatically move the new application into a suitable place on the system (a dir).
Auto-handling existing applications without signatures
------------------------------------------------------
First run:
The Application Indexer can be run on a directory to traverse it and all its subdirectories, while matching each dir with the application matchers to detect potential applications and sign them with signature files.
After the first run through, the Indexer will only look at the signature files in order to perform.
Second run:
In the second run, composite applications are detected and signature files are made for these. For the example above, all subdirs of My-Blog are traversed and the Indexer will copy all the signatures it finds to the .signatures folder of My-Blog.
But how do you detect a composite application?
For a web application it would often consist of a client and server side app. But in principle it could consist simply of one or more server apps or one or more client apps. There are no hard rules. The same applies in other domains. For this reason there needs to be some harder meta-data in order to guide this decision.
Each sub-application must be postfixed with "-app" or "-apps" in order to be considered a potential sub-application, fx "rails-app" or "rails-apps" if there are multiple rails apps in this composite app.
Third run:
On the third run, all signature files should be correctly set up. The Indexer now performs handling of each type of application, fx moving them it to a new place and then performs indexing. This is done according to configuration, where each application type is hooked up to a chain of Application Handlers, each with a dedicated responsibility. One handler could perform the move, another handler could update the Application Index etc.
Detailed Application signatures
--------------------------------------------
In the future, the signatures should contain details on the application.
The maturity is set to incubation when the signature file is initially created.
The version can be increased in a similar fashion as Ruby gems.
Note: The following are to be implemented as Thor tasks.
# show current version
$ app version
# increase version
$ app version:bump:major
$ app version:bump:minor
$ app version:bump:patch
The following version to maturity rules apply:
version [0.1.0 - 0.3.0[ : incubation
version [0.3.0 - 1.0.0[ : young
version > 1.0.0 : mature
The version and maturity of a composite app should be independent of its sub-apps as demonstrated in the following example.
The composite maturity state of the app is always subjective in nature.
Global configuration are stored in $HOME/.app_indexer/.global_config
Author: kristian mandrup[kmandrup, kmandrup@gmail.com]
Contributors:
- mike jackson[mjackson, mike.jackson@gmail.com]
- mira jackson[mirajackson, mira.jackson@gmail.com]
Version: 0.1.0
The Rails app template should ask questions in order to fill out the initial app signature. Other app generators should be updated similarly.
$ rails my_blog
What is the name of your application [My Blog] ?
Summary [TODO] ?
Description [TODO] ?
Contributors [yN]?
Contributor mjackson [yN]?
Contributor mirajackson [yN]?
Homepage [www.blogs.com]? # use /my-blog to append to default homepage!
Version [0.1.0]?
Example - APP.WEB.COMPOSITE.signature:
-------
Name: My Blog
Summary: My first blog
Description: A blog about ruby and rails development
Authors: kristian mandrup[kmandrup@gmail.com], mike jackson[...]
Homepage: www.blogs.com/my-blog
Maturity: young
Categories: blog
Run-in: browser
Environment: desktop
OS: desktop/all
Use: professional
Version: 0.4.0
Apps:
- Rails_3
- Sproutcore_1
Example - APP.WEB.RAILS.3.signature:
-------
Authors: kristian mandrup[kmandrup@gmail.com], mike jackson[...]
Maturity: incubation
Version: 0.2.0
Apps:
- Rails_3
Databases:
- mysql
- mongo_db
Views:
- erb # any .erb files in app/views
- haml
Styles:
- css
- sass # any .sass files in /public
Models:
- active_record
- mongo_mapper
Test:
- rspec
- cucumber
- webrat
Services:
- REST
Example - APP.WEB.SPROUTCORE.1.signature:
Authors: kristian mandrup[kmandrup@gmail.com], mike jackson[...]
Maturity: young
Version: 0.6.0
Apps:
- Sproutcore_1
Indexing signature files
------------------------
Resulting .signature files are stored in an index with the info.
You can then search on application specifics using this index.
The index is stored as a YAML file.
Signature Index database example:
---------------------------------
Models:
- Mongo Mapper: *MongoMapper
- Active Record: *ActiveRecord
...
Applications:
-
my_app:
- Type: *RAILS2_APP
- Models:
- &MongoMapper
- &ActiveRecord
- Test:
...
It is simply an Object graph!
In the future it might be stored in a Mongo DB or sqlite 3 or whatever.
Using the Application Index
---------------------------
The Application Index makes it possible to search for applications matching certain criteria, either from command line or even in a web app!
Example search/filter:
- "Give me all the Rails 3 apps using Cucumber and Mongo Mapper."
This could in time be used by Git and other repos to enable similar functionality ;)
The signatures could act as 'tags' for an application.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment