suspenders 20230113.0 → 20240516.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +83 -176
- data/Rakefile +13 -0
- data/lib/generators/suspenders/accessibility_generator.rb +24 -0
- data/lib/generators/suspenders/advisories_generator.rb +32 -0
- data/lib/generators/suspenders/ci_generator.rb +57 -0
- data/lib/generators/suspenders/email_generator.rb +56 -0
- data/lib/generators/suspenders/environments/development_generator.rb +50 -0
- data/lib/generators/suspenders/environments/production_generator.rb +27 -0
- data/lib/generators/suspenders/environments/test_generator.rb +39 -0
- data/lib/generators/suspenders/factories_generator.rb +64 -0
- data/lib/generators/suspenders/inline_svg_generator.rb +24 -0
- data/lib/generators/suspenders/install/web_generator.rb +71 -0
- data/lib/generators/suspenders/jobs_generator.rb +34 -0
- data/lib/generators/suspenders/lint_generator.rb +94 -0
- data/lib/generators/suspenders/prerequisites_generator.rb +19 -0
- data/lib/generators/suspenders/rake_generator.rb +25 -0
- data/lib/generators/suspenders/setup_generator.rb +14 -0
- data/lib/generators/suspenders/styles_generator.rb +84 -0
- data/lib/generators/suspenders/tasks_generator.rb +20 -0
- data/lib/generators/suspenders/testing_generator.rb +113 -0
- data/lib/generators/suspenders/views_generator.rb +38 -0
- data/lib/generators/templates/ci/ci.yml.tt +148 -0
- data/lib/generators/templates/ci/dependabot.yml +7 -0
- data/lib/generators/templates/email/email_interceptor.rb +11 -0
- data/lib/generators/templates/factories/factories_spec.rb +7 -0
- data/lib/generators/templates/factories/factories_test.rb +9 -0
- data/lib/generators/templates/install/web/CONTRIBUTING.md +94 -0
- data/lib/generators/templates/lint/config_better_html.yml +2 -0
- data/lib/generators/templates/lint/config_initializers_better_html.rb +9 -0
- data/lib/generators/templates/lint/erb-lint.yml +63 -0
- data/lib/generators/templates/lint/erblint.rake +47 -0
- data/lib/generators/templates/lint/eslintrc.json +7 -0
- data/lib/generators/templates/lint/package.json +4 -0
- data/lib/generators/templates/lint/prettierignore +1 -0
- data/lib/generators/templates/lint/prettierrc +11 -0
- data/lib/generators/templates/lint/rubocop.yml.tt +7 -0
- data/lib/generators/templates/prerequisites/node-version.tt +1 -0
- data/lib/generators/templates/setup/bin_setup.rb +39 -0
- data/lib/generators/templates/styles/postcss.config.js +11 -0
- data/lib/generators/templates/testing/driver.rb +5 -0
- data/lib/generators/templates/views/flashes.html.erb +7 -0
- data/lib/install/web.rb +54 -0
- data/lib/suspenders/cleanup/generate_readme.rb +165 -0
- data/lib/suspenders/cleanup/organize_gemfile.rb +134 -0
- data/lib/suspenders/engine.rb +5 -0
- data/lib/suspenders/generators.rb +126 -0
- data/lib/suspenders/railtie.rb +4 -0
- data/lib/suspenders/version.rb +4 -6
- data/lib/suspenders.rb +9 -33
- data/lib/tasks/suspenders.rake +37 -0
- metadata +82 -173
- data/.ruby-version +0 -1
- data/CONTRIBUTING.md +0 -59
- data/GOALS.md +0 -65
- data/LICENSE +0 -21
- data/NEWS.md +0 -738
- data/RELEASING.md +0 -18
- data/bin/suspenders +0 -50
- data/docs/heroku_deploy.md +0 -19
- data/docs/rails_7.md +0 -5
- data/lib/suspenders/actions/strip_comments_action.rb +0 -254
- data/lib/suspenders/actions.rb +0 -106
- data/lib/suspenders/adapters/heroku.rb +0 -136
- data/lib/suspenders/app_builder.rb +0 -267
- data/lib/suspenders/exit_on_failure.rb +0 -19
- data/lib/suspenders/generators/accessibility_generator.rb +0 -12
- data/lib/suspenders/generators/advisories_generator.rb +0 -15
- data/lib/suspenders/generators/analytics_generator.rb +0 -24
- data/lib/suspenders/generators/app_generator.rb +0 -215
- data/lib/suspenders/generators/base.rb +0 -60
- data/lib/suspenders/generators/ci_generator.rb +0 -32
- data/lib/suspenders/generators/db_optimizations_generator.rb +0 -18
- data/lib/suspenders/generators/factories_generator.rb +0 -22
- data/lib/suspenders/generators/forms_generator.rb +0 -18
- data/lib/suspenders/generators/inline_svg_generator.rb +0 -14
- data/lib/suspenders/generators/jobs_generator.rb +0 -37
- data/lib/suspenders/generators/js_driver_generator.rb +0 -18
- data/lib/suspenders/generators/json_generator.rb +0 -14
- data/lib/suspenders/generators/lint_generator.rb +0 -14
- data/lib/suspenders/generators/production/compression_generator.rb +0 -14
- data/lib/suspenders/generators/production/deployment_generator.rb +0 -16
- data/lib/suspenders/generators/production/email_generator.rb +0 -34
- data/lib/suspenders/generators/production/force_tls_generator.rb +0 -11
- data/lib/suspenders/generators/production/manifest_generator.rb +0 -25
- data/lib/suspenders/generators/production/single_redirect.rb +0 -15
- data/lib/suspenders/generators/production/timeout_generator.rb +0 -22
- data/lib/suspenders/generators/profiler_generator.rb +0 -35
- data/lib/suspenders/generators/runner_generator.rb +0 -48
- data/lib/suspenders/generators/staging/pull_requests_generator.rb +0 -25
- data/lib/suspenders/generators/static_generator.rb +0 -14
- data/lib/suspenders/generators/stylelint_generator.rb +0 -71
- data/lib/suspenders/generators/stylesheet_base_generator.rb +0 -15
- data/lib/suspenders/generators/testing_generator.rb +0 -43
- data/lib/suspenders/generators/views_generator.rb +0 -25
- data/templates/Gemfile.erb +0 -49
- data/templates/Procfile +0 -2
- data/templates/README.md.erb +0 -28
- data/templates/_analytics.html.erb +0 -8
- data/templates/_css_overrides.html.erb +0 -7
- data/templates/_flashes.html.erb +0 -7
- data/templates/active_job.rb +0 -14
- data/templates/application.postcss.css +0 -1
- data/templates/bin_auto_migrate +0 -5
- data/templates/bin_deploy +0 -10
- data/templates/bin_setup +0 -28
- data/templates/bin_setup_review_app.erb +0 -21
- data/templates/bin_yarn +0 -18
- data/templates/bundler_audit.rake +0 -4
- data/templates/capybara_silence_puma.rb +0 -1
- data/templates/chromedriver.rb +0 -27
- data/templates/circle.yml.erb +0 -6
- data/templates/config_locales_en.yml.erb +0 -19
- data/templates/descriptions/advisories.md +0 -5
- data/templates/descriptions/analytics.md +0 -4
- data/templates/descriptions/ci.md +0 -4
- data/templates/descriptions/compression.md +0 -4
- data/templates/descriptions/db_optimizations.md +0 -2
- data/templates/descriptions/deployment.md +0 -5
- data/templates/descriptions/email.md +0 -9
- data/templates/descriptions/factories.md +0 -12
- data/templates/descriptions/force_tls.md +0 -1
- data/templates/descriptions/forms.md +0 -1
- data/templates/descriptions/inline_svg.md +0 -2
- data/templates/descriptions/jobs.md +0 -3
- data/templates/descriptions/js_driver.md +0 -4
- data/templates/descriptions/json.md +0 -1
- data/templates/descriptions/lint.md +0 -3
- data/templates/descriptions/manifest.md +0 -2
- data/templates/descriptions/profiler.md +0 -7
- data/templates/descriptions/pull_requests.md +0 -4
- data/templates/descriptions/runner.md +0 -10
- data/templates/descriptions/single_redirect.md +0 -1
- data/templates/descriptions/static.md +0 -5
- data/templates/descriptions/stylelint.md +0 -3
- data/templates/descriptions/stylesheet_base.md +0 -1
- data/templates/descriptions/testing.md +0 -9
- data/templates/descriptions/timeout.md +0 -4
- data/templates/descriptions/views.md +0 -8
- data/templates/email.rb +0 -3
- data/templates/errors.rb +0 -35
- data/templates/flashes_helper.rb +0 -5
- data/templates/hound.yml +0 -15
- data/templates/json_encoding.rb +0 -1
- data/templates/oj.rb +0 -3
- data/templates/partials/ci_simplecov.rb +0 -14
- data/templates/partials/db_optimizations_configuration.rb +0 -7
- data/templates/partials/deployment_readme.md +0 -8
- data/templates/partials/email_smtp.rb +0 -2
- data/templates/partials/profiler_readme.md +0 -8
- data/templates/partials/pull_requests_config.rb +0 -5
- data/templates/partials/runner_readme.md +0 -31
- data/templates/partials/runner_setup.rb +0 -2
- data/templates/postcss.config.js +0 -8
- data/templates/postgresql_database.yml.erb +0 -20
- data/templates/rack_mini_profiler.rb +0 -7
- data/templates/rails_helper.rb +0 -25
- data/templates/sample_env +0 -12
- data/templates/secrets.yml +0 -8
- data/templates/smtp.rb +0 -9
- data/templates/spec_helper.rb +0 -25
- data/templates/suspenders_gitignore +0 -18
- data/templates/suspenders_layout.html.erb.erb +0 -23
- /data/{templates → lib/generators/templates/factories}/factories.rb +0 -0
- /data/{templates → lib/generators/templates/factories}/factory_bot_rspec.rb +0 -0
- /data/{templates → lib/generators/templates/inline_svg}/inline_svg.rb +0 -0
- /data/{templates → lib/generators/templates/lint}/stylelintrc.json +0 -0
- /data/{templates → lib/generators/templates/tasks}/dev.rake +0 -0
- /data/{templates → lib/generators/templates/testing}/action_mailer.rb +0 -0
- /data/{templates → lib/generators/templates/testing}/i18n.rb +0 -0
- /data/{templates/shoulda_matchers_config_rspec.rb → lib/generators/templates/testing/shoulda_matchers.rb} +0 -0
@@ -1,18 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class FormsGenerator < Generators::Base
|
5
|
-
def add_simple_form
|
6
|
-
gem "simple_form"
|
7
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
8
|
-
end
|
9
|
-
|
10
|
-
def configure_simple_form
|
11
|
-
create_file "config/initializers/simple_form.rb" do
|
12
|
-
"SimpleForm.setup {|config|}"
|
13
|
-
end
|
14
|
-
|
15
|
-
generate "simple_form:install", "--force"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class InlineSvgGenerator < Generators::Base
|
5
|
-
def add_inline_svg
|
6
|
-
gem "inline_svg"
|
7
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
8
|
-
end
|
9
|
-
|
10
|
-
def configure_inline_svg
|
11
|
-
copy_file "inline_svg.rb", "config/initializers/inline_svg.rb"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class JobsGenerator < Generators::Base
|
5
|
-
def add_jobs_gem
|
6
|
-
gem "sidekiq"
|
7
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
8
|
-
end
|
9
|
-
|
10
|
-
def initialize_active_job
|
11
|
-
copy_file(
|
12
|
-
"active_job.rb",
|
13
|
-
"config/initializers/active_job.rb"
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
def configure_active_job
|
18
|
-
configure_application_file("config.active_job.queue_adapter = :sidekiq")
|
19
|
-
configure_application_file("config.action_mailer.deliver_later_queue_name = nil")
|
20
|
-
configure_application_file("config.action_mailbox.queues.routing = nil")
|
21
|
-
configure_application_file("config.active_storage.queues.analysis = nil")
|
22
|
-
configure_application_file("config.active_storage.queues.purge = nil")
|
23
|
-
configure_application_file("config.active_storage.queues.mirror = nil")
|
24
|
-
configure_environment "test", "config.active_job.queue_adapter = :inline"
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def configure_application_file(config)
|
30
|
-
inject_into_file(
|
31
|
-
"config/application.rb",
|
32
|
-
"\n #{config}",
|
33
|
-
before: "\n end"
|
34
|
-
)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class JsDriverGenerator < Generators::Base
|
5
|
-
def add_gems
|
6
|
-
gem "webdrivers", group: :test
|
7
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
8
|
-
end
|
9
|
-
|
10
|
-
def configure_capybara
|
11
|
-
copy_file "chromedriver.rb", "spec/support/chromedriver.rb"
|
12
|
-
copy_file(
|
13
|
-
"capybara_silence_puma.rb",
|
14
|
-
"spec/support/capybara_silence_puma.rb"
|
15
|
-
)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class JsonGenerator < Generators::Base
|
5
|
-
def add_oj
|
6
|
-
gem "oj"
|
7
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
8
|
-
end
|
9
|
-
|
10
|
-
def configure_oj
|
11
|
-
copy_file "oj.rb", "config/initializers/oj.rb"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class LintGenerator < Generators::Base
|
5
|
-
def set_up_hound
|
6
|
-
copy_file "hound.yml", ".hound.yml"
|
7
|
-
end
|
8
|
-
|
9
|
-
def set_up_standard
|
10
|
-
gem "standard", group: :development
|
11
|
-
prepend_to_file("Rakefile", 'require "standard/rake"')
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "../base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
module Production
|
5
|
-
class CompressionGenerator < Generators::Base
|
6
|
-
def add_rack_deflater
|
7
|
-
configure_environment(
|
8
|
-
:production,
|
9
|
-
%(config.middleware.use Rack::Deflater)
|
10
|
-
)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require_relative "../base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
module Production
|
5
|
-
class DeploymentGenerator < Generators::Base
|
6
|
-
def copy_script
|
7
|
-
copy_file "bin_deploy", "bin/deploy"
|
8
|
-
chmod "bin/deploy", 0o755
|
9
|
-
end
|
10
|
-
|
11
|
-
def inform_user
|
12
|
-
append_template_to_file "README.md", "partials/deployment_readme.md"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative "../base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
module Production
|
5
|
-
class EmailGenerator < Generators::Base
|
6
|
-
def smtp_configuration
|
7
|
-
copy_file "smtp.rb", "config/smtp.rb"
|
8
|
-
|
9
|
-
prepend_file "config/environments/production.rb",
|
10
|
-
%{require Rails.root.join("config/smtp")\n\n}
|
11
|
-
end
|
12
|
-
|
13
|
-
def use_smtp
|
14
|
-
inject_template_into_file(
|
15
|
-
"config/environments/production.rb",
|
16
|
-
"partials/email_smtp.rb",
|
17
|
-
after: "config.action_mailer.perform_caching = false\n"
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
|
-
def env_vars
|
22
|
-
expand_json(
|
23
|
-
"app.json",
|
24
|
-
env: {
|
25
|
-
SMTP_ADDRESS: {required: true},
|
26
|
-
SMTP_DOMAIN: {required: true},
|
27
|
-
SMTP_PASSWORD: {required: true},
|
28
|
-
SMTP_USERNAME: {required: true}
|
29
|
-
}
|
30
|
-
)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require_relative "../base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
module Production
|
5
|
-
class ManifestGenerator < Generators::Base
|
6
|
-
def render_manifest
|
7
|
-
expand_json(
|
8
|
-
"app.json",
|
9
|
-
name: app_name.dasherize,
|
10
|
-
scripts: {},
|
11
|
-
env: {
|
12
|
-
APPLICATION_HOST: {required: true},
|
13
|
-
AUTO_MIGRATE_DB: {value: true},
|
14
|
-
EMAIL_RECIPIENTS: {required: true},
|
15
|
-
HEROKU_APP_NAME: {required: true},
|
16
|
-
HEROKU_PARENT_APP_NAME: {required: true},
|
17
|
-
RACK_ENV: {required: true},
|
18
|
-
SECRET_KEY_BASE: {generator: "secret"}
|
19
|
-
},
|
20
|
-
addons: ["heroku-postgresql", "heroku-redis"]
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require_relative "../base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
module Production
|
5
|
-
class SingleRedirect < Generators::Base
|
6
|
-
def add_rack_canonical_host
|
7
|
-
inject_into_file(
|
8
|
-
"config/environments/production.rb",
|
9
|
-
%{\n config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")},
|
10
|
-
before: "\nend"
|
11
|
-
)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require_relative "../base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
module Production
|
5
|
-
class TimeoutGenerator < Generators::Base
|
6
|
-
def add_gem
|
7
|
-
gem "rack-timeout", group: :production
|
8
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
9
|
-
end
|
10
|
-
|
11
|
-
def configure_rack_timeout
|
12
|
-
append_file ".sample.env", rack_timeout_config
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def rack_timeout_config
|
18
|
-
%(RACK_TIMEOUT_SERVICE_TIMEOUT=10)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class ProfilerGenerator < Generators::Base
|
5
|
-
def augment_default_env
|
6
|
-
append_to_file ".sample.env", "RACK_MINI_PROFILER=0\n"
|
7
|
-
rescue Errno::ENOENT
|
8
|
-
create_file ".sample.env", "RACK_MINI_PROFILER=0\n"
|
9
|
-
rescue Thor::Error => e
|
10
|
-
if e.message.match?(/does not appear to exist/)
|
11
|
-
create_file ".sample.env", "RACK_MINI_PROFILER=0\n"
|
12
|
-
else
|
13
|
-
raise
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def add_gem
|
18
|
-
gem "rack-mini-profiler", require: false
|
19
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
20
|
-
end
|
21
|
-
|
22
|
-
def configure_rack_mini_profiler
|
23
|
-
copy_file(
|
24
|
-
"rack_mini_profiler.rb",
|
25
|
-
"config/initializers/rack_mini_profiler.rb",
|
26
|
-
force: false,
|
27
|
-
skip: true
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
def update_readme
|
32
|
-
append_template_to_file "README.md", "partials/profiler_readme.md"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class RunnerGenerator < Generators::Base
|
5
|
-
def procfile
|
6
|
-
copy_file "Procfile", "Procfile"
|
7
|
-
end
|
8
|
-
|
9
|
-
def sample_env
|
10
|
-
copy_file "sample_env", ".sample.env"
|
11
|
-
end
|
12
|
-
|
13
|
-
def copy_sample_env
|
14
|
-
if bin_setup_is_ruby?
|
15
|
-
inject_template_into_file(
|
16
|
-
"bin/setup",
|
17
|
-
"partials/runner_setup.rb",
|
18
|
-
before: %( puts "\\n== Preparing database ==")
|
19
|
-
)
|
20
|
-
elsif bin_setup_mentions_ci?
|
21
|
-
inject_into_file(
|
22
|
-
"bin/setup",
|
23
|
-
%( cp -i .sample.env .env\n),
|
24
|
-
after: %(if [ -z "$CI" ]; then\n)
|
25
|
-
)
|
26
|
-
else
|
27
|
-
append_to_file(
|
28
|
-
"bin/setup",
|
29
|
-
%(\nif [ -z "$CI" ]; then\n cp -i .sample.env .env\nfi)
|
30
|
-
)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def update_readme
|
35
|
-
append_template_to_file "README.md", "partials/runner_readme.md"
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def bin_setup_is_ruby?
|
41
|
-
File.read("bin/setup", 20).match?(%r{#!/usr/bin/env ruby})
|
42
|
-
end
|
43
|
-
|
44
|
-
def bin_setup_mentions_ci?
|
45
|
-
File.read("bin/setup").match?(/if \[ -z "\$CI" \]/)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require_relative "../base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
module Staging
|
5
|
-
class PullRequestsGenerator < Generators::Base
|
6
|
-
def configure_heroku_staging_pr_pipeline_host
|
7
|
-
inject_template_into_file(
|
8
|
-
"config/environments/production.rb",
|
9
|
-
"partials/pull_requests_config.rb",
|
10
|
-
after: "Rails.application.configure do\n"
|
11
|
-
)
|
12
|
-
end
|
13
|
-
|
14
|
-
def create_review_apps_setup_script
|
15
|
-
template(
|
16
|
-
"bin_setup_review_app.erb",
|
17
|
-
"bin/setup_review_app",
|
18
|
-
force: true
|
19
|
-
)
|
20
|
-
|
21
|
-
run "chmod a+x bin/setup_review_app"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class StaticGenerator < Generators::Base
|
5
|
-
def add_high_voltage
|
6
|
-
gem "high_voltage"
|
7
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
8
|
-
end
|
9
|
-
|
10
|
-
def make_placeholder_directory
|
11
|
-
empty_directory_with_keep_file "app/views/pages"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class StylelintGenerator < Generators::Base
|
5
|
-
def setup_hound
|
6
|
-
action InvokeGenerator.new(self, "suspenders:lint")
|
7
|
-
action ToggleComments.new(self, ".hound.yml", /stylelintrc/)
|
8
|
-
end
|
9
|
-
|
10
|
-
def install_stylelint
|
11
|
-
dependencies = ["stylelint", "@thoughtbot/stylelint-config"]
|
12
|
-
action YarnInstall.new(self, dependencies, "--dev")
|
13
|
-
end
|
14
|
-
|
15
|
-
def copy_stylelint_config
|
16
|
-
copy_file "stylelintrc.json", ".stylelintrc.json"
|
17
|
-
end
|
18
|
-
|
19
|
-
class InvokeGenerator
|
20
|
-
def initialize(base, generator)
|
21
|
-
@base = base
|
22
|
-
@generator = generator
|
23
|
-
end
|
24
|
-
|
25
|
-
def invoke!
|
26
|
-
@base.invoke @generator
|
27
|
-
end
|
28
|
-
|
29
|
-
def revoke!
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class ToggleComments
|
34
|
-
def initialize(base, filename, pattern)
|
35
|
-
@base = base
|
36
|
-
@filename = filename
|
37
|
-
@pattern = pattern
|
38
|
-
end
|
39
|
-
|
40
|
-
def invoke!
|
41
|
-
@base.uncomment_lines(@filename, @pattern)
|
42
|
-
end
|
43
|
-
|
44
|
-
def revoke!
|
45
|
-
@base.behavior = :invoke
|
46
|
-
@base.comment_lines(@filename, @pattern)
|
47
|
-
ensure
|
48
|
-
@base.behavior = :revoke
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
class YarnInstall
|
53
|
-
def initialize(base, dependencies, flags)
|
54
|
-
@base = base
|
55
|
-
@dependencies = dependencies.join(" ")
|
56
|
-
@flags = flags
|
57
|
-
end
|
58
|
-
|
59
|
-
def invoke!
|
60
|
-
@base.run "bin/yarn add #{@dependencies} #{@flags}"
|
61
|
-
end
|
62
|
-
|
63
|
-
def revoke!
|
64
|
-
@base.behavior = :invoke
|
65
|
-
@base.run "bin/yarn remove #{@dependencies}"
|
66
|
-
ensure
|
67
|
-
@base.behavior = :revoke
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class StylesheetBaseGenerator < Generators::Base
|
5
|
-
def setup_normalize
|
6
|
-
run "yarn add postcss-normalize"
|
7
|
-
copy_file(
|
8
|
-
"application.postcss.css",
|
9
|
-
"app/assets/stylesheets/application.postcss.css",
|
10
|
-
force: true
|
11
|
-
)
|
12
|
-
copy_file "postcss.config.js", "postcss.config.js", force: true
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class TestingGenerator < Generators::Base
|
5
|
-
def add_testing_gems
|
6
|
-
gem "rspec-rails", "~> 5.1", group: %i[development test]
|
7
|
-
gem "shoulda-matchers", group: :test
|
8
|
-
|
9
|
-
Bundler.with_unbundled_env { run "bundle install" }
|
10
|
-
end
|
11
|
-
|
12
|
-
def generate_rspec
|
13
|
-
generate "rspec:install"
|
14
|
-
end
|
15
|
-
|
16
|
-
def configure_rspec
|
17
|
-
remove_file "spec/rails_helper.rb"
|
18
|
-
remove_file "spec/spec_helper.rb"
|
19
|
-
copy_file "rails_helper.rb", "spec/rails_helper.rb"
|
20
|
-
copy_file "spec_helper.rb", "spec/spec_helper.rb"
|
21
|
-
end
|
22
|
-
|
23
|
-
def provide_shoulda_matchers_config
|
24
|
-
copy_file(
|
25
|
-
"shoulda_matchers_config_rspec.rb",
|
26
|
-
"spec/support/shoulda_matchers.rb"
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
def configure_system_tests
|
31
|
-
empty_directory_with_keep_file "spec/system"
|
32
|
-
empty_directory_with_keep_file "spec/support/system"
|
33
|
-
end
|
34
|
-
|
35
|
-
def configure_i18n_for_test_environment
|
36
|
-
copy_file "i18n.rb", "spec/support/i18n.rb"
|
37
|
-
end
|
38
|
-
|
39
|
-
def configure_action_mailer_in_specs
|
40
|
-
copy_file "action_mailer.rb", "spec/support/action_mailer.rb"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require_relative "base"
|
2
|
-
|
3
|
-
module Suspenders
|
4
|
-
class ViewsGenerator < Generators::Base
|
5
|
-
def create_partials_directory
|
6
|
-
empty_directory "app/views/application"
|
7
|
-
end
|
8
|
-
|
9
|
-
def create_shared_flashes
|
10
|
-
copy_file "_flashes.html.erb", "app/views/application/_flashes.html.erb"
|
11
|
-
copy_file "flashes_helper.rb", "app/helpers/flashes_helper.rb"
|
12
|
-
end
|
13
|
-
|
14
|
-
def create_shared_css_overrides
|
15
|
-
copy_file "_css_overrides.html.erb",
|
16
|
-
"app/views/application/_css_overrides.html.erb"
|
17
|
-
end
|
18
|
-
|
19
|
-
def create_application_layout
|
20
|
-
template "suspenders_layout.html.erb.erb",
|
21
|
-
"app/views/layouts/application.html.erb",
|
22
|
-
force: true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/templates/Gemfile.erb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
git_source(:github) do |repo_name|
|
4
|
-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
5
|
-
"https://github.com/#{repo_name}.git"
|
6
|
-
end
|
7
|
-
|
8
|
-
ruby "<%= Suspenders::RUBY_VERSION %>"
|
9
|
-
|
10
|
-
<% if options[:api] %>
|
11
|
-
gem "sprockets", "< 4"
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
gem "bootsnap", require: false
|
15
|
-
gem "cssbundling-rails"
|
16
|
-
gem "honeybadger"
|
17
|
-
gem "jsbundling-rails"
|
18
|
-
gem "pg"
|
19
|
-
gem "puma"
|
20
|
-
gem "rack-canonical-host"
|
21
|
-
gem "rails", "<%= Suspenders::RAILS_VERSION %>"
|
22
|
-
gem "recipient_interceptor"
|
23
|
-
gem "sassc-rails"
|
24
|
-
gem "skylight"
|
25
|
-
gem "sprockets-rails"
|
26
|
-
gem "stimulus-rails"
|
27
|
-
gem "title"
|
28
|
-
gem "turbo-rails"
|
29
|
-
gem "tzinfo-data", platforms: [:mingw, :x64_mingw, :mswin, :jruby]
|
30
|
-
|
31
|
-
group :development do
|
32
|
-
gem "listen"
|
33
|
-
gem "web-console"
|
34
|
-
end
|
35
|
-
|
36
|
-
group :development, :test do
|
37
|
-
gem "awesome_print"
|
38
|
-
gem "pry-byebug"
|
39
|
-
gem "pry-rails"
|
40
|
-
end
|
41
|
-
|
42
|
-
group :test do
|
43
|
-
gem "formulaic"
|
44
|
-
gem "launchy"
|
45
|
-
gem "timecop"
|
46
|
-
gem "webmock"
|
47
|
-
end
|
48
|
-
|
49
|
-
gem "suspenders", group: [:development, :test]
|
data/templates/Procfile
DELETED
data/templates/README.md.erb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# <%= app_name.humanize %>
|
2
|
-
|
3
|
-
## Getting Started
|
4
|
-
|
5
|
-
After you have cloned this repo, run this setup script to set up your machine
|
6
|
-
with the necessary dependencies to run and test this app:
|
7
|
-
|
8
|
-
% ./bin/setup
|
9
|
-
|
10
|
-
It assumes you have a machine equipped with Ruby, Postgres, etc. If not, set up
|
11
|
-
your machine with [this script].
|
12
|
-
|
13
|
-
[this script]: https://github.com/thoughtbot/laptop
|
14
|
-
|
15
|
-
After setting up, you can run the application using [Heroku Local]:
|
16
|
-
|
17
|
-
% heroku local
|
18
|
-
|
19
|
-
[Heroku Local]: https://devcenter.heroku.com/articles/heroku-local
|
20
|
-
|
21
|
-
## Guidelines
|
22
|
-
|
23
|
-
Use the following guides for getting things done, programming well, and
|
24
|
-
programming in style.
|
25
|
-
|
26
|
-
* [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
|
27
|
-
* [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
|
28
|
-
* [Style](http://github.com/thoughtbot/guides/blob/master/style)
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<% if ENV["SEGMENT_KEY"] %>
|
2
|
-
<script type="text/javascript">
|
3
|
-
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
|
4
|
-
analytics.load("<%= ENV["SEGMENT_KEY"] %>");
|
5
|
-
analytics.page();
|
6
|
-
}}();
|
7
|
-
</script>
|
8
|
-
<% end %>
|