schienenzeppelin 0.1 → 0.2
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/.gitignore +2 -0
- data/.rubocop.yml +5 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +78 -71
- data/TODO.md +37 -25
- data/lib/schienenzeppelin.rb +5 -2
- data/lib/schienenzeppelin/add_on.rb +68 -0
- data/lib/schienenzeppelin/{helpers → addons}/annotate.rb +4 -2
- data/lib/schienenzeppelin/{helpers → addons}/capistrano.rb +2 -2
- data/lib/schienenzeppelin/{helpers → addons}/continuous_integration.rb +2 -2
- data/lib/schienenzeppelin/{helpers → addons}/credentials.rb +2 -2
- data/lib/schienenzeppelin/{helpers → addons}/devise.rb +6 -3
- data/lib/schienenzeppelin/addons/docker.rb +12 -0
- data/lib/schienenzeppelin/addons/docker_compose.rb +11 -0
- data/lib/schienenzeppelin/addons/dotenv.rb +11 -0
- data/lib/schienenzeppelin/{helpers → addons}/errors.rb +5 -2
- data/lib/schienenzeppelin/{helpers → addons}/factory_bot.rb +6 -2
- data/lib/schienenzeppelin/addons/foreman.rb +13 -0
- data/lib/schienenzeppelin/addons/generators.rb +30 -0
- data/lib/schienenzeppelin/{helpers → addons}/high_voltage.rb +4 -2
- data/lib/schienenzeppelin/addons/inline_svg.rb +9 -0
- data/lib/schienenzeppelin/{helpers/scaffold.rb → addons/irbrc.rb} +3 -3
- data/lib/schienenzeppelin/addons/jb.rb +9 -0
- data/lib/schienenzeppelin/{helpers/hotwire.rb → addons/lograge.rb} +3 -3
- data/lib/schienenzeppelin/addons/oj.rb +9 -0
- data/lib/schienenzeppelin/{helpers → addons}/pundit.rb +2 -2
- data/lib/schienenzeppelin/{helpers → addons}/rspec.rb +4 -2
- data/lib/schienenzeppelin/{helpers → addons}/rubocop.rb +2 -2
- data/lib/schienenzeppelin/addons/ruby_version.rb +11 -0
- data/lib/schienenzeppelin/addons/scaffold.rb +13 -0
- data/lib/schienenzeppelin/{helpers → addons}/services.rb +2 -2
- data/lib/schienenzeppelin/addons/shoulda.rb +13 -0
- data/lib/schienenzeppelin/{helpers → addons}/sidekiq.rb +3 -4
- data/lib/schienenzeppelin/{helpers → addons}/stimulus.rb +4 -2
- data/lib/schienenzeppelin/{helpers → addons}/stimulus_components.rb +4 -2
- data/lib/schienenzeppelin/{helpers → addons}/tailwind.rb +4 -2
- data/lib/schienenzeppelin/{helpers/home.rb → addons/views.rb} +5 -3
- data/lib/schienenzeppelin/app_builder.rb +2 -50
- data/lib/schienenzeppelin/app_generator.rb +53 -61
- data/lib/schienenzeppelin/context.rb +26 -0
- data/lib/schienenzeppelin/dependencies.rb +33 -0
- data/lib/schienenzeppelin/generator_utils.rb +77 -0
- data/lib/schienenzeppelin/version.rb +2 -2
- data/schienenzeppelin.gemspec +0 -1
- data/templates/.irbrc.erb +2 -2
- data/templates/Dockerfile.erb +1 -1
- data/templates/Gemfile.erb +39 -10
- data/templates/Procfile.dev.erb +5 -1
- data/templates/Procfile.erb +2 -0
- data/templates/app/views/shared/_navbar.html.erb.tt +19 -4
- data/templates/app/workers/application_worker.rb +5 -0
- data/templates/docker-compose.yml.erb +2 -2
- data/templates/spec/rails_helper.rb +1 -1
- metadata +41 -27
- data/.rspec_status +0 -3
- data/lib/schienenzeppelin/helper_base.rb +0 -28
- data/lib/schienenzeppelin/helpers/generators.rb +0 -26
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class ContinuousIntegration <
|
|
4
|
+
module AddOns
|
|
5
|
+
class ContinuousIntegration < AddOn
|
|
6
6
|
def apply
|
|
7
7
|
say 'Setting up GitHub CI'
|
|
8
8
|
template('.github/workflows/build.yml.erb', '.github/workflows/build.yml')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class Credentials <
|
|
4
|
+
module AddOns
|
|
5
|
+
class Credentials < AddOn
|
|
6
6
|
def apply
|
|
7
7
|
key_path = Pathname.new('config/credentials/production.key')
|
|
8
8
|
create_credential_files(key_path, 'config/credentials/production.yml.enc')
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class Devise <
|
|
4
|
+
module AddOns
|
|
5
|
+
class Devise < AddOn
|
|
6
|
+
depends_on :active_record
|
|
7
|
+
|
|
6
8
|
def apply
|
|
7
9
|
generate('devise:install', capture: true)
|
|
8
10
|
generate(:devise, 'User', 'name', 'admin:boolean', capture: true)
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
directory('app/views/devise', 'app/views/devise') if uses?(:views)
|
|
10
13
|
|
|
11
14
|
inject_into_file 'config/environments/development.rb', before: /^end/ do
|
|
12
15
|
<<-RUBY
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class Errors <
|
|
4
|
+
module AddOns
|
|
5
|
+
class Errors < AddOn
|
|
6
|
+
depends_on :tailwind
|
|
7
|
+
|
|
6
8
|
def apply
|
|
7
9
|
say 'Setting up custom error pages'
|
|
8
10
|
add_errors
|
|
@@ -43,6 +45,7 @@ module Schienenzeppelin
|
|
|
43
45
|
def patch_turbolinks
|
|
44
46
|
inject_into_file 'app/javascript/packs/application.js' do
|
|
45
47
|
<<~JS
|
|
48
|
+
|
|
46
49
|
// Patching turbolinks to allow custom errors
|
|
47
50
|
// See https://github.com/turbolinks/turbolinks/issues/179
|
|
48
51
|
window.Turbolinks.HttpRequest.prototype.requestLoaded = function() {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class FactoryBot <
|
|
4
|
+
module AddOns
|
|
5
|
+
class FactoryBot < AddOn
|
|
6
|
+
depends_on :active_record, :test
|
|
7
|
+
|
|
6
8
|
def apply
|
|
7
9
|
# TODO: Make this work for minitest
|
|
10
|
+
return unless uses?(:factory_bot)
|
|
11
|
+
|
|
8
12
|
empty_directory 'spec/factories'
|
|
9
13
|
template('spec/support/factory_bot.rb')
|
|
10
14
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schienenzeppelin
|
|
4
|
+
module AddOns
|
|
5
|
+
class Foreman < AddOn
|
|
6
|
+
def apply
|
|
7
|
+
template '.foreman.erb', '.foreman'
|
|
8
|
+
template 'Procfile.erb', 'Procfile'
|
|
9
|
+
template 'Procfile.dev.erb', 'Procfile.dev'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schienenzeppelin
|
|
4
|
+
module AddOns
|
|
5
|
+
class Generators < AddOn
|
|
6
|
+
def apply
|
|
7
|
+
directory('lib/generators/rails/navigation', 'lib/generators/rails/navigation') if uses?(:views)
|
|
8
|
+
|
|
9
|
+
template = 'lib/generators/rails/scaffold_controller_generator.rb'
|
|
10
|
+
template(template) if uses?(:scaffold)
|
|
11
|
+
|
|
12
|
+
generators = <<-RUBY
|
|
13
|
+
config.generators do |generate|
|
|
14
|
+
#{"require_relative '../lib/generators/rails/scaffold_controller_generator'" if uses?(:scaffold)}
|
|
15
|
+
generate.helper false
|
|
16
|
+
generate.javascripts false
|
|
17
|
+
generate.request_specs false
|
|
18
|
+
generate.routing_specs false
|
|
19
|
+
generate.stylesheets false
|
|
20
|
+
#{'generate.test_framework :rspec' if uses?(:rspec)}
|
|
21
|
+
generate.view_specs false
|
|
22
|
+
#{'generate.jb true' if uses?(:jb)}
|
|
23
|
+
#{'generate.factory_bot true' if uses?(:factory_bot)}
|
|
24
|
+
end
|
|
25
|
+
RUBY
|
|
26
|
+
inject_into_file 'config/application.rb', generators, before: /^ {2}end\n/
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class
|
|
4
|
+
module AddOns
|
|
5
|
+
class Lograge < AddOn
|
|
6
6
|
def apply
|
|
7
|
-
|
|
7
|
+
template 'config/initializers/lograge.rb'
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class Pundit <
|
|
4
|
+
module AddOns
|
|
5
|
+
class Pundit < AddOn
|
|
6
6
|
def apply
|
|
7
7
|
directory 'app/policies', 'app/policies'
|
|
8
8
|
template 'app/controllers/authorized_controller.rb.erb', 'app/controllers/authorized_controller.rb'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class Rspec <
|
|
4
|
+
module AddOns
|
|
5
|
+
class Rspec < AddOn
|
|
6
|
+
depends_on :test
|
|
7
|
+
|
|
6
8
|
def apply
|
|
7
9
|
create_file('.rspec', '--require spec_helper')
|
|
8
10
|
template('spec/rails_helper.rb')
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class Sidekiq <
|
|
4
|
+
module AddOns
|
|
5
|
+
class Sidekiq < AddOn
|
|
6
6
|
def apply
|
|
7
7
|
say 'Setting up sidekiq'
|
|
8
|
-
|
|
9
|
-
create_file('app/workers/.keep')
|
|
8
|
+
directory('app/workers', 'app/workers')
|
|
10
9
|
end
|
|
11
10
|
end
|
|
12
11
|
end
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class StimulusComponents <
|
|
4
|
+
module AddOns
|
|
5
|
+
class StimulusComponents < AddOn
|
|
6
|
+
depends_on :stimulus
|
|
7
|
+
|
|
6
8
|
def apply
|
|
7
9
|
run('yarn add tailwindcss-stimulus-components')
|
|
8
10
|
inject_into_file('app/javascript/packs/application.js') do
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class Tailwind <
|
|
4
|
+
module AddOns
|
|
5
|
+
class Tailwind < AddOn
|
|
6
|
+
depends_on :javascript
|
|
7
|
+
|
|
6
8
|
def apply
|
|
7
9
|
rails_command('tailwindcss:install')
|
|
8
10
|
template('app/javascript/stylesheets/components.scss')
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schienenzeppelin
|
|
4
|
-
module
|
|
5
|
-
class
|
|
4
|
+
module AddOns
|
|
5
|
+
class Views < AddOn
|
|
6
|
+
depends_on :tailwind
|
|
7
|
+
|
|
6
8
|
def apply
|
|
7
9
|
say 'Setting up custom landing page'
|
|
8
10
|
directory 'app/views/layouts', 'app/views/layouts', force: true
|
|
9
|
-
directory 'app/views/pages', 'app/views/pages'
|
|
10
11
|
directory 'app/views/shared', 'app/views/shared'
|
|
12
|
+
directory 'app/views/pages', 'app/views/pages' if uses?(:high_voltage)
|
|
11
13
|
# Make sure we can access any images put into the images folder
|
|
12
14
|
inject_into_file('app/javascript/packs/application.js', "require.context('../images', true)")
|
|
13
15
|
directory 'app/javascript/images', 'app/javascript/images'
|
|
@@ -10,7 +10,7 @@ module Schienenzeppelin
|
|
|
10
10
|
def credentials
|
|
11
11
|
super
|
|
12
12
|
# This sets up credentials using a custom template for both development and production use
|
|
13
|
-
Schienenzeppelin::
|
|
13
|
+
Schienenzeppelin::AddOns::Credentials.apply
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def readme
|
|
@@ -18,7 +18,7 @@ module Schienenzeppelin
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def ruby_version
|
|
21
|
-
|
|
21
|
+
Schienenzeppelin::AddOns::RubyVersion.new(Context.new(options)).apply
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def gemfile
|
|
@@ -29,26 +29,6 @@ module Schienenzeppelin
|
|
|
29
29
|
template '.gitignore.erb', '.gitignore'
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def irbrc
|
|
33
|
-
template '.irbrc.erb', '.irbrc'
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def docker
|
|
37
|
-
template 'Dockerfile.erb', 'Dockerfile'
|
|
38
|
-
template '.dockerignore.erb', '.dockerignore'
|
|
39
|
-
template 'docker-compose.yml.erb', 'docker-compose.yml'
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def dotenv
|
|
43
|
-
template '.env.development.erb', '.env.development'
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def foreman
|
|
47
|
-
template '.foreman.erb', '.foreman'
|
|
48
|
-
template 'Procfile.erb', 'Procfile'
|
|
49
|
-
template 'Procfile.dev.erb', 'Procfile.dev'
|
|
50
|
-
end
|
|
51
|
-
|
|
52
32
|
def database_yml
|
|
53
33
|
if options[:database] == 'postgresql'
|
|
54
34
|
template 'config/postgresql.yml.erb', 'config/database.yml'
|
|
@@ -56,33 +36,5 @@ module Schienenzeppelin
|
|
|
56
36
|
super
|
|
57
37
|
end
|
|
58
38
|
end
|
|
59
|
-
|
|
60
|
-
def lograge
|
|
61
|
-
template 'config/initializers/lograge.rb'
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def sidekiq
|
|
65
|
-
Schienenzeppelin::Helpers::Sidekiq.apply
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def pundit
|
|
69
|
-
Schienenzeppelin::Helpers::Pundit.apply
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def rspec
|
|
73
|
-
Schienenzeppelin::Helpers::Rspec.apply
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def shoulda
|
|
77
|
-
template 'spec/support/shoulda_matchers.rb'
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def high_voltage
|
|
81
|
-
Schienenzeppelin::Helpers::HighVoltage.apply
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def factory_bot
|
|
85
|
-
Schienenzeppelin::Helpers::FactoryBot.apply
|
|
86
|
-
end
|
|
87
39
|
end
|
|
88
40
|
end
|