def _renderHTML(self): from girder.utility import server self.vars['plugins'] = server.getPlugins() self.vars['pluginCss'] = [] self.vars['pluginJs'] = [] builtDir = os.path.join(constants.STATIC_ROOT_DIR, 'clients', 'web', 'static', 'built', 'plugins') for plugin in self.vars['plugins']: if os.path.exists(os.path.join(builtDir, plugin, 'plugin.min.css')): self.vars['pluginCss'].append(plugin) if os.path.exists(os.path.join(builtDir, plugin, 'plugin.min.js')): self.vars['pluginJs'].append(plugin) self.vars['apiRoot'] = server.getApiRoot() self.vars['staticRoot'] = server.getStaticRoot() self.vars['brandName'] = Setting().get(SettingKey.BRAND_NAME) self.vars['contactEmail'] = Setting().get( SettingKey.CONTACT_EMAIL_ADDRESS) self.vars['privacyNoticeHref'] = Setting().get( SettingKey.PRIVACY_NOTICE) self.vars['bannerColor'] = Setting().get(SettingKey.BANNER_COLOR) self.vars['registrationPolicy'] = Setting().get( SettingKey.REGISTRATION_POLICY) self.vars['enablePasswordLogin'] = Setting().get( SettingKey.ENABLE_PASSWORD_LOGIN) return super(Webroot, self)._renderHTML()
def main(dev, watch, watch_plugin, npm, reinstall, static_root): if shutil.which(npm) is None: raise click.UsageError( 'No npm executable was detected. Please ensure the npm executable is in your ' 'path, use the --npm flag, or set the "NPM_EXE" environment variable.' ) if watch and watch_plugin: raise click.UsageError( '--watch and --watch-plugins cannot be used together') if watch or watch_plugin: dev = True reinstall = False staging = _GIRDER_BUILD_ASSETS_PATH _generatePackageJSON( staging, os.path.join(_GIRDER_BUILD_ASSETS_PATH, 'package.json.template')) if not os.path.isdir(os.path.join(staging, 'node_modules')) or reinstall: # The autogeneration of package.json breaks how package-lock.json is # intended to work. If we don't delete it first, you will frequently # get "file doesn't exist" errors. npmLockFile = os.path.join(staging, 'package-lock.json') if os.path.exists(npmLockFile): os.unlink(npmLockFile) installCommand = [npm, 'install'] if not dev: installCommand.append('--production') check_call(installCommand, cwd=staging) quiet = '--no-progress=false' if sys.stdout.isatty( ) else '--no-progress=true' buildCommand = [ npm, 'run', 'build', '--', '--static-path=%s' % STATIC_ROOT_DIR, '--static-url=%s' % static_root or getStaticRoot(), quiet ] if watch: buildCommand.append('--watch') if watch_plugin: buildCommand.extend(['--watch', 'webpack:plugin_%s' % watch_plugin]) if dev: buildCommand.append('--env=dev') else: buildCommand.append('--env=prod') check_call(buildCommand, cwd=staging)
def _renderHTML(self): from girder.utility import server self.vars['plugins'] = server.getPlugins() self.vars['pluginCss'] = [] self.vars['pluginJs'] = [] builtDir = os.path.join(constants.STATIC_ROOT_DIR, 'clients', 'web', 'static', 'built', 'plugins') for plugin in self.vars['plugins']: if os.path.exists(os.path.join(builtDir, plugin, 'plugin.min.css')): self.vars['pluginCss'].append(plugin) if os.path.exists(os.path.join(builtDir, plugin, 'plugin.min.js')): self.vars['pluginJs'].append(plugin) self.vars['apiRoot'] = server.getApiRoot() self.vars['staticRoot'] = server.getStaticRoot() self.vars['brandName'] = Setting().get(SettingKey.BRAND_NAME) self.vars['contactEmail'] = Setting().get( SettingKey.CONTACT_EMAIL_ADDRESS) self.vars['bannerColor'] = Setting().get(SettingKey.BANNER_COLOR) self.vars['registrationPolicy'] = Setting().get(SettingKey.REGISTRATION_POLICY) self.vars['enablePasswordLogin'] = Setting().get(SettingKey.ENABLE_PASSWORD_LOGIN) return super(Webroot, self)._renderHTML()
def _renderHTML(self): from girder.utility import server self.vars['apiRoot'] = server.getApiRoot() self.vars['staticRoot'] = server.getStaticRoot() self.vars['brandName'] = Setting().get(SettingKey.BRAND_NAME) return super(ApiDocs, self)._renderHTML()