No commit activity in last 3 years
No release in over 3 years
Creates a Rails 3 engine configuration with multiple dummy apps and test framework configured and ready to go
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.4
~> 3.1.0.rc1
~> 0.9
>= 2.5
~> 0.14.6
 Project Readme

Multi App Engine

Similar to 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

Usage

$ mengine ENGINE_NAME [options]

Use —help to see supported options.

Example usage

Create a default engine called ‘MyEngine’

$ mangine my-engine

Dummy apps generated:

  • dummy-active_record

Design considerations and TODO

The goal is to implement the functionality described in this section.

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.
This functionality should be integrated into export and import commands on the dummy generator.

dummy export cancan_active_record --sandbox ~/rails-dummies [--bundle]

dummy import cancan_active_record --sandbox ~/rails-dummies

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.

dummy sandbox cancan_active_record --command "bundle update"

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.

dummy release cancan_active_record --github mike

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 apps configuration.
The dummy generate command will use the sandbox command internally for execution and is merely a “shorthand” for this common operation.

dummy generate ALL "scaffold post name:string"

The ALL name runs the scaffold on all dymmy apps.

dummy generate cancan devise --command "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.

Multi app Gem configuration

The multiengine should also have a way to update a set of apps with gems.

dummy update cancan-mongoid cancan-active_record

Run bundle update on each dummy app

dummy install cancan-mongoid cancan-active_record --gems devise cancan

Run bundle install after inserting gems into Gemfile of each dummy app
This command should also attempt to run cancan:install and cancan:configure

These commands should make it much easier to update the dummy apps with some configuration!

This update and install commands will also use the sandbox command internally for execution.

Notes on scaffolding

See scaffoldhub

Would be a cool thing to get rolling…

Dummies for ORMs

Create engine named ‘MyEngine’ and dummy apps configured for A.R and Mongoid

$ mangine my-engine --orms mongoid ar

Dummy apps:

  • dummy-mongoid
  • dummy-active_record

Testing framework

Create engine named ‘Demox’ and a single dummy app configured for Mongoid.
Use Rspec as the testing framework for the engine.

$ mangine demox --orms mongoid -t rspec

Dummy apps:

  • dummy-mongoid

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.

$ mangine demo --orms mongoid ar --types cancan devise -t rspec

Dummy apps:

  • dummy-cancan-mongoid
  • dummy-cancan-active_record
  • dummy-devise-mongoid
  • dummy-devise-active_record

Bugs and Feedback

If you discover any bugs, feel free to send me a message or create an issue on GitHub tracker

MIT License. Copyright 2011 Kristian Mandrup