kratos 1.0.2 → 1.0.3
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/lib/kratos/actions.rb +2 -3
- data/lib/kratos/app_builder.rb +47 -51
- data/lib/kratos/generators/app_generator.rb +2 -1
- data/lib/kratos/version.rb +1 -1
- data/templates/Gemfile.erb +3 -2
- data/templates/acceptance_helpers_rspec.rb +1 -1
- data/templates/bullet.rb +7 -0
- data/templates/dotfiles/.env +1 -0
- data/templates/dotfiles/.sample.application.yml +1 -3
- data/templates/routes.rb +2 -0
- data/templates/rubocop.yml +17 -32
- data/templates/rubocop_database.yml +11 -0
- data/templates/rubocop_rspec.yml +2 -0
- data/templates/secrets.yml +1 -0
- data/templates/timezones.rb +14 -14
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61045f764eef6fc5ffdcfc250d496b31695a5437
|
4
|
+
data.tar.gz: b32ec368b9ea11ad6e59f595d987d834ed5c460a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32eb2325a7f1f870030355a70810e0b046a556fa8b7b266d162b401cc722ef1be6b041e31ef4521259487d33328c66c61f7abe66977a4db2f3a2c7e05c22a7c
|
7
|
+
data.tar.gz: 8769fc3162ba927a705b862ddda36a6260cdb2c26b8c955b644fff8daf970a86ef8c6c8792a1b6a416671961016ed0f213e31e160ae29edfa83bed37b6ab95ef
|
data/lib/kratos/actions.rb
CHANGED
@@ -13,10 +13,9 @@ module Kratos
|
|
13
13
|
config = "config.action_mailer.default_url_options = { host: #{host} }"
|
14
14
|
configure_environment(rails_env, config)
|
15
15
|
|
16
|
-
|
16
|
+
append_file(
|
17
17
|
"config/environments/#{rails_env}.rb",
|
18
|
-
"\nRails.application.routes.default_url_options = { host: #{host} }"
|
19
|
-
after: "\nend"
|
18
|
+
"\n\nRails.application.routes.default_url_options = { host: #{host} }"
|
20
19
|
)
|
21
20
|
end
|
22
21
|
|
data/lib/kratos/app_builder.rb
CHANGED
@@ -37,25 +37,12 @@ class AppBuilder < Rails::AppBuilder
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def add_bullet_gem_configuration
|
40
|
-
|
41
|
-
config.after_initialize do
|
42
|
-
Bullet.enable = true
|
43
|
-
Bullet.bullet_logger = true
|
44
|
-
Bullet.rails_logger = true
|
45
|
-
end
|
46
|
-
|
47
|
-
RUBY
|
48
|
-
|
49
|
-
inject_into_file(
|
50
|
-
'config/environments/development.rb',
|
51
|
-
config,
|
52
|
-
after: "config.action_mailer.raise_delivery_errors = true\n"
|
53
|
-
)
|
40
|
+
copy_file 'bullet.rb', 'config/initializers/bullet.rb'
|
54
41
|
end
|
55
42
|
|
56
43
|
def raise_on_unpermitted_parameters
|
57
44
|
config = <<-RUBY
|
58
|
-
|
45
|
+
config.action_controller.action_on_unpermitted_parameters = :raise
|
59
46
|
RUBY
|
60
47
|
|
61
48
|
inject_into_class 'config/application.rb', 'Application', config
|
@@ -73,15 +60,15 @@ end
|
|
73
60
|
def configure_generators
|
74
61
|
config = <<-RUBY
|
75
62
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
63
|
+
config.generators do |generate|
|
64
|
+
generate.helper false
|
65
|
+
generate.javascript_engine false
|
66
|
+
generate.request_specs false
|
67
|
+
generate.routing_specs false
|
68
|
+
generate.stylesheets false
|
69
|
+
generate.test_framework :rspec
|
70
|
+
generate.view_specs false
|
71
|
+
end
|
85
72
|
|
86
73
|
RUBY
|
87
74
|
|
@@ -95,7 +82,7 @@ end
|
|
95
82
|
|
96
83
|
def configure_quiet_assets
|
97
84
|
config = <<-RUBY
|
98
|
-
|
85
|
+
config.quiet_assets = true
|
99
86
|
RUBY
|
100
87
|
|
101
88
|
inject_into_class 'config/application.rb', 'Application', config
|
@@ -173,8 +160,8 @@ end
|
|
173
160
|
|
174
161
|
config = <<-RUBY
|
175
162
|
|
176
|
-
config.action_mailer.delivery_method = :smtp
|
177
|
-
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
163
|
+
config.action_mailer.delivery_method = :smtp
|
164
|
+
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
178
165
|
RUBY
|
179
166
|
|
180
167
|
inject_into_file 'config/environments/production.rb', config,
|
@@ -184,8 +171,8 @@ config.action_mailer.smtp_settings = SMTP_SETTINGS
|
|
184
171
|
def enable_rack_deflater
|
185
172
|
config = <<-RUBY
|
186
173
|
|
187
|
-
# Enable deflate / gzip compression of controller-generated responses
|
188
|
-
config.middleware.use Rack::Deflater
|
174
|
+
# Enable deflate / gzip compression of controller-generated responses
|
175
|
+
config.middleware.use Rack::Deflater
|
189
176
|
RUBY
|
190
177
|
|
191
178
|
inject_into_file(
|
@@ -227,12 +214,12 @@ config.middleware.use Rack::Deflater
|
|
227
214
|
staging_file = 'config/environments/staging.rb'
|
228
215
|
copy_file 'staging.rb', staging_file
|
229
216
|
|
230
|
-
config =
|
217
|
+
config = <<~RUBY
|
231
218
|
|
232
|
-
Rails.application.configure do
|
233
|
-
# ...
|
234
|
-
end
|
235
|
-
|
219
|
+
Rails.application.configure do
|
220
|
+
# ...
|
221
|
+
end
|
222
|
+
RUBY
|
236
223
|
|
237
224
|
append_file staging_file, config
|
238
225
|
end
|
@@ -267,6 +254,11 @@ end
|
|
267
254
|
action_mailer_host 'production', %{ENV.fetch("APPLICATION_HOST")}
|
268
255
|
end
|
269
256
|
|
257
|
+
def configure_routes
|
258
|
+
remove_file 'config/routes.rb'
|
259
|
+
copy_file 'routes.rb', 'config/routes.rb'
|
260
|
+
end
|
261
|
+
|
270
262
|
def configure_redis
|
271
263
|
copy_file 'redis.rb', 'config/initializers/redis.rb'
|
272
264
|
end
|
@@ -276,17 +268,15 @@ end
|
|
276
268
|
copy_file 'sidekiq_rspec.yml', 'spec/support/sidekiq.rb'
|
277
269
|
copy_file 'sidekiq_security.rb', 'config/initializers/sidekiq.rb'
|
278
270
|
empty_directory 'tmp/pids'
|
279
|
-
end
|
280
271
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
EOS
|
272
|
+
route = <<-HERE
|
273
|
+
require 'sidekiq/web'
|
274
|
+
mount Sidekiq::Web => '/sidekiq'
|
275
|
+
HERE
|
276
|
+
|
277
|
+
inject_into_file('config/routes.rb',
|
278
|
+
route,
|
279
|
+
after: "Rails.application.routes.draw do\n")
|
290
280
|
end
|
291
281
|
|
292
282
|
def configure_time_formats
|
@@ -315,10 +305,16 @@ EOS
|
|
315
305
|
inject_into_class 'config/application.rb', 'Application', config
|
316
306
|
end
|
317
307
|
|
308
|
+
def configure_rubocop
|
309
|
+
copy_file 'rubocop.yml', '.rubocop.yml'
|
310
|
+
copy_file 'rubocop_database.yml', 'db/migrate/.rubocop.yml'
|
311
|
+
copy_file 'rubocop_rspec.yml', 'spec/.rubocop.yml'
|
312
|
+
end
|
313
|
+
|
318
314
|
def setup_brazilian_app
|
319
315
|
config = <<-RUBY
|
320
|
-
|
321
|
-
|
316
|
+
config.time_zone = 'Brasilia'
|
317
|
+
config.i18n.default_locale = :'pt-BR'
|
322
318
|
RUBY
|
323
319
|
|
324
320
|
inject_into_class 'config/application.rb', 'Application', config
|
@@ -337,7 +333,7 @@ EOS
|
|
337
333
|
|
338
334
|
def fix_i18n_deprecation_warning
|
339
335
|
config = <<-RUBY
|
340
|
-
|
336
|
+
config.i18n.enforce_available_locales = false
|
341
337
|
RUBY
|
342
338
|
|
343
339
|
inject_into_class 'config/application.rb', 'Application', config
|
@@ -350,10 +346,10 @@ task(:default).clear
|
|
350
346
|
task default: [:spec]
|
351
347
|
|
352
348
|
if defined? RSpec
|
353
|
-
task(:spec).clear
|
354
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
355
|
-
|
356
|
-
end
|
349
|
+
task(:spec).clear
|
350
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
351
|
+
t.verbose = false
|
352
|
+
end
|
357
353
|
end
|
358
354
|
EOS
|
359
355
|
end
|
@@ -106,13 +106,14 @@ module Kratos
|
|
106
106
|
build :copy_dotfiles
|
107
107
|
build :configure_default_url_options
|
108
108
|
build :configure_action_mailer
|
109
|
+
build :configure_routes
|
109
110
|
build :configure_redis
|
110
111
|
build :configure_sidekiq
|
111
|
-
build :configure_routes
|
112
112
|
build :configure_time_formats
|
113
113
|
build :configure_i18n_messages
|
114
114
|
build :configure_whenever
|
115
115
|
build :configure_app_services
|
116
|
+
build :configure_rubocop
|
116
117
|
build :setup_brazilian_app
|
117
118
|
build :setup_dalli_store
|
118
119
|
build :disable_xml_params
|
data/lib/kratos/version.rb
CHANGED
data/templates/Gemfile.erb
CHANGED
@@ -46,12 +46,13 @@ group :development, :test do
|
|
46
46
|
gem "factory_girl_rails"
|
47
47
|
gem "ffaker"
|
48
48
|
gem "rspec-rails", "~> 3.4.0"
|
49
|
-
gem
|
50
|
-
gem
|
49
|
+
gem "rubocop", require: false
|
50
|
+
gem "brakeman", require: false
|
51
51
|
end
|
52
52
|
|
53
53
|
group :test do
|
54
54
|
gem "capybara"
|
55
|
+
gem "poltergeist"
|
55
56
|
gem "database_cleaner"
|
56
57
|
gem "formulaic"
|
57
58
|
gem "launchy"
|
data/templates/bullet.rb
ADDED
data/templates/dotfiles/.env
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
ASSET_HOST: localhost:3000
|
2
2
|
APPLICATION_HOST: localhost:3000
|
3
|
-
PORT: 3000
|
4
|
-
RACK_ENV: development
|
5
3
|
REDIS_URL: redis://127.0.0.1:6379
|
4
|
+
SECRET_TOKEN: development_token
|
6
5
|
SECRET_KEY_BASE: development_secret
|
7
6
|
EXECJS_RUNTIME: Node
|
8
7
|
SMTP_ADDRESS: smtp.example.com
|
9
8
|
SMTP_DOMAIN: example.com
|
10
9
|
SMTP_PASSWORD: password
|
11
10
|
SMTP_USERNAME: username
|
12
|
-
WEB_CONCURRENCY: 1
|
13
11
|
AWS_REGION: us-east-1
|
14
12
|
AWS_ACCESS_KEY_ID: <put-your-key-here>
|
15
13
|
AWS_SECRET_ACCESS_KEY: <put-your-secret-here>
|
data/templates/routes.rb
ADDED
data/templates/rubocop.yml
CHANGED
@@ -1,40 +1,25 @@
|
|
1
1
|
AllCops:
|
2
|
+
TargetRubyVersion: 2.3
|
3
|
+
Include:
|
4
|
+
- Rakefile
|
5
|
+
- config.ru
|
2
6
|
Exclude:
|
3
|
-
-
|
4
|
-
- "db/**/*"
|
5
|
-
- "vendor/**/*"
|
6
|
-
- "tmp/**/*"
|
7
|
-
- "config/**/*"
|
8
|
-
- "bin/**/*"
|
9
|
-
- "log/**/*"
|
10
|
-
- "Guardfile"
|
11
|
-
- "spec/factories/*"
|
12
|
-
RunRailsCops: true
|
7
|
+
- db/schema.rb
|
13
8
|
|
14
|
-
|
15
|
-
Enabled:
|
9
|
+
Rails:
|
10
|
+
Enabled: true
|
16
11
|
|
17
|
-
|
18
|
-
|
12
|
+
MethodLength:
|
13
|
+
Max: 20
|
19
14
|
|
20
|
-
|
21
|
-
|
15
|
+
LineLength:
|
16
|
+
Max: 120
|
22
17
|
|
23
|
-
|
24
|
-
|
18
|
+
HasAndBelongsToMany:
|
19
|
+
Enabled: false
|
25
20
|
|
26
|
-
|
27
|
-
|
21
|
+
Documentation:
|
22
|
+
Enabled: false
|
28
23
|
|
29
|
-
|
30
|
-
|
31
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
32
|
-
Enabled: true
|
33
|
-
NamePrefix:
|
34
|
-
- is_
|
35
|
-
- has_
|
36
|
-
- have_
|
37
|
-
NamePrefixBlacklist:
|
38
|
-
- is_
|
39
|
-
Exclude:
|
40
|
-
- spec/**/*
|
24
|
+
StringLiterals:
|
25
|
+
Enabled: false
|
data/templates/secrets.yml
CHANGED
data/templates/timezones.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
module ActiveSupport
|
2
2
|
class TimeZone
|
3
|
-
MAPPING
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
3
|
+
MAPPING['Noronha'] = 'America/Noronha'
|
4
|
+
MAPPING['Belém'] = 'America/Belem'
|
5
|
+
MAPPING['Fortaleza'] = 'America/Fortaleza'
|
6
|
+
MAPPING['Recife'] = 'America/Recife'
|
7
|
+
MAPPING['Araguaina'] = 'America/Araguaina'
|
8
|
+
MAPPING['Maceió'] = 'America/Maceio'
|
9
|
+
MAPPING['Campo Grande'] = 'America/Campo_Grande'
|
10
|
+
MAPPING['Cuiabá'] = 'America/Cuiaba'
|
11
|
+
MAPPING['Santarém'] = 'America/Santarem'
|
12
|
+
MAPPING['Porto Velho'] = 'America/Porto_Velho'
|
13
|
+
MAPPING['Boa Vista'] = 'America/Boa_Vista'
|
14
|
+
MAPPING['Manaus'] = 'America/Manaus'
|
15
|
+
MAPPING['Eirunepé'] = 'America/Eirunepe'
|
16
|
+
MAPPING['Rio Branco'] = 'America/Rio_Branco'
|
17
17
|
|
18
18
|
def self.br_zones
|
19
19
|
@br_zones ||= all.find_all do |z|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kratos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jaisonerick
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- templates/application.scss
|
72
72
|
- templates/bin_setup
|
73
73
|
- templates/brakeman.rake
|
74
|
+
- templates/bullet.rb
|
74
75
|
- templates/bundler_audit.rake
|
75
76
|
- templates/cap_environment.rb
|
76
77
|
- templates/capybara_poltergeist.rb
|
@@ -101,9 +102,12 @@ files:
|
|
101
102
|
- templates/puma.rb
|
102
103
|
- templates/rails_helper.rb
|
103
104
|
- templates/redis.rb
|
105
|
+
- templates/routes.rb
|
104
106
|
- templates/rspec_api_documentation_rspec.rb.erb
|
105
107
|
- templates/rubocop.rake
|
106
108
|
- templates/rubocop.yml
|
109
|
+
- templates/rubocop_database.yml
|
110
|
+
- templates/rubocop_rspec.yml
|
107
111
|
- templates/schedule.rb
|
108
112
|
- templates/secrets.yml
|
109
113
|
- templates/shoulda_matchers_config_rspec.rb
|