rubysmith 7.2.0 → 7.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
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +218 -47
- data/lib/rubysmith/builder.rb +7 -5
- data/lib/rubysmith/builders/abstract.rb +2 -2
- data/lib/rubysmith/builders/bundler.rb +1 -1
- data/lib/rubysmith/builders/dev_container/compose.rb +22 -0
- data/lib/rubysmith/builders/dev_container/configuration.rb +22 -0
- data/lib/rubysmith/builders/dev_container/dockerfile.rb +22 -0
- data/lib/rubysmith/builders/docker/build.rb +24 -0
- data/lib/rubysmith/builders/docker/console.rb +24 -0
- data/lib/rubysmith/builders/docker/entrypoint.rb +24 -0
- data/lib/rubysmith/builders/docker/file.rb +21 -0
- data/lib/rubysmith/builders/docker/ignore.rb +21 -0
- data/lib/rubysmith/cli/actions/bootsnap.rb +22 -0
- data/lib/rubysmith/cli/actions/circle_ci.rb +1 -1
- data/lib/rubysmith/cli/actions/dcoo.rb +22 -0
- data/lib/rubysmith/cli/actions/dev_container.rb +22 -0
- data/lib/rubysmith/cli/actions/docker.rb +22 -0
- data/lib/rubysmith/cli/actions/funding.rb +1 -1
- data/lib/rubysmith/cli/actions/git_hub.rb +1 -1
- data/lib/rubysmith/cli/actions/git_hub_ci.rb +1 -1
- data/lib/rubysmith/cli/actions/maximum.rb +1 -1
- data/lib/rubysmith/cli/actions/minimum.rb +1 -1
- data/lib/rubysmith/cli/commands/build.rb +45 -33
- data/lib/rubysmith/configuration/contract.rb +6 -0
- data/lib/rubysmith/configuration/defaults.yml +6 -0
- data/lib/rubysmith/configuration/model.rb +8 -0
- data/lib/rubysmith/container.rb +2 -0
- data/lib/rubysmith/extensions/bundler.rb +16 -4
- data/lib/rubysmith/extensions/pragmater.rb +16 -2
- data/lib/rubysmith/extensions/rubocop.rb +11 -7
- data/lib/rubysmith/extensions/tocer.rb +8 -4
- data/lib/rubysmith/templates/%project_name%/.devcontainer/Dockerfile.erb +1 -0
- data/lib/rubysmith/templates/%project_name%/.devcontainer/compose.yaml.erb +35 -0
- data/lib/rubysmith/templates/%project_name%/.devcontainer/devcontainer.json.erb +17 -0
- data/lib/rubysmith/templates/%project_name%/.dockerignore.erb +36 -0
- data/lib/rubysmith/templates/%project_name%/.github/workflows/ci.yml.erb +5 -0
- data/lib/rubysmith/templates/%project_name%/Dockerfile.erb +60 -0
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +3 -0
- data/lib/rubysmith/templates/%project_name%/LICENSE-fair.adoc.erb +75 -0
- data/lib/rubysmith/templates/%project_name%/LICENSE-fair.md.erb +75 -0
- data/lib/rubysmith/templates/%project_name%/README.adoc.erb +4 -0
- data/lib/rubysmith/templates/%project_name%/README.md.erb +4 -0
- data/lib/rubysmith/templates/%project_name%/bin/docker/build.erb +15 -0
- data/lib/rubysmith/templates/%project_name%/bin/docker/console.erb +14 -0
- data/lib/rubysmith/templates/%project_name%/bin/docker/entrypoint.erb +8 -0
- data/lib/rubysmith.rb +1 -0
- data/rubysmith.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +24 -2
- metadata.gz.sig +0 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/struct"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Docker
|
8
|
+
# Builds Docker console script.
|
9
|
+
class Console < Abstract
|
10
|
+
using Refinements::Struct
|
11
|
+
|
12
|
+
def call
|
13
|
+
return false unless settings.build_docker
|
14
|
+
|
15
|
+
builder.call(settings.merge(template_path: "%project_name%/bin/docker/console.erb"))
|
16
|
+
.render
|
17
|
+
.permit 0o755
|
18
|
+
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/struct"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Docker
|
8
|
+
# Builds Docker entrypoint script.
|
9
|
+
class Entrypoint < Abstract
|
10
|
+
using Refinements::Struct
|
11
|
+
|
12
|
+
def call
|
13
|
+
return false unless settings.build_docker
|
14
|
+
|
15
|
+
builder.call(settings.merge(template_path: "%project_name%/bin/docker/entrypoint.erb"))
|
16
|
+
.render
|
17
|
+
.permit 0o755
|
18
|
+
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/struct"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Docker
|
8
|
+
# Builds Dockerfile configuration.
|
9
|
+
class File < Abstract
|
10
|
+
using Refinements::Struct
|
11
|
+
|
12
|
+
def call
|
13
|
+
return false unless settings.build_docker
|
14
|
+
|
15
|
+
builder.call(settings.merge(template_path: "%project_name%/Dockerfile.erb")).render
|
16
|
+
true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/struct"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Docker
|
8
|
+
# Builds Docker ignore configuration.
|
9
|
+
class Ignore < Abstract
|
10
|
+
using Refinements::Struct
|
11
|
+
|
12
|
+
def call
|
13
|
+
return false unless settings.build_docker
|
14
|
+
|
15
|
+
builder.call(settings.merge(template_path: "%project_name%/.dockerignore.erb")).render
|
16
|
+
true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sod"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module CLI
|
7
|
+
module Actions
|
8
|
+
# Stores Bootsnap flag.
|
9
|
+
class Bootsnap < Sod::Action
|
10
|
+
include Import[:settings]
|
11
|
+
|
12
|
+
description "Add Bootsnap gem."
|
13
|
+
|
14
|
+
on "--[no-]bootsnap"
|
15
|
+
|
16
|
+
default { Container[:settings].build_bootsnap }
|
17
|
+
|
18
|
+
def call(boolean) = settings.build_bootsnap = boolean
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sod"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module CLI
|
7
|
+
module Actions
|
8
|
+
# Stores Developer Certificate of Origin flag.
|
9
|
+
class DCOO < Sod::Action
|
10
|
+
include Import[:settings]
|
11
|
+
|
12
|
+
description "Add Developer Certificate of Origin documentation."
|
13
|
+
|
14
|
+
on "--[no-]dcoo"
|
15
|
+
|
16
|
+
default { Container[:settings].build_dcoo }
|
17
|
+
|
18
|
+
def call(boolean) = settings.build_dcoo = boolean
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sod"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module CLI
|
7
|
+
module Actions
|
8
|
+
# Stores Development Container flag.
|
9
|
+
class DevContainer < Sod::Action
|
10
|
+
include Import[:settings]
|
11
|
+
|
12
|
+
description "Add Development Container support."
|
13
|
+
|
14
|
+
on "--[no-]devcontainer"
|
15
|
+
|
16
|
+
default { Container[:settings].build_devcontainer }
|
17
|
+
|
18
|
+
def call(boolean) = settings.build_devcontainer = boolean
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sod"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module CLI
|
7
|
+
module Actions
|
8
|
+
# Stores Docker flag.
|
9
|
+
class Docker < Sod::Action
|
10
|
+
include Import[:settings]
|
11
|
+
|
12
|
+
description "Add Docker support."
|
13
|
+
|
14
|
+
on "--[no-]docker"
|
15
|
+
|
16
|
+
default { Container[:settings].build_docker }
|
17
|
+
|
18
|
+
def call(boolean) = settings.build_docker = boolean
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -12,36 +12,44 @@ module Rubysmith
|
|
12
12
|
|
13
13
|
# Order is important.
|
14
14
|
BUILDERS = [
|
15
|
-
Builders::Init
|
16
|
-
Builders::Core
|
17
|
-
Builders::Version
|
18
|
-
Builders::Documentation::Readme
|
19
|
-
Builders::Documentation::Citation
|
20
|
-
Builders::Documentation::License
|
21
|
-
Builders::Documentation::Version
|
22
|
-
Builders::Git::Setup
|
23
|
-
Builders::Git::Ignore
|
24
|
-
Builders::Git::Safe
|
25
|
-
Builders::Bundler
|
26
|
-
Builders::Rake::Binstub
|
27
|
-
Builders::Rake::Configuration
|
28
|
-
Builders::Console
|
29
|
-
Builders::CircleCI
|
30
|
-
Builders::Setup
|
31
|
-
Builders::GitHub::Template
|
32
|
-
Builders::GitHub::Funding
|
33
|
-
Builders::GitHub::CI
|
34
|
-
Builders::Guard
|
35
|
-
Builders::Reek
|
36
|
-
Builders::RSpec::Binstub
|
37
|
-
Builders::RSpec::Context
|
38
|
-
Builders::RSpec::Helper
|
39
|
-
Builders::Caliber
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Builders::
|
15
|
+
Builders::Init,
|
16
|
+
Builders::Core,
|
17
|
+
Builders::Version,
|
18
|
+
Builders::Documentation::Readme,
|
19
|
+
Builders::Documentation::Citation,
|
20
|
+
Builders::Documentation::License,
|
21
|
+
Builders::Documentation::Version,
|
22
|
+
Builders::Git::Setup,
|
23
|
+
Builders::Git::Ignore,
|
24
|
+
Builders::Git::Safe,
|
25
|
+
Builders::Bundler,
|
26
|
+
Builders::Rake::Binstub,
|
27
|
+
Builders::Rake::Configuration,
|
28
|
+
Builders::Console,
|
29
|
+
Builders::CircleCI,
|
30
|
+
Builders::Setup,
|
31
|
+
Builders::GitHub::Template,
|
32
|
+
Builders::GitHub::Funding,
|
33
|
+
Builders::GitHub::CI,
|
34
|
+
Builders::Guard,
|
35
|
+
Builders::Reek,
|
36
|
+
Builders::RSpec::Binstub,
|
37
|
+
Builders::RSpec::Context,
|
38
|
+
Builders::RSpec::Helper,
|
39
|
+
Builders::Caliber,
|
40
|
+
Builders::DevContainer::Dockerfile,
|
41
|
+
Builders::DevContainer::Compose,
|
42
|
+
Builders::DevContainer::Configuration,
|
43
|
+
Builders::Docker::Build,
|
44
|
+
Builders::Docker::Console,
|
45
|
+
Builders::Docker::Entrypoint,
|
46
|
+
Builders::Docker::File,
|
47
|
+
Builders::Docker::Ignore,
|
48
|
+
Extensions::Bundler,
|
49
|
+
Extensions::Pragmater,
|
50
|
+
Extensions::Tocer,
|
51
|
+
Extensions::Rubocop,
|
52
|
+
Builders::Git::Commit
|
45
53
|
].freeze
|
46
54
|
|
47
55
|
handle "build"
|
@@ -50,14 +58,18 @@ module Rubysmith
|
|
50
58
|
|
51
59
|
on Actions::Name
|
52
60
|
on Actions::AmazingPrint
|
61
|
+
on Actions::Bootsnap
|
53
62
|
on Actions::Caliber
|
54
|
-
on Actions::Console
|
55
|
-
on Actions::Contributions
|
56
63
|
on Actions::CircleCI
|
57
64
|
on Actions::Citation
|
58
65
|
on Actions::Community
|
59
66
|
on Actions::Conduct
|
67
|
+
on Actions::Console
|
68
|
+
on Actions::Contributions
|
69
|
+
on Actions::DCOO
|
60
70
|
on Actions::Debug
|
71
|
+
on Actions::DevContainer
|
72
|
+
on Actions::Docker
|
61
73
|
on Actions::Funding
|
62
74
|
on Actions::Git
|
63
75
|
on Actions::GitHub
|
@@ -87,7 +99,7 @@ module Rubysmith
|
|
87
99
|
|
88
100
|
def call
|
89
101
|
log_info "Building project skeleton: #{settings.project_name}..."
|
90
|
-
builders.each(
|
102
|
+
builders.each { |builder| builder.new(settings:, logger:).call }
|
91
103
|
log_info "Project skeleton complete!"
|
92
104
|
end
|
93
105
|
|
@@ -14,6 +14,7 @@ module Rubysmith
|
|
14
14
|
required(:author_handle).filled :string
|
15
15
|
required(:author_uri).filled :string
|
16
16
|
required(:build_amazing_print).filled :bool
|
17
|
+
required(:build_bootsnap).filled :bool
|
17
18
|
required(:build_caliber).filled :bool
|
18
19
|
required(:build_circle_ci).filled :bool
|
19
20
|
required(:build_citation).filled :bool
|
@@ -22,7 +23,10 @@ module Rubysmith
|
|
22
23
|
required(:build_conduct).filled :bool
|
23
24
|
required(:build_console).filled :bool
|
24
25
|
required(:build_contributions).filled :bool
|
26
|
+
required(:build_dcoo).filled :bool
|
25
27
|
required(:build_debug).filled :bool
|
28
|
+
required(:build_devcontainer).filled :bool
|
29
|
+
required(:build_docker).filled :bool
|
26
30
|
required(:build_funding).filled :bool
|
27
31
|
required(:build_git).filled :bool
|
28
32
|
required(:build_git_hub).filled :bool
|
@@ -52,11 +56,13 @@ module Rubysmith
|
|
52
56
|
required(:license_label).filled :string
|
53
57
|
required(:license_name).filled :string
|
54
58
|
required(:license_version).filled :string
|
59
|
+
optional(:organization_label).filled :string
|
55
60
|
required(:organization_uri).filled :string
|
56
61
|
optional(:project_name).filled :string
|
57
62
|
optional(:project_uri_community).filled :string
|
58
63
|
optional(:project_uri_conduct).filled :string
|
59
64
|
optional(:project_uri_contributions).filled :string
|
65
|
+
optional(:project_uri_dcoo).filled :string
|
60
66
|
optional(:project_uri_download).filled :string
|
61
67
|
optional(:project_uri_funding).filled :string
|
62
68
|
optional(:project_uri_home).filled :string
|
@@ -3,6 +3,7 @@ author:
|
|
3
3
|
uri: "%<organization_uri>s/team/%<author_handle>s"
|
4
4
|
build:
|
5
5
|
amazing_print: true
|
6
|
+
bootsnap: false
|
6
7
|
caliber: true
|
7
8
|
circle_ci: false
|
8
9
|
citation: true
|
@@ -11,7 +12,10 @@ build:
|
|
11
12
|
conduct: true
|
12
13
|
console: true
|
13
14
|
contributions: true
|
15
|
+
dcoo: false
|
14
16
|
debug: true
|
17
|
+
devcontainer: false
|
18
|
+
docker: false
|
15
19
|
funding: false
|
16
20
|
git: true
|
17
21
|
git_hub: false
|
@@ -34,6 +38,7 @@ build:
|
|
34
38
|
versions: true
|
35
39
|
zeitwerk: true
|
36
40
|
citation:
|
41
|
+
affiliation: "%<organization_label>s"
|
37
42
|
message: Please use the following metadata when citing this project in your work.
|
38
43
|
documentation:
|
39
44
|
format: "adoc"
|
@@ -48,6 +53,7 @@ project:
|
|
48
53
|
community: "%<organization_uri>s/community"
|
49
54
|
conduct: "%<organization_uri>s/policies/code_of_conduct"
|
50
55
|
contributions: "%<organization_uri>s/policies/contributions"
|
56
|
+
dcoo: "%<organization_uri>s/policies/developer_certificate_of_origin"
|
51
57
|
download: "https://rubygems.org/gems/%<project_name>s"
|
52
58
|
funding: "%<repository_uri>s/sponsors/%<repository_handle>s"
|
53
59
|
home: "%<organization_uri>s/projects/%<project_name>s"
|
@@ -15,6 +15,7 @@ module Rubysmith
|
|
15
15
|
:author_handle,
|
16
16
|
:author_uri,
|
17
17
|
:build_amazing_print,
|
18
|
+
:build_bootsnap,
|
18
19
|
:build_caliber,
|
19
20
|
:build_circle_ci,
|
20
21
|
:build_citation,
|
@@ -23,7 +24,10 @@ module Rubysmith
|
|
23
24
|
:build_conduct,
|
24
25
|
:build_console,
|
25
26
|
:build_contributions,
|
27
|
+
:build_dcoo,
|
26
28
|
:build_debug,
|
29
|
+
:build_devcontainer,
|
30
|
+
:build_docker,
|
27
31
|
:build_funding,
|
28
32
|
:build_git,
|
29
33
|
:build_git_hub,
|
@@ -53,11 +57,13 @@ module Rubysmith
|
|
53
57
|
:license_name,
|
54
58
|
:license_version,
|
55
59
|
:loaded_at,
|
60
|
+
:organization_label,
|
56
61
|
:organization_uri,
|
57
62
|
:project_name,
|
58
63
|
:project_uri_community,
|
59
64
|
:project_uri_conduct,
|
60
65
|
:project_uri_contributions,
|
66
|
+
:project_uri_dcoo,
|
61
67
|
:project_uri_download,
|
62
68
|
:project_uri_funding,
|
63
69
|
:project_uri_home,
|
@@ -103,6 +109,8 @@ module Rubysmith
|
|
103
109
|
|
104
110
|
def computed_project_uri_contributions = format_uri(__method__)
|
105
111
|
|
112
|
+
def computed_project_uri_dcoo = format_uri(__method__)
|
113
|
+
|
106
114
|
def computed_project_uri_download = format_uri(__method__)
|
107
115
|
|
108
116
|
def computed_project_uri_funding = format_uri(__method__)
|
data/lib/rubysmith/container.rb
CHANGED
@@ -22,9 +22,11 @@ module Rubysmith
|
|
22
22
|
.add_transformer(Configuration::Transformers::TemplateRoot.new)
|
23
23
|
.add_transformer(:root, :target_root)
|
24
24
|
.add_transformer(:format, :author_uri)
|
25
|
+
.add_transformer(:format, :citation_affiliation)
|
25
26
|
.add_transformer(:format, :project_uri_community)
|
26
27
|
.add_transformer(:format, :project_uri_conduct)
|
27
28
|
.add_transformer(:format, :project_uri_contributions)
|
29
|
+
.add_transformer(:format, :project_uri_dcoo)
|
28
30
|
.add_transformer(:format, :project_uri_download, :project_name)
|
29
31
|
.add_transformer(:format, :project_uri_funding)
|
30
32
|
.add_transformer(:format, :project_uri_home, :project_name)
|
@@ -9,7 +9,7 @@ module Rubysmith
|
|
9
9
|
module Extensions
|
10
10
|
# Ensures gem dependencies are installed.
|
11
11
|
class Bundler
|
12
|
-
include Import[:settings]
|
12
|
+
include Import[:settings, :logger]
|
13
13
|
|
14
14
|
using Refinements::IO
|
15
15
|
using Refinements::Pathname
|
@@ -20,6 +20,17 @@ module Rubysmith
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def call
|
23
|
+
logger.info { "Installing gem dependencies..." }
|
24
|
+
install
|
25
|
+
rescue ::Bundler::HTTPError
|
26
|
+
log_error
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :client
|
32
|
+
|
33
|
+
def install
|
23
34
|
settings.project_root.change_dir do
|
24
35
|
client.start %w[install --quiet]
|
25
36
|
STDOUT.squelch { client.start %w[lock --add-platform x86_64-linux --update] }
|
@@ -28,9 +39,10 @@ module Rubysmith
|
|
28
39
|
true
|
29
40
|
end
|
30
41
|
|
31
|
-
|
32
|
-
|
33
|
-
|
42
|
+
def log_error
|
43
|
+
logger.error { "Unable to install gem dependencies. Is your network stable?" }
|
44
|
+
false
|
45
|
+
end
|
34
46
|
end
|
35
47
|
end
|
36
48
|
end
|
@@ -7,14 +7,27 @@ module Rubysmith
|
|
7
7
|
module Extensions
|
8
8
|
# Ensures project skeleton has pragmas.
|
9
9
|
class Pragmater
|
10
|
-
include Import[:settings]
|
10
|
+
include Import[:settings, :logger]
|
11
11
|
|
12
12
|
using Refinements::Pathname
|
13
13
|
|
14
14
|
CLIENT = ::Pragmater::Inserter.new(
|
15
15
|
settings: ::Pragmater::Configuration::Model[
|
16
16
|
comments: ["# frozen_string_literal: true"],
|
17
|
-
patterns: %w[
|
17
|
+
patterns: %w[
|
18
|
+
**/*.rake
|
19
|
+
**/*.rb
|
20
|
+
*.gemspec
|
21
|
+
exe/*
|
22
|
+
bin/console
|
23
|
+
bin/rake
|
24
|
+
bin/rspec
|
25
|
+
bin/rubocop
|
26
|
+
bin/setup
|
27
|
+
config.ru
|
28
|
+
Gemfile
|
29
|
+
Rakefile
|
30
|
+
]
|
18
31
|
]
|
19
32
|
).freeze
|
20
33
|
|
@@ -24,6 +37,7 @@ module Rubysmith
|
|
24
37
|
end
|
25
38
|
|
26
39
|
def call
|
40
|
+
logger.info { "Adding frozen string literal pragmas..." }
|
27
41
|
settings.project_root.change_dir { client.call }
|
28
42
|
true
|
29
43
|
end
|
@@ -8,7 +8,7 @@ module Rubysmith
|
|
8
8
|
module Extensions
|
9
9
|
# Ensures project skeleton adheres to style guide.
|
10
10
|
class Rubocop
|
11
|
-
include Import[:settings]
|
11
|
+
include Import[:settings, :logger]
|
12
12
|
|
13
13
|
using Refinements::IO
|
14
14
|
using Refinements::Pathname
|
@@ -19,18 +19,22 @@ module Rubysmith
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def call
|
22
|
-
|
23
|
-
|
24
|
-
project_root.change_dir do
|
25
|
-
STDOUT.squelch { client.run ["--autocorrect-all", project_root.to_s] }
|
26
|
-
end
|
27
|
-
|
22
|
+
logger.info { "Running RuboCop autocorrect..." }
|
23
|
+
autocorrect
|
28
24
|
true
|
29
25
|
end
|
30
26
|
|
31
27
|
private
|
32
28
|
|
33
29
|
attr_reader :client
|
30
|
+
|
31
|
+
def autocorrect
|
32
|
+
project_root = settings.project_root
|
33
|
+
|
34
|
+
project_root.change_dir do
|
35
|
+
STDOUT.squelch { client.run ["--autocorrect-all", project_root.to_s] }
|
36
|
+
end
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
@@ -1,31 +1,35 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "refinements/pathname"
|
4
|
+
require "stringio"
|
4
5
|
require "tocer"
|
5
6
|
|
6
7
|
module Rubysmith
|
7
8
|
module Extensions
|
8
9
|
# Ensures project skeleton documentation has table of content.
|
9
10
|
class Tocer
|
10
|
-
include Import[:settings]
|
11
|
+
include Import[:settings, :logger]
|
11
12
|
|
12
13
|
using Refinements::Pathname
|
13
14
|
|
14
|
-
def initialize(client: ::Tocer::Runner.new, **)
|
15
|
+
def initialize(client: ::Tocer::Runner.new(io: StringIO.new), **)
|
15
16
|
@client = client
|
16
17
|
super(**)
|
17
18
|
end
|
18
19
|
|
19
20
|
def call
|
20
|
-
return false unless settings.build_readme
|
21
|
+
return false unless settings.build_readme && settings.markdown?
|
21
22
|
|
22
|
-
|
23
|
+
logger.info { "Adding table of contents..." }
|
24
|
+
upsert
|
23
25
|
true
|
24
26
|
end
|
25
27
|
|
26
28
|
private
|
27
29
|
|
28
30
|
attr_reader :client
|
31
|
+
|
32
|
+
def upsert = settings.project_root.change_dir { client.call }
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
FROM bkuhlmann/alpine-ruby:latest
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: "<%= settings.project_name %>"
|
2
|
+
|
3
|
+
services:
|
4
|
+
app:
|
5
|
+
build:
|
6
|
+
context: ..
|
7
|
+
dockerfile: .devcontainer/Dockerfile
|
8
|
+
volumes:
|
9
|
+
- ../..:/workspaces:cached
|
10
|
+
environment:
|
11
|
+
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
|
12
|
+
command: sleep infinity
|
13
|
+
depends_on:
|
14
|
+
- postgres
|
15
|
+
- redis
|
16
|
+
|
17
|
+
postgres:
|
18
|
+
image: postgres:latest
|
19
|
+
restart: unless-stopped
|
20
|
+
volumes:
|
21
|
+
- postgres-data:/var/lib/postgresql/data
|
22
|
+
environment:
|
23
|
+
POSTGRES_USER: postgres
|
24
|
+
POSTGRES_DB: postgres
|
25
|
+
POSTGRES_PASSWORD: postgres
|
26
|
+
|
27
|
+
redis:
|
28
|
+
image: redis:latest
|
29
|
+
restart: unless-stopped
|
30
|
+
volumes:
|
31
|
+
- redis-data:/data
|
32
|
+
|
33
|
+
volumes:
|
34
|
+
postgres-data:
|
35
|
+
redis-data:
|