Has anyone heard of a Ruby MVC framework for Apps/Scripts?
When Rails appeared – it was a revolutionary tool because it brought MVC to the masses of web developers and for once forced them to use design patterns and conventions. I'm looking for something like that but for scripting mundane admin tasks that are to be ran from cron or by user: updates, backups, admin tool box, etc. Now I'm sure everyone has their own favorite way of setting up their apps and toolboxes, but I was wondering if there is an MVC way of doing things. Something that would force me to use design patterns and conventions (I'm guilty, like I'm sure everyone else, to use shortcuts occasionally).
Now I've tried narf and bowline – but I think narf was abandoned, and bowline is geared towards GUI and is in early alpha.
Based on the feedback I'd like to clarify: when you start a new web app – no matter how small – you are going to use ruby or merb or ramaze or what have you. You do this to be able to use all the goodies and best practices from these frameworks. Of course you could just write your own little server and one file web app, but why? So I'm wondering if there is a framework like that for apps/scripts.
So does anyone have any recommendation?
To comment on a few comments below:
@Michael: I looked into chef and puppet before, both are good but – they are more for automating setup tasks, not writing apps.
@mansu: I don't want to replace Cron or Scheduled Tasks – they do good job already. I just want them to run my MVC scripts.
@Robert: Anvil sounds to be abandoned – the last update is from 2007 and it is geared to be a GUI framework. I don't think this is an overkill – and the reason is that right now I have about 40 scripts that are used (updating data from customers csv to mysql, running backups, running scripts on ftp, etc) and I'm sure it is bound to grow. What I came to realize is that some of my scripts do the same thing – like update data from csv to mysql, so I refactored my code to have a common library that uses a config file. So it isn't an overkill I think. I was just wondering if there is already a framework for this.
@mereghost: RuGUI is very interesting from the GUI perspective and warrants futher investigation. Seems to be actively maintained. I will see if I can use it or if I can maybe develop something based of it.
@bantic: not sure how I missed thor – I checkout Katz's blog from time to time. It is somewhat like what I was looking for, but not quite in a sense that it's geared to develop one tool with a bunch of options, i.e. copy command with a bunch of params on how to do copy. I want something where it's more of an app that has a bunch of tasks.
@Chuck: Chuck, I was thinking pretty much the same, until I started writing scripts that update DB. So in that sense I do have M part of MVC, if not view. You could potentially argue that I just have one view – console, or that I even have multiple – let's say my script needs to run daily and update some .xls file on a share, but also output it as csv, and maybe tsv file, and be able to do xml for consumption by a client service. While the conversion to file types (aka formatter in Rails) occurs in Controller, the actual layout of the data ( let's say they want some fields to be bolded and blue in .xls, and rearranged columns) should occur in View. I'm getting a feeling that I'm over complicating things, but on the other hand – that's what PHP developers used to say of frameworks until Rails came along spurred PHP knock-offs. 🙂
Also to continue with this example – let's say I have a model – ClientData, that is used by various scripts – some write to that table, some grab that data. Right now I have 4 script that use various parts of that table to import/export csv, and I use DBI::MySQL to create my queries and execute them. The problem is thou that once I make a change to that Model ( Table) – I need to make sure that I update all 4 scripts, to reflect a change in the column name or something. Right now I resorted to having a small lib of objects and config files that I require on script load. But I was hoping to use a proper framework to do this rather than Jerry-rigged solution 🙂 Also this not a for a web app. I don't need a web interface – as the only 2 people having access to this are myself and another system admin. Potentially I may need to provide some sort of access to users – so that authorized people can force to run certain scripts – but that is not a requirement and use said I can bootstrap Sinatra to do this .