123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Deploy\Console;
- use Symfony\Component\Console\Input\InputOption;
- use Symfony\Component\Console\Input\InputArgument;
- /**
- * Static Content Deployment Options helper
- *
- * This class contains the list options and their related constants,
- * which can be used for static content deployment CLI command
- */
- class DeployStaticOptions
- {
- /**
- * Key for area option
- */
- const AREA = 'area';
- /**
- * Key for exclude area option
- */
- const EXCLUDE_AREA = 'exclude-area';
- /**
- * Key for theme option
- */
- const THEME = 'theme';
- /**
- * Key for exclude theme option
- */
- const EXCLUDE_THEME = 'exclude-theme';
- /**
- * Key for languages parameter
- */
- const LANGUAGE = 'language';
- /**
- * Key for exclude languages parameter
- */
- const EXCLUDE_LANGUAGE = 'exclude-language';
- /**
- * Use specific deployment strategy
- */
- const STRATEGY = 'strategy';
- /**
- * Key for jobs option
- */
- const JOBS_AMOUNT = 'jobs';
- /**
- * Force run of static deploy
- */
- const FORCE_RUN = 'force';
- /**
- * Symlink locale if it not customized
- */
- const SYMLINK_LOCALE = 'symlink-locale';
- /**
- * Key for javascript option
- */
- const NO_JAVASCRIPT = 'no-javascript';
- /**
- * Key for css option
- */
- const NO_CSS = 'no-css';
- /**
- * Key for fonts option
- */
- const NO_FONTS = 'no-fonts';
- /**
- * Key for images option
- */
- const NO_IMAGES = 'no-images';
- /**
- * Key for html option
- */
- const NO_HTML = 'no-html';
- /**
- * Key for html option
- */
- const NO_HTML_MINIFY = 'no-html-minify';
- /**
- * Key for misc option
- */
- const NO_MISC = 'no-misc';
- /**
- * Key for dry-run option
- *
- * @deprecated since 2.2.0
- */
- const DRY_RUN = 'dry-run';
- /**
- * Key for less option
- *
- * @deprecated since 2.2.0
- */
- const NO_LESS = 'no-less';
- /**
- * Default jobs amount
- */
- const DEFAULT_JOBS_AMOUNT = 0;
- /**
- * Key for languages parameter
- */
- const LANGUAGES_ARGUMENT = 'languages';
- /**
- * Static content version
- */
- const CONTENT_VERSION = 'content-version';
- /**
- * Key for refresh content version only mode
- */
- const REFRESH_CONTENT_VERSION_ONLY = 'refresh-content-version-only';
- /**
- * Deploy static command options list
- *
- * @return array
- */
- public function getOptionsList()
- {
- return array_merge($this->getBasicOptions(), $this->getSkipOptions());
- }
- /**
- * Basic options
- *
- * @return array
- */
- private function getBasicOptions()
- {
- return [
- new InputOption(
- self::FORCE_RUN,
- '-f',
- InputOption::VALUE_NONE,
- 'Deploy files in any mode.'
- ),
- new InputOption(
- self::STRATEGY,
- '-s',
- InputOption::VALUE_OPTIONAL,
- 'Deploy files using specified strategy.',
- 'quick'
- ),
- new InputOption(
- self::AREA,
- '-a',
- InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
- 'Generate files only for the specified areas.',
- ['all']
- ),
- new InputOption(
- self::EXCLUDE_AREA,
- null,
- InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
- 'Do not generate files for the specified areas.',
- ['none']
- ),
- new InputOption(
- self::THEME,
- '-t',
- InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
- 'Generate static view files for only the specified themes.',
- ['all']
- ),
- new InputOption(
- self::EXCLUDE_THEME,
- null,
- InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
- 'Do not generate files for the specified themes.',
- ['none']
- ),
- new InputOption(
- self::LANGUAGE,
- '-l',
- InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
- 'Generate files only for the specified languages.',
- ['all']
- ),
- new InputOption(
- self::EXCLUDE_LANGUAGE,
- null,
- InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
- 'Do not generate files for the specified languages.',
- ['none']
- ),
- new InputOption(
- self::JOBS_AMOUNT,
- '-j',
- InputOption::VALUE_OPTIONAL,
- 'Enable parallel processing using the specified number of jobs.',
- self::DEFAULT_JOBS_AMOUNT
- ),
- new InputOption(
- self::SYMLINK_LOCALE,
- null,
- InputOption::VALUE_NONE,
- 'Create symlinks for the files of those locales, which are passed for deployment, '
- . 'but have no customizations.'
- ),
- new InputOption(
- self::CONTENT_VERSION,
- null,
- InputArgument::OPTIONAL,
- 'Custom version of static content can be used if running deployment on multiple nodes '
- . 'to ensure that static content version is identical and caching works properly.'
- ),
- new InputOption(
- self::REFRESH_CONTENT_VERSION_ONLY,
- null,
- InputOption::VALUE_NONE,
- 'Refreshing the version of static content only can be used to refresh static content '
- . 'in browser cache and CDN cache.'
- ),
- new InputArgument(
- self::LANGUAGES_ARGUMENT,
- InputArgument::IS_ARRAY,
- 'Space-separated list of ISO-639 language codes for which to output static view files.'
- ),
- ];
- }
- /**
- * Additional options
- *
- * Used to re-deploy specific types of static files
- *
- * @return array
- */
- private function getSkipOptions()
- {
- return [
- new InputOption(
- self::NO_JAVASCRIPT,
- null,
- InputOption::VALUE_NONE,
- 'Do not deploy JavaScript files.'
- ),
- new InputOption(
- self::NO_CSS,
- null,
- InputOption::VALUE_NONE,
- 'Do not deploy CSS files.'
- ),
- new InputOption(
- self::NO_LESS,
- null,
- InputOption::VALUE_NONE,
- 'Do not deploy LESS files.'
- ),
- new InputOption(
- self::NO_IMAGES,
- null,
- InputOption::VALUE_NONE,
- 'Do not deploy images.'
- ),
- new InputOption(
- self::NO_FONTS,
- null,
- InputOption::VALUE_NONE,
- 'Do not deploy font files.'
- ),
- new InputOption(
- self::NO_HTML,
- null,
- InputOption::VALUE_NONE,
- 'Do not deploy HTML files.'
- ),
- new InputOption(
- self::NO_MISC,
- null,
- InputOption::VALUE_NONE,
- 'Do not deploy files of other types (.md, .jbf, .csv, etc.).'
- ),
- new InputOption(
- self::NO_HTML_MINIFY,
- null,
- InputOption::VALUE_NONE,
- 'Do not minify HTML files.'
- )
- ];
- }
- }
|