Ruby App MVC framework (not a web interface)

Has anyone heard of the Ruby MVC framework for applications / scripts?

When Rails appeared, it was a revolutionary tool because it attracted MVC to the masses of web developers and this time forced them to use design patterns and conventions. I am looking for something similar, but for scripts of mundane admin tasks that should be run from cron or from the user: updates, backups, admin toolbar, etc. Now I’m sure that everyone has their own favorite way to configure applications and toolkits, but I was wondering if there is a way to execute MVC. Something that would force me to use design patterns and conventions (I'm to blame, like me, everyone else, sometimes use shortcuts).

Now I tried the narf and the bow, but I think the narf was abandoned and the bow is GUI oriented and is in early alpha.

Based on the reviews, I would like to clarify: when you start a new web application - no matter how small - you are going to use ruby ​​or merb or ramaze or whatever you have. You do this to take full advantage and best practices from these frameworks. Of course, you could just write your own server and one network application, but why? Therefore, I am wondering if there is such a platform for applications / scripts.

Anyone have any recommendations?


Comment on a few comments below: @Michael: I used to look at the chef and puppet, both are good, but - they are more designed to automate configuration tasks, and not to write applications.

@mansu: I don't want to replace Cron or scheduled tasks - they already do a good job. I just want them to run my MVC scripts.

@Robert: Anvil sounds for failure - the latest update since 2007, and it is designed to create a graphical interface. I don’t think this is too much, and the reason is that now I have about 40 scripts used (updating data from csv clients to mysql, starting backups, running scripts on ftp, etc.), and I'm sure what it should grow. I realized that some of my scripts do the same as the update data from csv to mysql, so I reworked my code to have a shared library that uses the configuration file. I think this is not too much. I just wondered if there was already a basis for this.

@mereghost: RuGUI is very interesting in terms of GUI and needs further study. Seems to be actively supported. I will see if I can use it, or if I can, perhaps, develop something based on it.

@bantic: I don’t know how I missed the ax - from time to time I check Katz’s blog. This is similar to what I was looking for, but not quite in the sense that it is designed to develop a single tool with many options, i.e. Copy commands with a set of options on how to make a copy. I want something where there are more applications that have many tasks.

@Chuck: Chuck, I thought almost the same way until I started writing scripts that update the database. Therefore, in this sense, I have the M-part of MVC, if not kind. You could argue that I just have one viewing console or I even have several - let them say that my script should run daily and update some .xls file on the shared resource, but also output it as csv, or maybe tsv file and be able to do xml for consumption by the customer service. Although conversion to file types (aka formatter in Rails) takes place in the controller, the actual data layout (let them want some fields to be in bold and blue in .xls and rearranged columns) should appear in the view. I get the feeling that I'm complicating the situation too much, but on the other hand, this is what the PHP developers talked about frameworks until Rails came under the influence of PHP knockouts. :-)

Also, to continue this example - let's say I have a model - ClientData, which is used by different scripts - some write to this table, some capture this data. Right now I have 4 scripts that use different parts of this table to import / export csv, and I use DBI :: MySQL to create my queries and execute them. The problem is that as soon as I make changes to this model (table) - I need to make sure that I update all 4 scripts to reflect the change in the column name or something else. Right now, I resorted to having a small library of objects and configuration files that I need when loading the script. But I was hoping to use the right structure to do this, and not a Jerry-based solution :-) Also, this is not for a web application. I do not need a web interface, since only 2 people have access to this self and another system administrator. Potentially, I may need some access for users - so that authorized people can force them to run certain scripts, but this is not a requirement, and I said that I can download Sinatra for this.

+4
source share
6 answers

For this kind of problem, it seems that you want the whole structure of the rails application, but the ability to use it for administrative tasks. One solution is to use the rails themselves, so you get mvc, testing, and many supporting programs, but instead of running scriipt / console to run the web application, use script / runner to run the ruby ​​code in the rails project.

cd rails commands script commands / back up rake db: migrate model

This is the skeleton that launches you without errors. Then add some features to your model:

def Backup database def put "Internal backup database" end end

and run it with script / runner

script / runner "Backup.new (). do_database"

And if you ever decide to do this in a web application, you do not need to move your code. You can even add this idea to an existing web application if you have code that you want to reuse.

+1
source

I'm not sure that this is exactly what you are looking for, but you should consider a chef who is oriented towards solving administrative problems in a fairly uniform manner.

Perhaps this does not quite fit the bill, but perhaps it will give some inspiration.

+1
source

For GUI applications, there was an “infrastructure” named RuGUI (or something like that).

For scripts, well, these are scripts. = p You can embed the MVC design pattern in everything you write without requiring a framework for this.

+1
source

I saw some libraries, such as cronedit, that let you run cron jobs using ruby. But I have yet to see the library that quality products. It might be a good idea to write one and let us know.

0
source
0
source

My opinion is that MVC is a kind of departure for sysadmin tasks. Therefore, I assume that you really do not want MVC, since you really have no models or views, do you really have controllers and the resulting actions?

But you want an agreement, if I understand correctly, and thus Puppet is probably the correct answer. This is a community supported scripting method and can be run via cron or whatever you like.

On the other hand, if you want to use webapp so that people can run admin tasks like cPanel, then you will use rails / sinatra and just connect it to delayed_job or something like that.

One of the last command line options is to use sake, which is a bypass server and defines tasks in this way.

Did I understand my assumptions correctly?

0
source

All Articles