Project

pugin

0.02
No commit activity in last 3 years
No release in over 3 years
Pugin is a component-based pattern design library that holds all of the reusable partials, styles and scripts for elements of UK Parliament microservices.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.15
~> 0.8
~> 5.0
~> 0.11
~> 5.1
~> 0.50
~> 0.12
~> 1.3, < 1.4
 Project Readme

Pugin Components Rails

pugin-components-ruby is a component-based pattern design library created by the Parliamentary Digital Service that holds all of the reusable partials for elements of the UK Parliament's microservices.

Build Status Test Coverage License

NOTE: This gem is in active development and is likely to change at short notice. It is not recommended that you use this in any production environment.

Contents

  • Requirements
  • Installation
  • Usage
    • Example
    • Adding the Parliamentary layout
      • Including rel-alternate links
        • Example
  • Getting Started with Development
    • Running the tests
  • Contributing
  • License

Requirements

pugin-components-ruby requires the following:

Installation

Within your rails application, add the below to your Gemfile.

gem 'pugin'

Usage

This gem's main function is to expose front-end components and assets to the host application's asset pipeline.

Once you add the gem to your Gemfile run:

bundle install

Now all of the view components should be available within your host application.

Example

<%= render partial: 'pugin/components/status' %>

Adding the Parliamentary layout

Add the following line into the application controller within your host application

layout 'pugin/layouts/pugin'

Including rel-alternate links

When rendering using the Parliamentary layout, if you'd like to document rel-alternates like so:

<link rel="alternate" type="application/rdf+json" href="https://api.example.com/some/url" />
<link rel="alternate" type="application/rdf+xml" href="https://api.example.com/some/other/url" />

You can do so automatically by setting Pugin.alternates.

Example

Within your controller:

alternates = [
  { type: 'application/rdf+json', href: 'https://api.example.com/some/url' },
  { type: 'application/rdf+xml', href: 'https://api.example.com/some/other/url' }
]

Pugin.alternates = alternates

Getting Started with Development

To clone the repository and set up the dependencies, run the following:

git clone https://github.com/ukparliament/pugin-components-ruby.git
cd pugin-components-ruby
bundle install

Running the tests

We use RSpec as our testing framework and tests can be run using:

bundle exec rake

Contributing

If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.

  1. Fork the repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Ensure your changes are tested using Rspec
  6. Create a new Pull Request

License

pugin-components-ruby is licensed under the Open Parliament Licence.