tramway-export 0.1.0 → 0.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -1
- data/app/controllers/tramway/export/application_controller.rb +2 -0
- data/app/controllers/tramway/export/exports_controller.rb +4 -2
- data/app/decorators/tramway/export/application_decorator.rb +3 -3
- data/app/decorators/tramway/export/xlsx/application_decorator.rb +2 -0
- data/app/helpers/tramway/export/application_helper.rb +2 -0
- data/app/jobs/tramway/export/application_job.rb +2 -0
- data/app/mailers/tramway/export/application_mailer.rb +2 -0
- data/app/models/tramway/export/application_record.rb +2 -0
- data/config/routes.rb +2 -0
- data/lib/tasks/tramway/export_tasks.rake +2 -0
- data/lib/tramway/export/engine.rb +2 -0
- data/lib/tramway/export/version.rb +3 -1
- data/lib/tramway/export.rb +4 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8a28bffa99e723823389b97dc255132840d45082e6cd1983a76e2c28f678196
|
4
|
+
data.tar.gz: 107fa809104440a7c3fb9528dbd21750b5e62fac72eba2da8bc1237c8df89202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2caa6491848f3f0398295f35d80f03d621b8ca02fab4b8847132ea63948fb4f571917391b694ca67dea210a0cf254217ada1e226f34362e59342b216eb7f489f
|
7
|
+
data.tar.gz: 71e40c79c77e859c0d3848c26e76426116dae437e05147e5f19c53aa8a78d9e42a2866698c793283f7be2025dfb99aa3039b9f162af1d9425caa63b273f20111
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'bundler/setup'
|
3
5
|
rescue LoadError
|
@@ -14,7 +16,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
17
|
end
|
16
18
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
19
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
18
20
|
load 'rails/tasks/engine.rake'
|
19
21
|
|
20
22
|
load 'rails/tasks/statistics.rake'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'xls_exporter'
|
2
4
|
|
3
5
|
class Tramway::Export::ExportsController < Tramway::Export::ApplicationController
|
@@ -13,12 +15,12 @@ class Tramway::Export::ExportsController < Tramway::Export::ApplicationControlle
|
|
13
15
|
export_models records, *xlsx_decorator_class.columns
|
14
16
|
end
|
15
17
|
stream = StringIO.new
|
16
|
-
book.write stream
|
18
|
+
book.write stream
|
17
19
|
send_data stream.string, content_type: 'application/xlsx', filename: xlsx_decorator_class.filename
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
21
|
-
|
23
|
+
|
22
24
|
def xlsx_decorator_class_name(model_name)
|
23
25
|
"#{model_name}XlsxDecorator".constantize
|
24
26
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tramway::Export::ApplicationDecorator
|
2
4
|
def initialize(object)
|
3
5
|
@object = object
|
@@ -21,7 +23,5 @@ class Tramway::Export::ApplicationDecorator
|
|
21
23
|
|
22
24
|
private
|
23
25
|
|
24
|
-
|
25
|
-
@object
|
26
|
-
end
|
26
|
+
attr_reader :object
|
27
27
|
end
|
data/config/routes.rb
CHANGED
data/lib/tramway/export.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tramway/export/engine'
|
2
4
|
|
3
5
|
module Tramway
|
4
6
|
module Export
|
@@ -10,6 +12,7 @@ module Tramway
|
|
10
12
|
end
|
11
13
|
|
12
14
|
def exportable_model?(model_class, project:)
|
15
|
+
return false unless project.present?
|
13
16
|
@exportable_models[project.to_sym]&.include? model_class
|
14
17
|
end
|
15
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-export
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xls_exporter
|
@@ -70,8 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
|
-
|
74
|
-
rubygems_version: 2.7.6
|
73
|
+
rubygems_version: 3.0.3
|
75
74
|
signing_key:
|
76
75
|
specification_version: 4
|
77
76
|
summary: Rails engine for exporting data
|