eitil 1.0.1.e.4 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -1
  3. data/eitil_core/README.md +93 -4
  4. data/eitil_core/lib/eitil_core.rb +1 -0
  5. data/eitil_core/lib/eitil_core/argument_helpers.rb +8 -0
  6. data/eitil_core/lib/eitil_core/argument_helpers/all_args_to_ivars_bang.rb +15 -0
  7. data/eitil_core/lib/eitil_core/argument_helpers/all_kwargs_to_ivars_bang.rb +15 -0
  8. data/eitil_core/lib/eitil_core/argument_helpers/args_to_h.rb +15 -0
  9. data/eitil_core/lib/eitil_core/argument_helpers/args_to_h_bang.rb +17 -0
  10. data/eitil_core/lib/eitil_core/argument_helpers/args_to_ivars_bang.rb +15 -0
  11. data/eitil_core/lib/eitil_core/float/safe_to_i.rb +3 -0
  12. data/eitil_core/lib/eitil_core/lookups.rb +2 -1
  13. data/eitil_core/lib/eitil_core/lookups/gem_path.rb +10 -0
  14. data/eitil_core/lib/eitil_core/mocks.rb +6 -0
  15. data/eitil_core/lib/eitil_core/mocks/array.rb +39 -0
  16. data/eitil_core/lib/eitil_core/mocks/hash.rb +36 -0
  17. data/eitil_core/lib/eitil_core/mocks/string.rb +11 -0
  18. data/eitil_integrate/README.md +11 -0
  19. data/eitil_integrate/lib/eitil_integrate.rb +4 -0
  20. data/eitil_integrate/lib/eitil_integrate/application_exporter.rb +22 -0
  21. data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum.rb +10 -0
  22. data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/drop_data.rb +54 -0
  23. data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/format_data.rb +27 -0
  24. data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/initialize.rb +22 -0
  25. data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/present_data.rb +31 -0
  26. data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/reduce_data.rb +18 -0
  27. data/eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/sum_data.rb +56 -0
  28. data/eitil_integrate/lib/eitil_integrate/application_exporter/default_export.rb +43 -0
  29. data/eitil_integrate/lib/eitil_integrate/application_exporter/helpers.rb +50 -0
  30. data/eitil_integrate/lib/eitil_integrate/application_exporter/infos.rb +20 -0
  31. data/eitil_integrate/lib/eitil_integrate/application_exporter/initialize.rb +28 -0
  32. data/eitil_integrate/lib/eitil_integrate/application_exporter/lookups.rb +40 -0
  33. data/eitil_integrate/lib/eitil_integrate/application_exporter/selectors.rb +58 -0
  34. data/eitil_integrate/lib/eitil_integrate/application_exporter/setters.rb +27 -0
  35. data/eitil_integrate/lib/eitil_integrate/application_exporter/store_file.rb +34 -0
  36. data/eitil_integrate/lib/eitil_integrate/application_exporter/style_cells.rb +97 -0
  37. data/eitil_integrate/lib/eitil_integrate/application_exporter/validations.rb +28 -0
  38. data/eitil_integrate/lib/eitil_integrate/application_exporter/write_cells.rb +78 -0
  39. data/eitil_integrate/lib/eitil_integrate/application_exporter/write_messages.rb +18 -0
  40. data/eitil_support/lib/eitil_support/directory/lookups.rb +3 -0
  41. data/lib/eitil.rb +0 -1
  42. data/lib/eitil/all.rb +2 -3
  43. data/lib/eitil/railtie.rb +28 -1
  44. data/lib/eitil/version.rb +1 -1
  45. metadata +62 -6
  46. data/lib/eitil/engine.rb +0 -38
  47. data/lib/tasks/eitil_tasks.rake +0 -4
@@ -0,0 +1,97 @@
1
+
2
+ # require "eitil_integrate/application_exporter/style_cells"
3
+
4
+ require "eitil_integrate/application_exporter/initialize"
5
+
6
+ module EitilIntegrate::RubyXL
7
+ class ApplicationExporter
8
+
9
+ COLOURS = { white: 'ffffff', black: '000000', red: 'FF0000', blue: '0000FF', green: '00FF00', yellow: 'FFFF00',
10
+ cyan: '00FFFF', magenta: 'FF00FF', dark_grey: '464646', grey: '7E7E7E', light_grey: 'C1C1C1',
11
+ eitje_blue: '0496FF' }
12
+
13
+ private
14
+
15
+ def style_file
16
+ style_general
17
+ style_custom
18
+ end
19
+
20
+ def style_general
21
+ style_row_height
22
+ style_column_width
23
+ style_first_row_bold
24
+ style_first_column_bold
25
+ end
26
+
27
+ def style_custom
28
+ %i[
29
+ style_first_x_columns_width
30
+ style_x_columns_width
31
+ style_first_x_rows_height
32
+ style_x_rows_height
33
+ ].each { |_method| safe_send _method }
34
+ end
35
+
36
+ # multi rows
37
+
38
+ def style_row_height(height = 15)
39
+ base_style_x_rows_height row_indices, height
40
+ end
41
+
42
+ def style_first_x_rows_height(n_rows, height)
43
+ base_style_x_rows_height (0...n_rows), height
44
+ end
45
+
46
+ def style_x_rows_height(row_indices = [], height)
47
+ row_indices.each { |i| @sheet.change_row_height(i, height) }
48
+ end
49
+
50
+ alias_method :base_style_x_rows_height, :style_x_rows_height
51
+
52
+ # multi columns
53
+
54
+ def style_column_width(width = 40)
55
+ base_style_x_columns_width column_indices, width
56
+ end
57
+
58
+ def style_first_x_columns_width(n_columns, width)
59
+ base_style_x_columns_width (0...n_columns), width
60
+ end
61
+
62
+ def style_x_columns_width(column_indices = [], width)
63
+ column_indices.each { |i| @sheet.change_column_width(i, width) }
64
+ end
65
+
66
+ alias_method :base_style_x_columns_width, :style_x_columns_width
67
+
68
+ # single row
69
+
70
+ def style_first_row_bold
71
+ style_row_bold first_row
72
+ end
73
+
74
+ def style_row_bold(row)
75
+ @sheet.change_row_bold(row, true)
76
+ end
77
+
78
+ def style_row_font_colour(row, colour)
79
+ @sheet.change_row_font_color row, COLOURS[colour.to_sym]
80
+ end
81
+
82
+ def style_row_background_colour(row, colour)
83
+ sheet[row].cells.each { |cell| cell.change_fill COLOURS[colour.to_sym] }
84
+ end
85
+
86
+ # single column
87
+
88
+ def style_first_column_bold
89
+ style_column_bold first_column
90
+ end
91
+
92
+ def style_column_bold(column)
93
+ @sheet.change_column_bold(column, true)
94
+ end
95
+
96
+ end
97
+ end
@@ -0,0 +1,28 @@
1
+
2
+ # require "eitil_integrate/application_exporter/validations"
3
+
4
+ require "eitil_integrate/application_exporter/initialize"
5
+ require "eitil_core/errors/raise_error"
6
+
7
+ module EitilIntegrate::RubyXL
8
+ class ApplicationExporter
9
+
10
+ def validate_args_presence(*args)
11
+ args.each do |arg|
12
+ unless instance_variable_get "@#{arg}"
13
+ raise_error 'ExportArgumentsNotSetError', 'Set all required arguments. (Be aware that nil values will fail the test.)'
14
+ end
15
+ end
16
+ true
17
+ end
18
+
19
+ def validate_args_value
20
+ # Empty holder to prevent NoMethodError in DefaultExporter#export.
21
+ end
22
+
23
+ def validate_data
24
+ # Empty holder to prevent NoMethodError in DefaultExporter#export.
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,78 @@
1
+
2
+ # require "eitil_integrate/application_exporter/write_cells"
3
+
4
+ require "eitil_integrate/application_exporter/initialize"
5
+
6
+ module EitilIntegrate::RubyXL
7
+ class ApplicationExporter
8
+
9
+ def new_row(row_hash)
10
+ row_hash.each { |x_axis, title| @sheet.add_cell(x, x_axis.to_s.to_i, title) }
11
+ @x += 1
12
+ end
13
+
14
+ def empty_row
15
+ @x += 1
16
+ end
17
+
18
+ def empty_rows(n_rows)
19
+ @x += n_rows
20
+ end
21
+
22
+ def new_column(column_hash)
23
+ column_hash.each { |y_axis, title| @sheet.add_cell(y_axis.to_s.to_i, y, title) }
24
+ @y += 1
25
+ end
26
+
27
+ def empty_column
28
+ @y += 1
29
+ end
30
+
31
+ def empty_columns(n_columns)
32
+ @y += n_columns
33
+ end
34
+
35
+ def rows
36
+ @sheet.sheet_data.rows
37
+ end
38
+
39
+ def row_indices
40
+ (0...rows.count).to_a
41
+ end
42
+
43
+ def columns
44
+ # RubyXl does not seem to be purposed around columns, but merely handle rows properly.
45
+ end
46
+
47
+ def column_indices
48
+ n_rows = rows.map { |r| r&.cells&.count }.compact.max #temporary hack
49
+ (0...n_rows).to_a
50
+ end
51
+
52
+ def array_to_row(array)
53
+ new_row array_to_indexed_hash(array)
54
+ end
55
+
56
+ def row_values(row_index)
57
+ rows.dig(row_index).cells.map &:value
58
+ end
59
+
60
+ def column_values(column_index)
61
+ rows.map { |row| row&.cells&.dig(column_index)&.value }
62
+ end
63
+
64
+ def all_column_values
65
+ column_indices.map { |i| { i => column_values(i) } }.inject &:merge
66
+ end
67
+
68
+ def all_row_values
69
+ row_indices.map { |i| { i => row_values(i) } }.inject &:merge
70
+ end
71
+
72
+ def sum_row
73
+ new_row EitilIntegrate::RubyXL::AutoSum.perform(all_column_values)
74
+ style_row_bold previous_row
75
+ end
76
+
77
+ end
78
+ end
@@ -0,0 +1,18 @@
1
+
2
+ # require "eitil_integrate/application_exporter/write_messages"
3
+
4
+ require "eitil_integrate/application_exporter/initialize"
5
+
6
+ module EitilIntegrate::RubyXL
7
+ class ApplicationExporter
8
+
9
+ def fill_messages
10
+ # nil fallback for if the exporter class has no method #fill_messages
11
+ end
12
+
13
+ def write_message(message)
14
+ new_row({ '0': message })
15
+ end
16
+
17
+ end
18
+ end
@@ -1,3 +1,6 @@
1
+
2
+ # require "eitil_support/directory"
3
+
1
4
  module EitilSupport
