zapp 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +21 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +46 -0
  6. data/.ruby-version +1 -0
  7. data/Gemfile +13 -0
  8. data/Gemfile.lock +110 -0
  9. data/Guardfile +23 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +91 -0
  12. data/Rakefile +8 -0
  13. data/bin/console +15 -0
  14. data/bin/setup +8 -0
  15. data/bin/zapp +7 -0
  16. data/examples/rails-app/.browserslistrc +1 -0
  17. data/examples/rails-app/.gitattributes +10 -0
  18. data/examples/rails-app/.gitignore +40 -0
  19. data/examples/rails-app/.ruby-version +1 -0
  20. data/examples/rails-app/Gemfile +58 -0
  21. data/examples/rails-app/Gemfile.lock +253 -0
  22. data/examples/rails-app/Rakefile +8 -0
  23. data/examples/rails-app/app/assets/config/manifest.js +2 -0
  24. data/examples/rails-app/app/assets/images/.keep +0 -0
  25. data/examples/rails-app/app/assets/stylesheets/application.css +15 -0
  26. data/examples/rails-app/app/channels/application_cable/channel.rb +6 -0
  27. data/examples/rails-app/app/channels/application_cable/connection.rb +6 -0
  28. data/examples/rails-app/app/controllers/application_controller.rb +4 -0
  29. data/examples/rails-app/app/controllers/concerns/.keep +0 -0
  30. data/examples/rails-app/app/helpers/application_helper.rb +4 -0
  31. data/examples/rails-app/app/javascript/channels/consumer.js +6 -0
  32. data/examples/rails-app/app/javascript/channels/index.js +5 -0
  33. data/examples/rails-app/app/javascript/packs/application.js +13 -0
  34. data/examples/rails-app/app/jobs/application_job.rb +9 -0
  35. data/examples/rails-app/app/mailers/application_mailer.rb +6 -0
  36. data/examples/rails-app/app/models/application_record.rb +5 -0
  37. data/examples/rails-app/app/models/concerns/.keep +0 -0
  38. data/examples/rails-app/app/views/layouts/application.html.erb +16 -0
  39. data/examples/rails-app/app/views/layouts/mailer.html.erb +13 -0
  40. data/examples/rails-app/app/views/layouts/mailer.text.erb +1 -0
  41. data/examples/rails-app/babel.config.js +82 -0
  42. data/examples/rails-app/bin/bundle +118 -0
  43. data/examples/rails-app/bin/rails +7 -0
  44. data/examples/rails-app/bin/rake +7 -0
  45. data/examples/rails-app/bin/setup +38 -0
  46. data/examples/rails-app/bin/spring +16 -0
  47. data/examples/rails-app/bin/webpack +21 -0
  48. data/examples/rails-app/bin/webpack-dev-server +21 -0
  49. data/examples/rails-app/bin/yarn +19 -0
  50. data/examples/rails-app/bin/zapp +1 -0
  51. data/examples/rails-app/config/application.rb +24 -0
  52. data/examples/rails-app/config/boot.rb +6 -0
  53. data/examples/rails-app/config/cable.yml +10 -0
  54. data/examples/rails-app/config/credentials.yml.enc +1 -0
  55. data/examples/rails-app/config/database.yml +25 -0
  56. data/examples/rails-app/config/environment.rb +7 -0
  57. data/examples/rails-app/config/environments/development.rb +78 -0
  58. data/examples/rails-app/config/environments/production.rb +122 -0
  59. data/examples/rails-app/config/environments/test.rb +62 -0
  60. data/examples/rails-app/config/initializers/application_controller_renderer.rb +9 -0
  61. data/examples/rails-app/config/initializers/assets.rb +16 -0
  62. data/examples/rails-app/config/initializers/backtrace_silencers.rb +10 -0
  63. data/examples/rails-app/config/initializers/content_security_policy.rb +31 -0
  64. data/examples/rails-app/config/initializers/cookies_serializer.rb +7 -0
  65. data/examples/rails-app/config/initializers/filter_parameter_logging.rb +8 -0
  66. data/examples/rails-app/config/initializers/inflections.rb +17 -0
  67. data/examples/rails-app/config/initializers/mime_types.rb +5 -0
  68. data/examples/rails-app/config/initializers/permissions_policy.rb +12 -0
  69. data/examples/rails-app/config/initializers/wrap_parameters.rb +16 -0
  70. data/examples/rails-app/config/locales/en.yml +33 -0
  71. data/examples/rails-app/config/puma.rb +45 -0
  72. data/examples/rails-app/config/routes.rb +5 -0
  73. data/examples/rails-app/config/spring.rb +8 -0
  74. data/examples/rails-app/config/storage.yml +34 -0
  75. data/examples/rails-app/config/webpack/development.js +5 -0
  76. data/examples/rails-app/config/webpack/environment.js +3 -0
  77. data/examples/rails-app/config/webpack/production.js +5 -0
  78. data/examples/rails-app/config/webpack/test.js +5 -0
  79. data/examples/rails-app/config/webpacker.yml +92 -0
  80. data/examples/rails-app/config/zapp.rb +10 -0
  81. data/examples/rails-app/config.ru +7 -0
  82. data/examples/rails-app/db/seeds.rb +8 -0
  83. data/examples/rails-app/lib/assets/.keep +0 -0
  84. data/examples/rails-app/lib/tasks/.keep +0 -0
  85. data/examples/rails-app/log/.keep +0 -0
  86. data/examples/rails-app/package.json +17 -0
  87. data/examples/rails-app/postcss.config.js +12 -0
  88. data/examples/rails-app/public/404.html +67 -0
  89. data/examples/rails-app/public/422.html +67 -0
  90. data/examples/rails-app/public/500.html +66 -0
  91. data/examples/rails-app/public/apple-touch-icon-precomposed.png +0 -0
  92. data/examples/rails-app/public/apple-touch-icon.png +0 -0
  93. data/examples/rails-app/public/favicon.ico +0 -0
  94. data/examples/rails-app/public/robots.txt +1 -0
  95. data/examples/rails-app/storage/.keep +0 -0
  96. data/examples/rails-app/test/application_system_test_case.rb +7 -0
  97. data/examples/rails-app/test/channels/application_cable/connection_test.rb +15 -0
  98. data/examples/rails-app/test/controllers/.keep +0 -0
  99. data/examples/rails-app/test/fixtures/files/.keep +0 -0
  100. data/examples/rails-app/test/helpers/.keep +0 -0
  101. data/examples/rails-app/test/integration/.keep +0 -0
  102. data/examples/rails-app/test/mailers/.keep +0 -0
  103. data/examples/rails-app/test/models/.keep +0 -0
  104. data/examples/rails-app/test/system/.keep +0 -0
  105. data/examples/rails-app/test/test_helper.rb +17 -0
  106. data/examples/rails-app/tmp/.keep +0 -0
  107. data/examples/rails-app/tmp/pids/.keep +0 -0
  108. data/examples/rails-app/vendor/.keep +0 -0
  109. data/examples/rails-app/yarn.lock +6973 -0
  110. data/lib/rack/handler/zap.rb +16 -0
  111. data/lib/zapp/cli.rb +45 -0
  112. data/lib/zapp/configuration.rb +131 -0
  113. data/lib/zapp/http_context/context.rb +32 -0
  114. data/lib/zapp/http_context/request.rb +28 -0
  115. data/lib/zapp/http_context/response.rb +27 -0
  116. data/lib/zapp/input_stream.rb +51 -0
  117. data/lib/zapp/logger.rb +63 -0
  118. data/lib/zapp/parser.rb +14 -0
  119. data/lib/zapp/server.rb +55 -0
  120. data/lib/zapp/version.rb +5 -0
  121. data/lib/zapp/worker.rb +88 -0
  122. data/lib/zapp/worker_pool.rb +40 -0
  123. data/lib/zapp.rb +34 -0
  124. data/zapp.gemspec +42 -0
  125. metadata +239 -0
@@ -0,0 +1,253 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ zapp (0.1.0)
5
+ concurrent-ruby (~> 1.1.9)
6
+ puma (~> 5.5.2)
7
+ rack (~> 2.2.3)
8
+ rake (~> 13.0)
9
+ rspec (~> 3.0)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ actioncable (6.1.4.1)
15
+ actionpack (= 6.1.4.1)
16
+ activesupport (= 6.1.4.1)
17
+ nio4r (~> 2.0)
18
+ websocket-driver (>= 0.6.1)
19
+ actionmailbox (6.1.4.1)
20
+ actionpack (= 6.1.4.1)
21
+ activejob (= 6.1.4.1)
22
+ activerecord (= 6.1.4.1)
23
+ activestorage (= 6.1.4.1)
24
+ activesupport (= 6.1.4.1)
25
+ mail (>= 2.7.1)
26
+ actionmailer (6.1.4.1)
27
+ actionpack (= 6.1.4.1)
28
+ actionview (= 6.1.4.1)
29
+ activejob (= 6.1.4.1)
30
+ activesupport (= 6.1.4.1)
31
+ mail (~> 2.5, >= 2.5.4)
32
+ rails-dom-testing (~> 2.0)
33
+ actionpack (6.1.4.1)
34
+ actionview (= 6.1.4.1)
35
+ activesupport (= 6.1.4.1)
36
+ rack (~> 2.0, >= 2.0.9)
37
+ rack-test (>= 0.6.3)
38
+ rails-dom-testing (~> 2.0)
39
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
40
+ actiontext (6.1.4.1)
41
+ actionpack (= 6.1.4.1)
42
+ activerecord (= 6.1.4.1)
43
+ activestorage (= 6.1.4.1)
44
+ activesupport (= 6.1.4.1)
45
+ nokogiri (>= 1.8.5)
46
+ actionview (6.1.4.1)
47
+ activesupport (= 6.1.4.1)
48
+ builder (~> 3.1)
49
+ erubi (~> 1.4)
50
+ rails-dom-testing (~> 2.0)
51
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
52
+ activejob (6.1.4.1)
53
+ activesupport (= 6.1.4.1)
54
+ globalid (>= 0.3.6)
55
+ activemodel (6.1.4.1)
56
+ activesupport (= 6.1.4.1)
57
+ activerecord (6.1.4.1)
58
+ activemodel (= 6.1.4.1)
59
+ activesupport (= 6.1.4.1)
60
+ activestorage (6.1.4.1)
61
+ actionpack (= 6.1.4.1)
62
+ activejob (= 6.1.4.1)
63
+ activerecord (= 6.1.4.1)
64
+ activesupport (= 6.1.4.1)
65
+ marcel (~> 1.0.0)
66
+ mini_mime (>= 1.1.0)
67
+ activesupport (6.1.4.1)
68
+ concurrent-ruby (~> 1.0, >= 1.0.2)
69
+ i18n (>= 1.6, < 2)
70
+ minitest (>= 5.1)
71
+ tzinfo (~> 2.0)
72
+ zeitwerk (~> 2.3)
73
+ addressable (2.8.0)
74
+ public_suffix (>= 2.0.2, < 5.0)
75
+ bindex (0.8.1)
76
+ bootsnap (1.9.1)
77
+ msgpack (~> 1.0)
78
+ builder (3.2.4)
79
+ byebug (11.1.3)
80
+ capybara (3.36.0)
81
+ addressable
82
+ matrix
83
+ mini_mime (>= 0.1.3)
84
+ nokogiri (~> 1.8)
85
+ rack (>= 1.6.0)
86
+ rack-test (>= 0.6.3)
87
+ regexp_parser (>= 1.5, < 3.0)
88
+ xpath (~> 3.2)
89
+ childprocess (4.1.0)
90
+ concurrent-ruby (1.1.9)
91
+ crass (1.0.6)
92
+ diff-lcs (1.4.4)
93
+ erubi (1.10.0)
94
+ ffi (1.15.4)
95
+ globalid (0.5.2)
96
+ activesupport (>= 5.0)
97
+ i18n (1.8.11)
98
+ concurrent-ruby (~> 1.0)
99
+ jbuilder (2.11.3)
100
+ activesupport (>= 5.0.0)
101
+ listen (3.7.0)
102
+ rb-fsevent (~> 0.10, >= 0.10.3)
103
+ rb-inotify (~> 0.9, >= 0.9.10)
104
+ loofah (2.12.0)
105
+ crass (~> 1.0.2)
106
+ nokogiri (>= 1.5.9)
107
+ mail (2.7.1)
108
+ mini_mime (>= 0.1.1)
109
+ marcel (1.0.2)
110
+ matrix (0.4.2)
111
+ method_source (1.0.0)
112
+ mini_mime (1.1.2)
113
+ minitest (5.14.4)
114
+ msgpack (1.4.2)
115
+ nio4r (2.5.8)
116
+ nokogiri (1.12.5-x86_64-linux)
117
+ racc (~> 1.4)
118
+ public_suffix (4.0.6)
119
+ puma (5.5.2)
120
+ nio4r (~> 2.0)
121
+ racc (1.6.0)
122
+ rack (2.2.3)
123
+ rack-mini-profiler (2.3.3)
124
+ rack (>= 1.2.0)
125
+ rack-proxy (0.7.0)
126
+ rack
127
+ rack-test (1.1.0)
128
+ rack (>= 1.0, < 3)
129
+ rails (6.1.4.1)
130
+ actioncable (= 6.1.4.1)
131
+ actionmailbox (= 6.1.4.1)
132
+ actionmailer (= 6.1.4.1)
133
+ actionpack (= 6.1.4.1)
134
+ actiontext (= 6.1.4.1)
135
+ actionview (= 6.1.4.1)
136
+ activejob (= 6.1.4.1)
137
+ activemodel (= 6.1.4.1)
138
+ activerecord (= 6.1.4.1)
139
+ activestorage (= 6.1.4.1)
140
+ activesupport (= 6.1.4.1)
141
+ bundler (>= 1.15.0)
142
+ railties (= 6.1.4.1)
143
+ sprockets-rails (>= 2.0.0)
144
+ rails-dom-testing (2.0.3)
145
+ activesupport (>= 4.2.0)
146
+ nokogiri (>= 1.6)
147
+ rails-html-sanitizer (1.4.2)
148
+ loofah (~> 2.3)
149
+ railties (6.1.4.1)
150
+ actionpack (= 6.1.4.1)
151
+ activesupport (= 6.1.4.1)
152
+ method_source
153
+ rake (>= 0.13)
154
+ thor (~> 1.0)
155
+ rake (13.0.6)
156
+ rb-fsevent (0.11.0)
157
+ rb-inotify (0.10.1)
158
+ ffi (~> 1.0)
159
+ regexp_parser (2.1.1)
160
+ rexml (3.2.5)
161
+ rspec (3.10.0)
162
+ rspec-core (~> 3.10.0)
163
+ rspec-expectations (~> 3.10.0)
164
+ rspec-mocks (~> 3.10.0)
165
+ rspec-core (3.10.1)
166
+ rspec-support (~> 3.10.0)
167
+ rspec-expectations (3.10.1)
168
+ diff-lcs (>= 1.2.0, < 2.0)
169
+ rspec-support (~> 3.10.0)
170
+ rspec-mocks (3.10.2)
171
+ diff-lcs (>= 1.2.0, < 2.0)
172
+ rspec-support (~> 3.10.0)
173
+ rspec-support (3.10.3)
174
+ rubyzip (2.3.2)
175
+ sass-rails (6.0.0)
176
+ sassc-rails (~> 2.1, >= 2.1.1)
177
+ sassc (2.4.0)
178
+ ffi (~> 1.9)
179
+ sassc-rails (2.1.2)
180
+ railties (>= 4.0.0)
181
+ sassc (>= 2.0)
182
+ sprockets (> 3.0)
183
+ sprockets-rails
184
+ tilt
185
+ selenium-webdriver (4.0.3)
186
+ childprocess (>= 0.5, < 5.0)
187
+ rexml (~> 3.2, >= 3.2.5)
188
+ rubyzip (>= 1.2.2)
189
+ semantic_range (3.0.0)
190
+ spring (3.0.0)
191
+ sprockets (4.0.2)
192
+ concurrent-ruby (~> 1.0)
193
+ rack (> 1, < 3)
194
+ sprockets-rails (3.4.0)
195
+ actionpack (>= 5.2)
196
+ activesupport (>= 5.2)
197
+ sprockets (>= 3.0.0)
198
+ sqlite3 (1.4.2)
199
+ thor (1.1.0)
200
+ tilt (2.0.10)
201
+ turbolinks (5.2.1)
202
+ turbolinks-source (~> 5.2)
203
+ turbolinks-source (5.2.0)
204
+ tzinfo (2.0.4)
205
+ concurrent-ruby (~> 1.0)
206
+ web-console (4.2.0)
207
+ actionview (>= 6.0.0)
208
+ activemodel (>= 6.0.0)
209
+ bindex (>= 0.4.0)
210
+ railties (>= 6.0.0)
211
+ webdrivers (5.0.0)
212
+ nokogiri (~> 1.6)
213
+ rubyzip (>= 1.3.0)
214
+ selenium-webdriver (~> 4.0)
215
+ webpacker (5.4.3)
216
+ activesupport (>= 5.2)
217
+ rack-proxy (>= 0.6.1)
218
+ railties (>= 5.2)
219
+ semantic_range (>= 2.3.0)
220
+ websocket-driver (0.7.5)
221
+ websocket-extensions (>= 0.1.0)
222
+ websocket-extensions (0.1.5)
223
+ xpath (3.2.0)
224
+ nokogiri (~> 1.8)
225
+ zeitwerk (2.5.1)
226
+
227
+ PLATFORMS
228
+ x86_64-linux
229
+
230
+ DEPENDENCIES
231
+ bootsnap (>= 1.4.4)
232
+ byebug
233
+ capybara (>= 3.26)
234
+ jbuilder (~> 2.7)
235
+ listen (~> 3.3)
236
+ rack-mini-profiler (~> 2.0)
237
+ rails (~> 6.1.4, >= 6.1.4.1)
238
+ sass-rails (>= 6)
239
+ selenium-webdriver
240
+ spring
241
+ sqlite3 (~> 1.4)
242
+ turbolinks (~> 5)
243
+ tzinfo-data
244
+ web-console (>= 4.1.0)
245
+ webdrivers
246
+ webpacker (~> 5.0)
247
+ zapp!
248
+
249
+ RUBY VERSION
250
+ ruby 3.0.0p0
251
+
252
+ BUNDLED WITH
253
+ 2.2.3
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
4
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5
+
6
+ require_relative("config/application")
7
+
8
+ Rails.application.load_tasks
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Channel < ActionCable::Channel::Base
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Connection < ActionCable::Connection::Base
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ end
File without changes
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1,6 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
3
+
4
+ import { createConsumer } from "@rails/actioncable"
5
+
6
+ export default createConsumer()
@@ -0,0 +1,5 @@
1
+ // Load all the channels within this directory and all subdirectories.
2
+ // Channel files must be named *_channel.js.
3
+
4
+ const channels = require.context('.', true, /_channel\.js$/)
5
+ channels.keys().forEach(channels)
@@ -0,0 +1,13 @@
1
+ // This file is automatically compiled by Webpack, along with any other files
2
+ // present in this directory. You're encouraged to place your actual application logic in
3
+ // a relevant structure within app/javascript and only use these pack files to reference
4
+ // that code so it'll be compiled.
5
+
6
+ import Rails from "@rails/ujs"
7
+ import Turbolinks from "turbolinks"
8
+ import * as ActiveStorage from "@rails/activestorage"
9
+ import "channels"
10
+
11
+ Rails.start()
12
+ Turbolinks.start()
13
+ ActiveStorage.start()
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationJob < ActiveJob::Base
4
+ # Automatically retry jobs that encountered a deadlock
5
+ # retry_on ActiveRecord::Deadlocked
6
+
7
+ # Most jobs are safe to ignore if the underlying records are no longer available
8
+ # discard_on ActiveJob::DeserializationError
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default(from: "from@example.com")
5
+ layout("mailer")
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
File without changes
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>RailsApp</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
10
+ <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
11
+ </head>
12
+
13
+ <body>
14
+ <%= yield %>
15
+ </body>
16
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,82 @@
1
+ module.exports = function(api) {
2
+ var validEnv = ['development', 'test', 'production']
3
+ var currentEnv = api.env()
4
+ var isDevelopmentEnv = api.env('development')
5
+ var isProductionEnv = api.env('production')
6
+ var isTestEnv = api.env('test')
7
+
8
+ if (!validEnv.includes(currentEnv)) {
9
+ throw new Error(
10
+ 'Please specify a valid `NODE_ENV` or ' +
11
+ '`BABEL_ENV` environment variables. Valid values are "development", ' +
12
+ '"test", and "production". Instead, received: ' +
13
+ JSON.stringify(currentEnv) +
14
+ '.'
15
+ )
16
+ }
17
+
18
+ return {
19
+ presets: [
20
+ isTestEnv && [
21
+ '@babel/preset-env',
22
+ {
23
+ targets: {
24
+ node: 'current'
25
+ }
26
+ }
27
+ ],
28
+ (isProductionEnv || isDevelopmentEnv) && [
29
+ '@babel/preset-env',
30
+ {
31
+ forceAllTransforms: true,
32
+ useBuiltIns: 'entry',
33
+ corejs: 3,
34
+ modules: false,
35
+ exclude: ['transform-typeof-symbol']
36
+ }
37
+ ]
38
+ ].filter(Boolean),
39
+ plugins: [
40
+ 'babel-plugin-macros',
41
+ '@babel/plugin-syntax-dynamic-import',
42
+ isTestEnv && 'babel-plugin-dynamic-import-node',
43
+ '@babel/plugin-transform-destructuring',
44
+ [
45
+ '@babel/plugin-proposal-class-properties',
46
+ {
47
+ loose: true
48
+ }
49
+ ],
50
+ [
51
+ '@babel/plugin-proposal-object-rest-spread',
52
+ {
53
+ useBuiltIns: true
54
+ }
55
+ ],
56
+ [
57
+ '@babel/plugin-proposal-private-methods',
58
+ {
59
+ loose: true
60
+ }
61
+ ],
62
+ [
63
+ '@babel/plugin-proposal-private-property-in-object',
64
+ {
65
+ loose: true
66
+ }
67
+ ],
68
+ [
69
+ '@babel/plugin-transform-runtime',
70
+ {
71
+ helpers: false
72
+ }
73
+ ],
74
+ [
75
+ '@babel/plugin-transform-regenerator',
76
+ {
77
+ async: false
78
+ }
79
+ ]
80
+ ].filter(Boolean)
81
+ }
82
+ }
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require("rubygems")
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+
28
+ bundler_version = nil
29
+ update_index = nil
30
+ ARGV.each_with_index do |a, i|
31
+ bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
32
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
33
+
34
+ bundler_version = Regexp.last_match(1)
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../Gemfile", __dir__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+
59
+ lockfile_contents = File.read(lockfile)
60
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
61
+
62
+ Regexp.last_match(1)
63
+ end
64
+
65
+ def bundler_version
66
+ @bundler_version ||=
67
+ env_var_version || cli_arg_version ||
68
+ lockfile_version
69
+ end
70
+
71
+ def bundler_requirement
72
+ return "#{Gem::Requirement.default}.a" unless bundler_version
73
+
74
+ bundler_gem_version = Gem::Version.new(bundler_version)
75
+
76
+ requirement = bundler_gem_version.approximate_recommendation
77
+
78
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
79
+
80
+ requirement += ".a" if bundler_gem_version.prerelease?
81
+
82
+ requirement
83
+ end
84
+
85
+ def load_bundler!
86
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
87
+
88
+ activate_bundler
89
+ end
90
+
91
+ def activate_bundler
92
+ gem_error = activation_error_handling do
93
+ gem("bundler", bundler_requirement)
94
+ end
95
+ return if gem_error.nil?
96
+
97
+ require_error = activation_error_handling do
98
+ require("bundler/version")
99
+ end
100
+ if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
101
+ return
102
+ end
103
+
104
+ warn("Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`")
105
+ exit(42)
106
+ end
107
+
108
+ def activation_error_handling
109
+ yield
110
+ nil
111
+ rescue StandardError, LoadError => e
112
+ e
113
+ end
114
+ end
115
+
116
+ m.load_bundler!
117
+
118
+ load(Gem.bin_path("bundler", "bundle")) if m.invoked_as_script?
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ load(File.expand_path("spring", __dir__))
5
+ APP_PATH = File.expand_path("../config/application", __dir__)
6
+ require_relative("../config/boot")
7
+ require("rails/commands")
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ load(File.expand_path("spring", __dir__))
5
+ require_relative("../config/boot")
6
+ require("rake")
7
+ Rake.application.run
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require("fileutils")
5
+
6
+ # path to your application root.
7
+ APP_ROOT = File.expand_path("..", __dir__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ FileUtils.chdir(APP_ROOT) do
14
+ # This script is a way to set up or update your development environment automatically.
15
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
16
+ # Add necessary setup steps to this file.
17
+
18
+ puts("== Installing dependencies ==")
19
+ system!("gem install bundler --conservative")
20
+ system("bundle check") || system!("bundle install")
21
+
22
+ # Install JavaScript dependencies
23
+ system!("bin/yarn")
24
+
25
+ # puts "\n== Copying sample files =="
26
+ # unless File.exist?('config/database.yml')
27
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
28
+ # end
29
+
30
+ puts("\n== Preparing database ==")
31
+ system!("bin/rails db:prepare")
32
+
33
+ puts("\n== Removing old logs and tempfiles ==")
34
+ system!("bin/rails log:clear tmp:clear")
35
+
36
+ puts("\n== Restarting application server ==")
37
+ system!("bin/rails restart")
38
+ end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
5
+ gem("bundler")
6
+ require("bundler")
7
+
8
+ # Load Spring without loading other gems in the Gemfile, for speed.
9
+ Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring|
10
+ Gem.use_paths(Gem.dir, Bundler.bundle_path.to_s, *Gem.path)
11
+ gem("spring", spring.version)
12
+ require("spring/binstub")
13
+ rescue Gem::LoadError
14
+ # Ignore when Spring is not installed.
15
+ end
16
+ end