eac_rails_base0 0.40.1 → 0.45.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '018a06adeb50f69f9d1525dccd55e8b1b0b99cd1943f10993539810f53796a1e'
4
- data.tar.gz: a8150cdf912c7fcad0008918e94b03229936285dc41e88c2742dd0396d87eaaf
3
+ metadata.gz: 3f90194b3c80150c0eebef0f4134e4cd4b1d6f8afe996e55cbfe3cd5e3d8a066
4
+ data.tar.gz: fa94abd6b59cd4c419d06fbb3f8432a48db2881f376b22f4f23a8984eaaccfef
5
5
  SHA512:
6
- metadata.gz: b2435c3fda8f3c12c047edb1d306897dfafbc747c10ff839ba4ded32be5cb17f46d2cfa9eb95d5668f71223457f2c3926e93f3cf1076b2a0586c8be3e840b94a
7
- data.tar.gz: dc95eb86db4772d20f1fa93bf5caffd75aff5965435169ee872c35067ceb1229211f21f1a0c86c102c9f275fd8b63350ad863d7dfa67ddf6a053615fcb1da65e
6
+ metadata.gz: 629f5c4ee3d0ff31a658bc28d638c22828246aaf8d69bc34ca9c0770d6f97ec2ab4a2739e313db8b6cf50c4ccb4a04fbf7de27a473bd0a9c60aab94e304bf893
7
+ data.tar.gz: 82877e3a1bdfb9ae6b843e91faaaeb900c7c11115d62c345987d67f0fee36e3c946fe216a2986dc236e2ba27f1b173cbf16375f7708e1ec54674699143d2fbf0
@@ -0,0 +1,4 @@
1
+ <% if current_user&.administrator %>
2
+ <div class="text-center"><b>Versão:</b> <%= base0_app_version %></div>
3
+ <div class="text-center"><b>RailsEnv:</b> <%= ::Rails.env %></div>
4
+ <% end %>
@@ -33,5 +33,6 @@
33
33
  <%= render partial: '/layouts/eac_rails_base0/flash' %>
34
34
  <%= yield %>
35
35
  </div>
36
+ <%= render partial: '/layouts/eac_rails_base0/version' %>
36
37
  </body>
37
38
  </html>
@@ -1,57 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_utils/core_ext'
3
4
  require 'rails/all'
4
5
 
5
6
  # Require the gems listed in Gemfile, including any gems
6
7
  # you've limited to :test, :development, or :production.
7
8
  Bundler.require(*Rails.groups)
8
9
 
9
- def rails_root(dir)
10
- return dir if ::File.exist?(::File.join(dir, 'config.ru'))
11
- raise 'config.ru not found in ascendent path' if dir == '/'
12
-
13
- rails_root(::File.dirname(dir))
14
- end
15
-
16
- local_configuration = ::File.join(rails_root(APP_PATH), 'config', 'local_configuration.rb')
17
- require local_configuration if File.exist?(local_configuration)
18
-
19
10
  module EacRailsBase0App
20
11
  class Application < Rails::Application
21
- # Settings in config/environments/* take precedence over those specified here.
22
- # Application configuration should go into files in config/initializers
23
- # -- all .rb files in that directory are automatically loaded.
24
-
25
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
- # config.time_zone = 'Central Time (US & Canada)'
28
-
29
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
- # config.i18n.default_locale = :de
32
- config.i18n.default_locale = :'pt-BR'
33
-
34
- # Do not swallow errors in after_commit/after_rollback callbacks.
35
- config.active_record.raise_in_transactional_callbacks = true if ::Rails.version < '5'
36
-
37
- # Autoload do código em /lib.
38
- config.autoload_paths << Rails.root.join('lib')
39
-
40
- config.after_initialize do
41
- ActiveRecord::Base.logger = nil
42
- end
43
-
44
- app_tmpdir = ::File.join(::Dir.tmpdir, ::Rails.root.to_path.parameterize, 'tmp')
45
-
46
- config.assets.configure do |env|
47
- env.cache = Sprockets::Cache::FileStore.new(
48
- ::File.join(app_tmpdir, 'cache', 'assets'),
49
- config.assets.cache_limit,
50
- env.logger
51
- )
12
+ class << self
13
+ def setup(*args)
14
+ args.each { |a| send("setup_#{a}") }
15
+ end
52
16
  end
