axlsx_styler 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +5 -2
- data/lib/axlsx_styler/axlsx_styles.rb +4 -1
- data/lib/axlsx_styler/version.rb +1 -1
- data/test/dummy_app/config/application.rb +4 -8
- data/test/helper_methods.rb +1 -1
- data/test/test_helper.rb +10 -0
- metadata +47 -35
- data/test/dummy_app/config/environments/development.rb +0 -30
- data/test/dummy_app/config/environments/production.rb +0 -60
- data/test/dummy_app/db/test.sqlite3 +0 -0
- data/test/dummy_app/log/test.log +0 -1004
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e2267d5ca327982984c81d1878626c04c7e131faaa00a1658538185bef9b0ed
|
4
|
+
data.tar.gz: 3f4fb23d36366e5b87876800306223979f414ccccde4dd6718967edc8d232cdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5290e9be78ca4df5b4c5fca45e60bf5bf648fdfd9bd7891a5fb2b17bdf1a310f23278528218a06070e9d2452af5ad4e7b8827c13d6a9505a185e15c68d0fdf69
|
7
|
+
data.tar.gz: 8ed27aff1ffefd5e9b5f2f7b15559b10b2ac1cc7682b51551024c6ec02f0e9ed239d6382e573d9b694ff38018b42aabdf42258e98737828092c486653cfa6058
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
- **Unreleased**
|
4
|
+
- Nothing yet
|
5
|
+
|
6
|
+
- **1.2.0 - October 21, 2022**
|
7
|
+
- This gem has now been merged into caxlsx v3.3.0 as such we are now deprecating this gem and dropping support for caxlsx v3.3.0+
|
8
|
+
- [#35](https://github.com/axlsx-styler-gem/axlsx_styler/pull/35) - Do not overwrite spreadsheet default font attributes if they have been customized
|
9
|
+
|
3
10
|
- **1.1.0 - August 26, 2020**
|
4
11
|
- [Issue #29](https://github.com/axlsx-styler-gem/axlsx_styler/issues/29) - Fix error `Invalid cellXfs id` when applying `dxf` styles
|
5
12
|
- [PR #28](https://github.com/axlsx-styler-gem/axlsx_styler/pull/28) - Allow passing arrays of cell ranges to the `add_style` and `add_border` methods
|
13
|
+
|
6
14
|
- **1.0.0 - January 5, 2020**
|
7
15
|
- Switch to the `caxlsx` gem (Community Axlsx) from the legacy unmaintained `axlsx` gem. Axlsx has had a long history of being poorly maintained so this community gem improves the situation.
|
8
16
|
- Require Ruby 2.3+
|
@@ -10,14 +18,19 @@
|
|
10
18
|
- Removed unnecessary module `AxlsxStyler::Axlsx`
|
11
19
|
- Major test suite improvements
|
12
20
|
- Add Rails dummy app to test suite and test with `axlsx_rails`
|
21
|
+
|
13
22
|
- **0.2.0**
|
14
23
|
- Add support for `axlsx` v3 (at this time for v3.0.0.pre).
|
15
24
|
- Update test suite to run against both v2 and v3 of `axlsx`
|
25
|
+
|
16
26
|
- **0.1.7**
|
17
27
|
- Allow mixing vanilla `axlsx` styles and those from `add_style` and `add_border`. See [this example](./examples/mixing_styles.rb)
|
28
|
+
|
18
29
|
- **0.1.5**
|
19
30
|
- Hide `Workbook#apply_styles` method to make it easier to use.
|
31
|
+
|
20
32
|
- **0.1.3**
|
21
33
|
- Make border styles customizable.
|
34
|
+
|
22
35
|
- **0.1.2**
|
23
36
|
- Allow applying multiple style hashes.
|
data/README.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# axlsx_styler
|
2
2
|
|
3
3
|
<a href="https://badge.fury.io/rb/axlsx_styler" target="_blank"><img height="21" style='border:0px;height:21px;' border='0' src="https://badge.fury.io/rb/axlsx_styler.svg" alt="Gem Version"></a>
|
4
|
-
<a href='https://
|
4
|
+
<a href='https://github.com/axlsx-styler-gem/axlsx_styler/actions' target='_blank'><img src="https://github.com/axlsx-styler-gem/axlsx_styler/workflows/Tests/badge.svg" style="max-width:100%;" height='21' style='border:0px;height:21px;' border='0' alt="CI Status"></a>
|
5
5
|
<a href='https://rubygems.org/gems/axlsx_styler' target='_blank'><img height='21' style='border:0px;height:21px;' src='https://ruby-gem-downloads-badge.herokuapp.com/axlsx_styler?label=rubygems&type=total&total_label=downloads&color=brightgreen' border='0' alt='RubyGems Downloads' /></a>
|
6
6
|
|
7
|
+
> **Note**
|
8
|
+
> **This gem has been [merged upstream into caxlsx v3.3.0](https://github.com/caxlsx/caxlsx/blob/master/CHANGELOG.md#v3.3.0). Please remove this gem from your Gemfile when using caxlsx@v3.3.0 and above.**
|
9
|
+
|
7
10
|
`axlsx_styler` is a gem that allows you to build clean and maintainable styles for your `axlsx` spreadsheets. Build your spreadsheeet with data and then apply styles later.
|
8
11
|
|
9
|
-
While [`axlsx`](https://github.com/
|
12
|
+
While [`axlsx`](https://github.com/caxlsx/caxlsx) is an excellent tool to build Excel spreadsheets in Ruby, the sheets styles are only applied immediately as the row is created. This makes it very difficult to style easily and effectively.
|
10
13
|
|
11
14
|
To solve this issue, `axlsx_styler` was born to allow the separation of styles from content within your `axlsx` code. It gives you the ability to fill out a spreadsheet with data and apply styles later.
|
12
15
|
|
@@ -12,7 +12,10 @@ module AxlsxStyler
|
|
12
12
|
if options[:type] == :dxf
|
13
13
|
style_id = super
|
14
14
|
else
|
15
|
-
|
15
|
+
### https://github.com/caxlsx/caxlsx/blob/9b6a78f43b9415bd155bddf6a6d872f5d5555595/lib/axlsx/stylesheet/styles.rb#L459
|
16
|
+
font_defaults = {name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family}
|
17
|
+
|
18
|
+
raw_style = {type: :xf}.merge(font_defaults).merge(options)
|
16
19
|
|
17
20
|
if raw_style[:format_code]
|
18
21
|
raw_style.delete(:num_fmt)
|
data/lib/axlsx_styler/version.rb
CHANGED
@@ -8,6 +8,10 @@ require 'axlsx_styler'
|
|
8
8
|
|
9
9
|
module Dummy
|
10
10
|
class Application < Rails::Application
|
11
|
+
if Rails::VERSION::STRING.to_f >= 5.1
|
12
|
+
config.load_defaults Rails::VERSION::STRING.to_f
|
13
|
+
end
|
14
|
+
|
11
15
|
# Settings in config/environments/* take precedence over those specified here.
|
12
16
|
# Application configuration should go into files in config/initializers
|
13
17
|
# -- all .rb files in that directory are automatically loaded.
|
@@ -36,14 +40,6 @@ module Dummy
|
|
36
40
|
# Configure sensitive parameters which will be filtered from the log file.
|
37
41
|
config.filter_parameters += [:password]
|
38
42
|
|
39
|
-
# Enable the asset pipeline
|
40
|
-
config.assets.enabled = true
|
41
|
-
|
42
|
-
config.assets.quiet = true
|
43
|
-
|
44
|
-
# Version of your assets, change this if you want to expire all your assets
|
45
|
-
config.assets.version = '1.0'
|
46
|
-
|
47
43
|
config.generators.test_framework = false
|
48
44
|
config.generators.helper = false
|
49
45
|
config.generators.stylesheets = false
|
data/test/helper_methods.rb
CHANGED
@@ -6,7 +6,7 @@ end
|
|
6
6
|
|
7
7
|
# Save to a file by getting contents from stream
|
8
8
|
def to_stream(filename)
|
9
|
-
File.open(File.expand_path("../../tmp/#{filename}.xlsx", __FILE__), '
|
9
|
+
File.open(File.expand_path("../../tmp/#{filename}.xlsx", __FILE__), 'wb') do |f|
|
10
10
|
f.write @axlsx.to_stream.read
|
11
11
|
end
|
12
12
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
ENV["RAILS_ENV"] = "test"
|
2
2
|
|
3
|
+
begin
|
4
|
+
require 'warning'
|
5
|
+
|
6
|
+
Warning.ignore(
|
7
|
+
%r{mail/parsers/address_lists_parser}, ### Hide mail gem warnings
|
8
|
+
)
|
9
|
+
rescue LoadError
|
10
|
+
# Do nothing
|
11
|
+
end
|
12
|
+
|
3
13
|
require File.expand_path("../dummy_app/config/environment.rb", __FILE__)
|
4
14
|
|
5
15
|
migration_path = Rails.root.join('db/migrate')
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axlsx_styler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
- Anton Sakovich
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: caxlsx
|
@@ -18,6 +18,9 @@ dependencies:
|
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 2.0.2
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.3.0
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -25,6 +28,9 @@ dependencies:
|
|
25
28
|
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: 2.0.2
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.3.0
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: activesupport
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,6 +143,20 @@ dependencies:
|
|
137
143
|
- - ">="
|
138
144
|
- !ruby/object:Gem::Version
|
139
145
|
version: '0'
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: warning
|
148
|
+
requirement: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
type: :development
|
154
|
+
prerelease: false
|
155
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
140
160
|
description: Build clean and maintainable styles for your axlsx spreadsheets. Build
|
141
161
|
your spreadsheeet with data and then apply styles later.
|
142
162
|
email:
|
@@ -172,8 +192,6 @@ files:
|
|
172
192
|
- test/dummy_app/config/boot.rb
|
173
193
|
- test/dummy_app/config/database.yml
|
174
194
|
- test/dummy_app/config/environment.rb
|
175
|
-
- test/dummy_app/config/environments/development.rb
|
176
|
-
- test/dummy_app/config/environments/production.rb
|
177
195
|
- test/dummy_app/config/environments/test.rb
|
178
196
|
- test/dummy_app/config/initializers/backtrace_silencers.rb
|
179
197
|
- test/dummy_app/config/initializers/inflections.rb
|
@@ -185,8 +203,6 @@ files:
|
|
185
203
|
- test/dummy_app/config/routes.rb
|
186
204
|
- test/dummy_app/config/secrets.yml
|
187
205
|
- test/dummy_app/db/schema.rb
|
188
|
-
- test/dummy_app/db/test.sqlite3
|
189
|
-
- test/dummy_app/log/test.log
|
190
206
|
- test/helper_methods.rb
|
191
207
|
- test/integration/application_test.rb
|
192
208
|
- test/test_helper.rb
|
@@ -200,7 +216,7 @@ homepage: https://github.com/axlsx-styler-gem/axlsx_styler
|
|
200
216
|
licenses:
|
201
217
|
- MIT
|
202
218
|
metadata: {}
|
203
|
-
post_install_message:
|
219
|
+
post_install_message:
|
204
220
|
rdoc_options: []
|
205
221
|
require_paths:
|
206
222
|
- lib
|
@@ -216,46 +232,42 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
232
|
version: '0'
|
217
233
|
requirements: []
|
218
234
|
rubygems_version: 3.1.2
|
219
|
-
signing_key:
|
235
|
+
signing_key:
|
220
236
|
specification_version: 4
|
221
237
|
summary: Build clean and maintainable styles for your axlsx spreadsheets. Build your
|
222
238
|
spreadsheeet with data and then apply styles later.
|
223
239
|
test_files:
|
224
|
-
- test/integration/application_test.rb
|
225
|
-
- test/test_helper.rb
|
226
|
-
- test/unit/examples_test.rb
|
227
|
-
- test/unit/borders_test.rb
|
228
|
-
- test/unit/merge_styles_test.rb
|
229
|
-
- test/unit/regresssions_test.rb
|
230
|
-
- test/unit/serialize_test.rb
|
231
|
-
- test/unit/to_stream_test.rb
|
232
|
-
- test/dummy_app/app/models/application_record.rb
|
233
|
-
- test/dummy_app/app/views/spreadsheets/test.xlsx.axlsx
|
234
|
-
- test/dummy_app/app/views/layouts/application.html.erb
|
235
|
-
- test/dummy_app/app/assets/stylesheets/application.css
|
236
240
|
- test/dummy_app/app/assets/config/manifest.js
|
237
241
|
- test/dummy_app/app/assets/javascripts/application.js
|
238
|
-
- test/dummy_app/app/
|
242
|
+
- test/dummy_app/app/assets/stylesheets/application.css
|
239
243
|
- test/dummy_app/app/controllers/application_controller.rb
|
240
|
-
- test/dummy_app/
|
241
|
-
- test/dummy_app/
|
244
|
+
- test/dummy_app/app/controllers/spreadsheets_controller.rb
|
245
|
+
- test/dummy_app/app/models/application_record.rb
|
246
|
+
- test/dummy_app/app/views/layouts/application.html.erb
|
247
|
+
- test/dummy_app/app/views/spreadsheets/test.xlsx.axlsx
|
248
|
+
- test/dummy_app/config/application.rb
|
249
|
+
- test/dummy_app/config/boot.rb
|
242
250
|
- test/dummy_app/config/database.yml
|
243
|
-
- test/dummy_app/config/environments/production.rb
|
244
|
-
- test/dummy_app/config/environments/test.rb
|
245
|
-
- test/dummy_app/config/environments/development.rb
|
246
|
-
- test/dummy_app/config/routes.rb
|
247
251
|
- test/dummy_app/config/environment.rb
|
248
|
-
- test/dummy_app/config/
|
249
|
-
- test/dummy_app/config/
|
250
|
-
- test/dummy_app/config/initializers/secret_token.rb
|
252
|
+
- test/dummy_app/config/environments/test.rb
|
253
|
+
- test/dummy_app/config/initializers/backtrace_silencers.rb
|
251
254
|
- test/dummy_app/config/initializers/inflections.rb
|
252
255
|
- test/dummy_app/config/initializers/mime_types.rb
|
256
|
+
- test/dummy_app/config/initializers/secret_token.rb
|
253
257
|
- test/dummy_app/config/initializers/session_store.rb
|
254
258
|
- test/dummy_app/config/initializers/wrap_parameters.rb
|
255
|
-
- test/dummy_app/config/
|
259
|
+
- test/dummy_app/config/locales/en.yml
|
260
|
+
- test/dummy_app/config/routes.rb
|
256
261
|
- test/dummy_app/config/secrets.yml
|
257
|
-
- test/dummy_app/config
|
258
|
-
- test/dummy_app/Rakefile
|
262
|
+
- test/dummy_app/config.ru
|
259
263
|
- test/dummy_app/db/schema.rb
|
260
|
-
- test/dummy_app/
|
264
|
+
- test/dummy_app/Rakefile
|
261
265
|
- test/helper_methods.rb
|
266
|
+
- test/integration/application_test.rb
|
267
|
+
- test/test_helper.rb
|
268
|
+
- test/unit/borders_test.rb
|
269
|
+
- test/unit/examples_test.rb
|
270
|
+
- test/unit/merge_styles_test.rb
|
271
|
+
- test/unit/regresssions_test.rb
|
272
|
+
- test/unit/serialize_test.rb
|
273
|
+
- test/unit/to_stream_test.rb
|
@@ -1,30 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Only use best-standards-support built into browsers
|
23
|
-
config.action_dispatch.best_standards_support = :builtin
|
24
|
-
|
25
|
-
# Do not compress assets
|
26
|
-
config.assets.compress = false
|
27
|
-
|
28
|
-
# Expands the lines which load the assets
|
29
|
-
config.assets.debug = true
|
30
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
3
|
-
|
4
|
-
# Code is not reloaded between requests
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Full error reports are disabled and caching is turned on
|
8
|
-
config.consider_all_requests_local = false
|
9
|
-
config.action_controller.perform_caching = true
|
10
|
-
|
11
|
-
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.serve_static_files = false
|
13
|
-
|
14
|
-
# Compress JavaScripts and CSS
|
15
|
-
config.assets.compress = true
|
16
|
-
|
17
|
-
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
-
config.assets.compile = false
|
19
|
-
|
20
|
-
# Generate digests for assets URLs
|
21
|
-
config.assets.digest = true
|
22
|
-
|
23
|
-
# Defaults to Rails.root.join("public/assets")
|
24
|
-
# config.assets.manifest = YOUR_PATH
|
25
|
-
|
26
|
-
# Specifies the header that your server uses for sending files
|
27
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
-
|
30
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
-
# config.force_ssl = true
|
32
|
-
|
33
|
-
# See everything in the log (default is :info)
|
34
|
-
# config.log_level = :debug
|
35
|
-
|
36
|
-
# Use a different logger for distributed setups
|
37
|
-
# config.logger = SyslogLogger.new
|
38
|
-
|
39
|
-
# Use a different cache store in production
|
40
|
-
# config.cache_store = :mem_cache_store
|
41
|
-
|
42
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
43
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
44
|
-
|
45
|
-
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
46
|
-
# config.assets.precompile += %w( search.js )
|
47
|
-
|
48
|
-
# Disable delivery errors, bad email addresses will be ignored
|
49
|
-
# config.action_mailer.raise_delivery_errors = false
|
50
|
-
|
51
|
-
# Enable threaded mode
|
52
|
-
# config.threadsafe!
|
53
|
-
|
54
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
55
|
-
# the I18n.default_locale when a translation can not be found)
|
56
|
-
config.i18n.fallbacks = true
|
57
|
-
|
58
|
-
# Send deprecation notices to registered listeners
|
59
|
-
config.active_support.deprecation = :notify
|
60
|
-
end
|
Binary file
|