| 90 | | You can check the already given application base directories: |
| | 90 | If the application has additional include directories, then these directories has to be also set in advance: |
| | 91 | |
| | 92 | {{{ |
| | 93 | #!erlang |
| | 94 | ri:addenv(include, "path/to/my/incldir"). |
| | 95 | }}} |
| | 96 | |
| | 97 | If the application build process contains compile-time macros, then these macros also can be set: |
| | 98 | |
| | 99 | {{{ |
| | 100 | #!erlang |
| | 101 | %if it is only used in ifdef forms. |
| | 102 | ri:addenv(def, 'my_macro'). |
| | 103 | |
| | 104 | ri:addenv(def, {'my_macro', my_macro_value}). |
| | 105 | }}} |
| | 106 | |
| | 107 | If the include forms of the application contain OS based enviromental nodes, then these nodes can be set: |
| | 108 | |
| | 109 | {{{ |
| | 110 | #!erlang |
| | 111 | ri:addenv(env_var, {os_env_name, "os_env_path"}). |
| | 112 | }}} |
| | 113 | |
| | 114 | Let's see an example: |
| | 115 | |
| | 116 | The Emakefile has the following contents: |
| | 117 | {{{ |
| | 118 | #!erlang |
| | 119 | |
| | 120 | {"/home/user/dev/lib/app1/src/*", |
| | 121 | [{i,"/home/user/dev/lib/"}, |
| | 122 | {d,'MY_MACRO', "ITS_VALUE"}, |
| | 123 | {outdir,"/home/user/dev/lib/app1/ebin"}]}. |
| | 124 | |
| | 125 | {"/home/user/dev/lib/app2/src/*", |
| | 126 | [{i,"/home/user/dev/lib/"}, |
| | 127 | {d,'MY_MACRO', "ITS_VALUE"}, |
| | 128 | {outdir,"/home/user/dev/lib/app2/ebin"}]}. |
| | 129 | |
| | 130 | {"/home/user/dev/lib/app3/src/*", |
| | 131 | [{i,"/home/user/dev/lib/share/include/"}, |
| | 132 | {i,"/home/user/dev/lib/"}, |
| | 133 | {outdir,"/home/user/dev/lib/app3/ebin"}]}. |
| | 134 | }}} |
| | 135 | |
| | 136 | To add {{{app1}}}, {{{app2}}}, {{{app3}}} to !RefactorErl you should do the followings: |
| | 137 | {{{ |
| | 138 | #!erlang |
| | 139 | |
| | 140 | % add app1, app2 with the same configuration |
| | 141 | ri:addenv(appbase, "/home/user/dev/lib/"), |
| | 142 | ri:addenv(def, {'MY_MACRO', "ITS_VALUE"}), |
| | 143 | |
| | 144 | Apps = [app1, app2], |
| | 145 | [ri:add(home, App) || App <- Apps]. |
| | 146 | |
| | 147 | % add app3 after the configuration has been modified |
| | 148 | ri:delenv(def), |
| | 149 | ri:addenv(include, "/home/user/dev/lib/share/include/"), |
| | 150 | |
| | 151 | ri:add(home, app3). |
| | 152 | |
| | 153 | }}} |
| | 154 | |
| | 155 | |
| | 156 | You can check the already given application base directories by listing all of the enviromental nodes: |
| | 163 | It is possible to delete the defined environment variables: |
| | 164 | |
| | 165 | {{{ |
| | 166 | #!erlang |
| | 167 | ri:delenv(include). |
| | 168 | }}} |
| | 169 | |
| | 170 | Or you can set an environmental variable to another value: |
| | 171 | {{{ |
| | 172 | #!erlang |
| | 173 | ri:setenv(env_name, "path/to/new_value"). |
| | 174 | }}} |
| | 175 | |
| | 176 | {{{ |
| | 177 | #!comment |
| | 178 | The following enviromental nodes can be set via the {{{ri}}} module: |
| | 179 | |
| | 180 | {{{output}}}: Where does RefactorErl write changes in? |
| | 181 | |
| | 182 | {{{appbase}}}: The list of the used application based directories. |
| | 183 | |
| | 184 | {{{include}}}: The list of the used include directories. |
| | 185 | |
| | 186 | {{{def}}}: The list of the compile-time macros. |
| | 187 | |
| | 188 | {{{env_var}}}: The list of the OS based enviromental nodes. |
| | 189 | |
| | 190 | }}} |
| | 191 | |
| | 192 | {{{ |
| | 193 | #!comment |