-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeff Parr
committed
Jun 28, 2023
1 parent
4f1ab57
commit 61d4d7a
Showing
12 changed files
with
200 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# list environment variables in a .env file | ||
# required variables can be specified in `initializers/dotenv.rb` | ||
# generate a template file with `$ dotenv -t .env` | ||
# SOMEVARIABLE=xxxxxsecretvariablexxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
EnableDefaultLinters: true | ||
linters: | ||
Rubocop: | ||
enabled: true | ||
rubocop_config: | ||
inherit_from: | ||
- .rubocop.yml | ||
Layout/InitialIndentation: | ||
Enabled: false | ||
Layout/LineLength: | ||
Enabled: false | ||
Layout/TrailingEmptyLines: | ||
Enabled: false | ||
Layout/TrailingWhitespace: | ||
Enabled: false | ||
Naming/FileName: | ||
Enabled: false | ||
Style/FrozenStringLiteralComment: | ||
Enabled: false | ||
Lint/UselessAssignment: | ||
Enabled: false | ||
Rails/OutputSafety: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--skip-bundle | ||
--skip-test | ||
--database=postgresql | ||
--skip-jbuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require: | ||
- standard | ||
- rubocop-rspec | ||
- rubocop-rails | ||
- rubocop-i18n | ||
- rubocop-capybara | ||
- rubocop-factory_bot | ||
|
||
inherit_gem: | ||
standard: config/base.yml | ||
|
||
AllCops: | ||
NewCops: enable | ||
Exclude: | ||
- db/schema.rb | ||
|
||
Style/StringLiterals: | ||
Enabled: true | ||
EnforcedStyle: single_quotes | ||
ConsistentQuotesInMultiline: false | ||
|
||
Style/StringLiteralsInInterpolation: | ||
Enabled: true | ||
EnforcedStyle: single_quotes | ||
|
||
Rails/Present: | ||
Exclude: | ||
- bin/* | ||
|
||
RSpec/NestedGroups: | ||
Exclude: | ||
- spec/requests/**/*.rb | ||
|
||
RSpec/ExampleLength: | ||
Exclude: | ||
- spec/system/**/*.rb | ||
|
||
I18n/RailsI18n: | ||
Enabled: true | ||
Exclude: | ||
- bin/* | ||
- db/* | ||
- spec/**/* | ||
|
||
I18n/GetText: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0.3 | ||
3.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
require "rake/testtask" | ||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new(:test) do |t| | ||
t.libs << "test" | ||
t.libs << "lib" | ||
t.test_files = FileList["test/**/*_test.rb"] | ||
t.libs << 'test' | ||
t.libs << 'lib' | ||
t.test_files = FileList['test/**/*_test.rb'] | ||
end | ||
|
||
task :default => :test | ||
task default: :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# list keys here that are required by the application | ||
|
||
# Dotenv.require_keys("SERVICE_APP_ID", "SERVICE_KEY", "SERVICE_SECRET") | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RSpec.configure do |config| | ||
config.include FactoryBot::Syntax::Methods | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Shoulda::Matchers.configure do |config| | ||
config.integrate do |with| | ||
with.test_framework :rspec | ||
with.library :rails | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,108 @@ | ||
require 'fileutils' | ||
# Copied from: https://github.com/mattbrictson/rails-template | ||
# Add this template directory to source_paths so that Thor actions like | ||
# copy_file and template resolve against our source files. If this file was | ||
# invoked remotely via HTTP, that means the files are not present locally. | ||
# In that case, use `git clone` to download them to a local temporary dir. | ||
def add_template_repository_to_source_path | ||
if __FILE__ =~ %r{\Ahttps?://} | ||
require 'tmpdir' | ||
source_paths.unshift(tempdir = Dir.mktmpdir('rails-template-')) | ||
at_exit { FileUtils.remove_entry(tempdir) } | ||
git clone: [ | ||
'--quiet', | ||
'https://github.com/jparr/minifast-rails.git', | ||
tempdir | ||
].map(&:shellescape).join(' ') | ||
|
||
if (branch = __FILE__[%r{minifast-rails/(.+)/template.rb}, 1]) | ||
Dir.chdir(tempdir) { git checkout: branch } | ||
end | ||
else | ||
source_paths.unshift(File.dirname(__FILE__)) | ||
end | ||
end | ||
|
||
def rails_version | ||
@rails_version ||= Gem::Version.new(Rails::VERSION::STRING) | ||
end | ||
|
||
def rails_7_or_newer? | ||
Gem::Requirement.new(">= 7.0.0").satisfied_by? rails_version | ||
Gem::Requirement.new('>= 7.0.0').satisfied_by? rails_version | ||
end | ||
|
||
def add_gems | ||
unless rails_7_or_newer? | ||
say_error '-----------------------------', :red | ||
say_error 'Please use Rails 7.0 or newer', :red | ||
say_error '-----------------------------', :red | ||
# raise 'hell' | ||
end | ||
|
||
add_template_repository_to_source_path | ||
|
||
gem_group :development, :test do | ||
gem 'dotenv-rails' | ||
gem 'rspec-rails' | ||
gem 'factory_bot_rails' | ||
gem 'faker' | ||
|
||
gem 'erb_lint', require: false | ||
gem 'pronto', require: false, group: :pronto | ||
gem 'pronto-rubocop', require: false, group: :pronto | ||
gem 'pronto-erb_lint', require: false, group: :pronto | ||
gem 'rubocop-performance', require: false, group: :pronto | ||
gem 'rubocop-i18n', require: false, group: :pronto | ||
gem 'rubocop-rails', require: false, group: :pronto | ||
gem 'rubocop-rspec', require: false, group: :pronto | ||
gem 'standard', group: :pronto | ||
end | ||
|
||
unless rails_7_or_newer? | ||
say_error "-----------------------------", :red | ||
say_error "Please use Rails 7.0 or newer", :red | ||
say_error "-----------------------------", :red | ||
# raise 'hell' | ||
gem_group :test do | ||
gem 'capybara' | ||
gem 'selenium-webdriver' | ||
gem 'shoulda-matchers', '~> 5.0' | ||
gem 'webdrivers' | ||
end | ||
|
||
add_gems | ||
gem 'view_component', '~> 3.2.0' | ||
gem 'hotwire-livereload' | ||
|
||
after_bundle do | ||
say "App successfully created!", :green | ||
generate 'rspec:install' | ||
directory 'spec/support' | ||
copy_file '.erb-lint.yml' | ||
copy_file '.rubocop.yml' | ||
|
||
run 'bundle binstubs erb_lint' | ||
run 'bundle binstubs rubocop' | ||
run 'bundle binstubs rspec-core' | ||
|
||
rails_command 'livereload:install' | ||
|
||
inject_into_file 'config/application.rb', after: 'config.load_defaults 7.0' do | ||
<<-RUBY | ||
config.view_component.generate.sidecar = true | ||
config.generators do |generator| | ||
generator.helper false | ||
generator.test_framework :rspec, | ||
view_specs: false, | ||
routing_specs: false | ||
end | ||
RUBY | ||
end | ||
|
||
append_to_file '.gitignore' do | ||
<<-GIT | ||
.env | ||
GIT | ||
end | ||
copy_file '.env.template' | ||
copy_file 'config/initializers/dotenv.rb' | ||
|
||
# todo: better readme template | ||
|
||
run 'bin/rubocop -A' | ||
|
||
say 'App successfully created!', :green | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters