eitil 1.1.36 → 1.2.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: a727b342fdcf5d8606bce86c115045c5a90621fe3624e59b92c16b2ecdfb8a4b
4
- data.tar.gz: afe1a161ccaf4d9b6d91d8052c8e76cf787b85e3f156d9ff1ffe696556ec064f
3
+ metadata.gz: bec9e917368ae2247d207eabbf6d0f8280e4ac5d27999245f81bc6d47e7a1a8e
4
+ data.tar.gz: d5dac1b85a0dff5143180c0d49db8c6773a45539a4f799ddb07b18a6de657594
5
5
  SHA512:
6
- metadata.gz: 6a30323d8425614fd455de01f08a7eef79ba43d215fb039335302288d1f6ad81bc74f192857306cbc6c9ca7bc4cf7e1d86f1e35a6be9c69e4c72112d550fbc10
7
- data.tar.gz: 6ddf4cfdc22dad7cc028129306b926945da729f0ed7c0234a32498b2c68a23c9c8bdbff3d4307e08da23bb0929fde358a32352b55afdc73d58d6cb13844cca69
6
+ metadata.gz: 2f095b69404768be104b743042e746ea08713275ffb26d39bf7f3d35612c9fd9b2d84800ab304230b3c96cd0b4902e0bd9f8b32a2786016d6efb3b23dbe74b1a
7
+ data.tar.gz: f49522248b51c3a377469ef267c584fc5f855a57040e8e5e88cc87b092ae7bb0672e4b8acf1fd5f59166296c797f5c74d050791cb08cce1f5eebd1f8155cca28
@@ -6,7 +6,7 @@ Kernel.module_eval do
6
6
  def args_to_h(local_binding, *local_vars)
7
7
 
8
8
  local_vars.reject { |lvar| lvar == local_binding }
9
- .reject { |lvar| lvar.to_s.starts_with?('_') }
9
+ .reject { |lvar| lvar.to_s.start_with?('_') }
10
10
  .map { |lvar| { "#{lvar}": local_binding.local_variable_get(lvar) } }
11
11
  .inject &:merge
12
12
 
@@ -8,7 +8,7 @@ Kernel.module_eval do
8
8
 
9
9
  def args_to_h!(*local_vars)
10
10
 
11
- local_vars.reject { |lvar| lvar.to_s.starts_with?('_') }
11
+ local_vars.reject { |lvar| lvar.to_s.start_with?('_') }
12
12
  .map { |lvar| { "#{lvar}": binding.of_caller(2).local_variable_get(lvar) } }
13
13
  .inject &:merge
14
14
 
@@ -31,17 +31,12 @@ module EitilIntegrate::RubyXL
31
31
 
32
32
  # returns the exporter_infos, without the datatypes – for taxonomy purpuses, the field
33
33
  # names are often sufficient
34
- def exporter_taxonomy
35
- exporter_infos.transform_values do |settings|
36
-
37
- settings.transform_values do |info|
38
-
39
- if info.is_a? Array
40
- info.first.is_a?(Hash) ? info.first.keys : info
41
- else
42
- info
43
- end
34
+ def exporter_taxonomy
35
+ parameter_fields = exporter_infos.transform_values { |v| v.select { |k,v| k == :required || k == :optional } }
44
36
 
37
+ parameter_fields.transform_values do |setting_collection|
38
+ setting_collection.transform_values do |setting|
39
+ setting.map { |key| key.is_a?(Hash) ? key.keys : key }.flatten
45
40
  end
46
41
  end
47
42
  end
@@ -10,7 +10,10 @@ module EitilSupport::Stack::Audit
10
10
  # .report_app_calls filters the stack on calls whose path include "/app/", since
11
11
  # audits otherwise tend to grow very big, which might endanger the database.
12
12
  stacktrace = EitilSupport::Stack.new.report_app_calls
13
- self.audits.last.update(stacktrace: stacktrace)
13
+
14
+ # Safe operator in order to avoid raising a NoMetodError when the record
15
+ # has no audits yet.
16
+ self.audits.last&.update(stacktrace: stacktrace)
14
17
  end
15
18
 
16
19
  end
@@ -14,6 +14,8 @@ module EitilWrapper
14
14
 
15
15
  def inherited(subclass)
16
16
  super
17
+
18
+ return if Eitil.skip_callback_helper_methods_for_models.include?(subclass.to_s.to_sym)
17
19
  subclass.use_eitil_callback_helper_methods
18
20
 
19
21
  rescue => e
@@ -36,6 +36,8 @@ module EitilWrapper
36
36
 
37
37
  def inherited(subclass)
38
38
  super
39
+
40
+ return if Eitil.skip_default_scopes_for_models.include?(subclass.to_s.to_sym)
39
41
  subclass.use_eitil_scopes
40
42
 
41
43
  rescue => e
data/lib/eitil/railtie.rb CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+
3
+
2
4
  # Constants
3
5
 
4
6
  module Eitil
@@ -9,8 +11,53 @@ module Eitil
9
11
 
10
12
  end
11
13
 
14
+
15
+
12
16
  # Configuration
13
17
 
18
+ module Eitil
19
+ class Railtie < ::Rails::Railtie
20
+
21
+ # The following configuration has its own special place in the boot sequence:
22
+ # on the one hand, it should run before the initialization of Eitil (gem), but
23
+ # read config assigned by the main app – which is only loaded AFTER all gems have
24
+ # been initialized.
25
+
26
+ # Therefore, we only require the specified file from the main app, after defining
27
+ # the possible configurations for the Eitil railtie. This way we escape the boot
28
+ # sequence's dedault order.
29
+
30
+ config.before_initialize do |eitil|
31
+
32
+ Eitil.mattr_accessor :controller_ivars,
33
+ :skip_default_scopes_for_models,
34
+ :skip_callback_helper_methods_for_models
35
+
36
+ Eitil.controller_ivars ||= []
37
+ Eitil.skip_default_scopes_for_models ||= []
38
+ Eitil.skip_callback_helper_methods_for_models ||= []
39
+
40
+ def Eitil.set_config(&block)
41
+ yield Eitil
42
+ end
43
+
44
+ config_path = Rails.root + 'config/initializers/eitil.rb'
45
+
46
+ if File.exists? config_path
47
+ puts "Loading Eitil config from #{config_path}..."
48
+ load config_path
49
+ else
50
+ puts "Eitil config not found at #{config_path}, resorting to defaults..."
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+
57
+
58
+
59
+ # Loading
60
+
14
61
  module Eitil
15
62
 
16
63
  class Railtie < ::Rails::Railtie
@@ -27,12 +74,4 @@ module Eitil
27
74
 
28
75
  end
29
76
 
30
- mattr_accessor :controller_ivars
31
-
32
- self.controller_ivars ||= []
33
-
34
- def self.set_config(&block)
35
- yield self
36
- end
37
-
38
77
  end
data/lib/eitil/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Eitil
2
2
 
3
- VERSION = '1.1.36'
3
+ VERSION = '1.2.0'
4
4
 
5
5
  end
@@ -0,0 +1,55 @@
1
+
2
+ require 'pry'
3
+ require 'rails'
4
+
5
+ require 'eitil'
6
+
7
+ # Implement specs for other railties later on, start with eitil_core.
8
+
9
+ require "eitil_core/railtie"
10
+ # require "eitil_store/railtie"
11
+ # require "eitil_integrate/railtie"
12
+ # require "eitil_support/railtie"
13
+ # require "eitil_wrapper/railtie"
14
+
15
+ require "eitil_core"
16
+ # require "eitil_store"
17
+ # require "eitil_integrate"
18
+ # require "eitil_support"
19
+ # require "eitil_wrapper"
20
+
21
+ RSpec.configure do |config|
22
+
23
+ config.expect_with :rspec do |expectations|
24
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
25
+ end
26
+
27
+ config.mock_with :rspec do |mocks|
28
+ mocks.verify_partial_doubles = true
29
+ end
30
+
31
+ end
32
+
33
+ # This block is added by us: the new methods .pry_describe and .pry_it
34
+ # automatically start a pry session after running the spec, allowing
35
+ # you to inspect the application's post spec state.
36
+ RSpec.configure do |config|
37
+
38
+ config.alias_example_group_to :pry_describe, pry: true
39
+ config.alias_example_group_to :pry_context, pry: true
40
+ config.alias_example_to :pry_it, pry: true
41
+ config.alias_example_to :pry_example, pry: true
42
+ config.alias_example_to :pry_specify, pry: true
43
+
44
+ config.after(:example, pry: true) do |example|
45
+ require 'pry'
46
+ binding.pry
47
+ end
48
+
49
+ end
50
+
51
+ # This is added by us, in order to set the :documentation formatter,
52
+ # which gives quite a lot of information about the tests, as default
53
+ RSpec.configure do |config|
54
+ config.formatter = :documentation
55
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eitil
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.36
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurriaan Schrofer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-02 00:00:00.000000000 Z
11
+ date: 2021-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,48 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 5.0.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 5.0.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
69
111
  description: "Eitil (eitje utility) never stops increasing your life's efficacy and
70
112
  productivity, yay!\n Our gem currently exists of five seperate
71
113
  layers (Railties), which can be integrated as standalone gems. \n This
@@ -205,6 +247,7 @@ files:
205
247
  - lib/eitil/all.rb
206
248
  - lib/eitil/railtie.rb
207
249
  - lib/eitil/version.rb
250
+ - spec/spec_helper.rb
208
251
  homepage: https://github.com/eitje-app/eitil_engine
209
252
  licenses:
210
253
  - MIT