2
5
  module Directory
3
6
  class << self
data/lib/eitil.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require "eitil/version"
2
- require "eitil/engine"
3
2
  require "eitil/railtie"
4
3
 
5
4
  module Eitil
data/lib/eitil/all.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
- require "rails"
3
2
  require "eitil"
3
+ require "pry"
4
4
 
5
5
  Eitil::Layers.each do |layer|
6
6
 
@@ -11,8 +11,7 @@ Eitil::Layers.each do |layer|
11
11
  rescue LoadError => e
12
12
  puts "failed to require #{layer}/railtie"
13
13
  puts "message: #{e.message}"
14
- puts "backtrace: #{e.backtrace}"
15
- binding.pry
14
+ # binding.pry
16
15
 
17
16
  end
18
17
  end
data/lib/eitil/railtie.rb CHANGED
@@ -1,6 +1,33 @@
1
+
2
+ require 'eitil/railtie'
3
+
4
+ # Constants
5
+
1
6
  module Eitil
2
7
 
3
- class Railtie < ::Rails::Railtie
8
+ Root = Gem.loaded_specs['eitil'].full_gem_path
9
+ Layers = %w( eitil_core eitil_support eitil_wrapper eitil_store eitil_integrate )
10
+
11
+ end
12
+
13
+
14
+ # Configuration
15
+
16
+ module Eitil
17
+
18
+ class Railtie < ::Rails::Railtie
19
+
20
+ # Add lib dirs to $LOAD_PATH, making them available in your main app.
21
+ Eitil::Layers.each do |layer|
22
+ $LOAD_PATH << "#{Eitil::Root}/#{layer}/lib"
23
+ end
24
+
25
+ end
26
+
27
+ mattr_accessor :get_controller_ivars_method
28
+
29
+ def self.set_config(&block)
30
+ yield self
4
31
  end
5
32
 
6
33
  end
data/lib/eitil/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Eitil
2
2
 
3
- VERSION = '1.0.1.e.4'
3
+ VERSION = '1.0.4'
4
4
 
5
5
  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.0.1.e.4
4
+ version: 1.0.4
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-06-11 00:00:00.000000000 Z
11
+ date: 2021-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.9.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: binding_of_caller
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubyXL
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: "Eitil (eitje utility) never stops increasing your life's efficacy and
42
70
  productivity, yay!\n Our gem currently exists of five seperate
43
71
  layers (Railties), which can be integrated as standalone gems. \n This
@@ -62,8 +90,13 @@ files:
62
90
  - eitil_core/lib/eitil_core/application_record/where_like.rb
63
91
  - eitil_core/lib/eitil_core/argument_helpers.rb
64
92
  - eitil_core/lib/eitil_core/argument_helpers/all_args_to_ivars.rb
93
+ - eitil_core/lib/eitil_core/argument_helpers/all_args_to_ivars_bang.rb
65
94
  - eitil_core/lib/eitil_core/argument_helpers/all_kwargs_to_ivars.rb
95
+ - eitil_core/lib/eitil_core/argument_helpers/all_kwargs_to_ivars_bang.rb
96
+ - eitil_core/lib/eitil_core/argument_helpers/args_to_h.rb
97
+ - eitil_core/lib/eitil_core/argument_helpers/args_to_h_bang.rb
66
98
  - eitil_core/lib/eitil_core/argument_helpers/args_to_ivars.rb
99
+ - eitil_core/lib/eitil_core/argument_helpers/args_to_ivars_bang.rb
67
100
  - eitil_core/lib/eitil_core/concerns.rb
68
101
  - eitil_core/lib/eitil_core/concerns/include_concerns_of.rb
69
102
  - eitil_core/lib/eitil_core/datetime.rb
@@ -76,6 +109,11 @@ files:
76
109
  - eitil_core/lib/eitil_core/hash/auto_dig.rb
77
110
  - eitil_core/lib/eitil_core/lookups.rb
78
111
  - eitil_core/lib/eitil_core/lookups/all_methods.rb
112
+ - eitil_core/lib/eitil_core/lookups/gem_path.rb
113
+ - eitil_core/lib/eitil_core/mocks.rb
114
+ - eitil_core/lib/eitil_core/mocks/array.rb
115
+ - eitil_core/lib/eitil_core/mocks/hash.rb
116
+ - eitil_core/lib/eitil_core/mocks/string.rb
79
117
  - eitil_core/lib/eitil_core/railtie.rb
80
118
  - eitil_core/lib/eitil_core/safe_executions.rb
81
119
  - eitil_core/lib/eitil_core/safe_executions/safe_call.rb
@@ -88,6 +126,26 @@ files:
88
126
  - eitil_core/lib/eitil_core/validations/run_validations.rb
89
127
  - eitil_integrate/README.md
