Skip to content

Commit

Permalink
Merge pull request #347 from nimblehq/release/5.1.0
Browse files Browse the repository at this point in the history
Release/5.1.0
  • Loading branch information
malparty authored Jul 26, 2022
2 parents b55db69 + daa995c commit f75c90d
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 25 deletions.
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Team
# @malparty is the Team Lead and the others are team members
* @rosle @andyduong1920 @bterone @byhbt @carryall @hanam1ni @hoangmirs @junan @Lahphim @longnd @malparty @tyrro

# Engineering Leads
CODEOWNERS @nimblehq/engineering-leads
14 changes: 8 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## What happened
https://github.com/nimblehq/rails-templates/issues/??

Describe the big picture of your changes here to communicate to the team why we should accept this pull request.
## What happened 👀

## Insight
Provide a description of the **changes** this pull request brings to the codebase. Additionally, when the pull request is still being worked on, a checklist of the planned changes is welcome to track progress.

Describe in details how to test the changes. Referenced documentation are welcome as well.
## Insight 📝

## Proof Of Work
Describe in detail why this solution is the most appropriate, which solution you tried but did not go with, and how to test the changes. References to relevant documentation are welcome as well.

Show us the implementation: screenshots, gif, etc.
## Proof Of Work 📹

Show us the implementation: screenshots, GIFs, etc.
1 change: 1 addition & 0 deletions .template/addons/docker/docker-compose.dev.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
container_name: <%= APP_NAME %>_db
environment:
- POSTGRES_DB=<%= APP_NAME %>_development
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"

Expand Down
1 change: 1 addition & 0 deletions .template/addons/docker/docker-compose.test.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
container_name: <%= APP_NAME %>_db
environment:
- POSTGRES_DB=<%= APP_NAME %>_test
- POSTGRES_PASSWORD=postgres
ports:
- "5432"

Expand Down
2 changes: 1 addition & 1 deletion .template/addons/docker/docker-compose.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- "5432:5432"

redis:
image: redis:5.0.7
image: redis:<%= REDIS_VERSION %>
container_name: <%= APP_NAME %>_redis
ports:
- "6379:6379"
Expand Down
12 changes: 6 additions & 6 deletions .template/addons/github/.github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Add the story URL here. Prefer the short link format, e.g. https://app.clubhouse.io/acme/story/1234/

## What happened
## What happened 👀

Describe the big picture of your changes here to communicate to the team why we should accept this pull request.
Provide a description of the **changes** this pull request brings to the codebase. Additionally, when the pull request is still being worked on, a checklist of the planned changes is welcome to track progress.

## Insight
## Insight 📝

Describe in detail how to test the changes. Referenced documentation is welcome as well.
Describe in detail why this solution is the most appropriate, which solution you tried but did not go with, and how to test the changes. References to relevant documentation are welcome as well.

## Proof Of Work
## Proof Of Work 📹

Show us the implementation: screenshots, gif, etc.
Show us the implementation: screenshots, GIFs, etc.
11 changes: 11 additions & 0 deletions .template/addons/hotwire/Gemfile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

# Hotwire Rails
insert_into_file 'Gemfile', after: /gem 'bcrypt'.*\n/ do
<<~RUBY
# Hotwire
gem 'turbo-rails' # Hotwire's SPA-like page accelerator
gem 'stimulus-rails' # Hotwire's modest JavaScript framework
RUBY
end
3 changes: 3 additions & 0 deletions .template/addons/hotwire/template.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

apply '.template/addons/hotwire/Gemfile.rb'
2 changes: 1 addition & 1 deletion .template/addons/slim/Dangerfile.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

insert_into_file 'Dangerfile', after: /eslint.lint.*\n/ do
insert_into_file 'Dangerfile', after: /stylelint.lint.*\n/ do
<<~RUBY
# Runs slim-lint on modified and added files in the PR
Expand Down
13 changes: 13 additions & 0 deletions .template/spec/addons/variants/web/hotwire/gemfile_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

describe 'Hotwire Addon - Gemfile' do
subject { file('Gemfile') }

it 'adds turbo-rails gem' do
expect(subject).to contain('turbo-rails')
end

it 'adds stimulus-rails gem' do
expect(subject).to contain('stimulus-rails')
end
end
4 changes: 4 additions & 0 deletions .template/spec/variants/web/dangerfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
it 'adds eslint lint' do
expect(subject).to contain('eslint.lint')
end

it 'adds stylelint lint' do
expect(subject).to contain('stylelint.lint')
end
end
4 changes: 4 additions & 0 deletions .template/spec/variants/web/gemfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
it 'adds danger-eslint gem' do
expect(subject).to contain('danger-eslint').after('^group :development, :test')
end

it 'adds danger-stylelint gem' do
expect(subject).to contain('danger-stylelint').after('^group :development, :test')
end
end

describe 'Test Environment' do
Expand Down
6 changes: 3 additions & 3 deletions .template/spec/variants/web/spec/codebase/codebase_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
describe 'Web variant - spec/codebase/codebase_spec.rb' do
subject { file('spec/codebase/codebase_spec.rb') }

