eac_rails_base0 0.37.1 → 0.40.0

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
  SHA256:
3
- metadata.gz: a2794df8b976c501bdbb92510e8eb6738ca7326a2c68f62f30284564fcf91967
4
- data.tar.gz: 53ac32e50ffb98d03d8c441360f34af9e38b8bdf6a98c17aba1c48f030b51dbc
3
+ metadata.gz: 20ae2a7f8314d4637e38f5f324f0ee9ef314ed0964477ef1ceb58b27e1d949b8
4
+ data.tar.gz: 83b42bcf46c4aaca8b397c11d24e4b0f0ace7b5d8a94d42e75185dcd60c1190e
5
5
  SHA512:
6
- metadata.gz: 562e183c5a65735bbef3c64a829dfc593503347db7d43e3b2163af9ffc4fd69400a0d2dff3a35766be8d6fa7fb8047bf5f67c90dab519073c222ae5e196eb291
7
- data.tar.gz: de7691a56d76b914fd1d967aa9f4d58d0bea5f241a9818ee3a4be67daf49785e2a87345eefbf726d9474eac3030b2989900e9a5f8a96670046287c0eec313c39
6
+ metadata.gz: 91c5c84d65469f2d73c767c06a895c50cb9f4970f7b007466251cffc9733b840fc310352f3e373de144d575c5b006f241c1dd2e0af169f3bda5b9928cee2d7d3
7
+ data.tar.gz: 53a82f8ac645124d7e60fcab6295659a9a96dce8aaddbf7523d48a440e680a925ec5dd611708a394a769210a9249d74fcfa2ec84e52bd1c697335c2b8460e0fb
@@ -5,6 +5,7 @@ module EacRailsBase0
5
5
  include ::CanCanDry::ControllerAuthorization
6
6
 
7
7
  layout 'eac_rails_base0/application'
8
+ helper ::EacRailsBase0::AppVersionHelper
8
9
  helper ::EacRailsBase0::LayoutHelper
9
10
  helper ::EacRailsUtils::FormatterHelper
10
11
  helper ::EacRailsUtils::LinksHelper
@@ -22,6 +23,7 @@ module EacRailsBase0
22
23
  redirect_to main_app.root_url
23
24
  else
24
25
  flash[:danger] = 'Por favor faça o login.'
26
+ store_location_for(::EacUsersSupport::User, request.fullpath)
25
27
  redirect_to eac_users_support.new_user_session_path
26
28
  end
27
29
  end
@@ -33,5 +35,9 @@ module EacRailsBase0
33
35
  super
34
36
  end
35
37
  end
38
+
39
+ def after_sign_in_path_for(resource)
40
+ stored_location_for(resource) || root_path
41
+ end
36
42
  end
37
43
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRailsBase0
4
+ module AppVersionHelper
5
+ def base0_app_version
6
+ base0_app_version_by_environment_variable ||
7
+ base0_app_version_by_version_file ||
8
+ ::I18n.t('eac_rails_base0.app_version.unsetted')
9
+ end
10
+
11
+ def base0_app_version_by_environment_variable
12
+ ENV['APP_VERSION'].to_s.strip.presence
13
+ end
14
+
15
+ def base0_app_version_by_version_file
16
+ ::Rails.root.children.find { |file| file.basename.to_path.downcase == 'version' }
17
+ .if_present { |file| file.read.presence }
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRailsBase0
4
+ class ApplicationRecord < ActiveRecord::Base
5
+ self.abstract_class = true
6
+ end
7
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'carrierwave'
4
+ require 'carrierwave/orm/activerecord'
4
5
  require 'fog/aws'
5
6
 
6
7
  if ENV['carrierwave_provider'] == 'AWS'
@@ -2,4 +2,4 @@
2
2
 
3
3
  # Be sure to restart your server when you modify this file.
4
4
 
5
- Rails.application.config.action_dispatch.cookies_serializer = :json
5
+ Rails.application.config.action_dispatch.cookies_serializer = :marshal
@@ -25,6 +25,8 @@ pt-BR:
25
25
  picker: '%d/%m/%Y %H:%M'
26
26
  short: '%d/%m/%y %H:%M'
27
27
  eac_rails_base0:
28
+ app_version:
29
+ unsetted: Não especificada
28
30
  main_menu:
29
31
  admin:
30
32
  aranha: Aranha
@@ -32,10 +32,11 @@ module EacRailsBase0App
32
32
  config.i18n.default_locale = :'pt-BR'
33
33
 
34
34
  # Do not swallow errors in after_commit/after_rollback callbacks.
35
- config.active_record.raise_in_transactional_callbacks = true
35
+ config.active_record.raise_in_transactional_callbacks = true if ::Rails.version < '5'
36
36
 
37
37
  # Autoload do código em /lib.
38
38
  config.autoload_paths << Rails.root.join('lib')
39
+ config.eager_load_paths << ::Rails.root.join('lib')
39
40
 
40
41
  config.after_initialize do
41
42
  ActiveRecord::Base.logger = nil
@@ -5,23 +5,21 @@ module EacRailsBase0
5
5
  module EacRailsUtilsLinksHelper
6
6
  class << self
7
7
  def included(base)
8
- base.include(InstanceMethods)
9
- base.include(::CanCanDryHelper)
10
- base.alias_method_chain :short_object_link, :base0
11
- base.alias_method_chain :object_path_by_class, :base0
8
+ base.prepend(InstanceMethods)
9
+ base.prepend(::CanCanDryHelper)
12
10
  end
13
11
  end
14
12
 
15
13
  module InstanceMethods
16
- def short_object_link_with_base0(object, action = nil, options = {})
14
+ def short_object_link(object, action = nil, options = {})
17
15
  value_or_sign(object, '') do |value|
18
16
  path = object_path(value, action)
19
17
  link_to '', url_for(path), options if can_by_path?(path, options[:method])
20
18
  end
21
19
  end
22
20
 
23
- def object_path_by_class_with_base0(*args)
24
- object_path_by_class_without_base0(*args).gsub(/_url\z/, '_path')
21
+ def object_path_by_class(*args)
22
+ super(*args).gsub(/_url\z/, '_path')
25
23
  end
26
24
  end
27
25
  end
@@ -31,4 +29,4 @@ end
31
29
  require 'eac_rails_utils/links_helper'
32
30
  patch = ::EacRailsBase0::Patches::EacRailsUtilsLinksHelper
33
31
  target = ::EacRailsUtils::LinksHelper
34
- target.send(:include, patch) unless target.included_modules.include?(patch)
32
+ target.prepend(patch) unless target.included_modules.include?(patch)
@@ -5,14 +5,13 @@ module EacRailsBase0
5
5
  module UrlForPatch
6
6
  class << self
7
7
  def included(base)
8
- base.include(InstanceMethods)
9
- base.alias_method_chain :url_for, :engines
8
+ base.prepend(InstanceMethods)
10
9
  end
11
10
  end
12
11
 
13
12
  module InstanceMethods
14
- def url_for_with_engines(options = nil)
15
- url_for_without_engines(options)
13
+ def url_for(options = nil)
14
+ super(options)
16
15
  rescue ActionController::UrlGenerationError
17
16
  engines_url_for(options)
18
17
  end
@@ -39,4 +38,4 @@ end
39
38
 
40
39
  patch = ::EacRailsBase0::Patches::UrlForPatch
41
40
  target = ::ActionDispatch::Routing::UrlFor
42
- target.send(:include, patch) unless target.included_modules.include?(patch)
41
+ target.prepend(patch) unless target.included_modules.include?(patch)
@@ -1,20 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # This file was generated by the `rails generate rspec:install` command. Conventionally, all
4
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
- # The generated `.rspec` file contains `--require spec_helper` which will cause
6
- # this file to always be loaded, without a need to explicitly require it in any
7
- # files.
8
- #
9
- # Given that it is always loaded, you are encouraged to keep this file as
10
- # light-weight as possible. Requiring heavyweight dependencies from this file
11
- # will add to the boot time of your test suite on EVERY test run, even for an
12
- # individual file that may not need all of that loaded. Instead, consider making
13
- # a separate helper file that requires the additional dependencies and performs
14
- # the additional setup, and require it from the spec files that actually need
15
- # it.
16
- #
17
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
3
  begin
19
4
  ActiveRecord::Migration.maintain_test_schema!
20
5
  rescue ActiveRecord::PendingMigrationError => e
@@ -23,114 +8,22 @@ rescue ActiveRecord::PendingMigrationError => e
23
8
  end
24
9
 
25
10
  RSpec.configure do |config|
26
- # rspec-expectations config goes here. You can use an alternate
27
- # assertion/expectation library such as wrong or the stdlib/minitest
28
- # assertions if you prefer.
29
11
  config.expect_with :rspec do |expectations|
30
- # This option will default to `true` in RSpec 4. It makes the `description`
31
- # and `failure_message` of custom matchers include text for helper methods
32
- # defined using `chain`, e.g.:
33
- # be_bigger_than(2).and_smaller_than(4).description
34
- # # => "be bigger than 2 and smaller than 4"
35
- # ...rather than:
36
- # # => "be bigger than 2"
37
12
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
38
13
  end
39
14
 
40
- # rspec-mocks config goes here. You can use an alternate test double
41
- # library (such as bogus or mocha) by changing the `mock_with` option here.
42
15
  config.mock_with :rspec do |mocks|
43
- # Prevents you from mocking or stubbing a method that does not exist on
44
- # a real object. This is generally recommended, and will default to
45
- # `true` in RSpec 4.
46
16
  mocks.verify_partial_doubles = true
47
17
  end
48
18
 
49
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
50
- # have no way to turn it off -- the option exists only for backwards
51
- # compatibility in RSpec 3). It causes shared context metadata to be
52
- # inherited by the metadata hash of host groups and examples, rather than
53
- # triggering implicit auto-inclusion in groups with matching metadata.
54
19
  config.shared_context_metadata_behavior = :apply_to_host_groups
55
-
56
- # The settings below are suggested to provide a good initial experience
57
- # with RSpec, but feel free to customize to your heart's content.
58
- # # This allows you to limit a spec run to individual examples or groups
59
- # # you care about by tagging them with `:focus` metadata. When nothing
60
- # # is tagged with `:focus`, all examples get run. RSpec also provides
61
- # # aliases for `it`, `describe`, and `context` that include `:focus`
62
- # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
63
- # config.filter_run_when_matching :focus
64
- #
65
- # # Allows RSpec to persist some state between runs in order to support
66
- # # the `--only-failures` and `--next-failure` CLI options. We recommend
67
- # # you configure your source control system to ignore this file.
68
20
  config.example_status_persistence_file_path = ::Rails.root.join('tmp', 'cache', 'rspec.txt')
69
- #
70
- # # Limits the available syntax to the non-monkey patched syntax that is
71
- # # recommended. For more details, see:
72
- # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
73
- # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
74
- # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
75
- # config.disable_monkey_patching!
76
- #
77
- # # Many RSpec users commonly either run the entire suite or an individual
78
- # # file, and it's useful to allow more verbose output when running an
79
- # # individual spec file.
80
- # if config.files_to_run.one?
81
- # # Use the documentation formatter for detailed output,
82
- # # unless a formatter has already been configured
83
- # # (e.g. via a command-line flag).
84
- # config.default_formatter = "doc"
85
- # end
86
- #
87
- # # Print the 10 slowest examples and example groups at the
88
- # # end of the spec run, to help surface which specs are running
89
- # # particularly slow.
90
- # config.profile_examples = 10
91
- #
92
- # # Run specs in random order to surface order dependencies. If you find an
93
- # # order dependency and want to debug it, you can fix the order by providing
94
- # # the seed, which is printed after each run.
95
- # # --seed 1234
96
- # config.order = :random
97
- #
98
- # # Seed global randomization in this process using the `--seed` CLI option.
99
- # # Setting this allows you to use `--seed` to deterministically reproduce
100
- # # test failures related to randomization by passing the same `--seed` value
101
- # # as the one that triggered the failure.
102
- # Kernel.srand config.seed
103
-
104
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
105
21
  config.fixture_path = "#{::Rails.root}/spec/fixtures"
106
-
107
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
108
- # examples within a transaction, remove the following line or assign false
109
- # instead of true.
110
22
  config.use_transactional_fixtures = true
