From 535db47e81cff6a149d6793d65bb0cce4c782a65 Mon Sep 17 00:00:00 2001 From: Kristian Mandrup Date: Wed, 25 May 2011 15:06:46 +0200 Subject: [PATCH] dummy exec described --- README.textile | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/README.textile b/README.textile index da07a09..f901e1f 100644 --- a/README.textile +++ b/README.textile @@ -1,6 +1,8 @@ h1. Multi App Engine -Similar to "enginex":https://github.com/josevalim/enginex but can generate and setup multiple individual dummy apps (configured for either Mongoid or Active Record) for testing your gem. +Similar to "enginex":https://github.com/josevalim/enginex but can generate and setup multiple individual dummy apps (configured for either Mongoid or Active Record) for testing your gem. The gem comes with the following executables: +* mangine - Create new Engine with Dummy apps +* dummy - operate on Dummy apps h2. Usage @@ -12,9 +14,9 @@ h2. Example usage Create a default engine called 'MyEngine' -@$ mengine my-engine@ +@$ mangine my-engine@ -Dummy apps: +Dummy apps generated: * _dummy-active_record_ h2. Design considerations and TODO @@ -24,29 +26,37 @@ The goal is to implement the functionality described in this section. h3. Multi app Export/Import The problem is, that the rails command doesn't work right within a directory with its own Gemfile. You need to first export the app to a sandbox, then run the -@bundle install@, @rails new@ or @rails g@ command in this sandbox environment and then importa the app again. I will isolate this functionality into a set of generators. +@bundle install@, @rails new@ or @rails g@ command in this sandbox environment and then importa the app again. +This functionality should be integrated into _export_ and _import_ commands on the *dummy* generator. -@export_dummies cancan_active_record ~/rails-dummies [--bundle]@ +@dummy export cancan_active_record ~/rails-dummies [--bundle]@ -@import_dummies cancan_active_record ~/rails-dummies [--bundle]@ +@dummy import cancan_active_record ~/rails-dummies [--bundle]@ The _sandbox_ command will export the dummy app to the sandbox (if not there), execute a given command on the dummy app then import the dummy app back in. -@sandbox_dummy cancan_active_record "bundle update" +@dummy sandbox cancan_active_record "bundle update" h3. Release dummy app There could also be a command to easily release a dummy app. The dummy should be linked to the current version of the gem/engine. Hence the VERSION file (or gemspec version) could be used to version stamp the gem statement in the dummy apps' Gemfile. The optional --github option could be used to indicate that the app should draw its engine from an alternative github source. This is useful if someone forks off the original engine and thus wants to demonstrate how the dummy app functions with his version of the engine gem. -@release_dummy cancan_active_record --github mike@ +@dummy release cancan_active_record --github mike@ h3. Multi app Generation There is also a need to be able to run a generator command across all dummy apps, such as fx: @rails g scaffold post name:string@ -Then for each dummy app, the generator will run via the dummy app configuration +Then for each dummy app, the generator will run via the dummy apps configuration. +The dummy _generate_ command will use the _sandbox_ command internally for execution and is merely a "shorthand" for this common operation. -@gen_dummies ALL "scaffold post name:string"@ +@dummy generate ALL "scaffold post name:string"@ + +The ALL name runs the scaffold on all dymmy apps. + +@dummy generate cancan devise "scaffold post name:string"@ --orms active_record + +When the _--orms_ option is used, the command is only run on dummy apps with matching orm postfix For this example it would generate a Mongoid Post model for the mongoid dummy and an AR model for the AR dummy etc. @@ -54,16 +64,17 @@ h3. Multi app Gem configuration The multiengine should also have a way to update a set of apps with gems. -@update_dummies cancan-mongoid cancan-active_record --gems devise cancan@ +@dummy update cancan-mongoid cancan-active_record --gems devise cancan@ This generator should for each of the listed dummy apps, insert the gem statement, run @bundle install@ and then attempt to run @cancan:install@ and @cancan:configure@ This should make it much easier to update the dummy apps with some configuration! +This _update_ command will also use the _sandbox_ command internally for execution. h2. Dummies for ORMs Create engine named 'MyEngine' and dummy apps configured for A.R and Mongoid -@$ mengine my-engine --orms mongoid ar@ +@$ mangine my-engine --orms mongoid ar@ Dummy apps: * _dummy-mongoid_ @@ -74,7 +85,7 @@ h2. Testing framework Create engine named 'Demox' and a single dummy app configured for Mongoid. Use Rspec as the testing framework for the engine. -@$ mengine demox --orms mongoid -t rspec@ +@$ mangine demox --orms mongoid -t rspec@ Dummy apps: * dummy-mongoid @@ -84,7 +95,7 @@ h2. Dummy application types Create engine named 'Demox' and create dummy apps for cancan and devise (types). For each type create dummy apps for A.R and Mongoid. Use Rspec as the testing framework. -@$ mengine demo --orms mongoid ar --types cancan devise -t rspec@ +@$ mangine demo --orms mongoid ar --types cancan devise -t rspec@ Dummy apps: * _dummy-cancan-mongoid_