90
128
  - eitil_integrate/lib/eitil_integrate.rb
129
+ - eitil_integrate/lib/eitil_integrate/application_exporter.rb
130
+ - eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum.rb
131
+ - eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/drop_data.rb
132
+ - eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/format_data.rb
133
+ - eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/initialize.rb
134
+ - eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/present_data.rb
135
+ - eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/reduce_data.rb
136
+ - eitil_integrate/lib/eitil_integrate/application_exporter/auto_sum/sum_data.rb
137
+ - eitil_integrate/lib/eitil_integrate/application_exporter/default_export.rb
138
+ - eitil_integrate/lib/eitil_integrate/application_exporter/helpers.rb
139
+ - eitil_integrate/lib/eitil_integrate/application_exporter/infos.rb
140
+ - eitil_integrate/lib/eitil_integrate/application_exporter/initialize.rb
141
+ - eitil_integrate/lib/eitil_integrate/application_exporter/lookups.rb
142
+ - eitil_integrate/lib/eitil_integrate/application_exporter/selectors.rb
143
+ - eitil_integrate/lib/eitil_integrate/application_exporter/setters.rb
144
+ - eitil_integrate/lib/eitil_integrate/application_exporter/store_file.rb
145
+ - eitil_integrate/lib/eitil_integrate/application_exporter/style_cells.rb
146
+ - eitil_integrate/lib/eitil_integrate/application_exporter/validations.rb
147
+ - eitil_integrate/lib/eitil_integrate/application_exporter/write_cells.rb
148
+ - eitil_integrate/lib/eitil_integrate/application_exporter/write_messages.rb
91
149
  - eitil_integrate/lib/eitil_integrate/railtie.rb
92
150
  - eitil_store/README.md
93
151
  - eitil_store/lib/eitil_store.rb
@@ -119,10 +177,8 @@ files:
119
177
  - eitil_wrapper/lib/eitil_wrapper/scopes/default_scopes.rb
120
178
  - lib/eitil.rb
121
179
  - lib/eitil/all.rb
122
- - lib/eitil/engine.rb
123
180
  - lib/eitil/railtie.rb
124
181
  - lib/eitil/version.rb
125
- - lib/tasks/eitil_tasks.rake
126
182
  homepage: https://github.com/eitje-app/eitil_engine
127
183
  licenses:
128
184
  - MIT
@@ -141,9 +197,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
197
  version: '0'
142
198
  required_rubygems_version: !ruby/object:Gem::Requirement
143
199
  requirements:
144
- - - ">"
200
+ - - ">="
145
201
  - !ruby/object:Gem::Version
146
- version: 1.3.1
202
+ version: '0'
147
203
  requirements: []
148
204
  rubygems_version: 3.1.2
149
205
  signing_key:
data/lib/eitil/engine.rb DELETED
@@ -1,38 +0,0 @@
1
-
2
- require 'eitil/railtie'
3
-
4
-
5
- # Constants
6
-
7
- module Eitil
8
-
9
- # preferably find a less hacky way to retrieve the gem's root path, perhaps with Kernel#pwd?
10
- Root = $LOAD_PATH.find { |x| x.match /eitil/ }.chomp('/lib')
11
- Layers = %w( eitil_core eitil_support eitil_wrapper eitil_store eitil_integrate )
12
-
13
- end
14
-
15
-
16
- # Configuration
17
-
18
- module Eitil
19
-
20
- class Engine < ::Rails::Engine
21
-
22
- isolate_namespace Eitil
23
- config.generators.api_only = true
24
-
25
- # Add lib dirs to $LOAD_PATH, making them available in your main app.
26
- Eitil::Layers.each do |layer|
27
- $LOAD_PATH << "#{Eitil::Root}/#{layer}/lib"
28
- end
29
-
30
- end
31
-
32
- mattr_accessor :get_controller_ivars_method
33
-
34
- def self.set_config(&block)
35
- yield self
36
- end
37
-
38
- end