111
-
112
- # RSpec Rails can automatically mix in different behaviours to your tests
113
- # based on their file location, for example enabling you to call `get` and
114
- # `post` in specs under `spec/controllers`.
115
- #
116
- # You can disable this behaviour by removing the line below, and instead
117
- # explicitly tag your specs with their type, e.g.:
118
- #
119
- # RSpec.describe UsersController, :type => :controller do
120
- # # ...
121
- # end
122
- #
123
- # The different available types are documented in the features, such as in
124
- # https://relishapp.com/rspec/rspec-rails/docs
125
23
  config.infer_spec_type_from_file_location!
126
-
127
- # Filter lines from Rails gems in backtraces.
128
24
  config.filter_rails_from_backtrace!
129
- # arbitrary gems may also be filtered via:
130
- # config.filter_gems_from_backtrace("gem name")
131
25
  end
132
26
 
133
- require 'eac_rails_base0/spec_helper/capybara'
134
- require 'eac_rails_base0/spec_helper/factory_bot'
135
- require 'eac_rails_base0/spec_helper/eac_users_support'
27
+ require 'eac_ruby_utils/require_sub'
28
+ ::EacRubyUtils.require_sub __FILE__
136
29
  require 'aranha/parsers/spec/source_target_fixtures_example'
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'devise'
4
+ require_relative 'factory_bot'
4
5
 
5
6
  RSpec.configure do |config|
6
7
  config.include Warden::Test::Helpers
@@ -23,9 +24,11 @@ RSpec.shared_context 'when user is admin', shared_context: :metadata do
23
24
 
24
25
  before do
25
26
  visit '/users/sign_in'
26
- fill_in 'E-mail', with: user.email
27
- fill_in 'Password', with: user.password
28
- click_on 'Log in'
27
+ fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
28
+ with: user.email
29
+ fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
30
+ with: user.password
31
+ click_button ::I18n.translate!('devise.log_in')
29
32
  end
30
33
 
31
34
  it 'user should be logged' do
@@ -37,9 +40,9 @@ end
37
40
  RSpec.shared_context 'when user is anonymous', shared_context: :metadata do
38
41
  before do
39
42
  visit '/'
40
- if link_exist?('Sair')
41
- click_link('Sair')
42
- elsif !link_exist?('Entrar')
43
+ if link_exist?(::I18n.translate!('devise.log_out'))
44
+ click_link(::I18n.translate!('devise.log_out'))
45
+ elsif !link_exist?(::I18n.translate!('devise.log_in'))
43
46
  raise 'login nor logout link found'
44
47
  end
45
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsBase0
4
- VERSION = '0.37.1'
4
+ VERSION = '0.40.0'
5
5
  end
@@ -1 +1 @@
1
- --require lib/spec_rails_helper --color --format doc --default-path . --pattern '**/spec/**/*_spec.rb'
1
+ --require lib/spec_rails_helper --color --format doc --default-path . --pattern 'spec/**/*_spec.rb'
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rails_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.37.1
4
+ version: 0.40.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-07-06 00:00:00.000000000 Z
11
+ date: 2020-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: active_scaffold
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.5'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.5.5
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.5'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.5.5
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: aranha
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -130,16 +150,16 @@ dependencies:
130
150
  name: coffee-rails
131
151
  requirement: !ruby/object:Gem::Requirement
132
152
  requirements:
133
- - - "~>"
153
+ - - ">="
134
154
  - !ruby/object:Gem::Version
135
- version: 4.1.0
155
+ version: 4.2.2
136
156
  type: :runtime
137
157
  prerelease: false
138
158
  version_requirements: !ruby/object:Gem::Requirement
139
159
  requirements:
140
- - - "~>"
160
+ - - ">="
141
161
  - !ruby/object:Gem::Version
142
- version: 4.1.0
162
+ version: 4.2.2
143
163
  - !ruby/object:Gem::Dependency
144
164
  name: eac_rails_utils
145
165
  requirement: !ruby/object:Gem::Requirement
@@ -180,14 +200,20 @@ dependencies:
180
200
  requirements:
181
201
  - - "~>"
182
202
  - !ruby/object:Gem::Version
183
- version: '0.4'
203
+ version: '0.6'
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: 0.6.3
184
207
  type: :runtime
185
208
  prerelease: false
186
209
  version_requirements: !ruby/object:Gem::Requirement
187
210
  requirements:
188
211
  - - "~>"
189
212
  - !ruby/object:Gem::Version
