export_manager 0.1.0 → 0.1.2

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: bef60f8d969610cbcdecd4080a8e7f523a72f12236fda5cf4c888a988e4c4865
4
- data.tar.gz: 6d6952cac70b8b184a71ff96fc6d4bc2ecc18d3e5be46246f77a561096c45d8b
3
+ metadata.gz: 40d5fdb8ff5853f69a8ab218b81011f6e4b46ed8372f34a26b4f7ccc4a721d47
4
+ data.tar.gz: aefe59c79746d380c20d87c1a694baa2d2704cb668465747d0f23f9c6116f5b5
5
5
  SHA512:
6
- metadata.gz: 52a52b61970df870b054494cdfa748b12ee8361821b16ef874272aea2a26744066361ca9c997a194cf89a820dec9c115044d1f07f1714a43a6b48452930a8c3a
7
- data.tar.gz: ed6f1ac833eb002539bd2c9b8b1c890ae79b1a4ee151c7af18c397523767dce15aec51d0a5a726e65128f2ef0028e24fa67fd6ac57b3527c8efa771679f2e7c2
6
+ metadata.gz: f29cccdc68a4646cf7eb404db7ccb81993ff4f9f6e21abbcbbd51a5a9e4316f78da1fbb93f3e38a0169a86e24522198c0f7cb2b3dc84ac1924519646ab2fb9c8
7
+ data.tar.gz: 60014ead662d2e7e60ce964140600b691b288e0a52422c3c309a5bc95ff7b4d27d333b1326237db222c5dba49c92d0e9884f77558f6c935eddf88a94db2b844f
data/README.md CHANGED
@@ -1,23 +1,32 @@
1
1
  # ExportManager
2
- ExportManager handles the dynamic export of table data to CSV, JSON, EXCEL and XML format.
2
+ The ExportManager handles the dynamic export of table data to CSV, JSON, Excel, and XML formats.
3
3
 
4
4
  ## Usage
5
- The ExportManager allows users to export data from dynamic tables with dynamic columns. The system provides flexibility in choosing the data to be exported and generates a CSV, JSON, EXCEL and XML file accordingly.
5
+ The ExportManager allows users to export data from dynamic tables with dynamic columns. The system provides flexibility in selecting the data to be exported and generates a **CSV, JSON, Excel, or XML** file accordingly.
6
+
7
+ ## Demo
8
+ [Screencast from 27-12-24 04:09:24 PM IST.webm](https://github.com/user-attachments/assets/17d245c3-5234-4171-b349-6cc1a74ea847)
6
9
 
7
10
  ## Quick Start
8
11
  ```ruby
9
- 1) gem "export_manager"
10
- 2) Add on config/routes.rb -> mount ExportManager::Engine, at: '/'
11
- 3) Add manifest.js
12
- //= link export_manager/application.css
13
- //= link export_manager/application.js
14
- 4) rails assets:precompile (on console)
12
+ 1) Add the following gems to your Gemfile
13
+ gem "export_manager"
14
+ gem "caxlsx"
15
+ gem "caxlsx_rails"
16
+ 2) In config/routes.rb, add
17
+ mount ExportManager::Engine, at: '/'
18
+
19
+ 3) Add the following lines to manifest.js
20
+ //= link export_manager/application.css
21
+ //= link export_manager/application.js
22
+
23
+ 4) Run rails assets:precompile in the console
15
24
  ```
16
25
 
17
- ## Worked on DATABASE
26
+ ## Database Support
18
27
  ```ruby
19
- 1) postgres
20
- 2) mysql
28
+ 1) PostgreSQL
29
+ 2) MySQL
21
30
  ```
22
31
 
23
32
 
@@ -26,6 +35,8 @@ Add this line to your application's Gemfile:
26
35
 
27
36
  ```ruby
28
37
  gem "export_manager"
38
+ gem "caxlsx"
39
+ gem "caxlsx_rails"
29
40
  ```
30
41
 
31
42
  And then execute:
@@ -39,14 +50,14 @@ $ gem install export_manager
39
50
  ```
40
51
 
41
52
 
42
- Remove the table name from the select box. (Note: Please create a global.rb file in the config/initializers/global.rb directory and add the necessary code inside this file.)
53
+ Remove a specific table name from the select box by creating a **global.rb** file in the **config/initializers** directory and adding the following code
43
54
  ```ruby
44
55
  config/initializers/global.rb
45
56
 
46
57
  REMOVE_TABLE_NAME = ['ActiveStorageBlobs'] # remove table
47
58
  ```
48
59
 
49
- Add the custom file name in global.rb
60
+ Add the custom file name in **global.rb**
50
61
  ```ruby
51
62
  config/initializers/global.rb
52
63
 
@@ -56,5 +67,11 @@ JSON_FILE_NAME = "JSON_EXPORT_#{Date.today}.json"
56
67
  XML_FILE_NAME = "XML_EXPORT_#{Date.today}.xml"
57
68
  ```
58
69
 
70
+ If an authenticated user has the **admin?** method returning **true**, they can access the ExportManager engine at /.
71
+ ```ruby
72
+ authenticated :user, ->(user) { user.admin? } do
73
+ mount ExportManager::Engine, at: '/'
74
+ end
75
+ ```
59
76
  ## License
60
77
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -66,9 +66,6 @@ module ExportManager
66
66
  excel_data = ExportManager.generate_json(records, columns)
67
67
  send_json(excel_data, file_name)
68
68
  when "xml"
69
- puts "records======#{records.first}"
70
- puts "columns======#{columns}"
71
-
72
69
  xml_data = ExportManager.generate_xml(records, columns)
73
70
  send_xml(xml_data, file_name)
74
71
  end
@@ -1,3 +1,3 @@
1
1
  module ExportManager
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require "export_manager/version"
2
2
  require "export_manager/engine"
3
+ require "csv"
3
4
 
4
5
  module ExportManager
5
6
  def self.generate_csv(records, columns)
@@ -13,7 +14,7 @@ module ExportManager
13
14
 
14
15
  def self.generate_excel(records, columns)
15
16
  wb = Axlsx::Package.new
16
- wb.workbook.add_worksheet(name: "Users Report") do |sheet|
17
+ wb.workbook.add_worksheet(name: "Report") do |sheet|
17
18
  sheet.add_row columns
18
19
 
19
20
  records.each do |record|
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: export_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vishal Mahto
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-27 00:00:00.000000000 Z
10
+ date: 2025-01-06 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -25,8 +24,8 @@ dependencies:
25
24
  - !ruby/object:Gem::Version
26
25
  version: '7.0'
27
26
  description: The ExportManager allows users to export data from dynamic tables with
28
- dynamic columns. The system provides flexibility in choosing the data to be exported
29
- and generates a CSV file accordingly.
27
+ dynamic columns. The system provides flexibility in selecting the data to be exported
28
+ and generates a CSV, JSON, Excel, or XML file accordingly.
30
29
  email:
31
30
  - vishalgmahto@proton.me
32
31
  executables: []
@@ -58,10 +57,10 @@ homepage: https://github.com/VishalMahtog/export_manager
58
57
  licenses:
59
58
  - MIT
60
59
  metadata:
60
+ keywords: export, csv, excel, JSON, json, xml, XML, export data, Export, gem, ruby
61
61
  homepage_uri: https://github.com/VishalMahtog/export_manager
62
62
  source_code_uri: https://github.com/VishalMahtog/export_manager
63
63
  changelog_uri: http://mygemserver.com
64
- post_install_message:
65
64
  rdoc_options: []
66
65
  require_paths:
67
66
  - lib
@@ -76,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
75
  - !ruby/object:Gem::Version
77
76
  version: '0'
78
77
  requirements: []
79
- rubygems_version: 3.4.10
80
- signing_key:
78
+ rubygems_version: 3.6.2
81
79
  specification_version: 4
82
- summary: ExportManager handles the dynamic export of table data to CSV format.
80
+ summary: ExportManager handles the dynamic export of table data to CSV, JSON, Excel,
81
+ or XML format.
83
82
  test_files: []