@@ -37,12 +37,12 @@ function setup(options, imports, register, app) {
3737 } ;
3838
3939 // Load addons list from a directory return as a map name -> addon
40- var loadAddonsInfos = function ( addonsRoot , options ) {
40+ var loadAddonsInfos = function ( addonsRoot , _options ) {
4141 // Diretcory to explore
4242 addonsRoot = addonsRoot || configAddonsPath ;
4343
4444 // Options
45- options = _ . defaults ( { } , options || { } , {
45+ _options = _ . defaults ( { } , _options || { } , {
4646 ignoreError : false
4747 } ) ;
4848
@@ -52,14 +52,14 @@ function setup(options, imports, register, app) {
5252 if ( dir . indexOf ( '.' ) == 0 ) return Q ( addons ) ;
5353
5454 var addonPath = path . join ( addonsRoot , dir ) ;
55- var addon = new Addon ( logger , addonPath ) ;
55+ var addon = new Addon ( logger , addonPath , options ) ;
5656 return addon . load ( ) . then ( function ( ) {
5757 addon . infos . default = isDefaultAddon ( addon ) ;
5858 addons [ addon . infos . name ] = addon ;
5959 return Q ( addons ) ;
6060 } , function ( err ) {
6161 logger . error ( "error" , err ) ;
62- if ( options . ignoreError ) {
62+ if ( _options . ignoreError ) {
6363 // When ignoring error
6464 // it will check that the addon is not a symlink
6565 // and unlink invalid ones
@@ -123,6 +123,12 @@ function setup(options, imports, register, app) {
123123 }
124124 } )
125125 . then ( function ( ) {
126+ // Blacklist
127+ if ( addon . isBlacklisted ( ) ) {
128+ logger . error ( "Default addon" , addon . infos . name , "is blacklisted" ) ;
129+ return Q ( ) ;
130+ }
131+
126132 // Relink it
127133 //logger.log("link ", addon.root, configAddonsPath)
128134 return addon . symlink ( configAddonsPath ) ;
@@ -131,10 +137,10 @@ function setup(options, imports, register, app) {
131137 } ;
132138
133139 // Install an addon by its git url
134- var installAddon = function ( git , options ) {
140+ var installAddon = function ( git , _options ) {
135141 var addon , tempDir ;
136142
137- options = _ . defaults ( { } , options || { } , {
143+ _options = _ . defaults ( { } , _options || { } , {
138144
139145 } ) ;
140146
@@ -158,9 +164,14 @@ function setup(options, imports, register, app) {
158164 return repo . checkout ( gitRef ) ;
159165 } ) . then ( function ( ) {
160166 // Load addon
161- addon = new Addon ( logger , tempDir ) ;
167+ addon = new Addon ( logger , tempDir , options ) ;
162168 return addon . load ( ) ;
163169 } ) . then ( function ( ) {
170+ // Blacklist
171+ if ( addon . isBlacklisted ( ) ) {
172+ return Q . reject ( new Error ( "Addon " + addon . infos . name + "is blacklisted" ) ) ;
173+ }
174+
164175 // Valid installation of addon with a hook
165176 return hooks . use ( "addons" , addon . infos ) ;
166177 } ) . then ( function ( ) {
0 commit comments