Skip to content

Instantly share code, notes, and snippets.

@bookshelfdave
Forked from marcparadise/user_default
Last active August 29, 2015 14:08
Show Gist options
  • Save bookshelfdave/2a1a666a8b70d590c688 to your computer and use it in GitHub Desktop.
Save bookshelfdave/2a1a666a8b70d590c688 to your computer and use it in GitHub Desktop.
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
-module(user_default).
-compile(export_all).
-include("/srv/piab/mounts/oc_erchef/deps/chef_objects/include/chef_types.hrl").
-include("/srv/piab/mounts/oc_erchef/deps/oc_chef_authz/include/oc_chef_authz.hrl").
-include("/srv/piab/mounts/oc_erchef/deps/oc_chef_authz/include/oc_chef_types.hrl").
%-include("/srv/piab/mounts/oc_erchef/deps/oc_chef_wm/include/oc_chef_wm.hrl").
%-include("/srv/piab/mounts/oc_erchef/deps/chef_wm/include/chef_wm.hrl").
kill_cleanup() ->
exit(whereis(oc_chef_authz_cleanup), die).
update_mod(Mod) ->
Info = Mod:module_info(),
CompileInfo = proplists:get_value(compile, Info),
Path = proplists:get_value(source, CompileInfo),
Options = [{d, 'BASE_RESOURCE', oc_chef_wm_base},
{d, 'OC_CHEF'},
{debug_info, debug_info},
{d, 'BASE_ROUTES', oc_chef_wm_routes},
{d,'CHEF_WM_DARKLAUNCH',xdarklaunch_req},
{d,'CHEF_DB_DARKLAUNCH',xdarklaunch_req},
{parse_transform,lager_transform},
{i, "include"},
{i, "/srv/piab/mounts/oc_erchef/deps/oc_chef_wm/include"},
{i, "/srv/piab/mounts/oc_erchef/deps/chef_wm/include"},
{i, "/srv/piab/mounts/oc_erchef/deps/chef_db/include"},
{i, "/srv/piab/mounts/oc_erchef/deps/chef_objects/include"},
{i, "/srv/piab/mounts/oc_erchef/deps/oc_chef_authz/include"},
binary],
case compile:file(Path, Options) of
{ok, _Mod, Bin, Warnings} ->
reload(Mod, Path, Bin),
Warnings;
{ok, _Mod, Bin} ->
reload(Mod, Path, Bin),
ok;
Error ->
Error
end.
reload(Mod, Path, Binary) ->
code:delete(Mod),
code:purge(Mod),
code:load_binary(Mod, Path, Binary).
@bookshelfdave
Copy link
Author

I think you can build the beam with erlc, and drop it into /srv/piab/mount/oc_erchef/rel, then launch oc_erchef console from there and it wll pick it up.  Once leaded you can update_mod(modified-mod-name) from the console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment