tilt-caxlsx 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +19 -0
- data/README.md +43 -0
- data/lib/tilt/axlsx/version.rb +5 -0
- data/lib/tilt/axlsx.rb +25 -0
- data/lib/tilt-axlsx.rb +1 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9557ce55a31d2214a521c9afe70679edd7ca8a0163b0bbc75858362dbf0a6cfb
|
4
|
+
data.tar.gz: 1f7c0b3d1f27ec2fc70a05bdb2e02930f45fe34ddff96dca4c4e993f9ccb23c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fb104c6834b401e2a26a05b2e5aa9e8bb788f887b56311f05923e030542e9f36110dc0be8c84e855b65c5a469c9150b20a80d82b8d70a0fa07a5935d708d4eb9
|
7
|
+
data.tar.gz: 420ae03246c2140fd5e9cd08d22ea3c3a7dd5ee974c693b956136012f5aaf74b2b0ae26195ea026b575382bd9a489f8716fa97b248f753c5014f04059c806857
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2023 Jordan Owens
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# tilt-caxlsx
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/tilt-caxlsx.svg)](https://badge.fury.io/rb/tilt-caxlsx)
|
4
|
+
[![Tests](https://github.com/jkowens/tilt-caxlsx/actions/workflows/test.yml/badge.svg)](https://github.com/jkowens/tilt-caxlsx/actions/workflows/test.yml)
|
5
|
+
|
6
|
+
|
7
|
+
Adds support for rendering [Caxlsx](https://github.com/caxlsx/caxlsx) templates using [Tilt](https://github.com/rtomayko/tilt).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'tilt-caxlsx'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install tilt-caxlsx
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Create a template with the .xlsx or .axlsx extension. Use `xlsx_package` variable to create your spreadsheet:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
wb = xlsx_package.workbook
|
29
|
+
wb.add_worksheet(name: "Users") do |sheet|
|
30
|
+
sheet.add_row ["ID", "Email", "Full Name"]
|
31
|
+
@users.each do |user|
|
32
|
+
sheet.add_row [user.id, user.email, user.full_name]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create new Pull Request
|
data/lib/tilt/axlsx.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "tilt"
|
2
|
+
require "axlsx"
|
3
|
+
|
4
|
+
module Tilt
|
5
|
+
class AxlsxTemplate < Template
|
6
|
+
self.default_mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
7
|
+
|
8
|
+
def prepare
|
9
|
+
end
|
10
|
+
|
11
|
+
def precompiled_preamble(locals)
|
12
|
+
"xlsx_package = ::Axlsx::Package.new"
|
13
|
+
end
|
14
|
+
|
15
|
+
def precompiled_postamble(locals)
|
16
|
+
"xlsx_package.to_stream.string"
|
17
|
+
end
|
18
|
+
|
19
|
+
def precompiled_template(locals)
|
20
|
+
data.to_str
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Tilt.register Tilt::AxlsxTemplate, :xlsx, :axlsx
|
25
|
+
end
|
data/lib/tilt-axlsx.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "tilt/axlsx"
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tilt-caxlsx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jordan Owens
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tilt
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.4'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: caxlsx
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: minitest
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '5.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '5.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: roo
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 2.10.0
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.10.0
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: standard
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.23.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.23.0
|
103
|
+
description: Integrates Axlsx with Tilt
|
104
|
+
email: jkowens@gmail.com
|
105
|
+
executables: []
|
106
|
+
extensions: []
|
107
|
+
extra_rdoc_files: []
|
108
|
+
files:
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- lib/tilt-axlsx.rb
|
112
|
+
- lib/tilt/axlsx.rb
|
113
|
+
- lib/tilt/axlsx/version.rb
|
114
|
+
homepage: https://github.com/jkowens/tilt-axlsx
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubygems_version: 3.3.25
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Generate xlsx documents with Tilt
|
137
|
+
test_files: []
|