kratos 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0de6c6b17b97898bf72dbafab8dab0e7604a950
4
- data.tar.gz: 5698bc8c4f76dcfba3913038c38037db1defb36f
3
+ metadata.gz: 61045f764eef6fc5ffdcfc250d496b31695a5437
4
+ data.tar.gz: b32ec368b9ea11ad6e59f595d987d834ed5c460a
5
5
  SHA512:
6
- metadata.gz: a81a53e3c13f990be93ead020b0e73a492a7b2508d61336c3c38c377b295ca74c432ee85a6bd0cc045ae318955b851b201264cca31cbb97c62ff8046111fe024
7
- data.tar.gz: 5a8b9588f704b45e6c56e46ec979ef594de3f735ce6e00944d257a6eba867dc2b54a6bb7805f79724283d5cc4bdf10f4bd1531c2f10ed9a831391f926d5c0618
6
+ metadata.gz: a32eb2325a7f1f870030355a70810e0b046a556fa8b7b266d162b401cc722ef1be6b041e31ef4521259487d33328c66c61f7abe66977a4db2f3a2c7e05c22a7c
7
+ data.tar.gz: 8769fc3162ba927a705b862ddda36a6260cdb2c26b8c955b644fff8daf970a86ef8c6c8792a1b6a416671961016ed0f213e31e160ae29edfa83bed37b6ab95ef
@@ -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
- inject_into_file(
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
 
@@ -37,25 +37,12 @@ class AppBuilder < Rails::AppBuilder
37
37
  end
38
38
 
39
39
  def add_bullet_gem_configuration
40
- config = <<-RUBY
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
- config.action_controller.action_on_unpermitted_parameters = :raise
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
- config.generators do |generate|
77
- generate.helper false
78
- generate.javascript_engine false
79
- generate.request_specs false
80
- generate.routing_specs false
81
- generate.stylesheets false
82
- generate.test_framework :rspec
83
- generate.view_specs false
84
- end
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
- config.quiet_assets = true
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 = <<-RUBY
217
+ config = <<~RUBY
231
218
 
232
- Rails.application.configure do
233
- # ...
234
- end
235
- RUBY
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
- def configure_routes
282
- replace_in_file 'config/routes.rb',
283
- /Rails\.application\.routes\.draw do.*end/m,
284
- <<-EOS
285
- Rails.application.routes.draw do
286
- require 'sidekiq/web'
287
- mount Sidekiq::Web => '/sidekiq'
288
- end
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
- config.time_zone = 'Brasilia'
321
- config.i18n.default_locale = :'pt-BR'
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
- config.i18n.enforce_available_locales = false
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
- t.verbose = false
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
@@ -2,5 +2,5 @@
2
2
  module Kratos
3
3
  RAILS_VERSION = '~> 4.2.0'.freeze
4
4
  RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
5
- VERSION = '1.0.2'.freeze
5
+ VERSION = '1.0.3'.freeze
6
6
  end
@@ -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 'rubocop', require: false
50
- gem 'brakeman', require: false
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"
@@ -14,5 +14,5 @@ module AcceptanceHelpers
14
14
  end
15
15
 
16
16
  RSpec.configure do |config|
17
- config.include Acceptance::JsonHelpers, type: :acceptance
17
+ config.include AcceptanceHelpers, type: :acceptance
18
18
  end
@@ -0,0 +1,7 @@
1
+ Rails.application.configure do
2
+ if Rails.env.development?
3
+ Bullet.enable = true
4
+ Bullet.bullet_logger = true
5
+ Bullet.rails_logger = true
6
+ end
7
+ end
@@ -1,2 +1,3 @@
1
1
  WEB_CONCURRENCY=1
2
2
  MAX_THREADS=3
3
+ PORT=3000
@@ -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>
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -1,40 +1,25 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Include:
4
+ - Rakefile
5
+ - config.ru
2
6
  Exclude:
3
- - "Gemfile"
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
- Metrics/MethodLength:
15
- Enabled: false
9
+ Rails:
10
+ Enabled: true
16
11
 
17
- Metrics/ClassLength:
18
- Enabled: false
12
+ MethodLength:
13
+ Max: 20
19
14
 
20
- Metrics/AbcSize:
21
- Enabled: false
15
+ LineLength:
16
+ Max: 120
22
17
 
23
- Metrics/CyclomaticComplexity:
24
- Max: 10
18
+ HasAndBelongsToMany:
19
+ Enabled: false
25
20
 
26
- Metrics/PerceivedComplexity:
27
- Max: 10
21
+ Documentation:
22
+ Enabled: false
28
23
 
29
- Style/PredicateName:
30
- Description: Check the names of predicate methods.
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
@@ -0,0 +1,11 @@
1
+ inherit_from:
2
+ - ../../.rubocop.yml
3
+
4
+ MethodLength:
5
+ Max: 200
6
+
7
+ LineLength:
8
+ Max: 180
9
+
10
+ SingleSpaceBeforeFirstArg:
11
+ Enable: false
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - ../.rubocop.yml
@@ -1,4 +1,5 @@
1
1
  default: &default
2
+ secret_token: <%%= ENV["SECRET_TOKEN"] %>
2
3
  secret_key_base: <%%= ENV["SECRET_KEY_BASE"] %>
3
4
 
4
5
  development:
@@ -1,19 +1,19 @@
1
1
  module ActiveSupport
2
2
  class TimeZone
3
- MAPPING.merge!('Noronha' => 'America/Noronha',
4
- 'Belém' => 'America/Belem',
5
- 'Fortaleza' => 'America/Fortaleza',
6
- 'Recife' => 'America/Recife',
7
- 'Araguaina' => 'America/Araguaina',
8
- 'Maceió' => 'America/Maceio',
9
- 'Campo Grande' => 'America/Campo_Grande',
10
- 'Cuiabá' => 'America/Cuiaba',
11
- 'Santarém' => 'America/Santarem',
12
- 'Porto Velho' => 'America/Porto_Velho',
13
- 'Boa Vista' => 'America/Boa_Vista',
14
- 'Manaus' => 'America/Manaus',
15
- 'Eirunepé' => 'America/Eirunepe',
16
- 'Rio Branco' => 'America/Rio_Branco')
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.2
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