No description
Find a file
Martin Pitt a26ef5d27c Simplify spec file
- Entirely drop `%build` section, as there is nothing to do anyway.
- Use `%make_install` macro.
- Replace the complicated file list wrangling with a simple directory
  enumeration.

Thanks to Igor Gnatenko for the suggestions!

See https://bugzilla.redhat.com/show_bug.cgi?id=1603146

Closes #38
2018-08-02 10:16:49 -04:00
po Add i18n for HTML and manifest 2018-06-19 18:09:57 +02:00
src Add scss example 2018-06-22 11:15:57 +02:00
test Run tests with Python 3 2018-07-02 17:37:20 +02:00
.babelrc initial commit. Created a basic webpack.config.js file, some basic .babelrc settings, and some notes on the build 2017-06-20 07:41:52 -04:00
.eslintignore Add more sample content to subscriptions page 2017-07-26 10:33:14 +02:00
.eslintrc.json Add more sample content to subscriptions page 2017-07-26 10:33:14 +02:00
.gitignore Add git tag derived version to tarball and spec 2018-06-22 20:07:29 +02:00
.travis.yml Add .travis.yml (#15) 2017-10-19 17:54:52 +02:00
cockpit-starter-kit.spec.in Simplify spec file 2018-08-02 10:16:49 -04:00
cockpituous-release Add minimal Cockpituous release script 2018-07-19 09:22:45 +02:00
LICENSE Initial commit with a LICENSE and README 2017-06-14 18:19:15 +02:00
Makefile Fix Makefile dependencies for directories in src/ 2018-07-19 09:11:07 +02:00
org.cockpit-project.starter-kit.metainfo.xml Consistently name everything [cockpit-]starter-kit (#14) 2017-10-19 17:54:12 +02:00
package.json Add scss example 2018-06-22 11:15:57 +02:00
README.md Add minimal Cockpituous release script 2018-07-19 09:22:45 +02:00
Vagrantfile vagrant: Use rsync backend for file sharing 2018-06-25 14:28:42 +02:00
webpack.config.js Add scss example 2018-06-22 11:15:57 +02:00

Cockpit Starter Kit

Scaffolding for a Cockpit module.

Getting and building the source

Make sure you have npm available (usually from your distribution package). These commands check out the source and build it into the dist/ directory:

git clone https://github.com/cockpit-project/starter-kit.git
cd starter-kit
make

Installing

make install compiles and installs the package in /usr/share/cockpit/. The convenience targets srpm and rpm build the source and binary rpms, respectively. Both of these make use of the dist-gzip target, which is used to generate the distribution tarball. In production mode, source files are automatically minified and compressed. Set NODE_ENV=production if you want to duplicate this behavior.

For development, you usually want to run your module straight out of the git tree. To do that, link that to the location were cockpit-bridge looks for packages:

mkdir -p ~/.local/share/cockpit
ln -s `pwd`/dist ~/.local/share/cockpit/starter-kit

After changing the code and running make again, reload the Cockpit page in your browser.

Automated Testing

Run make check to build an RPM, install it into a standard Cockpit test VM (centos-7 by default), and run the test/check-application integration test on it. This uses Cockpit's Chrome DevTools Protocol based browser tests, through a Python API abstraction. Note that this API is not guaranteed to be stable, so if you run into failures and don't want to adjust tests, consider checking out Cockpit's test/common from a tag instead of master (see the test/common target in Makefile).

After the test VM is prepared, you can manually run the test without rebuilding the VM, possibly with extra options for tracing and halting on test failures (for interactive debugging):

TEST_OS=centos-7 test/check-application -tvs

You can also run the test against a different Cockpit image, for example:

TEST_OS=fedora-28 make check

Vagrant

This directory contains a Vagrantfile that installs and starts cockpit on a Fedora 26 cloud image. Run vagrant up to start it and vagrant rsync to synchronize the dist directory to /usr/local/share/cockit/starter-kit. Use vagrant rsync-auto to automatically sync when contents of the dist directory change.

Customizing

After cloning the Starter Kit you should rename the files, package names, and labels to your own project's name. Use these commands to find out what to change:

find -iname '*starter*'
git grep -i starter

Automated release

Once your cloned project is ready for a release, you should consider automating that. Cockpituous release aims to fully automate project releases to GitHub, Fedora, Ubuntu, COPR, Docker Hub, and other places. The intention is that the only manual step for releasing a project is to create a signed tag for the version number; pushing the tag then triggers a GitHub webhook that calls a set of release scripts (on Cockpit's CI infrastructure).

starter-kit includes an example cockpitous release script that builds an upstream release tarball and source RPM. Please see the above cockpituous documentation for details.

Further reading