Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator for adding formats #132

Merged
merged 3 commits into from
Apr 7, 2016
Merged

Generator for adding formats #132

merged 3 commits into from
Apr 7, 2016

Conversation

fofr
Copy link
Contributor

@fofr fofr commented Apr 5, 2016

Based on @dsingleton's work for components: alphagov/static#444

Usage: rails generate format [format_name]

Adds the following files:

  • View specific stylesheet (and appends include to application.scss)
  • Format erb template with title, page class, title component and
    description
  • Format presenter
  • Format presenter test
  • Format integration test

Based around these early commits when adding formats:

fofr added 2 commits April 5, 2016 15:35
Usage: `rails generate format [format_name]`

Adds the following files:
* View specific stylesheet (and appends include to application.scss)
* Format erb template with title, page class, title component and
description
* Format presenter
* Format presenter test
* Format integration test
@boffbowsh boffbowsh deployed to government-frontend-pr-132 April 5, 2016 14:43 Active
source_root File.expand_path('../templates', __FILE__)

def copy_format_files
format_name = file_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good to call underscore on this. Rails generators for e.g. model accept both forms and turn them into the correct thing, e.g. rails g model FooBar is equivalent to rails g model foo_bar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, added in 5792915

Let both of these work correctly:
bundle exec rails generate format format_name
bundle exec rails generate format FormatName
@boffbowsh
Copy link
Contributor

👍 but will let @dsingleton look first and merge

@boffbowsh
Copy link
Contributor

Nah, let's merge it

@boffbowsh boffbowsh merged commit 312003f into master Apr 7, 2016
@boffbowsh boffbowsh deleted the format-generator branch April 7, 2016 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants