modulorails 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +14 -0
  3. data/.gitignore +2 -0
  4. data/.travis.yml +23 -4
  5. data/Appraisals +18 -0
  6. data/CHANGELOG.md +12 -0
  7. data/Dockerfile.ruby25 +34 -0
  8. data/Dockerfile.ruby26 +28 -0
  9. data/Dockerfile.ruby27 +25 -0
  10. data/Dockerfile.ruby30 +25 -0
  11. data/Dockerfile.ruby31 +25 -0
  12. data/Gemfile.lock +59 -52
  13. data/README.md +16 -4
  14. data/Rakefile +1 -1
  15. data/docker-compose.yml +37 -0
  16. data/entrypoints/appraisal_test.sh +7 -0
  17. data/gemfiles/rails_52.gemfile +9 -0
  18. data/gemfiles/rails_60.gemfile +9 -0
  19. data/gemfiles/rails_61.gemfile +9 -0
  20. data/gemfiles/rails_70.gemfile +9 -0
  21. data/lib/generators/{docker → modulorails/docker}/docker_generator.rb +1 -1
  22. data/lib/generators/{docker → modulorails/docker}/templates/Dockerfile.prod.tt +14 -9
  23. data/lib/generators/{docker → modulorails/docker}/templates/Dockerfile.tt +5 -7
  24. data/lib/generators/{docker → modulorails/docker}/templates/config/database.yml.tt +11 -0
  25. data/lib/generators/{docker → modulorails/docker}/templates/docker-compose.prod.yml.tt +18 -4
  26. data/lib/generators/modulorails/docker/templates/docker-compose.yml.tt +71 -0
  27. data/lib/generators/{docker → modulorails/docker}/templates/entrypoints/docker-entrypoint.sh.tt +0 -0
  28. data/lib/generators/modulorails/docker/templates/entrypoints/webpack-entrypoint.sh.tt +7 -0
  29. data/lib/generators/{gitlabci → modulorails/gitlabci}/gitlabci_generator.rb +4 -23
  30. data/lib/generators/modulorails/gitlabci/templates/.gitlab-ci.yml.tt +118 -0
  31. data/lib/generators/modulorails/gitlabci/templates/.modulorails-gitlab-ci +6 -0
  32. data/lib/generators/{gitlabci → modulorails/gitlabci}/templates/config/database-ci.yml.tt +0 -0
  33. data/lib/generators/modulorails/healthcheck/health_check_generator.rb +41 -0
  34. data/lib/generators/modulorails/healthcheck/templates/.modulorails-health_check +6 -0
  35. data/lib/generators/modulorails/healthcheck/templates/config/initializers/health_check.rb.tt +100 -0
  36. data/lib/generators/modulorails/self_update/self_update_generator.rb +32 -0
  37. data/lib/modulorails/configuration.rb +8 -2
  38. data/lib/modulorails/data.rb +21 -2
  39. data/lib/modulorails/railtie.rb +19 -4
  40. data/lib/modulorails/validators/database_configuration.rb +1 -1
  41. data/lib/modulorails/version.rb +1 -1
  42. data/lib/modulorails.rb +34 -15
  43. data/modulorails.gemspec +2 -0
  44. metadata +69 -24
  45. data/lib/generators/docker/templates/docker-compose.yml.tt +0 -37
  46. data/lib/generators/gitlabci/templates/.gitlab-ci.yml.tt +0 -79
  47. data/lib/generators/gitlabci/templates/.modulorails-gitlab-ci +0 -3
  48. data/lib/modulorails/updater.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55dbb40ab0e717d0204e96ded91f37a2384d6a068cc588d4c4c9db90e96c2d91
4
- data.tar.gz: e6f08f5aeec11a0249d8323604f17471120a066e696308c6ad9d0b2e4ed93cd7
3
+ metadata.gz: f695c4454203bb2d22353b7cff523da2315c7ce5472300208f1774d6aed2be5a
4
+ data.tar.gz: f02062f1a5878154caa982fbf70dd5d584cdd1b07a90f5614aa4e01d27b79b20
5
5
  SHA512:
6
- metadata.gz: f4c82055e0f2037c6f4ff7831659be156ff501eb4fbe80ac52089f1857f20ff1db40e81446d0bf2bbfba1df6bba7638b05b54bb114623ff856eb9fce5cb65641
7
- data.tar.gz: 79732d5ad59379f2988ac10d8dac50f99d1984365fca5487ead432cb8d7f2e1b39b666e344dc02f051c267ffe9da19dcc4a82785ecda669c638bed101ee23fe0
6
+ metadata.gz: 93943d5cd4726cce846e10c09149ff39b19adadbdf823a3ffc4032e524184ebd1fd50a83be07286ea50938062995df3a6166edd206461efeb400b85e00101d31
7
+ data.tar.gz: 92b4689741e9468f395656200ff35096553e332e84958892adaedccfb6b14fb674f01078ae3a8588d104838d9e080422de7ae414224add37ed0c9a533aaf0508
data/.dockerignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.gem
13
+ gemfiles/*.lock
14
+ Gemfile.lock
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  *.gem
13
+ gemfiles/*.lock
14
+ /config/database.yml
data/.travis.yml CHANGED
@@ -1,9 +1,28 @@
1
1
  ---
2
2
  language: ruby
3
3
  cache: bundler
4
- rvm:
5
- - 2.5
6
- - 2.6
7
- - 2.7
4
+
5
+ ruby:
6
+ - '2.5'
7
+ - '2.6'
8
+ - '2.7'
9
+ - '3.0'
10
+ - '3.1'
11
+
8
12
  before_install:
9
13
  - gem install bundler -v 2.1.4
14
+
15
+ gemfile:
16
+ - gemfiles/rails_52.gemfile
17
+ - gemfiles/rails_60.gemfile
18
+ - gemfiles/rails_61.gemfile
19
+ - gemfiles/rails_70.gemfile
20
+
21
+ matrix:
22
+ exclude:
23
+ - gemfile: gemfiles/rails_70.gemfile
24
+ ruby: 2.5
25
+ - gemfile: gemfiles/rails_70.gemfile
26
+ ruby: 2.6
27
+
28
+ script: bundle exec rake spec
data/Appraisals ADDED
@@ -0,0 +1,18 @@
1
+ appraise "rails-52" do
2
+ gem 'rails', '~> 5.2', '>= 5.2.6'
3
+ end
4
+
5
+ appraise "rails-60" do
6
+ gem 'rails', '~> 6.0', '>= 6.0.4.4'
7
+ end
8
+
9
+ appraise "rails-61" do
10
+ gem 'rails', '~> 6.1', '>= 6.1.4.4'
11
+ end
12
+
13
+ # Rails 7 requires at least Ruby 2.7
14
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
15
+ appraise "rails-70" do
16
+ gem 'rails', '~> 7.0'
17
+ end
18
+ end
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file is used to list changes made in each version of the gem.
4
4
 
5
+ # 0.4.0
6
+
7
+ Fixes, updates and health_check release.
8
+
9
+ - Update generators for Docker and Gitlab CI.
10
+ - Move all generators under the `modulorails` namespace.
11
+ - Add dependency to `health_check` gem.
12
+ - Fix error on database configuration validator when no database.yml exists.
13
+ - Rescue if httparty can't post to configuration.endpoint.
14
+ - Add dockerfiles to test on many Ruby versions.
15
+ - Add appraisal to test on many Rails versions.
16
+
5
17
  # 0.3.0
6
18
 
7
19
  Docker release.
data/Dockerfile.ruby25 ADDED
@@ -0,0 +1,34 @@
1
+ #
2
+ # BUILD IMAGE
3
+ #
4
+ FROM ruby:2.5-alpine
5
+
6
+ WORKDIR /app
7
+
8
+ RUN apk add --update --no-cache \
9
+ alpine-sdk \
10
+ tzdata
11
+
12
+ RUN gem install bundler
13
+
14
+ # Your RubyGems version (3.0.3)) has a bug that prevents `required_ruby_version` from working for
15
+ # Bundler. Any scripts that use `gem install bundler` will break as soon as Bundler drops support
16
+ # for your Ruby version. Please upgrade RubyGems to avoid future breakage and silence this warning
17
+ # by running `gem update --system 3.2.3`
18
+ RUN gem update --system 3.2.3
19
+
20
+ COPY . .
21
+
22
+ RUN bundle config set specific_platform true
23
+
24
+ # Ensure the use of a Gemfile working with Ruby 2.5
25
+ RUN sed -e 's/"..\/"/".\/"/' gemfiles/rails_52.gemfile > Gemfile
26
+
27
+ # Install the basic dependencies
28
+ RUN bundle install
29
+
30
+ # Install dependencies for all supported Rails versions
31
+ RUN bundle exec appraisal install
32
+
33
+ # Run the tests
34
+ CMD ['./entrypoints/appraisal_test.sh']
data/Dockerfile.ruby26 ADDED
@@ -0,0 +1,28 @@
1
+ #
2
+ # BUILD IMAGE
3
+ #
4
+ FROM ruby:2.6-alpine
5
+
6
+ WORKDIR /app
7
+
8
+ RUN apk add --update --no-cache \
9
+ alpine-sdk \
10
+ tzdata
11
+
12
+ RUN gem install bundler
13
+
14
+ COPY . .
15
+
16
+ RUN bundle config set specific_platform true
17
+
18
+ # Ensure the use of a Gemfile working with Ruby 2.6
19
+ RUN sed -e 's/"..\/"/".\/"/' gemfiles/rails_52.gemfile > Gemfile
20
+
21
+ # Install the basic dependencies
22
+ RUN bundle install
23
+
24
+ # Install dependencies for all supported Rails versions
25
+ RUN bundle exec appraisal install
26
+
27
+ # Run the tests
28
+ CMD ['./entrypoints/appraisal_test.sh']
data/Dockerfile.ruby27 ADDED
@@ -0,0 +1,25 @@
1
+ #
2
+ # BUILD IMAGE
3
+ #
4
+ FROM ruby:2.7-alpine
5
+
6
+ WORKDIR /app
7
+
8
+ RUN apk add --update --no-cache \
9
+ alpine-sdk \
10
+ tzdata
11
+
12
+ RUN gem install bundler
13
+
14
+ COPY . .
15
+
16
+ RUN bundle config set specific_platform true
17
+
18
+ # Install the basic dependencies
19
+ RUN bundle install
20
+
21
+ # Install dependencies for all supported Rails versions
22
+ RUN bundle exec appraisal install
23
+
24
+ # Run the tests
25
+ CMD ['./entrypoints/appraisal_test.sh']
data/Dockerfile.ruby30 ADDED
@@ -0,0 +1,25 @@
1
+ #
2
+ # BUILD IMAGE
3
+ #
4
+ FROM ruby:3.0-alpine
5
+
6
+ WORKDIR /app
7
+
8
+ RUN apk add --update --no-cache \
9
+ alpine-sdk \
10
+ tzdata
11
+
12
+ RUN gem install bundler
13
+
14
+ COPY . .
15
+
16
+ RUN bundle config set specific_platform true
17
+
18
+ # Install the basic dependencies
19
+ RUN bundle install
20
+
21
+ # Install dependencies for all supported Rails versions
22
+ RUN bundle exec appraisal install
23
+
24
+ # Run the tests
25
+ CMD ['./entrypoints/appraisal_test.sh']
data/Dockerfile.ruby31 ADDED
@@ -0,0 +1,25 @@
1
+ #
2
+ # BUILD IMAGE
3
+ #
4
+ FROM ruby:3.1-alpine
5
+
6
+ WORKDIR /app
7
+
8
+ RUN apk add --update --no-cache \
9
+ alpine-sdk \
10
+ tzdata
11
+
12
+ RUN gem install bundler
13
+
14
+ COPY . .
15
+
16
+ RUN bundle config set specific_platform true
17
+
18
+ # Install the basic dependencies
19
+ RUN bundle install
20
+
21
+ # Install dependencies for all supported Rails versions
22
+ RUN bundle exec appraisal install
23
+
24
+ # Run the tests
25
+ CMD ['./entrypoints/appraisal_test.sh']
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modulorails (0.3.0)
4
+ modulorails (0.4.0)
5
5
  git (~> 1.7, >= 1.7.0)
6
+ health_check (~> 3.1)
6
7
  httparty
7
8
  i18n
8
9
  railties (>= 4.2.0)
@@ -10,97 +11,103 @@ PATH
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- actionpack (6.0.3.2)
14
- actionview (= 6.0.3.2)
15
- activesupport (= 6.0.3.2)
16
- rack (~> 2.0, >= 2.0.8)
14
+ actionpack (7.0.0)
15
+ actionview (= 7.0.0)
16
+ activesupport (= 7.0.0)
17
+ rack (~> 2.0, >= 2.2.0)
17
18
  rack-test (>= 0.6.3)
18
19
  rails-dom-testing (~> 2.0)
19
20
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
- actionview (6.0.3.2)
21
- activesupport (= 6.0.3.2)
21
+ actionview (7.0.0)
22
+ activesupport (= 7.0.0)
22
23
  builder (~> 3.1)
23
24
  erubi (~> 1.4)
24
25
  rails-dom-testing (~> 2.0)
25
26
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
- activemodel (6.0.3.2)
27
- activesupport (= 6.0.3.2)
28
- activerecord (6.0.3.2)
29
- activemodel (= 6.0.3.2)
30
- activesupport (= 6.0.3.2)
31
- activesupport (6.0.3.2)
27
+ activemodel (7.0.0)
28
+ activesupport (= 7.0.0)
29
+ activerecord (7.0.0)
30
+ activemodel (= 7.0.0)
31
+ activesupport (= 7.0.0)
32
+ activesupport (7.0.0)
32
33
  concurrent-ruby (~> 1.0, >= 1.0.2)
33
- i18n (>= 0.7, < 2)
34
- minitest (~> 5.1)
35
- tzinfo (~> 1.1)
36
- zeitwerk (~> 2.2, >= 2.2.2)
34
+ i18n (>= 1.6, < 2)
35
+ minitest (>= 5.1)
36
+ tzinfo (~> 2.0)
37
+ appraisal (2.4.1)
38
+ bundler
39
+ rake
40
+ thor (>= 0.14.0)
37
41
  builder (3.2.4)
38
- concurrent-ruby (1.1.7)
42
+ concurrent-ruby (1.1.9)
39
43
  crass (1.0.6)
40
- diff-lcs (1.4.4)
44
+ diff-lcs (1.5.0)
41
45
  erubi (1.10.0)
42
- git (1.8.1)
46
+ git (1.10.2)
43
47
  rchardet (~> 1.8)
44
- httparty (0.18.1)
48
+ health_check (3.1.0)
49
+ railties (>= 5.0)
50
+ httparty (0.20.0)
45
51
  mime-types (~> 3.0)
46
52
  multi_xml (>= 0.5.2)
47
- i18n (1.8.5)
53
+ i18n (1.8.11)
48
54
  concurrent-ruby (~> 1.0)
49
- loofah (2.9.0)
55
+ loofah (2.13.0)
50
56
  crass (~> 1.0.2)
51
57
  nokogiri (>= 1.5.9)
52
58
  method_source (1.0.0)
53
- mime-types (3.3.1)
59
+ mime-types (3.4.1)
54
60
  mime-types-data (~> 3.2015)
55
- mime-types-data (3.2021.0225)
56
- minitest (5.14.1)
61
+ mime-types-data (3.2022.0105)
62
+ minitest (5.15.0)
57
63
  multi_xml (0.6.0)
58
- nokogiri (1.11.1-x86_64-darwin)
64
+ nokogiri (1.13.1-aarch64-linux)
59
65
  racc (~> 1.4)
60
- racc (1.5.2)
66
+ racc (1.6.0)
61
67
  rack (2.2.3)
62
68
  rack-test (1.1.0)
63
69
  rack (>= 1.0, < 3)
64
70
  rails-dom-testing (2.0.3)
65
71
  activesupport (>= 4.2.0)
66
72
  nokogiri (>= 1.6)
67
- rails-html-sanitizer (1.3.0)
73
+ rails-html-sanitizer (1.4.2)
68
74
  loofah (~> 2.3)
69
- railties (6.0.3.2)
70
- actionpack (= 6.0.3.2)
71
- activesupport (= 6.0.3.2)
75
+ railties (7.0.0)
76
+ actionpack (= 7.0.0)
77
+ activesupport (= 7.0.0)
72
78
  method_source
73
- rake (>= 0.8.7)
74
- thor (>= 0.20.3, < 2.0)
79
+ rake (>= 12.2)
80
+ thor (~> 1.0)
81
+ zeitwerk (~> 2.5)
75
82
  rake (12.3.3)
76
83
  rchardet (1.8.0)
77
- rspec (3.9.0)
78
- rspec-core (~> 3.9.0)
79
- rspec-expectations (~> 3.9.0)
80
- rspec-mocks (~> 3.9.0)
81
- rspec-core (3.9.2)
82
- rspec-support (~> 3.9.3)
83
- rspec-expectations (3.9.2)
84
+ rspec (3.10.0)
85
+ rspec-core (~> 3.10.0)
86
+ rspec-expectations (~> 3.10.0)
87
+ rspec-mocks (~> 3.10.0)
88
+ rspec-core (3.10.1)
89
+ rspec-support (~> 3.10.0)
90
+ rspec-expectations (3.10.1)
84
91
  diff-lcs (>= 1.2.0, < 2.0)
85
- rspec-support (~> 3.9.0)
86
- rspec-mocks (3.9.1)
92
+ rspec-support (~> 3.10.0)
93
+ rspec-mocks (3.10.2)
87
94
  diff-lcs (>= 1.2.0, < 2.0)
88
- rspec-support (~> 3.9.0)
89
- rspec-support (3.9.3)
90
- thor (1.1.0)
91
- thread_safe (0.3.6)
92
- tzinfo (1.2.7)
93
- thread_safe (~> 0.1)
94
- zeitwerk (2.4.0)
95
+ rspec-support (~> 3.10.0)
96
+ rspec-support (3.10.3)
97
+ thor (1.2.1)
98
+ tzinfo (2.0.4)
99
+ concurrent-ruby (~> 1.0)
100
+ zeitwerk (2.5.3)
95
101
 
96
102
  PLATFORMS
97
- ruby
103
+ aarch64-linux
98
104
 
99
105
  DEPENDENCIES
100
106
  activerecord (>= 4.2.0)
107
+ appraisal
101
108
  modulorails!
102
109
  rake (~> 12.0)
103
110
  rspec (~> 3.0)
104
111
 
105
112
  BUNDLED WITH
106
- 2.1.4
113
+ 2.3.3
data/README.md CHANGED
@@ -10,7 +10,7 @@ provides templates for the common configurations and defines common dependencies
10
10
  Add this line to your application's Gemfile:
11
11
 
12
12
  ```ruby
13
- gem 'modulorails', git: 'git://github.com/moduloTech/modulorails.git'
13
+ gem 'modulorails'
14
14
  ```
15
15
 
16
16
  And then execute:
@@ -33,9 +33,21 @@ end
33
33
 
34
34
  ## Development
35
35
 
36
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
-
38
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+ There are tests in `spec`. To run tests:
37
+ - Build Docker images using `docker compose build`.
38
+ - You can run tests on all supported Ruby versions using `docker compose up`.
39
+ - Or you can run test on a specific Ruby version using one of the following commands:
40
+ - Ruby 2.5: `docker compose run ruby25`
41
+ - Ruby 2.6: `docker compose run ruby26`
42
+ - Ruby 2.7: `docker compose run ruby27`
43
+ - Ruby 3.0: `docker compose run ruby30`
44
+ - Ruby 3.1: `docker compose run ruby31`
45
+
46
+ [Appraisal](https://github.com/thoughtbot/appraisal) is used to test the gem against many supported Rails versions:
47
+ - Rails 5.2, 6.0 and 6.1 on Ruby 2.5 and 2.6.
48
+ - Rails 5.2, 6.0, 6.1 and 7.0 on Ruby 2.7, 3.0 and 3.1.
49
+
50
+ Travis CI is configured to automatically run tests in all supported Ruby versions and dependency sets after each push.
39
51
 
40
52
  ## Contributing
41
53
 
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -0,0 +1,37 @@
1
+ version: '3.7'
2
+
3
+ services:
4
+ ruby25:
5
+ image: modulotechgroup/modulorails:testruby25
6
+ build:
7
+ context: .
8
+ dockerfile: Dockerfile.ruby25
9
+ command: ./entrypoints/appraisal_test.sh
10
+
11
+ ruby26:
12
+ image: modulotechgroup/modulorails:testruby26
13
+ build:
14
+ context: .
15
+ dockerfile: Dockerfile.ruby26
16
+ command: ./entrypoints/appraisal_test.sh
17
+
18
+ ruby27:
19
+ image: modulotechgroup/modulorails:testruby27
20
+ build:
21
+ context: .
22
+ dockerfile: Dockerfile.ruby27
23
+ command: ./entrypoints/appraisal_test.sh
24
+
25
+ ruby30:
26
+ image: modulotechgroup/modulorails:testruby30
27
+ build:
28
+ context: .
29
+ dockerfile: Dockerfile.ruby30
30
+ command: ./entrypoints/appraisal_test.sh
31
+
32
+ ruby31:
33
+ image: modulotechgroup/modulorails:testruby31
34
+ build:
35
+ context: .
36
+ dockerfile: Dockerfile.ruby31
37
+ command: ./entrypoints/appraisal_test.sh
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ # Exit immediately if a command exits with a non-zero status
4
+ set -e
5
+
6
+ # Launch the tests
7
+ bundle exec appraisal rake spec
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 12.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem "rails", "~> 5.2", ">= 5.2.6"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 12.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem "rails", "~> 6.0", ">= 6.0.4.4"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 12.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem "rails", "~> 6.1", ">= 6.1.4.4"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 12.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem "rails", "~> 7.0"
8
+
9
+ gemspec path: "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'rails/generators'
4
4
 
5
- class DockerGenerator < Rails::Generators::Base
5
+ class Modulorails::DockerGenerator < Rails::Generators::Base
6
6
  source_root File.expand_path('templates', __dir__)
7
7
  desc 'This generator creates Dockerfiles for an app'
8
8
 
@@ -1,4 +1,3 @@
1
- FROM surnet/alpine-wkhtmltopdf:3.12-0.12.6-small as wkhtmltopdf
2
1
  # BUILD IMAGE
3
2
  FROM ruby:<%= Modulorails.data.ruby_version %>-alpine as builder
4
3
 
@@ -7,12 +6,16 @@ WORKDIR /app
7
6
 
8
7
  RUN apk add --update --no-cache \
9
8
  alpine-sdk \
10
- mysql-dev \
11
9
  nodejs \
12
- sqlite-dev \
13
10
  tzdata \
14
11
  yarn \
15
- shared-mime-info
12
+ shared-mime-info \
13
+ <%- adapter = Modulorails.data.adapter -%>
14
+ <%- if adapter =~ /mysql/ -%>
15
+ mysql-dev
16
+ <%- else -%>
17
+ postgresql-dev
18
+ <%- end -%>
16
19
  RUN gem install bundler -v <%= Modulorails.data.bundler_version %>
17
20
 
18
21
  COPY Gemfile Gemfile.lock ./
@@ -33,15 +36,17 @@ WORKDIR /app
33
36
  RUN apk add --update --no-cache \
34
37
  curl \
35
38
  git \
36
- mysql-dev \
37
39
  nodejs \
38
- sqlite-dev \
39
40
  tzdata \
40
- shared-mime-info
41
+ shared-mime-info \
42
+ <%- adapter = Modulorails.data.adapter -%>
43
+ <%- if adapter =~ /mysql/ -%>
44
+ mysql-dev \
45
+ <%- else -%>
46
+ postgresql-dev \
47
+ <%- end -%>
41
48
  && rm -rf .git/
42
49
 
43
- # Replace segfault version with patched one
44
- COPY --from=wkhtmltopdf /bin/wkhtmltopdf /usr/bin/wkhtmltopdf
45
50
  COPY --from=builder /app .
46
51
 
47
52
  RUN bundle config --local path vendor/bundle \
@@ -1,6 +1,3 @@
1
- # Import wkhtmltopdf with qt patched because from alpine it's not and segfault
2
- FROM surnet/alpine-wkhtmltopdf:3.12-0.12.6-small as wkhtmltopdf
3
-
4
1
  FROM ruby:<%= Modulorails.data.ruby_version %>-alpine
5
2
 
6
3
  ENV RAILS_ENV=development
@@ -10,9 +7,13 @@ RUN apk add --update --no-cache \
10
7
  alpine-sdk \
11
8
  nodejs \
12
9
  yarn \
13
- sqlite-dev \
14
10
  tzdata \
11
+ <%- adapter = Modulorails.data.adapter -%>
12
+ <%- if adapter =~ /mysql/ -%>
15
13
  mysql-dev
14
+ <%- else -%>
15
+ postgresql-dev
16
+ <%- end -%>
16
17
  RUN gem install bundler -v <%= Modulorails.data.bundler_version %>
17
18
 
18
19
  COPY Gemfile Gemfile.lock ./
@@ -20,9 +21,6 @@ RUN bundle install --jobs=2
20
21
 
21
22
  COPY . .
22
23
 
23
- # Replace segfault version with patched one
24
- COPY --from=wkhtmltopdf /bin/wkhtmltopdf /usr/bin/wkhtmltopdf
25
-
26
24
  EXPOSE 3000
27
25
 
28
26
  ENTRYPOINT ["./entrypoints/docker-entrypoint.sh"]
@@ -1,5 +1,7 @@
1
1
  <%- image_name = Modulorails.data.name.parameterize -%>
2
2
  <%- upper_image_name = image_name.upcase -%>
3
+ <%- adapter = Modulorails.data.adapter -%>
4
+ <%- if adapter =~ /mysql/ -%>
3
5
  development: &default
4
6
  adapter: mysql2
5
7
  encoding: utf8mb4
@@ -9,6 +11,15 @@ development: &default
9
11
  password: <%%= ENV.fetch('<%= upper_image_name %>_DATABASE_PASSWORD', '') %>
10
12
  host: <%%= ENV.fetch('<%= upper_image_name %>_DATABASE_HOST', 'database') %>
11
13
  port: <%%= ENV.fetch('<%= upper_image_name %>_DATABASE_PORT', 3306) %>
14
+ <%- else -%>
15
+ development: &default
16
+ adapter: pg
17
+ database: <%%= ENV.fetch('<%= upper_image_name %>_DATABASE_NAME', '<%= image_name %>') %>
18
+ username: <%%= ENV.fetch('<%= upper_image_name %>_DATABASE_USERNAME', 'postgres') %>
19
+ password: <%%= ENV.fetch('<%= upper_image_name %>_DATABASE_PASSWORD', 'postgres') %>
20
+ host: <%%= ENV.fetch('<%= upper_image_name %>_DATABASE_HOST', 'database') %>
21
+ port: <%%= ENV.fetch('<%= upper_image_name %>_DATABASE_PORT', 5432) %>
22
+ <%- end -%>
12
23
 
13
24
  test:
14
25
  <<: *default