boring_generators 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +17 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +75 -0
- data/README.md +23 -3
- data/boring_generators.gemspec +2 -0
- data/lib/boring_generators/version.rb +1 -1
- data/lib/generators/boring/ci/circleci/install/install_generator.rb +31 -0
- data/lib/generators/boring/ci/circleci/install/templates/config.psql.yml.tt +48 -0
- data/lib/generators/boring/ci/circleci/install/templates/config.sql.yml.tt +48 -0
- data/lib/generators/boring/ci/circleci/install/templates/database.yml.ci.tt +14 -0
- data/lib/generators/boring/ci/github_action/install/install_generator.rb +31 -0
- data/lib/generators/boring/ci/github_action/install/templates/ci.yml.tt +59 -0
- data/lib/generators/boring/ci/travisci/install/install_generator.rb +23 -0
- data/lib/generators/boring/ci/travisci/install/templates/.travis.yml.tt +35 -0
- data/lib/generators/boring/rubocop/install/install_generator.rb +37 -0
- data/lib/generators/boring/rubocop/install/templates/.rubocop.yml.tt +262 -0
- data/lib/generators/boring/tailwind/install/install_generator.rb +2 -2
- metadata +3155 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b67dbb666f39abf0bec2904c68065fa65c33cf0456b5a16d8a26fdc8b0e962c
|
4
|
+
data.tar.gz: 4862c8a53fd09686720f71adffeba1cecdb778034d1cdb5a69629f7a61fec625
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1025146551a477fdabd33a6e722fee8bbb4e65fdef5b35075b6cedbc55af53f142620ecdc837e33849703a33ae783e4ed131e7a459489d5be83407618cbcfa61
|
7
|
+
data.tar.gz: 81363bcb6e92b1f815d7757a2adf4a3a6f7d7f646cef62df472159189384b03c624499efa309102ec9312b9fd65aadc0c9caaf6cb37cf3c454ec5b6b491150d0
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
name: Tests
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
steps:
|
8
|
+
- name: Checkout code
|
9
|
+
uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 2.7.1
|
14
|
+
- name: Install gems
|
15
|
+
run: bundle install --jobs 4 --retry 3
|
16
|
+
- name: Run tests
|
17
|
+
run: bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.4.0 (October 23rd, 2020)
|
6
|
+
* Adds CircleCI install generator. ([@abhaynikam][])
|
7
|
+
* Adds GitHub Actions install generator. ([@abhaynikam][])
|
8
|
+
* Adds Travis CI install generator. ([@abhaynikam][])
|
9
|
+
* Adds Rubocop install generator. ([@abhaynikam][])
|
10
|
+
|
5
11
|
## 0.3.0 (September 19th, 2020)
|
6
12
|
* Adds Bullet install generator. ([@abhaynikam][])
|
7
13
|
* Adds Audit gems(bundler-audit, ruby_audit) install generator. ([@abhaynikam][])
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
boring_generators (0.4.0)
|
5
|
+
railties
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (6.0.3.4)
|
11
|
+
actionview (= 6.0.3.4)
|
12
|
+
activesupport (= 6.0.3.4)
|
13
|
+
rack (~> 2.0, >= 2.0.8)
|
14
|
+
rack-test (>= 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (6.0.3.4)
|
18
|
+
activesupport (= 6.0.3.4)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubi (~> 1.4)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activesupport (6.0.3.4)
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
|
+
i18n (>= 0.7, < 2)
|
26
|
+
minitest (~> 5.1)
|
27
|
+
tzinfo (~> 1.1)
|
28
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
29
|
+
builder (3.2.4)
|
30
|
+
byebug (11.1.3)
|
31
|
+
concurrent-ruby (1.1.7)
|
32
|
+
crass (1.0.6)
|
33
|
+
erubi (1.9.0)
|
34
|
+
i18n (1.8.5)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
loofah (2.7.0)
|
37
|
+
crass (~> 1.0.2)
|
38
|
+
nokogiri (>= 1.5.9)
|
39
|
+
method_source (1.0.0)
|
40
|
+
mini_portile2 (2.4.0)
|
41
|
+
minitest (5.14.2)
|
42
|
+
nokogiri (1.10.10)
|
43
|
+
mini_portile2 (~> 2.4.0)
|
44
|
+
rack (2.2.3)
|
45
|
+
rack-test (1.1.0)
|
46
|
+
rack (>= 1.0, < 3)
|
47
|
+
rails-dom-testing (2.0.3)
|
48
|
+
activesupport (>= 4.2.0)
|
49
|
+
nokogiri (>= 1.6)
|
50
|
+
rails-html-sanitizer (1.3.0)
|
51
|
+
loofah (~> 2.3)
|
52
|
+
railties (6.0.3.4)
|
53
|
+
actionpack (= 6.0.3.4)
|
54
|
+
activesupport (= 6.0.3.4)
|
55
|
+
method_source
|
56
|
+
rake (>= 0.8.7)
|
57
|
+
thor (>= 0.20.3, < 2.0)
|
58
|
+
rake (12.3.3)
|
59
|
+
thor (1.0.1)
|
60
|
+
thread_safe (0.3.6)
|
61
|
+
tzinfo (1.2.7)
|
62
|
+
thread_safe (~> 0.1)
|
63
|
+
zeitwerk (2.4.0)
|
64
|
+
|
65
|
+
PLATFORMS
|
66
|
+
ruby
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
boring_generators!
|
70
|
+
byebug
|
71
|
+
minitest (~> 5.0)
|
72
|
+
rake (~> 12.0)
|
73
|
+
|
74
|
+
BUNDLED WITH
|
75
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,8 +1,20 @@
|
|
1
|
-
|
1
|
+
<h3 align="center">
|
2
|
+
Boring Generators
|
3
|
+
</h3>
|
2
4
|
|
3
|
-
|
5
|
+
<p align="center">
|
6
|
+
<a href="https://rubygems.org/gems/boring_generators"><img alt="Gem" src="https://img.shields.io/gem/dt/boring_generators?style=flat-square"></a>
|
7
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/abhaynikam/boring_generators/CI?style=flat-square">
|
8
|
+
</p>
|
9
|
+
|
10
|
+
<p>
|
11
|
+
Have you ever started a new adventure/hobby project of your and instead of spending time in solving the actual problem statement with the website ended up configuring the application and put a lot of effort into it. Yeah, We felt that too. Boring generator tries to resolve the painful same redundant configuration you do in every application by adding generators to easily configure it.
|
12
|
+
</p>
|
13
|
+
|
14
|
+
<p>
|
15
|
+
Check out the generator we support right now. We are planning to add support to most of the mostly used and required gems. We are open to any idea of yours, feel free to raise a discussion by opening up an issue or try contributing.
|
16
|
+
</p>
|
4
17
|
|
5
|
-
Check out the generator we support right now. We are planning to add support to most of the mostly used and required gems. We are open to any idea of yours, feel free to raise a discussion by opening up an issue or try contributing.
|
6
18
|
|
7
19
|
## Installation
|
8
20
|
|
@@ -34,6 +46,10 @@ The boring generator introduces following generators:
|
|
34
46
|
- Install Active Storage for Google Cloud Service: `rails generate boring:active_storage:google:install`
|
35
47
|
- Install Active Storage for AWS: `rails generate boring:active_storage:aws:install`
|
36
48
|
- Install Active Storage for Azure: `rails generate boring:active_storage:azure:install`
|
49
|
+
- Install CircleCI: `rails generate boring:ci:circleci:install --repository_name=<name> --ruby_version=<version>`
|
50
|
+
- Install GitHub Actions: `rails generate boring:ci:github_action:install --repository_name=<name> --ruby_version=<version>`
|
51
|
+
- Install Travis CI: `rails generate boring:ci:travisci:install --ruby_version=<version>`
|
52
|
+
- Install Rubocop: `rails generate boring:rubocop:install --ruby_version=<version>`
|
37
53
|
|
38
54
|
## Development
|
39
55
|
|
@@ -45,6 +61,10 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
45
61
|
|
46
62
|
Bug reports and pull requests are welcome on GitHub at https://github.com/abhaynikam/boring_generators. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/abhaynikam/boring_generators/blob/master/CODE_OF_CONDUCT.md).
|
47
63
|
|
64
|
+
## Changelog
|
65
|
+
|
66
|
+
Boring Generators changelog is available [here](https://github.com/abhaynikam/boring_generators/blob/master/CHANGELOG.md).
|
67
|
+
|
48
68
|
## License
|
49
69
|
|
50
70
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/boring_generators.gemspec
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Ci
|
5
|
+
module Circleci
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
desc "Adds Circle CI to the application"
|
8
|
+
source_root File.expand_path("templates", __dir__)
|
9
|
+
|
10
|
+
DEFAULT_RUBY_VERSION = "2.7.1"
|
11
|
+
DEFAULT_REPOSITORY_NAME = "boring_generators"
|
12
|
+
|
13
|
+
class_option :ruby_version, type: :string, aliases: "-v",
|
14
|
+
desc: "Tell us the ruby version to which you use for the application. Default to Ruby #{DEFAULT_RUBY_VERSION}"
|
15
|
+
class_option :skip_node, type: :boolean, aliases: "-sn",
|
16
|
+
desc: "Skips the node configuration required for webpacker based Rails application."
|
17
|
+
class_option :repository_name, type: :string, aliases: "-rn",
|
18
|
+
desc: "Tell us the repository name to be used as database name on circleci. Defaults to #{DEFAULT_REPOSITORY_NAME}"
|
19
|
+
|
20
|
+
def add_circle_ci_configuration
|
21
|
+
@skip_node = options[:skip_node]
|
22
|
+
@ruby_version = options[:ruby_version] ? options[:ruby_version] : DEFAULT_RUBY_VERSION
|
23
|
+
@repository_name = options[:repository_name] ? options[:repository_name] : DEFAULT_REPOSITORY_NAME
|
24
|
+
|
25
|
+
template("config.psql.yml", ".circleci/config.yml")
|
26
|
+
template("database.yml.ci", "config/database.yml.ci")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
orbs:
|
4
|
+
ruby: circleci/ruby@1.1.1
|
5
|
+
<%- unless @skip_node -%>
|
6
|
+
node: circleci/node@2
|
7
|
+
<%- end -%>
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
parallelism: 1
|
12
|
+
docker:
|
13
|
+
- image: cimg/ruby:<%= @ruby_version %>-node
|
14
|
+
- image: circleci/postgres:11.2
|
15
|
+
environment:
|
16
|
+
POSTGRES_USER: postgres
|
17
|
+
POSTGRES_DB: <%= "#{@repository_name}_test" %>
|
18
|
+
environment:
|
19
|
+
BUNDLE_JOBS: "3"
|
20
|
+
BUNDLE_RETRY: "3"
|
21
|
+
PGHOST: 127.0.0.1
|
22
|
+
PGUSER: postgres
|
23
|
+
RAILS_ENV: test
|
24
|
+
steps:
|
25
|
+
- checkout
|
26
|
+
- ruby/install-deps
|
27
|
+
<%- unless @skip_node -%>
|
28
|
+
# Store bundle cache
|
29
|
+
- node/install-packages:
|
30
|
+
pkg-manager: yarn
|
31
|
+
cache-key: "yarn.lock"
|
32
|
+
<%- end -%>
|
33
|
+
- run: cp config/database.yml.ci config/database.yml
|
34
|
+
- run:
|
35
|
+
name: Wait for DB
|
36
|
+
command: dockerize -wait tcp://localhost:5432 -timeout 1m
|
37
|
+
- run:
|
38
|
+
name: Database setup
|
39
|
+
command: bundle exec rails db:schema:load --trace
|
40
|
+
- run:
|
41
|
+
name: Run test
|
42
|
+
command: bundle exec rails test
|
43
|
+
|
44
|
+
workflows:
|
45
|
+
version: 2
|
46
|
+
test:
|
47
|
+
jobs:
|
48
|
+
- test
|
@@ -0,0 +1,48 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
orbs:
|
4
|
+
ruby: circleci/ruby@1.1.1
|
5
|
+
node: circleci/node@2
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
parallelism: 1
|
10
|
+
docker:
|
11
|
+
- image: cimg/ruby:<%= @ruby_version %>-node
|
12
|
+
environment:
|
13
|
+
MYSQL_DATABASE: <%= @test_database_name %>
|
14
|
+
environment:
|
15
|
+
BUNDLE_JOBS: "3"
|
16
|
+
BUNDLE_RETRY: "3"
|
17
|
+
RAILS_ENV: test
|
18
|
+
steps:
|
19
|
+
- checkout
|
20
|
+
- run:
|
21
|
+
name: Waiting for MySQL to be ready
|
22
|
+
command: |
|
23
|
+
for i in `seq 1 10`;
|
24
|
+
do
|
25
|
+
nc -z 127.0.0.1 3306 && echo Success && exit 0
|
26
|
+
echo -n .
|
27
|
+
sleep 1
|
28
|
+
done
|
29
|
+
echo Failed waiting for MySQL && exit 1
|
30
|
+
- ruby/install-deps
|
31
|
+
<%- unless @skip_node -%>
|
32
|
+
# Store bundle cache
|
33
|
+
- node/install-packages:
|
34
|
+
pkg-manager: yarn
|
35
|
+
cache-key: "yarn.lock"
|
36
|
+
<%- end -%>
|
37
|
+
- run:
|
38
|
+
name: Database setup
|
39
|
+
command: bundle exec rails db:schema:load --trace
|
40
|
+
- run:
|
41
|
+
name: Run test
|
42
|
+
command: bundle exec rails test
|
43
|
+
|
44
|
+
workflows:
|
45
|
+
version: 2
|
46
|
+
test:
|
47
|
+
jobs:
|
48
|
+
- test
|
@@ -0,0 +1,14 @@
|
|
1
|
+
default: &default
|
2
|
+
adapter: postgresql
|
3
|
+
host: 127.0.0.1
|
4
|
+
encoding: unicode
|
5
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 10 } %>
|
6
|
+
|
7
|
+
development:
|
8
|
+
<<: *default
|
9
|
+
database: <%= "#{@repository_name}_development" %>
|
10
|
+
|
11
|
+
test:
|
12
|
+
<<: *default
|
13
|
+
user: postgres
|
14
|
+
database: <%= "#{@repository_name}_test" %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Ci
|
5
|
+
module GithubAction
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
desc "Adds Github Action to the application"
|
8
|
+
source_root File.expand_path("templates", __dir__)
|
9
|
+
|
10
|
+
DEFAULT_RUBY_VERSION = "2.7.1"
|
11
|
+
DEFAULT_NODE_VERSION = "10.13.0"
|
12
|
+
DEFAULT_REPOSITORY_NAME = "boring_generators"
|
13
|
+
|
14
|
+
class_option :ruby_version, type: :string, aliases: "-v",
|
15
|
+
desc: "Tell us the ruby version which you use for the application. Default to Ruby #{DEFAULT_RUBY_VERSION}"
|
16
|
+
class_option :node_version, type: :string, aliases: "-v",
|
17
|
+
desc: "Tell us the node version which you use for the application. Default to Ruby #{DEFAULT_NODE_VERSION}"
|
18
|
+
class_option :repository_name, type: :string, aliases: "-rn",
|
19
|
+
desc: "Tell us the repository name to be used as database name on circleci. Defaults to #{DEFAULT_REPOSITORY_NAME}"
|
20
|
+
|
21
|
+
def add_github_actions_configuration
|
22
|
+
@ruby_version = options[:ruby_version] ? options[:ruby_version] : DEFAULT_RUBY_VERSION
|
23
|
+
@node_version = options[:node_version] ? options[:node_version] : DEFAULT_NODE_VERSION
|
24
|
+
@repository_name = options[:repository_name] ? options[:repository_name] : DEFAULT_REPOSITORY_NAME
|
25
|
+
|
26
|
+
template("ci.yml", ".github/workflows/ci.yml")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
name: Tests
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
services:
|
8
|
+
postgres:
|
9
|
+
image: postgres:11
|
10
|
+
env:
|
11
|
+
POSTGRES_USER: <%= @repository_name %>
|
12
|
+
POSTGRES_DB: <%= "#{@repository_name}_test" %>
|
13
|
+
POSTGRES_PASSWORD: ""
|
14
|
+
ports: ["5432:5432"]
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- name: Checkout code
|
18
|
+
uses: actions/checkout@v2
|
19
|
+
- name: <%= "Set up Ruby #{@ruby_version}" %>
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: <%= @ruby_version %>
|
23
|
+
- name: Ruby gem cache
|
24
|
+
uses: actions/cache@v1
|
25
|
+
with:
|
26
|
+
path: vendor/bundle
|
27
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
28
|
+
restore-keys: |
|
29
|
+
${{ runner.os }}-gems-
|
30
|
+
- name: Install gems
|
31
|
+
run: |
|
32
|
+
bundle config path vendor/bundle
|
33
|
+
bundle install --jobs 4 --retry 3
|
34
|
+
- name: Setup Node
|
35
|
+
uses: actions/setup-node@v1
|
36
|
+
with:
|
37
|
+
node-version: <%= @node_version %>
|
38
|
+
- name: Find yarn cache location
|
39
|
+
id: yarn-cache
|
40
|
+
run: echo "::set-output name=dir::$(yarn cache dir)"
|
41
|
+
- name: JS package cache
|
42
|
+
uses: actions/cache@v1
|
43
|
+
with:
|
44
|
+
path: ${{ steps.yarn-cache.outputs.dir }}
|
45
|
+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
46
|
+
restore-keys: |
|
47
|
+
${{ runner.os }}-yarn-
|
48
|
+
- name: Install packages
|
49
|
+
run: |
|
50
|
+
yarn install --pure-lockfile
|
51
|
+
- name: Setup test database
|
52
|
+
env:
|
53
|
+
RAILS_ENV: test
|
54
|
+
PGHOST: localhost
|
55
|
+
PGUSER: <%= @repository_name %>
|
56
|
+
run: |
|
57
|
+
bin/rails db:setup
|
58
|
+
- name: Run tests
|
59
|
+
run: bundle exec rails test # TODO: Update the test runner command as per your requirement.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Boring
|
4
|
+
module Ci
|
5
|
+
module Travisci
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
desc "Adds Github Action to the application"
|
8
|
+
source_root File.expand_path("templates", __dir__)
|
9
|
+
|
10
|
+
DEFAULT_RUBY_VERSION = "2.7.1"
|
11
|
+
|
12
|
+
class_option :ruby_version, type: :string, aliases: "-v",
|
13
|
+
desc: "Tell us the ruby version which you use for the application. Default to Ruby #{DEFAULT_RUBY_VERSION}"
|
14
|
+
|
15
|
+
def add_github_actions_configuration
|
16
|
+
@ruby_version = options[:ruby_version] ? options[:ruby_version] : DEFAULT_RUBY_VERSION
|
17
|
+
|
18
|
+
template(".travis.yml", ".travis.yml")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|