Way to have my own recipe without resorting to adding it into the Setup module?

Topics: Customizing Orchard, Writing modules
Dec 25, 2011 at 6:14 AM

I love the Startup Module and the ease of creating a recipe that is perfect for a person's setup.  I have done exactly that but did it by including it into the Orchard.Setup module itself.  Not ideal of course.  Is there a better/proper way to include my own recipe file without having it specifically added to the Orchard.Setup Recipes folder? 

Coordinator
Dec 27, 2011 at 9:41 AM

That's the place...

Dec 28, 2011 at 1:03 AM
bertrandleroy wrote:

That's the place...

If I want to create and maintain a recipe outside of the core product should I have a separate project, build process or installer that dumps it into the Setup/Recipe folder?  I'd like to be able to create a set of themes, recipes, and modules that do not rely on having to modify the core product source control in order to function.  

Do you have a suggestion for the best approach to this?  I guess I could recommend a core code change that would look for and enable a specific module name (like SetupExtension) during the setup process that would (if it finds it) enable it and have access to the recipes included in that module...but I'm guessing there is a better way than that (maybe simpler too).

Thanks for the insight and assistance.

Coordinator
Dec 28, 2011 at 1:45 AM

The guideline would be to create your own distribution that would include your recipe as part of the build process for the package.

Dec 28, 2011 at 8:01 PM

Corecomps, I'm doing my site development in a similar manner to what it sounds like you want to do. I wanted to isolate from the orchard source as much as possible, but still give myself the opportunity to develop using the orchard source, and update code there when I want to (mainly pulling code commits from the orchard project -- I haven't modified any code there myself). 

 

Here's what I did: 

  • extract orchard 1.3.10 source to c:\orchard\
  • my project, which is source controlled in SVN, lives in c:\svn_projects\mysite\orchard\
  • Folder structure: 
  • c:\svn_projects\mysite\orchard\
        Orchard.Web\
            Modules\
                 MySiteModule\
                 Orchard.Setup\
                     Recipes\
                         mysite.recipe.xml
            Themes\
                 MySiteTheme\
        MySite-Orchard.sln
        setup_symlinks.bat

 

Setup_symlinks.bat gets copied to c:\orchard\src\, and executed there. It creates a symbolic link from the orchard source to my source controlled project folders for the following files/folders: 

 

MySite-Orchard.sln

Orchard.Web\Modules\MySiteModule\

Orchard.Web\Modules\Orchard.Setup\Recipes\mysite.recipe.xml

 Orchard.Web\Themes\MySiteTheme\

 

There are probably much better ways to do this, but this works for me so far. I might replace the process with an msbuild script if I find myself starting from scratch on a regular basis. I also have a db script to drop and recreate the DB that I point orchard to, and set up the dbo user for Orchard. When I want to start fresh I do this: 

  1. Wipe out c:\orchard\, and get fresh copy of the Orchard code from codeplex (alternatively, just wipe out c:\orchard\src\Orchard.Web\App_Data\*.* )
  2. Run my db script to drop and recreate the db that Orchard uses
  3. Copy my setup_symlinks
  4. Execute setup_symlinks.bat
  5. Open c:\orchard\src\MySite-Orchard.sln in VS2010, and hit Ctrl+F5 to run the app
  6. (browser window opens to Orchard setup screen) -> fill out the settings, and select my recipe from the droplist (Orchard picks up my recipe thanks to the setup_symlinks.bat script)

 

Hope this helps.