it 'adds scss lint example' do
expect(subject).to contain(scss_lint_example)
it 'adds stylelint example' do
expect(subject).to contain(stylelint_example)
end

it 'adds eslint example' do
Expand All @@ -13,7 +13,7 @@

private

def scss_lint_example
def stylelint_example
<<~RUBY
it 'does not offend stylelint' do
expect(`yarn run stylelint ./`).to be_empty
Expand Down
1 change: 1 addition & 0 deletions .template/variants/web/.stylelintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/**
/app/assets/builds/**
/vendor/**
3 changes: 3 additions & 0 deletions .template/variants/web/Dangerfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
# Runs ESLint on modified and added files in the PR
eslint.lint
# Runs Stylelint on all files
stylelint.lint
RUBY
end
3 changes: 1 addition & 2 deletions .template/variants/web/Gemfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
gem 'sprockets-rails' # The original asset pipeline for Rails
gem 'cssbundling-rails' # Bundle and process CSS
gem 'jsbundling-rails' # Bundle and transpile JavaScript
# gem 'turbo-rails' # Hotwire's SPA-like page accelerator
# gem 'stimulus-rails' # Hotwire's modest JavaScript framework
# gem 'image_processing' # Use Active Storage variants
RUBY
end
Expand All @@ -26,6 +24,7 @@
insert_into_file 'Gemfile', after: /gem 'danger'.*\n/ do
<<~RUBY.indent(2)
gem 'danger-eslint' # ESLint
gem 'danger-stylelint' # Stylelint
RUBY
end

Expand Down
1 change: 1 addition & 0 deletions .template/variants/web/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def apply_web_variant!
# Add-ons - [Optional]
apply '.template/addons/bootstrap/template.rb' if yes? install_addon_prompt 'Bootstrap'
apply '.template/addons/slim/template.rb' if yes? install_addon_prompt 'Slim Template Engine'
apply '.template/addons/hotwire/template.rb' if yes? install_addon_prompt 'Hotwire'

after_bundle do
use_source_path __dir__
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
common_addon_prompts = Y\nY\nY\nY\nY\n

# Y - in response to Would you like to add the Bootstrap addon?
# Y - in response to Would you like to add the Slim Template Engine addon?
web_addon_prompts = Y\nY\n
# Y - in response to Would you like to add the Slim Template Engine addon?
# Y - in response to Would you like to add the Hotwire addon?
web_addon_prompts = Y\nY\nY\n

create_web:
printf "${common_addon_prompts}${web_addon_prompts}" | rails new $(APP_NAME) -m ./template.rb -T ${OPTIONS}
Expand Down
1 change: 1 addition & 0 deletions config/application.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ default: &default
DB_HOST: "localhost"
DB_PORT: "5432"
DB_USERNAME: "postgres"
DB_PASSWORD: "postgres"
MAILER_DEFAULT_HOST: "localhost"
MAILER_DEFAULT_PORT: "3000"
MAILER_SENDER: "Test <[email protected]>"
Expand Down
2 changes: 2 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ development:
host: <%= ENV['DB_HOST'] %>
port: <%= ENV['DB_PORT'] %>
username: <%= ENV['DB_USERNAME'] %>
password: <%= ENV['DB_PASSWORD'] %>
database: <%= ENV['DB_NAME'] %>_development

test:
<<: *default
host: <%= ENV['DB_HOST'] %>
port: <%= ENV['DB_PORT'] %>
username: <%= ENV['DB_USERNAME'] %>
password: <%= ENV['DB_PASSWORD'] %>
database: <%= ENV['DB_NAME'] %>_test

production:
Expand Down
8 changes: 4 additions & 4 deletions template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
DOCKER_REGISTRY_HOST = 'docker.io'
DOCKER_IMAGE = "nimblehq/#{APP_NAME}".freeze
RUBY_VERSION = '3.0.1'
POSTGRES_VERSION = '12.1'
REDIS_VERSION = '5.0.7'
POSTGRES_VERSION = '14.4'
REDIS_VERSION = '6.2.7'
# Variants
API_VARIANT = options[:api] || ENV['API'] == 'true'
WEB_VARIANT = !API_VARIANT
Expand Down Expand Up @@ -115,7 +115,7 @@ def delete_test_folder
end

def install_addon_prompt(addon)
"Would you like to add the #{addon} addon? [Yn]"
"Would you like to add the #{addon} addon? [yN]"
end

def post_default_addons_install
Expand All @@ -134,7 +134,7 @@ def get_content_between(content, string_start, string_end)

# Setup the template root path
# If the template file is the url, clone the repo to the tmp directory
template_root = __FILE__ =~ %r{\Ahttps?://} ? remote_repository : __dir__
template_root = __FILE__.match?(%r{\Ahttps?://}) ? remote_repository : __dir__
use_source_path template_root

# Init the template helpers
Expand Down

0 comments on commit f75c90d

Please sign in to comment.