190
- version: '0.4'
213
+ version: '0.6'
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ version: 0.6.3
191
217
  - !ruby/object:Gem::Dependency
192
218
  name: eac_ruby_utils
193
219
  requirement: !ruby/object:Gem::Requirement
@@ -208,20 +234,20 @@ dependencies:
208
234
  requirements:
209
235
  - - "~>"
210
236
  - !ruby/object:Gem::Version
211
- version: '0.6'
237
+ version: '0.8'
212
238
  - - ">="
213
239
  - !ruby/object:Gem::Version
214
- version: 0.6.1
240
+ version: 0.8.2
215
241
  type: :runtime
216
242
  prerelease: false
217
243
  version_requirements: !ruby/object:Gem::Requirement
218
244
  requirements:
219
245
  - - "~>"
220
246
  - !ruby/object:Gem::Version
221
- version: '0.6'
247
+ version: '0.8'
222
248
  - - ">="
223
249
  - !ruby/object:Gem::Version
224
- version: 0.6.1
250
+ version: 0.8.2
225
251
  - !ruby/object:Gem::Dependency
226
252
  name: factory_bot_rails
227
253
  requirement: !ruby/object:Gem::Requirement
@@ -330,22 +356,16 @@ dependencies:
330
356
  name: rails
331
357
  requirement: !ruby/object:Gem::Requirement
332
358
  requirements:
333
- - - "~>"
334
- - !ruby/object:Gem::Version
335
- version: 4.2.11
336
359
  - - ">="
337
360
  - !ruby/object:Gem::Version
338
- version: 4.2.11.1
361
+ version: 4.2.11.3
339
362
  type: :runtime
340
363
  prerelease: false
341
364
  version_requirements: !ruby/object:Gem::Requirement
342
365
  requirements:
343
- - - "~>"
344
- - !ruby/object:Gem::Version
345
- version: 4.2.11
346
366
  - - ">="
347
367
  - !ruby/object:Gem::Version
348
- version: 4.2.11.1
368
+ version: 4.2.11.3
349
369
  - !ruby/object:Gem::Dependency
350
370
  name: rails-i18n
351
371
  requirement: !ruby/object:Gem::Requirement
@@ -360,6 +380,20 @@ dependencies:
360
380
  - - "~>"
361
381
  - !ruby/object:Gem::Version
362
382
  version: '4.0'
383
+ - !ruby/object:Gem::Dependency
384
+ name: recordselect
385
+ requirement: !ruby/object:Gem::Requirement
386
+ requirements:
387
+ - - ">="
388
+ - !ruby/object:Gem::Version
389
+ version: 3.10.1
390
+ type: :runtime
391
+ prerelease: false
392
+ version_requirements: !ruby/object:Gem::Requirement
393
+ requirements:
394
+ - - ">="
395
+ - !ruby/object:Gem::Version
396
+ version: 3.10.1
363
397
  - !ruby/object:Gem::Dependency
364
398
  name: rspec-rails
365
399
  requirement: !ruby/object:Gem::Requirement
@@ -515,8 +549,10 @@ files:
515
549
  - app/assets/stylesheets/eac_rails_base0/components.scss
516
550
  - app/assets/stylesheets/eac_rails_base0/default_configuration.scss
517
551
  - app/controllers/eac_rails_base0/application_controller.rb
552
+ - app/helpers/eac_rails_base0/app_version_helper.rb
518
553
  - app/helpers/eac_rails_base0/layout_helper.rb
519
554
  - app/helpers/eac_rails_base0/panel_default_helper.rb
555
+ - app/models/eac_rails_base0/application_record.rb
520
556
  - app/uploaders/eac_rails_base0/default_file_uploader.rb
521
557
  - app/views/devise/confirmations/new.html.erb
522
558
  - app/views/devise/mailer/confirmation_instructions.html.erb
@@ -620,8 +656,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
620
656
  - !ruby/object:Gem::Version
621
657
  version: '0'
622
658
  requirements: []
623
- rubyforge_project:
624
- rubygems_version: 2.7.7
659
+ rubygems_version: 3.0.8
625
660
  signing_key:
626
661
  specification_version: 4
627
662
  summary: A Rails base for multiple Rails projects developed by Esquilo Azul Company.