{"id":18939060,"url":"https://github.com/monai/gulp-brass","last_synced_at":"2025-04-15T19:30:37.492Z","repository":{"id":25272002,"uuid":"28697472","full_name":"monai/gulp-brass","owner":"monai","description":"Build RPM package","archived":false,"fork":false,"pushed_at":"2016-04-22T14:55:54.000Z","size":202,"stargazers_count":13,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-29T01:12:57.595Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-01T22:39:01.000Z","updated_at":"2024-02-22T08:55:43.000Z","dependencies_parsed_at":"2022-08-25T02:41:01.812Z","dependency_job_id":null,"html_url":"https://github.com/monai/gulp-brass","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fgulp-brass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fgulp-brass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fgulp-brass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fgulp-brass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monai","download_url":"https://codeload.github.com/monai/gulp-brass/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248573812,"owners_count":21126906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T12:16:15.243Z","updated_at":"2025-04-15T19:30:37.075Z","avatar_url":"https://github.com/monai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-brass\n\n[![Build Status](http://img.shields.io/travis/monai/gulp-brass/develop.svg)](https://travis-ci.org/monai/gulp-brass)\n[![NPM Version](http://img.shields.io/npm/v/gulp-brass.svg)](https://www.npmjs.org/package/gulp-brass)\n\nBuild RPM package.\n\n## Introduction\n\nThis is a wrapper around [`rpmbuild`](https://fedoraproject.org/wiki/How_to_create_an_RPM_package#The_basics_of_building_RPM_packages) command and SPEC file generator done in gulp way. It covers subset of RPM features required to package, deploy, and run application on (usually) server. That is, it's possible but not encouraged to to use gulp-brass as a tool to package software for publishing to end users. On the contrary, you should see gulp-brass as deployment tool for, but not limited to, your own applications.\n\ngulp-brass follows gulp pattern `gulp.src(...)` -\u003e `transform` -\u003e `gulp.dest(...)`. From this pattern emerges core gulp-brass API design principle: sane defaults and extensibility over configuration. Following this, provided SPEC file and service file templates are and will be kept at bare minimum. If you want to extend them, you should copy and modify provided files or write your own from scratch and pass them to `gulp.src(...)`. Not so rare example cases would be adding pre/post install/uninstall hooks to SPEC file or using advanced systemd features.\n\n## How to use\n\nBelow is API documentation but it's highly recommended look at [examples](/examples) to see how gulpfile might look as a whole.\n\n## FAQ\n\n**Q: How to create user during RPM installation?**\n\nA: See [example](/examples/node-advanced/gulpfile.js#L64).\n\n**Q: How to customize systemd unit file?**\n\nA: See [example](/examples/node-advanced/gulpfile.js#L51).\n\n**Q: I need feature X to be added to spec/unit file**\n\nA: These files are meant to be extended by user. See examples above.\n\n## RPM\n\n```js\nvar brass = require('gulp-brass');\n```\n### brass.create(options)\n\n```js\nvar rpm = brass.create(options);\n```\n\nOptions that represent SPEC file tags (see [more information on SPEC tags](http://rpm.org/max-rpm-snapshot/s1-rpm-inside-tags.html)):\n\n- `type` (default: `rpm`) - for now only RPM is supported.\n- `name` - name of the software being packaged.\n- `version` - version of the software being packaged.\n- `license` - license of software being packaged.\n- `summary` - one-line description of the packaged software.\n- `description` - in-depth description of the packaged software.\n- `release` (default: 1) -  package's version.\n- `url` (optional) - URL that can be used to obtain additional information about the packaged software.\n\nOther options:\n\n- `prefix` (default: `/usr`, optional) - prefix where to install binaries. It's not used by gulp-brass but intended to be used by plugins. For example, it's used by [gulp-brass-npm](https://github.com/monai/gulp-brass-npm/).\n\nService options (see more [information on services](#services)):\n\n- `service.type` - service type, eg: `systemd`, `sysv`, `upstart`.\n- `service.name` - name of the service to be installed.\n- `service.summary` - one-line description of service. Used only by `sysv`.\n- `service.description` - description of service.\n- `service.exec` - command with arguments that are executed when the service is started.\n- `service.user` - user that the service process is executed as.\n- `service.group` - group that the service process is executed as.\n\nThis is recommended `service` object structure and it's expected by default service file templates and plugins, eg. [gulp-brass-npm](https://github.com/monai/gulp-brass-npm/).\n\n### rpm.options\n\nAn object that contains merged default option and options passed to `brass.create()`. It can be modified to adjust settings after `brass.create()` was called.\n\n### rpm.globOptions\n\nReturns an options object to be passed to `gulp.src(globs[, options])` when the sources of software being packaged are unpacked to [BUILD directory](#rpmbuilddir). It's value always is:\n\n```js\n{\n  mark: true,\n  cwd: rpm.buildDir_BUILD,\n  base: rpm.buildDir_BUILD\n}\n```\n\n### rpm.buildDir_*\n\n`rpmbuild` uses five special purpose directories in which performs build: SOURCES, SPECS, BUILD, RPMS, SRPMS. See more information on [build directory structure](http://rpm.org/max-rpm-snapshot/ch-rpm-build.html).\n\n- `SOURCES` is not used by gulp-brass.\n- `SPECS` contains SPEC file. `rpm.specTask()` places SPEC file to this directory and `rpm.buildTask()` runs `rpmbuild` against that file. Customized SPEC file also should be placed to this directory.\n- `BUILD` is the directory for unpacked sources and software building. Although it's not necessary to use this directory at all, but it's the place to build or put built software when using one build system for building software, and gulp only for packaging it to RPM.\n- `RPMS` contains built RPM file.\n- `RPMS` is not used by gulp-brass.\n\n### rpm.buildRoot\n\nThis directory represents root directory on the machine the RPM will be installed to. Hence, all packaged files should be placed to subdirectories of `rpm.buildRoot`.\n\nExample:\n\nFile `thefile` upon RPM install will be placed to `/usr/bin/thefile`.\n\n```js\ngulp.src('thefile')\ngulp.pipe(gulp.dest(path.join(rpm.buildRoot, 'usr/bin')))\ngulp.pipe(rpm.files())\n```\n\n### rpm.setupTask()\n\nReturns gulp task for `rpm.setup()`.\n\nThis task is recommended way to run setup since `rpm.setup()` doesn't return stream, hence there's nothing to customize.\n\n### rpm.setup(callback)\n\nCreates build directory (`./brass_build`) and directory structure required by `rpmbuild` in it.\n\n### rpm.files()\n\nReturns transform stream which registers piped files to be listed in SPEC file. All packaged files must be piped to this stream. Always pipe after `gulp.dest()`.\n\n### rpm.specTask()\n\nReturns gulp task which renders default SPEC file template.\n\nUse this task if you're not going to customize SPEC file.\n\n### rpm.spec()\n\nReturns transform stream which renders piped SPEC file template. Before rendering template it populates `rpm.options.specFileList` with `rpm.renderFileList()` output.\n\n### rpm.buildTask()\n\nReturns gulp task which runs `rpmbuild` against SPEC file.\n\nThis task is recommended way to run build since `rpm.build()` doesn't accept any customizations.\n\n### rpm.build()\n\nReturns transform stream which runs `rpmbuild` against piped SPEC files.\n\n### rpm.renderFileList()\n\nReturns registered files list with inlined attributes as string to be used in `%files` section in SPEC file. See section [vinyl extension](#vinyl-extensions).\n\n## Utils\n\n```js\nvar util = brass.util;\n```\n\n### util.assets(filename)\n\nReturns path to internal [asset](/assets). Intended to use with `gulp.src()`.\n\n### util.stream(callback, flush)\n\nReturns transform stream in object mode.\n\nCallback arguments are `callback(file, callback)`.\n\nFlush arguments are `flush(callback)`.\n\n### util.template(data)\n\nReturns stream that renders piped vinyl objects as templates with provided `data`.\nUses [handlebars](https://www.npmjs.com/package/handlebars) template engine and [handlebars-helper-equal](https://www.npmjs.com/package/handlebars-helper-equal) helper.\n\n### util.symlink(name, [options])\n\nReturns stream that makes symlinks to `name` path like `$ ln -s target name`.\nIf name is an array, it iterates to next name with each file.\n\nOptions:\n\n- `deep` - if `true`, makes symlink for each name to each piped file. This is convenient when you need to have few symlinks to same file.\n\n## Services\n\ngulp-brass comes with [service file templates](/assets/service) since often packaged software installations run as system services. Service file should be placed to corresponding service file directory and registered as packaged file. gulp task that does these steps may look like this:\n\n```js\ngulp.task('service', [ 'setup' ], function () {\n    return gulp.src(brass.util.assets('service/systemd'))\n    .pipe(brass.util.template(options.service))\n    .pipe(brass.util.rename(options.service.name +'.service'))\n    .pipe(gulp.dest(path.join(rpm.buildRoot, '/lib/systemd/system')))\n    .pipe(rpm.files());\n});\n```\n\n## Vinyl extensions\n\n`rpm.renderFileList()` uses some vinyl file object extensions:\n\n- `file.attr` (`[ mode, user, group ]`) - sets file mode, user, and group, eg. `[ '0777', 'apache', 'apache' ]`.\n- `file.config` (default: `false`) - sets if file is config file.\n- `file.noreplace` (default: `false`) - sets config file upgrade policy.\n\nMore info on `config` and `noreplace` [prefixes](https://fedoraproject.org/wiki/How_to_create_an_RPM_package#.25files_prefixes).\n\n## License\n\nISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonai%2Fgulp-brass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonai%2Fgulp-brass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonai%2Fgulp-brass/lists"}