eac_rails_base0 0.53.0 → 0.55.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/eac_rails_base0.js +1 -0
- data/app/assets/stylesheets/eac_rails_base0.scss +1 -0
- data/app/controllers/eac_rails_base0/application_controller.rb +1 -0
- data/app/helpers/eac_rails_base0/main_menu_helper.rb +2 -0
- data/app/helpers/eac_rails_base0/user_menu_helper.rb +2 -2
- data/config/initializers/devise.rb +14 -0
- data/config/locales/en.yml +4 -0
- data/lib/eac_rails_base0/app_base/ability.rb +2 -0
- data/lib/eac_rails_base0/app_base/ability_mapping.rb +7 -2
- data/lib/eac_rails_base0/app_base/application/all.rb +9 -5
- data/lib/eac_rails_base0/engine.rb +1 -0
- data/lib/eac_rails_base0/rspec/setup.rb +10 -64
- data/lib/eac_rails_base0/rspec/shared_contexts/when_user_is_admin.rb +22 -0
- data/lib/eac_rails_base0/rspec/shared_contexts/when_user_is_anonymous.rb +23 -0
- data/lib/eac_rails_base0/rspec/shared_contexts/when_user_is_non_admin.rb +22 -0
- data/lib/eac_rails_base0/version.rb +1 -1
- metadata +40 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 025d0d3fba613f0a893722bbacba3045eac5963db25c04b9444cfe9a98b53609
|
4
|
+
data.tar.gz: 46f4048b0867dcc00ea04a150c7b373a4d7fd2486a9b81062622c081c0cc6c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 594ff2ef0508e05afc16938f100e6922592f33dd054298a83a30cefbe4d3164f31b9250801eb67eae3e6e2c996c655fb5096b447dd6f6b1aeb11cc631edc5764
|
7
|
+
data.tar.gz: 7ffc764febce192a0e2060bcc5d5040d9bb12ed1e8053eaf1f55b628527373d48610ceb157cb58626c3ded734073d4b8ad3e3084af3616b025963d357507c7d5
|
@@ -11,6 +11,7 @@ module EacRailsBase0
|
|
11
11
|
helper ::EacRailsUtils::FormatterHelper
|
12
12
|
helper ::EacRailsUtils::LinksHelper
|
13
13
|
helper ::EacRailsUtils::OpenGraphProtocolHelper
|
14
|
+
helper ::EacRailsBase0::PanelDefaultHelper
|
14
15
|
helper ::EacRailsBase0::UserMenuHelper
|
15
16
|
|
16
17
|
# Prevent CSRF attacks by raising an exception.
|
@@ -50,6 +50,8 @@ module EacRailsBase0
|
|
50
50
|
def aranha_main_menu_admin_entries
|
51
51
|
{
|
52
52
|
::Aranha::Address.model_name.human(count: 2) => [aranha.addresses_path],
|
53
|
+
::Aranha::ProcessorConfiguration.model_name.human(count: 2) =>
|
54
|
+
[aranha.processor_configurations_path],
|
53
55
|
::Aranha::StartPoint.model_name.human(count: 2) => [aranha.start_points_path]
|
54
56
|
}
|
55
57
|
end
|
@@ -8,9 +8,9 @@ module EacRailsBase0
|
|
8
8
|
r[current_user.to_s] = {
|
9
9
|
'Alterar senha' => [eac_users_support.edit_user_registration_path]
|
10
10
|
}
|
11
|
-
r['
|
11
|
+
r[t('devise.log_out')] = [eac_users_support.destroy_user_session_path, link_method: :delete]
|
12
12
|
else
|
13
|
-
r['
|
13
|
+
r[t('devise.log_in')] = [eac_users_support.new_user_session_path]
|
14
14
|
end
|
15
15
|
r
|
16
16
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'devise'
|
4
|
+
|
5
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
6
|
+
# Many of these configuration options can be set straight in your model.
|
7
|
+
Devise.setup do |config|
|
8
|
+
#
|
9
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
10
|
+
# so you need to do it manually. For the users scope, it would be:
|
11
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
12
|
+
|
13
|
+
# config.parent_controller = 'EacRailsBase0::ApplicationController'
|
14
|
+
end
|
data/config/locales/en.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_active_scaffold'
|
3
4
|
require 'active_scaffold/bridges/cancan/cancan_bridge'
|
4
5
|
|
5
6
|
module EacRailsBase0
|
@@ -58,6 +59,7 @@ module EacRailsBase0
|
|
58
59
|
|
59
60
|
can :manage, ::EacUsersSupport::User
|
60
61
|
can :manage, ::Aranha::Address
|
62
|
+
can :manage, ::Aranha::ProcessorConfiguration
|
61
63
|
can :manage, ::Aranha::StartPoint
|
62
64
|
can :manage, ::BrRailties::FederalUnit
|
63
65
|
can :manage, ::BrRailties::Municipality
|
@@ -12,8 +12,7 @@ module EacRailsBase0
|
|
12
12
|
map_devise
|
13
13
|
map_devise_invitable
|
14
14
|
map_controller 'EacUsersSupport::Admin::Users', :manage, ::EacUsersSupport::User
|
15
|
-
|
16
|
-
map_controller 'Aranha::StartPoints', :manage, ::Aranha::StartPoint
|
15
|
+
map_aranha
|
17
16
|
map_controller 'BrRailties::FederalUnits', :manage, ::BrRailties::FederalUnit
|
18
17
|
map_controller 'BrRailties::Municipalities', :manage, ::BrRailties::Municipality
|
19
18
|
map_controller 'ScheduledTasks', :manage, ::ScheduledTask
|
@@ -24,6 +23,12 @@ module EacRailsBase0
|
|
24
23
|
def map_eac_rails_base0
|
25
24
|
map_controller 'EacRailsBase0::Mailer', :manage, :eac_rails_base0_mailer
|
26
25
|
end
|
26
|
+
|
27
|
+
def map_aranha
|
28
|
+
map_controller 'Aranha::Addresses', :manage, ::Aranha::Address
|
29
|
+
map_controller 'Aranha::ProcessorConfigurations', :manage, ::Aranha::ProcessorConfiguration
|
30
|
+
map_controller 'Aranha::StartPoints', :manage, ::Aranha::StartPoint
|
31
|
+
end
|
27
32
|
end
|
28
33
|
end
|
29
34
|
end
|
@@ -6,7 +6,8 @@ module EacRailsBase0App
|
|
6
6
|
class Application < Rails::Application
|
7
7
|
module All
|
8
8
|
common_concern do
|
9
|
-
setup('assets_cache', 'dependencies', '
|
9
|
+
setup('app_root', 'assets_cache', 'dependencies', 'defaults', 'localization', 'load_paths',
|
10
|
+
'loggers')
|
10
11
|
end
|
11
12
|
|
12
13
|
module ClassMethods
|
@@ -14,11 +15,10 @@ module EacRailsBase0App
|
|
14
15
|
::File.join(::Dir.tmpdir, ::Rails.root.to_path.parameterize, 'tmp')
|
15
16
|
end
|
16
17
|
|
17
|
-
def
|
18
|
-
return
|
19
|
-
raise 'config.ru not found in ascendent path' if dir == '/'
|
18
|
+
def setup_app_root
|
19
|
+
return unless defined?(APP_PATH)
|
20
20
|
|
21
|
-
|
21
|
+
config.root = find_root(APP_PATH)
|
22
22
|
end
|
23
23
|
|
24
24
|
def setup_assets_cache
|
@@ -31,6 +31,10 @@ module EacRailsBase0App
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def setup_defaults
|
35
|
+
config.load_defaults 5.1
|
36
|
+
end
|
37
|
+
|
34
38
|
def setup_dependencies
|
35
39
|
require 'carrierwave'
|
36
40
|
end
|
@@ -5,15 +5,13 @@ require 'factory_bot'
|
|
5
5
|
|
6
6
|
module EacRailsBase0
|
7
7
|
module Rspec
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def perform
|
12
|
-
return unless defined?(::Rails)
|
8
|
+
module Setup
|
9
|
+
def self.extended(obj)
|
10
|
+
return unless obj.rails_app_path
|
13
11
|
|
14
12
|
%w[engines admin_user non_admin_user admin_example non_admin_example
|
15
13
|
anonymous_example].each do |m|
|
16
|
-
send("setup_#{m}")
|
14
|
+
obj.send("setup_#{m}")
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
@@ -48,68 +46,16 @@ module EacRailsBase0
|
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
51
|
-
def setup_admin_example
|
52
|
-
|
53
|
-
let(:user) { ::FactoryBot.create(:admin_user) }
|
54
|
-
|
55
|
-
before do
|
56
|
-
visit '/users/sign_in'
|
57
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
58
|
-
with: user.email
|
59
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
60
|
-
with: user.password
|
61
|
-
click_button ::I18n.translate!('devise.log_in')
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'user should be logged' do
|
65
|
-
expect(page).to have_content user.email
|
66
|
-
expect(::EacUsersSupport::User.current_user).not_to be_nil
|
67
|
-
end
|
68
|
-
end
|
49
|
+
def setup_admin_example
|
50
|
+
require 'eac_rails_base0/rspec/shared_contexts/when_user_is_admin'
|
69
51
|
end
|
70
52
|
|
71
|
-
def setup_non_admin_example
|
72
|
-
|
73
|
-
let(:user) { ::FactoryBot.create(:non_admin_user) }
|
74
|
-
|
75
|
-
before do
|
76
|
-
visit '/users/sign_in'
|
77
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
78
|
-
with: user.email
|
79
|
-
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
80
|
-
with: user.password
|
81
|
-
click_button ::I18n.translate!('devise.log_in')
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'user should be logged' do
|
85
|
-
expect(page).to have_content user.email
|
86
|
-
expect(::EacUsersSupport::User.current_user).not_to be_nil
|
87
|
-
end
|
88
|
-
end
|
53
|
+
def setup_non_admin_example
|
54
|
+
require 'eac_rails_base0/rspec/shared_contexts/when_user_is_non_admin'
|
89
55
|
end
|
90
56
|
|
91
|
-
def setup_anonymous_example
|
92
|
-
|
93
|
-
before do
|
94
|
-
visit '/'
|
95
|
-
if link_exist?(::I18n.translate!('devise.log_out'))
|
96
|
-
click_link(::I18n.translate!('devise.log_out'))
|
97
|
-
elsif !link_exist?(::I18n.translate!('devise.log_in'))
|
98
|
-
raise 'login nor logout link found'
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'user should be not logged' do
|
103
|
-
expect(::EacUsersSupport::User.current_user).to be_nil
|
104
|
-
end
|
105
|
-
|
106
|
-
def link_exist?(locator) # rubocop:disable Lint/NestedMethodDefinition
|
107
|
-
find_link(locator)
|
108
|
-
true
|
109
|
-
rescue Capybara::ElementNotFound
|
110
|
-
false
|
111
|
-
end
|
112
|
-
end
|
57
|
+
def setup_anonymous_example
|
58
|
+
require 'eac_rails_base0/rspec/shared_contexts/when_user_is_anonymous'
|
113
59
|
end
|
114
60
|
end
|
115
61
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::RSpec.shared_context 'when user is admin', shared_context: :metadata do
|
4
|
+
let(:user) { ::FactoryBot.create(:admin_user) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
visit '/users/sign_in'
|
8
|
+
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
9
|
+
with: user.email
|
10
|
+
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
11
|
+
with: user.password
|
12
|
+
click_button ::I18n.translate!('devise.log_in')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'user should be logged' do
|
16
|
+
expect(page).to have_content user.email
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should be a link to logout' do
|
20
|
+
expect(page).to have_link(nil, href: '/users/sign_out')
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::RSpec.shared_context 'when user is anonymous', shared_context: :metadata do
|
4
|
+
before do
|
5
|
+
visit '/'
|
6
|
+
if link_exist?(::I18n.translate!('devise.log_out'))
|
7
|
+
click_link(::I18n.translate!('devise.log_out'))
|
8
|
+
elsif !link_exist?(::I18n.translate!('devise.log_in'))
|
9
|
+
raise 'login nor logout link found'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should be a link to log in' do
|
14
|
+
expect(page).to have_link(nil, href: '/users/sign_in')
|
15
|
+
end
|
16
|
+
|
17
|
+
def link_exist?(locator)
|
18
|
+
find_link(locator)
|
19
|
+
true
|
20
|
+
rescue Capybara::ElementNotFound
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::RSpec.shared_context 'when user is non admin', shared_context: :metadata do
|
4
|
+
let(:user) { ::FactoryBot.create(:non_admin_user) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
visit '/users/sign_in'
|
8
|
+
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.email'),
|
9
|
+
with: user.email
|
10
|
+
fill_in ::I18n.translate!('activerecord.attributes.eac_users_support/user.password'),
|
11
|
+
with: user.password
|
12
|
+
click_button ::I18n.translate!('devise.log_in')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'user should be logged' do
|
16
|
+
expect(page).to have_content user.email
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should be a link to logout' do
|
20
|
+
expect(page).to have_link(nil, href: '/users/sign_out')
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_rails_base0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.55.2
|
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: 2021-
|
11
|
+
date: 2021-09-04 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.5
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.5.5
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: aranha-parsers
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +30,20 @@ dependencies:
|
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
33
|
+
version: '0.7'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.7.1
|
48
37
|
type: :runtime
|
49
38
|
prerelease: false
|
50
39
|
version_requirements: !ruby/object:Gem::Requirement
|
51
40
|
requirements:
|
52
41
|
- - "~>"
|
53
42
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
43
|
+
version: '0.7'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.7.1
|
55
47
|
- !ruby/object:Gem::Dependency
|
56
48
|
name: bootstrap-sass
|
57
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +126,20 @@ dependencies:
|
|
134
126
|
- - ">="
|
135
127
|
- !ruby/object:Gem::Version
|
136
128
|
version: 4.2.2
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: eac_active_scaffold
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - "~>"
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0.1'
|
136
|
+
type: :runtime
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - "~>"
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0.1'
|
137
143
|
- !ruby/object:Gem::Dependency
|
138
144
|
name: eac_cli
|
139
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,34 +200,34 @@ dependencies:
|
|
194
200
|
requirements:
|
195
201
|
- - "~>"
|
196
202
|
- !ruby/object:Gem::Version
|
197
|
-
version: '0.
|
203
|
+
version: '0.74'
|
198
204
|
type: :runtime
|
199
205
|
prerelease: false
|
200
206
|
version_requirements: !ruby/object:Gem::Requirement
|
201
207
|
requirements:
|
202
208
|
- - "~>"
|
203
209
|
- !ruby/object:Gem::Version
|
204
|
-
version: '0.
|
210
|
+
version: '0.74'
|
205
211
|
- !ruby/object:Gem::Dependency
|
206
212
|
name: eac_users_support
|
207
213
|
requirement: !ruby/object:Gem::Requirement
|
208
214
|
requirements:
|
209
215
|
- - "~>"
|
210
216
|
- !ruby/object:Gem::Version
|
211
|
-
version: '0.
|
217
|
+
version: '0.9'
|
212
218
|
- - ">="
|
213
219
|
- !ruby/object:Gem::Version
|
214
|
-
version: 0.
|
220
|
+
version: 0.9.3
|
215
221
|
type: :runtime
|
216
222
|
prerelease: false
|
217
223
|
version_requirements: !ruby/object:Gem::Requirement
|
218
224
|
requirements:
|
219
225
|
- - "~>"
|
220
226
|
- !ruby/object:Gem::Version
|
221
|
-
version: '0.
|
227
|
+
version: '0.9'
|
222
228
|
- - ">="
|
223
229
|
- !ruby/object:Gem::Version
|
224
|
-
version: 0.
|
230
|
+
version: 0.9.3
|
225
231
|
- !ruby/object:Gem::Dependency
|
226
232
|
name: fog-aws
|
227
233
|
requirement: !ruby/object:Gem::Requirement
|
@@ -358,16 +364,16 @@ dependencies:
|
|
358
364
|
name: rails-i18n
|
359
365
|
requirement: !ruby/object:Gem::Requirement
|
360
366
|
requirements:
|
361
|
-
- - "
|
367
|
+
- - ">="
|
362
368
|
- !ruby/object:Gem::Version
|
363
|
-
version: '
|
369
|
+
version: '0'
|
364
370
|
type: :runtime
|
365
371
|
prerelease: false
|
366
372
|
version_requirements: !ruby/object:Gem::Requirement
|
367
373
|
requirements:
|
368
|
-
- - "
|
374
|
+
- - ">="
|
369
375
|
- !ruby/object:Gem::Version
|
370
|
-
version: '
|
376
|
+
version: '0'
|
371
377
|
- !ruby/object:Gem::Dependency
|
372
378
|
name: recordselect
|
373
379
|
requirement: !ruby/object:Gem::Requirement
|
@@ -500,14 +506,14 @@ dependencies:
|
|
500
506
|
requirements:
|
501
507
|
- - "~>"
|
502
508
|
- !ruby/object:Gem::Version
|
503
|
-
version: '0.
|
509
|
+
version: '0.3'
|
504
510
|
type: :development
|
505
511
|
prerelease: false
|
506
512
|
version_requirements: !ruby/object:Gem::Requirement
|
507
513
|
requirements:
|
508
514
|
- - "~>"
|
509
515
|
- !ruby/object:Gem::Version
|
510
|
-
version: '0.
|
516
|
+
version: '0.3'
|
511
517
|
description:
|
512
518
|
email:
|
513
519
|
executables:
|
@@ -559,6 +565,7 @@ files:
|
|
559
565
|
- config/initializers/backtrace_silencers.rb
|
560
566
|
- config/initializers/carrier_wave.rb
|
561
567
|
- config/initializers/cookies_serializer.rb
|
568
|
+
- config/initializers/devise.rb
|
562
569
|
- config/initializers/filter_parameter_logging.rb
|
563
570
|
- config/initializers/mime_types.rb
|
564
571
|
- config/initializers/patches.rb
|
@@ -608,6 +615,9 @@ files:
|
|
608
615
|
- lib/eac_rails_base0/patches/url_for_patch.rb
|
609
616
|
- lib/eac_rails_base0/rspec.rb
|
610
617
|
- lib/eac_rails_base0/rspec/setup.rb
|
618
|
+
- lib/eac_rails_base0/rspec/shared_contexts/when_user_is_admin.rb
|
619
|
+
- lib/eac_rails_base0/rspec/shared_contexts/when_user_is_anonymous.rb
|
620
|
+
- lib/eac_rails_base0/rspec/shared_contexts/when_user_is_non_admin.rb
|
611
621
|
- lib/eac_rails_base0/version.rb
|
612
622
|
- lib/eac_rails_base0/x_engine.rb
|
613
623
|
- lib/fog.rb
|