53
17
 
54
- migrate_deprecated_dir = ::Rails.root.join('db', 'migrate_deprecated')
55
- config.paths['db/migrate'] << migrate_deprecated_dir if migrate_deprecated_dir.directory?
18
+ require_sub __FILE__, include_modules: true
56
19
  end
57
20
  end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRailsBase0App
6
+ class Application < Rails::Application
7
+ module All
8
+ common_concern do
9
+ setup('local_configuration', 'assets_cache', 'dependencies', 'localization', 'load_paths',
10
+ 'loggers')
11
+ end
12
+
13
+ module ClassMethods
14
+ def app_temporary_directory
15
+ ::File.join(::Dir.tmpdir, ::Rails.root.to_path.parameterize, 'tmp')
16
+ end
17
+
18
+ def rails_root(dir)
19
+ return dir if ::File.exist?(::File.join(dir, 'config.ru'))
20
+ raise 'config.ru not found in ascendent path' if dir == '/'
21
+
22
+ rails_root(::File.dirname(dir))
23
+ end
24
+
25
+ def setup_assets_cache
26
+ config.assets.configure do |env|
27
+ env.cache = Sprockets::Cache::FileStore.new(
28
+ ::File.join(app_temporary_directory, 'cache', 'assets'),
29
+ config.assets.cache_limit,
30
+ env.logger
31
+ )
32
+ end
33
+ end
34
+
35
+ def setup_dependencies
36
+ require 'carrierwave'
37
+ end
38
+
39
+ def setup_deprecated_migrations
40
+ path = ::Rails.root.join('db', 'migrate_deprecated')
41
+ config.paths['db/migrate'] << path if path.directory?
42
+ end
43
+
44
+ def setup_load_paths
45
+ config.autoload_paths << Rails.root.join('lib')
46
+ end
47
+
48
+ def setup_local_configuration
49
+ local_configuration = ::File.join(rails_root(APP_PATH), 'config',
50
+ 'local_configuration.rb')
51
+ require local_configuration if File.exist?(local_configuration)
52
+ end
53
+
54
+ def setup_localization
55
+ config.i18n.default_locale = :'pt-BR'
56
+ end
57
+
58
+ def setup_loggers
59
+ config.after_initialize do
60
+ ActiveRecord::Base.logger = nil
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRailsBase0App
6
+ class Application < Rails::Application
7
+ module Development
8
+ common_concern do
9
+ next unless ::Rails.env.development?
10
+
11
+ setup('assets', 'cache', 'general', 'letter_opener', 'log')
12
+ end
13
+
14
+ module ClassMethods
15
+ def setup_assets
16
+ config.assets.debug = true
17
+ config.assets.quiet = true
18
+ end
19
+
20
+ def setup_cache
21
+ if Rails.root.join('tmp/caching-dev.txt').exist?
22
+ config.action_controller.perform_caching = true
23
+ config.cache_store = :memory_store
24
+ config.public_file_server.headers = {
25
+ 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
26
+ }
27
+ else
28
+ config.action_controller.perform_caching = false
29
+ config.cache_store = :null_store
30
+ end
31
+ end
32
+
33
+ def setup_general
34
+ config.cache_classes = false
35
+ config.eager_load = false
36
+ config.consider_all_requests_local = true
37
+ config.action_mailer.raise_delivery_errors = false
38
+ config.action_mailer.perform_caching = false
39
+ config.active_record.migration_error = :page_load
40
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
41
+ end
42
+
43
+ def setup_letter_opener
44
+ require 'letter_opener'
45
+ config.action_mailer.delivery_method = :letter_opener
46
+ config.action_mailer.perform_deliveries = true
47
+ end
48
+
49
+ def setup_log
50
+ config.active_support.deprecation = :log
51
+ config.logger = Logger.new(STDOUT)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRailsBase0App
6
+ class Application < Rails::Application
7
+ module Production
8
+ common_concern do
9
+ next unless ::Rails.env.production?
10
+
11
+ setup('assets', 'general', 'log', 'public_file_server')
12
+ end
13
+
14
+ module ClassMethods
15
+ def setup_assets
16
+ config.assets.js_compressor = :uglifier
17
+ config.assets.compile = false
18
+ end
19
+
20
+ def setup_general
21
+ config.active_record.dump_schema_after_migration = false
22
+ config.cache_classes = true
23
+ config.eager_load = false
24
+ config.consider_all_requests_local = false
25
+ config.action_controller.perform_caching = true
26
+ config.read_encrypted_secrets = true
27
+ config.action_mailer.perform_caching = false
28
+ config.i18n.fallbacks = true
29
+ end
30
+
31
+ def setup_log
32
+ config.log_level = :debug
33
+ config.log_tags = [:request_id]
34
+ config.active_support.deprecation = :notify
35
+ config.log_formatter = ::Logger::Formatter.new
36
+ return if ENV['RAILS_LOG_TO_STDOUT'].blank?
37
+
38
+ logger = ActiveSupport::Logger.new(STDOUT)
39
+ logger.formatter = config.log_formatter
40
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
41
+ end
42
+
43
+ def setup_public_file_server
44
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRailsBase0App
6
+ class Application < Rails::Application
7
+ module Test
8
+ common_concern do
9
+ next unless ::Rails.env.test?
10
+
11
+ setup('action_controller', 'general', 'log', 'public_file_server')
12
+ end
13
+
14
+ module ClassMethods
15
+ def setup_action_controller
16
+ config.action_controller.perform_caching = false
17
+ config.action_controller.allow_forgery_protection = false
18
+ end
19
+
20
+ def setup_general
21
+ config.cache_classes = true
22
+ config.eager_load = false
23
+
24
+ config.consider_all_requests_local = true
25
+ config.action_controller.perform_caching = false
26
+ config.action_dispatch.show_exceptions = false
27
+ config.action_mailer.delivery_method = :test
28
+ end
29
+
30
+ def setup_log
31
+ config.active_support.deprecation = :stderr
32
+ end
33
+
34
+ def setup_public_file_server
35
+ config.public_file_server.enabled = true
36
+ config.public_file_server.headers = {
37
+ 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -26,7 +26,7 @@ module EacRailsBase0
26
26
  end
27
27
 
28
28
  def db
29
- # Do nothing
29
+ directory 'db'
30
30
  end
31
31
 
32
32
  def lib
@@ -0,0 +1,23 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ <% if sqlite3? -%>
11
+ # Ignore the default SQLite database.
12
+ /db/*.sqlite3
13
+ /db/*.sqlite3-journal
14
+
15
+ <% end -%>
16
+ # Ignore all logfiles and tempfiles.
17
+ /log/*
18
+ !/log/.keep
19
+ /tmp
20
+
21
+ # Configuration files
22
+ config/database.y*ml
23
+ config/local_configuration.rb
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsBase0
4
- VERSION = '0.40.1'
4
+ VERSION = '0.45.0'
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'rake/testtask'
3
4
  require 'rspec/core/rake_task'
4
5
 
5
6
  namespace :eac_rails_base0 do
@@ -12,16 +13,22 @@ namespace :eac_rails_base0 do
12
13
  end
13
14
  Rake::Task['eac_rails_base0:rspec'].enhance ['db:test:prepare']
14
15
 
15
- desc 'Minitest for engines'
16
- Rails::TestTask.new('minitest:engines' => 'test:prepare') do |t|
17
- t.pattern = 'engines/*/test/**/*_test.rb'
16
+ namespace :minitest do
17
+ { core: '', engines: 'engines/*/' }.each do |name, pattern_prefix|
18
+ ::Rake::TestTask.new(name => 'test:prepare') do |t|
19
+ t.libs << 'test'
20
+ t.pattern = "#{pattern_prefix}test/**/*_test.rb"
21
+ t.ruby_opts = %w[-W0]
22
+ t.verbose = false
23
+ end
24
+ end
18
25
  end
19
26
 
20
- desc 'Minitest for application'
21
- task minitest: %w[test:run eac_rails_base0:minitest:engines]
27
+ desc 'Minitest for application and engines'
28
+ task minitest: %w[core engines].map { |task| "eac_rails_base0:minitest:#{task}" }
22
29
 
23
30
  desc 'Minitest and RSpec for application'
24
- task test: ['test', 'eac_rails_base0:rspec']
31
+ task test: ['eac_rails_base0:minitest', 'eac_rails_base0:rspec']
25
32
  end
26
33
 
27
34
  Rake::Task['default'].clear
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rails_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.1
4
+ version: 0.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-13 00:00:00.000000000 Z
11
+ date: 2020-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_scaffold
@@ -339,7 +339,7 @@ dependencies:
339
339
  - !ruby/object:Gem::Version
340
340
  version: '0'
341
341
  - !ruby/object:Gem::Dependency
342
- name: puma
342
+ name: letter_opener
343
343
  requirement: !ruby/object:Gem::Requirement
344
344
  requirements:
345
345
  - - ">="
@@ -353,19 +353,47 @@ dependencies:
353
353
  - !ruby/object:Gem::Version
354
354
  version: '0'
355
355
  - !ruby/object:Gem::Dependency
356
- name: rails
356
+ name: listen
357
+ requirement: !ruby/object:Gem::Requirement
358
+ requirements:
359
+ - - ">="
360
+ - !ruby/object:Gem::Version
361
+ version: '0'
362
+ type: :runtime
363
+ prerelease: false
364
+ version_requirements: !ruby/object:Gem::Requirement
365
+ requirements:
366
+ - - ">="
367
+ - !ruby/object:Gem::Version
368
+ version: '0'
369
+ - !ruby/object:Gem::Dependency
370
+ name: puma
357
371
  requirement: !ruby/object:Gem::Requirement
358
372
  requirements:
359
373
  - - ">="
360
374
  - !ruby/object:Gem::Version
361
- version: 4.2.11.3
375
+ version: '0'
362
376
  type: :runtime
363
377
  prerelease: false
364
378
  version_requirements: !ruby/object:Gem::Requirement
365
379
  requirements:
366
380
  - - ">="
367
381
  - !ruby/object:Gem::Version
368
- version: 4.2.11.3
382
+ version: '0'
383
+ - !ruby/object:Gem::Dependency
384
+ name: rails
385
+ requirement: !ruby/object:Gem::Requirement
386
+ requirements:
387
+ - - "~>"
388
+ - !ruby/object:Gem::Version
389
+ version: 5.1.7
390
+ type: :runtime
391
+ prerelease: false
392
+ version_requirements: !ruby/object:Gem::Requirement
393
+ requirements:
394
+ - - "~>"
395
+ - !ruby/object:Gem::Version
396
+ version: 5.1.7
369
397
  - !ruby/object:Gem::Dependency
370
398
  name: rails-i18n
371
399
  requirement: !ruby/object:Gem::Requirement
@@ -568,6 +596,7 @@ files:
568
596
  - app/views/layouts/eac_rails_base0/_navbar_user.html.erb
569
597
  - app/views/layouts/eac_rails_base0/_open_graph_protocol.html.erb
570
598
  - app/views/layouts/eac_rails_base0/_tasks_scheduler_alert.html.erb
599
+ - app/views/layouts/eac_rails_base0/_version.erb
571
600
  - app/views/layouts/eac_rails_base0/application.html.erb
572
601
  - config/initializers/action_mailer.rb
573
602
  - config/initializers/active_scaffold.rb
@@ -578,7 +607,6 @@ files:
578
607
  - config/initializers/filter_parameter_logging.rb
579
608
  - config/initializers/mime_types.rb
580
609
  - config/initializers/patches.rb
581
- - config/initializers/pg_deprecated_constants.rb
582
610
  - config/initializers/session_store.rb
583
611
  - config/initializers/wrap_parameters.rb
584
612
  - config/locales/pt-BR.yml
@@ -588,6 +616,10 @@ files:
588
616
  - lib/eac_rails_base0/app_base/ability.rb
589
617
  - lib/eac_rails_base0/app_base/ability_mapping.rb
590
618
  - lib/eac_rails_base0/app_base/application.rb
619
+ - lib/eac_rails_base0/app_base/application/all.rb
620
+ - lib/eac_rails_base0/app_base/application/development.rb
621
+ - lib/eac_rails_base0/app_base/application/production.rb
622
+ - lib/eac_rails_base0/app_base/application/test.rb
591
623
  - lib/eac_rails_base0/app_generator/builder.rb
592
624
  - lib/eac_rails_base0/app_generator/generator.rb
593
625
  - lib/eac_rails_base0/app_generator/templates/Gemfile
@@ -610,6 +642,7 @@ files:
610
642
  - lib/eac_rails_base0/app_generator/templates/config/environments/production.rb
611
643
  - lib/eac_rails_base0/app_generator/templates/config/environments/test.rb
612
644
  - lib/eac_rails_base0/app_generator/templates/config/routes.rb
645
+ - lib/eac_rails_base0/app_generator/templates/gitignore
613
646
  - lib/eac_rails_base0/app_generator/templates/lib/local_plugins.rb
614
647
  - lib/eac_rails_base0/boolean_value.rb
615
648
  - lib/eac_rails_base0/engine.rb
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # File: lib/pg/deprecated_constants.rb
4
- #
5
- # This file overrides the pg gem's pg/deprecated_constants.rb file and so
6
- # its warning message is not printed. Avoiding this warning message helps
7
- # clean up the app startup and test output.
8
- #
9
- # This behaviour relies on lib/ being ahead of the pg gem in $LOAD_PATH and
10
- # these lines from the pg gem's lib/pg.rb file:
11
- # autoload :PGError, 'pg/deprecated_constants'
12
- # autoload :PGconn, 'pg/deprecated_constants'
13
- # autoload :PGresult, 'pg/deprecated_constants'
14
- #
15
- # Your config/application.rb may need to modify autoload_paths to ensure
16
- # the lib/ dir is ahead of the pg gem install path in $LOAD_PATH:
17
- #
18
- # config.autoload_paths << Rails.root.join('lib')
19
- #
20
- if (PG::VERSION != '0.21.0') || (ActiveRecord.version.to_s != '4.2.11.3')
21
- ::Rails.logger.warn(<<~MSG)
22
- -----------------------------------------------------------------------------------
23
- The pg and/or activerecord gem version has changed, meaning deprecated pg constants
24
- may no longer be in use, so try deleting this file to see if the
25
- 'The PGconn, PGresult, and PGError constants are deprecated...' message has gone:
26
- #{__FILE__}
27
- -----------------------------------------------------------------------------------
28
-
29
- MSG
30
- end
31
-
32
- # Declare the deprecated constants as is done in the original
33
- # pg/deprecated_constants.rb so they can still be used by older
34
- # versions of gems such as activerecord.
35
- PGconn = PG::Connection
36
- PGresult = PG::Result
37
- PGError = PG::Error