welaika-suspenders 2.31.0 → 2.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/CHANGELOG_WELAIKA.md +9 -0
- data/NEWS.md +13 -0
- data/lib/suspenders/app_builder.rb +1 -0
- data/lib/suspenders/generators/app_generator.rb +1 -0
- data/lib/suspenders/generators/ci_generator.rb +2 -0
- data/lib/suspenders/generators/js_driver_generator.rb +6 -1
- data/lib/suspenders/generators/lint_generator.rb +8 -3
- data/lib/suspenders/generators/stylelint_generator.rb +37 -0
- data/lib/suspenders/generators/testing_generator.rb +2 -1
- data/lib/suspenders/version.rb +2 -2
- data/lib/suspenders.rb +1 -0
- data/spec/features/stylelint_spec.rb +38 -0
- data/suspenders.gemspec +1 -0
- data/templates/Dockerfile.gitlab.erb +56 -0
- data/templates/Gemfile.erb +4 -1
- data/templates/README.md.erb +25 -13
- data/templates/browserslist +1 -0
- data/templates/capybara_silence_puma.rb +1 -0
- data/templates/chromedriver.rb +16 -21
- data/templates/dockerignore +28 -0
- data/templates/gitlab-ci.yml.erb +9 -12
- data/templates/overcommit.yml +9 -0
- data/templates/rakefile_template.rb +1 -0
- data/templates/rubocop.yml +4 -1
- data/templates/spec_helper.rb +3 -1
- data/templates/stylelintrc.json +83 -0
- metadata +28 -7
- data/todo.txt +0 -15
- data/todo_suspenders.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa410fcc07994007373f8540720d69b677a4c99a93d4e7a7ddcfa6a6cc0164d1
|
4
|
+
data.tar.gz: 5882a69046c98bed5863298d97b6b53787320fbf13c41ecb206de269744c22c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42f5419c01bd320331fc8f064dab72da935e02c1414b5bd8ebca046b2717062644f552be248e7298164a4aa9d6304be571c60edda4fa7f4ed1a874998ca6969e
|
7
|
+
data.tar.gz: c4389e82bec8f413934f1c0c5a7ba7fc79d3ed39438e0666228d126179c5fe571a32836646b6c3f22d92249bb85eac01f27c415b33e834d17760f16366060a75
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.3
|
data/.travis.yml
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
2.32.0 (June 24, 2019)
|
2
|
+
* Changed: introduced this file (`CHANGELOG_WELAIKA`) to tracks changes. The original file from thoughtbot is called `NEWS.MD`.
|
3
|
+
* Feature: linter for sass files ([stylelint](https://stylelint.io/)). Defaults are almost the same as thoughtbot. I edited some rules to support sass syntax, but probably we will need more tweaks. Voluteers?
|
4
|
+
* Change: use system tests instead of feature tests. Rspec now suggests you to use system tests instead of features tests because 1) they are build in in Rails 2) they share the same database connection so we don't need `database_cleaner` anymore. Create system tests in `spec/system`, that's it!
|
5
|
+
* Change: reintroduced `autoprefixer-rails`. I removed it some weeks ago because I had problems deploying a rails app with in on Heroku. I don't know if anything changed, but I would like to give it a second chance :)
|
6
|
+
* Change: rubocop is not splitted in several gems
|
7
|
+
* Feature: use a custom docker image for gitlab.ci. We experimented this already in a couple of projects. We use a docker image so we can install node, yarn and chrome once for all.
|
8
|
+
* Change: removed the CI configuration for a remote selenium webdriver. We don't need it anymore. Some old projects still uses it, but newer ones will just use headless Chrome and a custom docker image.
|
9
|
+
* Change: use bundler 2 now that Heroku supports it https://devcenter.heroku.com/articles/ruby-support#libraries
|
data/NEWS.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
1.52.0 (June 7, 2019)
|
2
|
+
* Changed: Setup system tests instead of feature specs
|
3
|
+
* Upgraded: Rails 5.2.3
|
4
|
+
|
5
|
+
1.51.0 (April 26, 2019)
|
6
|
+
|
7
|
+
* Changed: from sass-rails to sassc-rails.
|
8
|
+
* Upgraded: Ruby 2.6.3.
|
9
|
+
* Fixed: Avoid installing autoprefixer-rails in api mode
|
10
|
+
* New generator: `suspenders:stylelint` for setting up stylelint.
|
11
|
+
* New generator: `suspenders:production:manifest` for app.json.
|
12
|
+
* New generator: `suspenders:production:deployment` for bin/deploy script.
|
13
|
+
|
1
14
|
1.50.0 (December 28, 2018)
|
2
15
|
|
3
16
|
* Removed: jquery-rails.
|
@@ -237,6 +237,7 @@ config.public_file_server.headers = {
|
|
237
237
|
end
|
238
238
|
|
239
239
|
def copy_miscellaneous_files
|
240
|
+
copy_file "browserslist", "browserslist"
|
240
241
|
copy_file "errors.rb", "config/initializers/errors.rb"
|
241
242
|
copy_file "json_encoding.rb", "config/initializers/json_encoding.rb"
|
242
243
|
end
|
@@ -163,6 +163,7 @@ module Suspenders
|
|
163
163
|
generate("suspenders:db_optimizations")
|
164
164
|
generate("suspenders:factories")
|
165
165
|
generate("suspenders:lint")
|
166
|
+
generate("suspenders:stylelint")
|
166
167
|
generate("suspenders:views")
|
167
168
|
generate("suspenders:decorator")
|
168
169
|
generate("suspenders:faker")
|
@@ -4,7 +4,9 @@ module Suspenders
|
|
4
4
|
class CiGenerator < Generators::Base
|
5
5
|
def configure_ci
|
6
6
|
template 'gitlab-ci.yml.erb', '.gitlab-ci.yml'
|
7
|
+
template 'Dockerfile.gitlab.erb', 'Dockerfile.gitlab'
|
7
8
|
copy_file 'database.gitlab.yml', 'config/database.gitlab.yml'
|
9
|
+
copy_file 'dockerignore', '.dockerignore'
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
@@ -5,11 +5,16 @@ module Suspenders
|
|
5
5
|
def add_gems
|
6
6
|
gem 'capybara', '>= 2.15', '< 4.0', group: :test
|
7
7
|
gem 'selenium-webdriver', group: :test
|
8
|
+
gem 'webdrivers', '~> 4.0', group: :test
|
8
9
|
Bundler.with_clean_env { run "bundle install" }
|
9
10
|
end
|
10
11
|
|
11
|
-
def
|
12
|
+
def configure_capybara
|
12
13
|
copy_file "chromedriver.rb", "spec/support/chromedriver.rb"
|
14
|
+
copy_file(
|
15
|
+
"capybara_silence_puma.rb",
|
16
|
+
"spec/support/capybara_silence_puma.rb",
|
17
|
+
)
|
13
18
|
end
|
14
19
|
end
|
15
20
|
end
|
@@ -3,12 +3,17 @@ require_relative "base"
|
|
3
3
|
module Suspenders
|
4
4
|
class LintGenerator < Generators::Base
|
5
5
|
def add_linters_gems
|
6
|
-
gem 'rubocop', require: false, group: :development
|
6
|
+
gem 'rubocop', '~> 0.71.0', require: false, group: :development
|
7
|
+
gem 'rubocop-performance', require: false, group: :development
|
8
|
+
gem 'rubocop-rails', require: false, group: :development
|
7
9
|
gem 'rubocop-rspec', require: false, group: :development
|
8
10
|
gem 'slim_lint', require: false, group: :development
|
9
|
-
gem 'overcommit', require: false, group: :development
|
11
|
+
gem 'overcommit', '>= 0.48.1', require: false, group: :development
|
10
12
|
gem 'rubycritic', require: false, group: :development
|
11
|
-
|
13
|
+
|
14
|
+
# FIXME: switch back to bundle install once https://github.com/sds/overcommit/pull/649
|
15
|
+
# will be merged
|
16
|
+
Bundler.with_clean_env { run "bundle update" }
|
12
17
|
end
|
13
18
|
|
14
19
|
def setup_rubocop
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
|
3
|
+
module Suspenders
|
4
|
+
class StylelintGenerator < Generators::Base
|
5
|
+
def install_stylelint
|
6
|
+
dependencies = ["stylelint",
|
7
|
+
"stylelint-config-recommended",
|
8
|
+
"stylelint-order",
|
9
|
+
"stylelint-declaration-block-no-ignored-properties",
|
10
|
+
"stylelint-scss"]
|
11
|
+
action YarnInstall.new(self, dependencies, "--dev")
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_stylelint_config
|
15
|
+
copy_file "stylelintrc.json", ".stylelintrc.json"
|
16
|
+
end
|
17
|
+
|
18
|
+
class YarnInstall
|
19
|
+
def initialize(base, dependencies, flags)
|
20
|
+
@base = base
|
21
|
+
@dependencies = dependencies.join(" ")
|
22
|
+
@flags = flags
|
23
|
+
end
|
24
|
+
|
25
|
+
def invoke!
|
26
|
+
@base.run "bin/yarn add #{@dependencies} #{@flags}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def revoke!
|
30
|
+
@base.behavior = :invoke
|
31
|
+
@base.run "bin/yarn remove #{@dependencies}"
|
32
|
+
ensure
|
33
|
+
@base.behavior = :revoke
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -27,8 +27,9 @@ module Suspenders
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def configure_system_tests
|
31
31
|
empty_directory_with_keep_file "spec/system"
|
32
|
+
empty_directory_with_keep_file "spec/support/system"
|
32
33
|
end
|
33
34
|
|
34
35
|
def configure_i18n_for_test_environment
|
data/lib/suspenders/version.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Suspenders
|
2
|
-
RAILS_VERSION = "~> 5.2.
|
2
|
+
RAILS_VERSION = "~> 5.2.3".freeze
|
3
3
|
POSTGRES_VERSION = "10.6".freeze # Used in CI
|
4
4
|
RUBY_VERSION = IO.
|
5
5
|
read("#{File.dirname(__FILE__)}/../../.ruby-version").
|
6
6
|
strip.
|
7
7
|
freeze
|
8
|
-
VERSION = "2.
|
8
|
+
VERSION = "2.32.0".freeze
|
9
9
|
end
|
data/lib/suspenders.rb
CHANGED
@@ -2,6 +2,7 @@ require "suspenders/version"
|
|
2
2
|
require "suspenders/generators/app_generator"
|
3
3
|
require "suspenders/generators/static_generator"
|
4
4
|
require "suspenders/generators/stylesheet_base_generator"
|
5
|
+
require "suspenders/generators/stylelint_generator"
|
5
6
|
require "suspenders/generators/ci_generator"
|
6
7
|
require "suspenders/generators/db_optimizations_generator"
|
7
8
|
require "suspenders/generators/factories_generator"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "suspenders:stylelint", type: :generator do
|
4
|
+
context "generate" do
|
5
|
+
it "creates .stylelintrc.json" do
|
6
|
+
with_app { generate("suspenders:stylelint") }
|
7
|
+
|
8
|
+
expect(".stylelintrc.json").to exist_as_a_file
|
9
|
+
end
|
10
|
+
|
11
|
+
it "adds stylelint to the package.json" do
|
12
|
+
with_app { generate("suspenders:stylelint") }
|
13
|
+
|
14
|
+
expect("package.json").to match_contents(/devDependencies/)
|
15
|
+
expect("package.json").to match_contents(/stylelint/)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "destroy" do
|
20
|
+
it "removes .stylelintrc.json" do
|
21
|
+
with_app do
|
22
|
+
generate("suspenders:stylelint")
|
23
|
+
destroy("suspenders:stylelint")
|
24
|
+
end
|
25
|
+
|
26
|
+
expect(".stylelintrc.json").not_to exist_as_a_file
|
27
|
+
end
|
28
|
+
|
29
|
+
it "removes stylelint from package.json" do
|
30
|
+
with_app do
|
31
|
+
generate("suspenders:stylelint")
|
32
|
+
destroy("suspenders:stylelint")
|
33
|
+
end
|
34
|
+
|
35
|
+
expect("package.json").not_to match_contents(/stylelint/)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/suspenders.gemspec
CHANGED
@@ -27,6 +27,7 @@ weLaika's fork of the famous thoughbot suspenders gem.
|
|
27
27
|
s.version = Suspenders::VERSION
|
28
28
|
|
29
29
|
s.add_dependency 'rails', Suspenders::RAILS_VERSION
|
30
|
+
s.add_dependency 'bundler', '>=2'
|
30
31
|
|
31
32
|
s.add_development_dependency 'rspec', '~> 3.8'
|
32
33
|
s.add_development_dependency 'pry-byebug', '~> 3.6'
|
@@ -0,0 +1,56 @@
|
|
1
|
+
FROM ruby:<%= Suspenders::RUBY_VERSION %>
|
2
|
+
|
3
|
+
LABEL maintainer="fabrizio.monti@welaika.com"
|
4
|
+
|
5
|
+
# https://github.com/hadolint/hadolint/wiki/DL4006
|
6
|
+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
7
|
+
|
8
|
+
# hadolint ignore=DL3008
|
9
|
+
RUN apt-get update \
|
10
|
+
&& apt-get install -y --no-install-recommends locales \
|
11
|
+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
|
12
|
+
&& apt-get clean \
|
13
|
+
&& rm -rf /var/lib/apt/lists/*
|
14
|
+
|
15
|
+
ENV LANG en_US.utf8
|
16
|
+
|
17
|
+
# install project specific apt packages
|
18
|
+
# hadolint ignore=DL3008
|
19
|
+
RUN apt-get update \
|
20
|
+
&& apt-get install -y --no-install-recommends imagemagick \
|
21
|
+
&& apt-get clean \
|
22
|
+
&& rm -rf /var/lib/apt/lists/*
|
23
|
+
|
24
|
+
# install nodejs
|
25
|
+
# hadolint ignore=DL3008
|
26
|
+
RUN curl -sSL https://deb.nodesource.com/setup_10.x | bash - \
|
27
|
+
&& apt-get update \
|
28
|
+
&& apt-get install -y --no-install-recommends nodejs \
|
29
|
+
&& apt-get clean \
|
30
|
+
&& rm -rf /var/lib/apt/lists/*
|
31
|
+
|
32
|
+
# install yarn
|
33
|
+
# hadolint ignore=DL3008
|
34
|
+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
35
|
+
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
|
36
|
+
&& apt-get update \
|
37
|
+
&& apt-get install -y --no-install-recommends yarn \
|
38
|
+
&& apt-get clean \
|
39
|
+
&& rm -rf /var/lib/apt/lists/*
|
40
|
+
|
41
|
+
# install chrome
|
42
|
+
# `dpkg -i` and `apt-get -f` must be different bash commands, so we must use `;` instead of `&&` chain
|
43
|
+
RUN curl -sS -O https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
|
44
|
+
&& dpkg -i google-chrome-stable_current_amd64.deb; \
|
45
|
+
apt-get update \
|
46
|
+
&& apt-get -y --fix-broken --no-install-recommends install \
|
47
|
+
&& rm google-chrome-stable_current_amd64.deb \
|
48
|
+
&& apt-get clean \
|
49
|
+
&& rm -rf /var/lib/apt/lists/*
|
50
|
+
|
51
|
+
RUN gem install bundler --version '>= 2' \
|
52
|
+
&& bundle config git.allow_insecure true \
|
53
|
+
&& bundle config silence_root_warning true \
|
54
|
+
&& bundle config jobs "$(nproc)"
|
55
|
+
|
56
|
+
CMD ["irb"]
|
data/templates/Gemfile.erb
CHANGED
@@ -9,7 +9,10 @@ end
|
|
9
9
|
|
10
10
|
ruby '<%= Suspenders::RUBY_VERSION %>'
|
11
11
|
|
12
|
-
gem 'active_interaction', '~> 3.
|
12
|
+
gem 'active_interaction', '~> 3.7'
|
13
|
+
<% unless options[:api] %>
|
14
|
+
gem 'autoprefixer-rails'
|
15
|
+
<% end %>
|
13
16
|
gem 'bootsnap', '>= 1.1.0', require: false
|
14
17
|
gem 'coffee-rails', '~> 4.2'
|
15
18
|
gem 'email_validator'
|
data/templates/README.md.erb
CHANGED
@@ -2,15 +2,7 @@
|
|
2
2
|
|
3
3
|
## Getting Started
|
4
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 or MySQL, Node, Yarn and ImageMagick.
|
11
|
-
|
12
5
|
To install Ruby, read the [rbenv guide](https://github.com/rbenv/rbenv#installation)
|
13
|
-
or the [rvm guide](https://rvm.io/rvm/install).
|
14
6
|
|
15
7
|
To install Postgres:
|
16
8
|
|
@@ -30,18 +22,22 @@ To install Yarn:
|
|
30
22
|
|
31
23
|
$ brew install yarn
|
32
24
|
|
33
|
-
To install Chromedriver (for integration test):
|
34
|
-
|
35
|
-
$ brew cask install chromedriver
|
36
|
-
|
37
25
|
To install ImageMagick (delete if not applicable):
|
38
26
|
|
39
27
|
$ brew install imagemagick@6
|
40
28
|
|
41
|
-
|
29
|
+
Now, clone this repo and you are ready to run the setup script:
|
30
|
+
|
31
|
+
% ./bin/setup
|
32
|
+
|
33
|
+
You can run the application using [Heroku Local](https://devcenter.heroku.com/articles/heroku-local):
|
42
34
|
|
43
35
|
$ heroku local
|
44
36
|
|
37
|
+
Run the quality checks and the tests suite:
|
38
|
+
|
39
|
+
$ rake
|
40
|
+
|
45
41
|
## Setup on Heroku (delete if not applicable):
|
46
42
|
|
47
43
|
### Database
|
@@ -81,3 +77,19 @@ For Sentry's release detection to work correctly, please run
|
|
81
77
|
https://elements.heroku.com/addons/heroku-redis
|
82
78
|
|
83
79
|
$ heroku addons:create heroku-redis:hobby-dev
|
80
|
+
|
81
|
+
## Gitlab Docker Image
|
82
|
+
|
83
|
+
We use a customer Docker image for our gitlab CI.
|
84
|
+
|
85
|
+
You can read more about submitting a new image version [here](https://gitlab.com/welaika/<%= app_name %>/container_registry).
|
86
|
+
|
87
|
+
Since our `Dockerfile` is called `Dockerfile.gitlab`, the commands are slightly different:
|
88
|
+
|
89
|
+
|
90
|
+
```bash
|
91
|
+
$ docker build -f Dockerfile.gitlab -t registry.gitlab.com/welaika/<%= app_name %> .
|
92
|
+
$ docker push registry.gitlab.com/welaika/<%= app_name %>
|
93
|
+
```
|
94
|
+
|
95
|
+
Eventually, you can lint Dockerfiles with [hadolint](https://github.com/hadolint/hadolint)
|
@@ -0,0 +1 @@
|
|
1
|
+
Last 2 versions
|
@@ -0,0 +1 @@
|
|
1
|
+
Capybara.server = :puma, { Silent: true }
|
data/templates/chromedriver.rb
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'webdrivers'
|
3
4
|
require 'selenium/webdriver'
|
4
5
|
|
5
|
-
Capybara.
|
6
|
+
Capybara.register_driver :chrome do |app|
|
7
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
8
|
+
end
|
6
9
|
|
7
10
|
Capybara.register_driver :headless_chrome do |app|
|
11
|
+
options = ::Selenium::WebDriver::Chrome::Options.new
|
12
|
+
options.headless!
|
13
|
+
# Set a big (15" MBP retina resolution) window size so that
|
14
|
+
# `save_and_open_screenshot` captures the whole page.
|
15
|
+
options.add_argument "--window-size=1680,1050"
|
16
|
+
|
8
17
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
9
18
|
chromeOptions: { args: %w[headless disable-gpu] }
|
10
19
|
)
|
@@ -12,31 +21,17 @@ Capybara.register_driver :headless_chrome do |app|
|
|
12
21
|
Capybara::Selenium::Driver.new(
|
13
22
|
app,
|
14
23
|
browser: :chrome,
|
24
|
+
options: options,
|
15
25
|
desired_capabilities: capabilities
|
16
26
|
)
|
17
27
|
end
|
18
28
|
|
29
|
+
# NOTE: here for backwards compatibility, we should use system tests
|
30
|
+
# instead now (`driven_by :headless_chrome`)
|
31
|
+
Capybara.javascript_driver = :headless_chrome
|
32
|
+
|
19
33
|
RSpec.configure do |config|
|
20
34
|
config.before(:each, type: :system) do
|
21
|
-
|
22
|
-
# Make the test app listen to outside requests, for the remote Selenium instance.
|
23
|
-
Capybara.server_host = '0.0.0.0'
|
24
|
-
|
25
|
-
# Specify the driver
|
26
|
-
driven_by :selenium, using: :chrome, screen_size: [1400, 2000],
|
27
|
-
options: { url: ENV['SELENIUM_REMOTE_URL'] }
|
28
|
-
|
29
|
-
# Get the rails application IP
|
30
|
-
rails_ip = Socket.ip_address_list.find(&:ipv4_private?).ip_address
|
31
|
-
|
32
|
-
# Set the rails application Port (choose what you want)
|
33
|
-
Capybara.server_port = 3001
|
34
|
-
|
35
|
-
# Use the IP instead of localhost so Capybara knows where to direct Selenium
|
36
|
-
host! "http://#{rails_ip}:#{Capybara.server_port}"
|
37
|
-
else
|
38
|
-
# Otherwise, use the local machine's chromedriver
|
39
|
-
driven_by :headless_chrome
|
40
|
-
end
|
35
|
+
driven_by :headless_chrome
|
41
36
|
end
|
42
37
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Git
|
2
|
+
/.git
|
3
|
+
/.gitignore
|
4
|
+
|
5
|
+
# Editor temp files
|
6
|
+
*.swp *.swo
|
7
|
+
|
8
|
+
# Logs
|
9
|
+
/log/*
|
10
|
+
|
11
|
+
# Dumps
|
12
|
+
/*.sql.gz
|
13
|
+
/latest.dump
|
14
|
+
|
15
|
+
# Temp files
|
16
|
+
/tmp/*
|
17
|
+
|
18
|
+
# Node
|
19
|
+
/node_modules/*
|
20
|
+
|
21
|
+
# Uploads
|
22
|
+
/public/system/*
|
23
|
+
/public/uploads/*
|
24
|
+
/storage/*
|
25
|
+
/uploads/*
|
26
|
+
|
27
|
+
# Test
|
28
|
+
/coverage/*
|
data/templates/gitlab-ci.yml.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
image:
|
1
|
+
image: registry.gitlab.com/welaika/<%= app_name %>
|
2
2
|
|
3
3
|
variables:
|
4
4
|
GET_SOURCES_ATTEMPTS: 3
|
@@ -7,7 +7,6 @@ variables:
|
|
7
7
|
POSTGRES_DB: rails_app_test
|
8
8
|
POSTGRES_USER: root
|
9
9
|
POSTGRES_PASSWORD: ''
|
10
|
-
SELENIUM_REMOTE_URL: "http://selenium__standalone-chrome:4444/wd/hub/"
|
11
10
|
|
12
11
|
.job-creation-policy: &job-creation-policy
|
13
12
|
only:
|
@@ -18,7 +17,6 @@ variables:
|
|
18
17
|
|
19
18
|
.services: &rails-services
|
20
19
|
- postgres:<%= Suspenders::POSTGRES_VERSION %>
|
21
|
-
- selenium/standalone-chrome:latest
|
22
20
|
|
23
21
|
.cache: &cache-settings
|
24
22
|
key: "$CI_COMMIT_REF_SLUG"
|
@@ -50,6 +48,14 @@ quality:rubocop:
|
|
50
48
|
- bundle check --path vendor/bundle
|
51
49
|
- bundle exec rubocop
|
52
50
|
|
51
|
+
quality:stylelint:
|
52
|
+
<<: *job-creation-policy
|
53
|
+
stage: quality
|
54
|
+
cache:
|
55
|
+
<<: *cache-settings
|
56
|
+
script:
|
57
|
+
- npx stylelint app/assets/stylesheets
|
58
|
+
|
53
59
|
quality:slim_lint:
|
54
60
|
<<: *job-creation-policy
|
55
61
|
stage: quality
|
@@ -93,15 +99,6 @@ test:rspec:
|
|
93
99
|
cache:
|
94
100
|
<<: *cache-settings
|
95
101
|
script:
|
96
|
-
# Install node
|
97
|
-
- curl -sL https://deb.nodesource.com/setup_10.x | bash -
|
98
|
-
- apt-get install -qq nodejs
|
99
|
-
|
100
|
-
# Install yarn
|
101
|
-
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
102
|
-
- echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
|
103
|
-
- apt-get update -qq && apt-get install -qq yarn
|
104
|
-
|
105
102
|
# Verify node and yarn versions
|
106
103
|
- node --version
|
107
104
|
- yarn --version
|
data/templates/overcommit.yml
CHANGED
@@ -12,3 +12,12 @@ PreCommit:
|
|
12
12
|
enabled: true
|
13
13
|
on_warn: fail # Treat all warnings as failures
|
14
14
|
command: ['bundle', 'exec', 'slim-lint'] # Invoke within Bundler context
|
15
|
+
|
16
|
+
Stylelint:
|
17
|
+
enabled: true
|
18
|
+
description: 'Check styles with Stylelint'
|
19
|
+
command: ['npx', 'stylelint']
|
20
|
+
include:
|
21
|
+
- '**/*.scss'
|
22
|
+
- '**/*.sass'
|
23
|
+
- '**/*.css'
|
@@ -11,6 +11,7 @@ task(:default).clear
|
|
11
11
|
desc 'Run linters, quality, security and tests'
|
12
12
|
task :default do
|
13
13
|
sh 'bundle exec rubocop'
|
14
|
+
sh 'npx stylelint app/assets/stylesheets'
|
14
15
|
sh 'bundle exec slim-lint app/views/'
|
15
16
|
sh 'bundle exec rubycritic app/ config/ lib/ --no-browser --minimum-score 94 --format console'
|
16
17
|
sh 'bundle exec bundle-audit check --update'
|
data/templates/rubocop.yml
CHANGED
data/templates/spec_helper.rb
CHANGED
@@ -38,7 +38,9 @@ RSpec.configure do |config|
|
|
38
38
|
Kernel.srand config.seed
|
39
39
|
end
|
40
40
|
|
41
|
-
WebMock.disable_net_connect!(
|
41
|
+
WebMock.disable_net_connect!(
|
42
|
+
allow_localhost: true, allow: %w[chromedriver.storage.googleapis.com]
|
43
|
+
)
|
42
44
|
|
43
45
|
# Only allow Timecop with block syntax
|
44
46
|
Timecop.safe_mode = true
|
@@ -0,0 +1,83 @@
|
|
1
|
+
{
|
2
|
+
"extends": "stylelint-config-recommended",
|
3
|
+
"plugins": [
|
4
|
+
"stylelint-declaration-block-no-ignored-properties",
|
5
|
+
"stylelint-order",
|
6
|
+
"stylelint-scss"
|
7
|
+
],
|
8
|
+
"rules": {
|
9
|
+
"at-rule-no-unknown": null,
|
10
|
+
"block-closing-brace-empty-line-before": null,
|
11
|
+
"block-closing-brace-newline-before": null,
|
12
|
+
"block-opening-brace-newline-after": null,
|
13
|
+
"block-opening-brace-space-before": null,
|
14
|
+
"color-hex-case": "lower",
|
15
|
+
"color-hex-length": "short",
|
16
|
+
"color-named": "never",
|
17
|
+
"comment-whitespace-inside": "always",
|
18
|
+
"declaration-bang-space-after": "never",
|
19
|
+
"declaration-bang-space-before": "always",
|
20
|
+
"declaration-block-semicolon-newline-after": null,
|
21
|
+
"declaration-block-trailing-semicolon": null,
|
22
|
+
"declaration-colon-space-after": "always-single-line",
|
23
|
+
"declaration-colon-space-before": "never",
|
24
|
+
"declaration-no-important": true,
|
25
|
+
"declaration-property-unit-whitelist": {
|
26
|
+
"line-height": []
|
27
|
+
},
|
28
|
+
"declaration-property-value-blacklist": {
|
29
|
+
"/^transition/": ["/all/"]
|
30
|
+
},
|
31
|
+
"function-calc-no-invalid": true,
|
32
|
+
"function-comma-space-after": "always-single-line",
|
33
|
+
"function-comma-space-before": "never",
|
34
|
+
"function-parentheses-space-inside": "never-single-line",
|
35
|
+
"function-url-quotes": "always",
|
36
|
+
"indentation": 2,
|
37
|
+
"length-zero-no-unit": true,
|
38
|
+
"max-nesting-depth": 3,
|
39
|
+
"no-eol-whitespace": true,
|
40
|
+
"no-missing-end-of-source-newline": true,
|
41
|
+
"number-leading-zero": "always",
|
42
|
+
"number-no-trailing-zeros": true,
|
43
|
+
"order/properties-alphabetical-order": true,
|
44
|
+
"plugin/declaration-block-no-ignored-properties": true,
|
45
|
+
"property-no-vendor-prefix": true,
|
46
|
+
"rule-empty-line-before": [
|
47
|
+
"always",
|
48
|
+
{
|
49
|
+
"except": [
|
50
|
+
"first-nested"
|
51
|
+
],
|
52
|
+
"ignore": [
|
53
|
+
"after-comment"
|
54
|
+
]
|
55
|
+
}
|
56
|
+
],
|
57
|
+
"scss/at-extend-no-missing-placeholder": true,
|
58
|
+
"scss/at-import-no-partial-leading-underscore": true,
|
59
|
+
"scss/at-import-partial-extension-blacklist": ["scss"],
|
60
|
+
"scss/at-rule-no-unknown": true,
|
61
|
+
"scss/dollar-variable-colon-space-after": "always",
|
62
|
+
"scss/dollar-variable-colon-space-before": "never",
|
63
|
+
"scss/no-duplicate-dollar-variables": true,
|
64
|
+
"scss/operator-no-unspaced": true,
|
65
|
+
"scss/selector-no-redundant-nesting-selector": true,
|
66
|
+
"selector-list-comma-newline-after": "always",
|
67
|
+
"selector-max-id": 0,
|
68
|
+
"selector-nested-pattern": [
|
69
|
+
"^(?!&__|&--|&-|&_).*", {
|
70
|
+
"message": "Don't concatenate selectors using Sass's parent selector (`&`)."
|
71
|
+
}
|
72
|
+
],
|
73
|
+
"selector-no-qualifying-type": true,
|
74
|
+
"selector-no-vendor-prefix": true,
|
75
|
+
"selector-pseudo-class-case": "lower",
|
76
|
+
"selector-pseudo-element-case": "lower",
|
77
|
+
"selector-pseudo-element-colon-notation": "double",
|
78
|
+
"selector-type-case": "lower",
|
79
|
+
"shorthand-property-no-redundant-values": true,
|
80
|
+
"string-quotes": "double",
|
81
|
+
"value-no-vendor-prefix": true
|
82
|
+
}
|
83
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: welaika-suspenders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -17,14 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 5.2.
|
20
|
+
version: 5.2.3
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 5.2.
|
27
|
+
version: 5.2.3
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '2'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: rspec
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,6 +96,7 @@ files:
|
|
82
96
|
- ".rspec"
|
83
97
|
- ".ruby-version"
|
84
98
|
- ".travis.yml"
|
99
|
+
- CHANGELOG_WELAIKA.md
|
85
100
|
- CONTRIBUTING.md
|
86
101
|
- Gemfile
|
87
102
|
- LICENSE
|
@@ -119,6 +134,7 @@ files:
|
|
119
134
|
- lib/suspenders/generators/security_generator.rb
|
120
135
|
- lib/suspenders/generators/staging/pull_requests_generator.rb
|
121
136
|
- lib/suspenders/generators/static_generator.rb
|
137
|
+
- lib/suspenders/generators/stylelint_generator.rb
|
122
138
|
- lib/suspenders/generators/stylesheet_base_generator.rb
|
123
139
|
- lib/suspenders/generators/testing_generator.rb
|
124
140
|
- lib/suspenders/generators/views_generator.rb
|
@@ -136,6 +152,7 @@ files:
|
|
136
152
|
- spec/features/production/email_spec.rb
|
137
153
|
- spec/features/production/manifest_spec.rb
|
138
154
|
- spec/features/staging/pull_requests_spec.rb
|
155
|
+
- spec/features/stylelint_spec.rb
|
139
156
|
- spec/spec_helper.rb
|
140
157
|
- spec/support/be_executable_matcher.rb
|
141
158
|
- spec/support/contain_json_matcher.rb
|
@@ -146,6 +163,7 @@ files:
|
|
146
163
|
- spec/support/project_files.rb
|
147
164
|
- spec/support/suspenders.rb
|
148
165
|
- suspenders.gemspec
|
166
|
+
- templates/Dockerfile.gitlab.erb
|
149
167
|
- templates/Gemfile.erb
|
150
168
|
- templates/Procfile
|
151
169
|
- templates/README.md.erb
|
@@ -158,10 +176,13 @@ files:
|
|
158
176
|
- templates/bin_import_dump.erb
|
159
177
|
- templates/bin_setup
|
160
178
|
- templates/bin_setup_review_app.erb
|
179
|
+
- templates/browserslist
|
180
|
+
- templates/capybara_silence_puma.rb
|
161
181
|
- templates/chromedriver.rb
|
162
182
|
- templates/config_locales_it.yml.erb
|
163
183
|
- templates/database.gitlab.yml
|
164
184
|
- templates/dev.rake
|
185
|
+
- templates/dockerignore
|
165
186
|
- templates/dotfiles/.ctags
|
166
187
|
- templates/dotfiles/.env
|
167
188
|
- templates/email.rb
|
@@ -190,10 +211,9 @@ files:
|
|
190
211
|
- templates/slim.rb
|
191
212
|
- templates/smtp.rb
|
192
213
|
- templates/spec_helper.rb
|
214
|
+
- templates/stylelintrc.json
|
193
215
|
- templates/suspenders_gitignore
|
194
216
|
- templates/suspenders_layout.html.slim
|
195
|
-
- todo.txt
|
196
|
-
- todo_suspenders.md
|
197
217
|
homepage: http://github.com/welaika/welaika-suspenders
|
198
218
|
licenses:
|
199
219
|
- MIT
|
@@ -207,7 +227,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
227
|
requirements:
|
208
228
|
- - ">="
|
209
229
|
- !ruby/object:Gem::Version
|
210
|
-
version: 2.6.
|
230
|
+
version: 2.6.3
|
211
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
232
|
requirements:
|
213
233
|
- - ">="
|
@@ -231,6 +251,7 @@ test_files:
|
|
231
251
|
- spec/features/production/email_spec.rb
|
232
252
|
- spec/features/production/manifest_spec.rb
|
233
253
|
- spec/features/staging/pull_requests_spec.rb
|
254
|
+
- spec/features/stylelint_spec.rb
|
234
255
|
- spec/spec_helper.rb
|
235
256
|
- spec/support/be_executable_matcher.rb
|
236
257
|
- spec/support/contain_json_matcher.rb
|
data/todo.txt
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# TODO
|
2
|
-
configurare gitlab ci
|
3
|
-
|
4
|
-
# DONE
|
5
|
-
controllare che :sass e :coffee nei file slim funzionino in produzione
|
6
|
-
rake file con rubocop, brakeman, bla bla
|
7
|
-
controllare se ci sono altri linters da mettere
|
8
|
-
aggiungere sentry
|
9
|
-
aggiornare rspec
|
10
|
-
configurare rubocop
|
11
|
-
configurare overcommit
|
12
|
-
aggiungere jquery ad application.js oppure rimuoverlo del tutto!
|
13
|
-
|
14
|
-
# SKIPPED
|
15
|
-
aggiungere sidekiq, oppure rimuovere delayed_job:w
|
data/todo_suspenders.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
* aggiornare rspec-rails
|