Aloha,

I created some convenience functions called
erlyweb:create_components/2 and erlyweb:create_components/3.

These work exactly like the singular variant erlweb:create_component/2 
and /3. But in this case the plural functions accept lists of atoms in 
the first parameter.

Like this:

LotsaComponents = [entry, category, tag].
erlyweb:create_components(LotsaComponents, "/projectX").

Options = [{magic, on}, {model, off}, {erltl, on}].
TonsaComponents = [header, tail].
erlyweb:create_components(TonsaComponents, "/projectX", Options).

==Patch starts here==
--- erlyweb.erl.bak     2008-07-25 15:51:01.000000000 +0200
+++ erlyweb.erl 2008-07-25 17:26:51.000000000 +0200
@@ -16,6 +16,8 @@
          create_app/2,
          create_component/2,
          create_component/3,
+        create_components/3,
+        create_components/2,
          compile/1,
          compile/2,
          out/1,
@@ -88,6 +90,29 @@
         Other -> Other
      end.

+%% @doc Create all files like the singular create_component/3 function
+%% but make multiple.
+%% @spec create_components
+%%     ( Components::[ atom() | string() ]
+%%     , AppDir::string()
+%%     , Options::[option()])
+%%             ->
+%%                     [ ok | {error, Err}]
+create_components (Components, AppDir, Options) ->
+    F = fun (C) ->
+        if
+            is_atom(C) -> atom_to_list(C);
+            true -> C
+        end
+    end,
+    [ create_component(F(Component), AppDir, Options) || Component <- 
Components ].
+
+%% @doc Create all files like the singular create_component/2 function
+%% @equiv create_components (Components, AppDir, [{magic, on}, {model, 
on}, {erltl, off}])
+create_components (Components, AppDir) ->
+  Options = [{magic, on}, {model, on}, {erltl, off}],
+  create_components (Components, AppDir, Options).
+
  %% @doc Compile all the files for an application. Files with the '.et'
  %%   extension are compiled with ErlTL.
  %%
==Patch ends here==

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to