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

Add base Github wiki #317

Merged
merged 9 commits into from
Mar 16, 2022
Merged

Add base Github wiki #317

merged 9 commits into from
Mar 16, 2022

Conversation

rosle
Copy link
Contributor

@rosle rosle commented Jan 27, 2022

#286

What happened

  • Github now is an optional addon
  • Init base Github wiki if user select to install Github addon
  • Revamp the message to output the instruction message after complete

Insight

Keep the README.md in the base template. When Github addon is selected:

  • Split the current content in the README.md to multiple wiki pages
  • Move .github/workflow/README.md -> .github/wiki/CI-CD.md
  • After completed, show manual instruction, so the user can complete the setup

Revamp template message

Now that we add the manual instruction, I took the opportunity to refactor the whole message when the project creation is completed.

  1. Output the rubocop autofix to tmp/template_rubocop.txt
  2. Print success message
  3. Print the error and instruction if it is set

Screen Shot 2565-02-02 at 12 32 24

With multiple errors + instructions:

Screen Shot 2565-02-02 at 12 59 15

Proof Of Work

You can try on your local with:

rails new <app_name> -m https://raw.githubusercontent.com/nimblehq/rails-templates/feature/github-wiki/template.rb

Enable Github Addon, it should generate wiki pages

## Table of Contents

- [[Home]]
- [[Getting Started]]

## Infrastructure

- [[CI/CD|CI CD]]

## Operations

- [[Testing]]

Screen Shot 2565-01-27 at 16 46 01

Please review the content in the PR

@rosle rosle added this to the 5.0.0 milestone Jan 27, 2022
@rosle rosle self-assigned this Jan 27, 2022
@rosle rosle force-pushed the feature/github-wiki branch 2 times, most recently from a57184b to 6232cda Compare January 27, 2022 09:48
@rosle rosle force-pushed the feature/github-wiki branch 3 times, most recently from 282f122 to 7677332 Compare February 1, 2022 07:46
@rosle rosle requested a review from a team February 2, 2022 09:12
@rosle rosle marked this pull request as ready for review February 2, 2022 09:12
.template/hooks/before_complete/report.rb Outdated Show resolved Hide resolved
.template/hooks/before_complete/report.rb Outdated Show resolved Hide resolved
attr_reader :errors
end
end
class Template::Errors < Template::Messages; end
Copy link
Contributor

@olivierobert olivierobert Feb 3, 2022

Choose a reason for hiding this comment

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

I am not sure about this architecture implementation as it feels a bit unnatural/strange 🤔

Just like flashes, how about instead having one class/object e.g. Template::Messages and when adding a new message to the list, one has to add a type e.g. {type: :info, text: "Please set up ..."}, {type: :error, text: "Please set up ..."}. Then when looping for messages, the messages will be filtered by type.

Note that there could be some convenience methods like Template::Messages.add_info, Template::Messages.add_error. These could be created automatically for each type using define_method:

class Template::Messages
  #...

  def add(type message)
    messages << { type: type: message:  message.chomp }
  end

  ["error", "info"].each do |type| 
	 define_method(:"add_#{type}") do |message|
        add(type, message)
      end
   end
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me rework the message system in another PR. I need to revisit all the places that we add the message and also deal with how to print out all messages of specific type 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll be working on it when doing Issue: Refactor Template Helpers

@olivierobert olivierobert requested a review from a team February 4, 2022 02:32
.template/addons/github/template.rb Outdated Show resolved Hide resolved
.template/addons/github/template.rb Show resolved Hide resolved
@rosle rosle merged commit 3bf65e1 into develop Mar 16, 2022
@rosle rosle deleted the feature/github-wiki branch March 18, 2022 04:01
@rosle rosle mentioned this pull request Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants