xcellus 0.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/libxcbindings-darwin-amd64.so +0 -0
- data/bin/libxcbindings-linux-amd64.so +0 -0
- data/{ext/xcellus → bin}/libxcbindings.h +1 -1
- data/ext/xcellus_bin/extconf.rb +14 -0
- data/ext/xcellus_bin/xcellus_bin.c +26 -0
- data/lib/xcellus.rb +2 -6
- metadata +23 -89
- data/.editorconfig +0 -14
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/CODE_OF_CONDUCT.md +0 -74
- data/Dockerfile +0 -10
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -65
- data/Gopkg.lock +0 -15
- data/Gopkg.toml +0 -34
- data/LICENSE +0 -21
- data/Makefile +0 -25
- data/README.md +0 -89
- data/Rakefile +0 -8
- data/bin/console +0 -8
- data/ext/xcellus/Makefile +0 -263
- data/ext/xcellus/extconf.h +0 -4
- data/ext/xcellus/extconf.rb +0 -23
- data/ext/xcellus/xcellus.c +0 -27
- data/golang/xcellus.go +0 -80
- data/script/build-golang +0 -9
- data/script/build-ruby +0 -8
- data/xcellus.gemspec +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 78dc25b767c41c977eb969e4f192dd70dfa5a8f2
|
4
|
+
data.tar.gz: db542eb69137904a628176b5042f78904cf51f74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d868d60d5be842c60e7ab0145b1b9ded4d7a5cd83fb5a5921af965bfb7cfeebd8c83e939679e658a01a3243c6e94ea96476d128681d6652ef33b5978a29d69
|
7
|
+
data.tar.gz: cee5f648d9b07a86cefcd01538ebc0182b4ab27cc1ec45d65e25891ec6179244ca259a883c1d646c6533ff3f8257a6c4ac2b42120c3186191a2e1217d4b9027a
|
Binary file
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
extension_name = 'xcellus_bin'
|
4
|
+
target_platform = 'linux'
|
5
|
+
if RbConfig::CONFIG['target'] =~ /darwin/
|
6
|
+
target_platform = 'darwin'
|
7
|
+
end
|
8
|
+
|
9
|
+
bindings = "xcbindings-#{target_platform}-amd64"
|
10
|
+
|
11
|
+
dir_config(extension_name)
|
12
|
+
dir_config(bindings, '$(srcdir)/../../bin', '$(srcdir)/../../bin')
|
13
|
+
$LDFLAGS << " -l#{bindings} -Wl,-rpath,./../../bin -Wl,-rpath,./../bin"
|
14
|
+
create_makefile(extension_name)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#include <stdbool.h>
|
2
|
+
#include <ruby.h>
|
3
|
+
#include "../../bin/libxcbindings.h"
|
4
|
+
|
5
|
+
VALUE rb_process(VALUE self, VALUE str) {
|
6
|
+
if (RB_TYPE_P(str, T_STRING) == 0) return Qnil;
|
7
|
+
struct go_xcellus_process_return result = go_xcellus_process(RSTRING_PTR(str));
|
8
|
+
bool failed = result.r0 == 1;
|
9
|
+
char *error_description = result.r1;
|
10
|
+
GoInt buffer_len = result.r2;
|
11
|
+
char *buffer = result.r3;
|
12
|
+
if(failed) {
|
13
|
+
VALUE errObj = rb_exc_new2(rb_eStandardError, error_description);
|
14
|
+
free(error_description);
|
15
|
+
rb_exc_raise(errObj);
|
16
|
+
}
|
17
|
+
|
18
|
+
VALUE retval = rb_str_new(buffer, buffer_len);
|
19
|
+
free(buffer);
|
20
|
+
return retval;
|
21
|
+
}
|
22
|
+
|
23
|
+
void Init_xcellus_bin() {
|
24
|
+
VALUE module = rb_define_module("Xcellus");
|
25
|
+
rb_define_singleton_method(module, "process", rb_process, 1);
|
26
|
+
}
|
data/lib/xcellus.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
|
-
|
2
|
-
require_relative '../ext/xcellus/xcellus.so'
|
3
|
-
rescue LoadError
|
4
|
-
require_relative '../ext/xcellus/xcellus.bundle'
|
5
|
-
end
|
1
|
+
require File.expand_path('../xcellus_bin', __FILE__)
|
6
2
|
|
7
3
|
require 'json'
|
8
4
|
|
9
5
|
module Xcellus
|
10
|
-
VERSION = '0.1'.freeze
|
6
|
+
VERSION = '0.1.2'.freeze
|
11
7
|
|
12
8
|
class << self
|
13
9
|
def transform(input)
|
metadata
CHANGED
@@ -1,139 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcellus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Gama
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake-compiler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.16'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.16'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
17
|
+
- - ">="
|
46
18
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
19
|
+
version: '0'
|
48
20
|
type: :development
|
49
21
|
prerelease: false
|
50
22
|
version_requirements: !ruby/object:Gem::Requirement
|
51
23
|
requirements:
|
52
|
-
- - "
|
24
|
+
- - ">="
|
53
25
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
26
|
+
version: '0'
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
28
|
+
name: bundler
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
31
|
- - "~>"
|
60
32
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
33
|
+
version: '1.16'
|
62
34
|
type: :development
|
63
35
|
prerelease: false
|
64
36
|
version_requirements: !ruby/object:Gem::Requirement
|
65
37
|
requirements:
|
66
38
|
- - "~>"
|
67
39
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
40
|
+
version: '1.16'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
42
|
+
name: rake
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
72
44
|
requirements:
|
73
45
|
- - "~>"
|
74
46
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
47
|
+
version: '12.0'
|
76
48
|
type: :development
|
77
49
|
prerelease: false
|
78
50
|
version_requirements: !ruby/object:Gem::Requirement
|
79
51
|
requirements:
|
80
52
|
- - "~>"
|
81
53
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: codecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
54
|
+
version: '12.0'
|
97
55
|
description: |2
|
98
56
|
Xcellus leverages a native extension to create XLSX files. It is an 'ugly'
|
99
57
|
generator because it lacks all styling mechanisms to make your XLSX pretty.
|
100
58
|
email:
|
101
59
|
- hey@vito.io
|
102
|
-
executables:
|
103
|
-
|
104
|
-
- extconf.
|
105
|
-
- extconf.rb
|
106
|
-
- libxcbindings.h
|
107
|
-
- xcellus.c
|
108
|
-
- xcellus.so
|
109
|
-
extensions: []
|
60
|
+
executables: []
|
61
|
+
extensions:
|
62
|
+
- ext/xcellus_bin/extconf.rb
|
110
63
|
extra_rdoc_files: []
|
111
64
|
files:
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
- Gemfile
|
118
|
-
- Gemfile.lock
|
119
|
-
- Gopkg.lock
|
120
|
-
- Gopkg.toml
|
121
|
-
- LICENSE
|
122
|
-
- Makefile
|
123
|
-
- README.md
|
124
|
-
- Rakefile
|
125
|
-
- bin/console
|
126
|
-
- ext/xcellus/Makefile
|
127
|
-
- ext/xcellus/extconf.h
|
128
|
-
- ext/xcellus/extconf.rb
|
129
|
-
- ext/xcellus/libxcbindings.h
|
130
|
-
- ext/xcellus/xcellus.c
|
131
|
-
- ext/xcellus/xcellus.so
|
132
|
-
- golang/xcellus.go
|
65
|
+
- bin/libxcbindings-darwin-amd64.so
|
66
|
+
- bin/libxcbindings-linux-amd64.so
|
67
|
+
- bin/libxcbindings.h
|
68
|
+
- ext/xcellus_bin/extconf.rb
|
69
|
+
- ext/xcellus_bin/xcellus_bin.c
|
133
70
|
- lib/xcellus.rb
|
134
|
-
- script/build-golang
|
135
|
-
- script/build-ruby
|
136
|
-
- xcellus.gemspec
|
137
71
|
homepage: https://github.com/victorgama/xcellus
|
138
72
|
licenses:
|
139
73
|
- MIT
|
@@ -154,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
88
|
version: '0'
|
155
89
|
requirements: []
|
156
90
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.6.14
|
158
92
|
signing_key:
|
159
93
|
specification_version: 4
|
160
94
|
summary: Xcellus is an ugly XLSX generator
|
data/.editorconfig
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at hey@vito.io. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Dockerfile
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
xcellus (0.1)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
ast (2.4.0)
|
10
|
-
codecov (0.1.10)
|
11
|
-
json
|
12
|
-
simplecov
|
13
|
-
url
|
14
|
-
diff-lcs (1.3)
|
15
|
-
docile (1.3.1)
|
16
|
-
json (2.1.0)
|
17
|
-
parallel (1.12.1)
|
18
|
-
parser (2.5.1.0)
|
19
|
-
ast (~> 2.4.0)
|
20
|
-
powerpack (0.1.2)
|
21
|
-
rainbow (3.0.0)
|
22
|
-
rake (10.5.0)
|
23
|
-
rspec (3.7.0)
|
24
|
-
rspec-core (~> 3.7.0)
|
25
|
-
rspec-expectations (~> 3.7.0)
|
26
|
-
rspec-mocks (~> 3.7.0)
|
27
|
-
rspec-core (3.7.1)
|
28
|
-
rspec-support (~> 3.7.0)
|
29
|
-
rspec-expectations (3.7.0)
|
30
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.7.0)
|
32
|
-
rspec-mocks (3.7.0)
|
33
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.7.0)
|
35
|
-
rspec-support (3.7.1)
|
36
|
-
rubocop (0.55.0)
|
37
|
-
parallel (~> 1.10)
|
38
|
-
parser (>= 2.5)
|
39
|
-
powerpack (~> 0.1)
|
40
|
-
rainbow (>= 2.2.2, < 4.0)
|
41
|
-
ruby-progressbar (~> 1.7)
|
42
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
43
|
-
ruby-progressbar (1.9.0)
|
44
|
-
simplecov (0.16.1)
|
45
|
-
docile (~> 1.1)
|
46
|
-
json (>= 1.8, < 3)
|
47
|
-
simplecov-html (~> 0.10.0)
|
48
|
-
simplecov-html (0.10.2)
|
49
|
-
unicode-display_width (1.4.0)
|
50
|
-
url (0.3.2)
|
51
|
-
|
52
|
-
PLATFORMS
|
53
|
-
ruby
|
54
|
-
|
55
|
-
DEPENDENCIES
|
56
|
-
bundler (~> 1.16)
|
57
|
-
codecov
|
58
|
-
rake (~> 10.0)
|
59
|
-
rspec (~> 3.0)
|
60
|
-
rubocop (~> 0.55.0)
|
61
|
-
simplecov (~> 0.16.1)
|
62
|
-
xcellus!
|
63
|
-
|
64
|
-
BUNDLED WITH
|
65
|
-
1.16.1
|
data/Gopkg.lock
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
2
|
-
|
3
|
-
|
4
|
-
[[projects]]
|
5
|
-
name = "github.com/tealeg/xlsx"
|
6
|
-
packages = ["."]
|
7
|
-
revision = "8be35264fa75a1bbe954ce51eba04f273e2c59e5"
|
8
|
-
version = "v1.0.3"
|
9
|
-
|
10
|
-
[solve-meta]
|
11
|
-
analyzer-name = "dep"
|
12
|
-
analyzer-version = 1
|
13
|
-
inputs-digest = "ac8a23a08b92cf25234b5b72dbefae4e8a6dd453d9affff27b41d610802d1649"
|
14
|
-
solver-name = "gps-cdcl"
|
15
|
-
solver-version = 1
|
data/Gopkg.toml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# Gopkg.toml example
|
2
|
-
#
|
3
|
-
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
4
|
-
# for detailed Gopkg.toml documentation.
|
5
|
-
#
|
6
|
-
# required = ["github.com/user/thing/cmd/thing"]
|
7
|
-
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
8
|
-
#
|
9
|
-
# [[constraint]]
|
10
|
-
# name = "github.com/user/project"
|
11
|
-
# version = "1.0.0"
|
12
|
-
#
|
13
|
-
# [[constraint]]
|
14
|
-
# name = "github.com/user/project2"
|
15
|
-
# branch = "dev"
|
16
|
-
# source = "github.com/myfork/project2"
|
17
|
-
#
|
18
|
-
# [[override]]
|
19
|
-
# name = "github.com/x/y"
|
20
|
-
# version = "2.4.0"
|
21
|
-
#
|
22
|
-
# [prune]
|
23
|
-
# non-go = false
|
24
|
-
# go-tests = true
|
25
|
-
# unused-packages = true
|
26
|
-
|
27
|
-
|
28
|
-
[[constraint]]
|
29
|
-
name = "github.com/tealeg/xlsx"
|
30
|
-
version = "1.0.3"
|
31
|
-
|
32
|
-
[prune]
|
33
|
-
go-tests = true
|
34
|
-
unused-packages = true
|
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2018 Victor Gama
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/Makefile
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
2
|
-
|
3
|
-
all:
|
4
|
-
echo "Please specify what to build"
|
5
|
-
exit 1
|
6
|
-
|
7
|
-
go:
|
8
|
-
docker run -v $(ROOT_DIR):/source --rm golang:1.10 /source/script/build-golang
|
9
|
-
|
10
|
-
ruby:
|
11
|
-
docker run -v $(ROOT_DIR):/source --rm victorgama/ruby-base:2.4 /source/script/build-ruby
|
12
|
-
|
13
|
-
darwin: clean
|
14
|
-
go build -o ext/xcellus/libxcbindings.a -buildmode=c-archive golang/xcellus.go
|
15
|
-
cd ext/xcellus && ruby extconf.rb && make
|
16
|
-
cd pkg && rm *
|
17
|
-
|
18
|
-
linux: clean go ruby
|
19
|
-
|
20
|
-
release: linux
|
21
|
-
gem push $(shell ls pkg)
|
22
|
-
|
23
|
-
clean:
|
24
|
-
cd ext/xcellus && \
|
25
|
-
rm -f extconf.h libxcbindings.* Makefile mkmf.* *.so *.o *.bundle
|
data/README.md
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
# Xcellus
|
2
|
-
|
3
|
-
[![Build Status](https://travis-ci.com/victorgama/xcellus.svg?branch=master)](https://travis-ci.com/victorgama/xcellus)
|
4
|
-
[![codecov](https://codecov.io/gh/victorgama/xcellus/branch/master/graph/badge.svg)](https://codecov.io/gh/victorgama/xcellus)
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/xcellus.svg)](https://badge.fury.io/rb/xcellus)
|
6
|
-
|
7
|
-
**Xcellus** is an ugly XLSX generator. It leverages a native extension to create
|
8
|
-
XLSX files. It is said to be an 'ugly' generator because it lacks all styling
|
9
|
-
mechanisms to make your XLSX pretty (such as fonts, borders, and the likes).
|
10
|
-
|
11
|
-
## Installation
|
12
|
-
|
13
|
-
> **WARNING**: Xcellus is targeted for Linux (amd64). It won't work on other architectures and support for them is not planned.
|
14
|
-
|
15
|
-
Add this line to your application's Gemfile:
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
gem 'xcellus'
|
19
|
-
```
|
20
|
-
|
21
|
-
And then execute:
|
22
|
-
|
23
|
-
$ bundle
|
24
|
-
|
25
|
-
Or install it yourself as:
|
26
|
-
|
27
|
-
$ gem install xcellus
|
28
|
-
|
29
|
-
## Usage
|
30
|
-
|
31
|
-
Xcellus transforms a list of hashes (acting as worksheets) into a XLSX workbook:
|
32
|
-
|
33
|
-
```ruby
|
34
|
-
require 'xcellus'
|
35
|
-
io = Xcellus.transform [
|
36
|
-
{
|
37
|
-
title: 'Brian\'s Worksheet',
|
38
|
-
headers: [:Artist, :Track, :Playcount],
|
39
|
-
rows: [
|
40
|
-
['Metallica', 'Hero of the Day', 242],
|
41
|
-
['Metallica', 'The Shortest Straw', 186],
|
42
|
-
['Queens of the Stone Age', 'My God Is the Sun', 276],
|
43
|
-
['Queens of the Stone Age', 'I Sat by the Ocean', 270],
|
44
|
-
['Gorillaz', 'On Melancholy Hill', 203],
|
45
|
-
['Gorillaz', 'Kids With Guns', 184],
|
46
|
-
]
|
47
|
-
}
|
48
|
-
]
|
49
|
-
# => #<StringIO:0x000000000245cc78>
|
50
|
-
|
51
|
-
File.open('BrianosMusic.xlsx', 'wb') do |f|
|
52
|
-
f.write(io.string)
|
53
|
-
end
|
54
|
-
# => 6377
|
55
|
-
```
|
56
|
-
|
57
|
-
## Contributing
|
58
|
-
|
59
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/victorgama/xcellus. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
60
|
-
|
61
|
-
## Code of Conduct
|
62
|
-
|
63
|
-
Everyone interacting in the Pagu project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/victorgama/xcellus/blob/master/CODE_OF_CONDUCT.md).
|
64
|
-
|
65
|
-
## License
|
66
|
-
|
67
|
-
```
|
68
|
-
The MIT License (MIT)
|
69
|
-
|
70
|
-
Copyright (c) 2018 Victor Gama
|
71
|
-
|
72
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
73
|
-
of this software and associated documentation files (the "Software"), to deal
|
74
|
-
in the Software without restriction, including without limitation the rights
|
75
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
76
|
-
copies of the Software, and to permit persons to whom the Software is
|
77
|
-
furnished to do so, subject to the following conditions:
|
78
|
-
|
79
|
-
The above copyright notice and this permission notice shall be included in
|
80
|
-
all copies or substantial portions of the Software.
|
81
|
-
|
82
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
83
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
84
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
85
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
86
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
87
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
88
|
-
THE SOFTWARE.
|
89
|
-
```
|
data/Rakefile
DELETED
data/bin/console
DELETED
data/ext/xcellus/Makefile
DELETED
@@ -1,263 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
-
V = 0
|
6
|
-
Q1 = $(V:1=)
|
7
|
-
Q = $(Q1:0=@)
|
8
|
-
ECHO1 = $(V:1=@ :)
|
9
|
-
ECHO = $(ECHO1:0=@ echo)
|
10
|
-
NULLCMD = :
|
11
|
-
|
12
|
-
#### Start of system configuration section. ####
|
13
|
-
|
14
|
-
srcdir = .
|
15
|
-
topdir = /usr/local/include/ruby-2.4.0
|
16
|
-
hdrdir = $(topdir)
|
17
|
-
arch_hdrdir = /usr/local/include/ruby-2.4.0/x86_64-linux
|
18
|
-
PATH_SEPARATOR = :
|
19
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
20
|
-
prefix = $(DESTDIR)/usr/local
|
21
|
-
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
-
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
-
exec_prefix = $(prefix)
|
25
|
-
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
-
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
-
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
-
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
-
sitedir = $(rubylibprefix)/site_ruby
|
37
|
-
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
-
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
-
archincludedir = $(includedir)/$(arch)
|
41
|
-
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
-
archlibdir = $(libdir)/$(arch)
|
43
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
-
mandir = $(datarootdir)/man
|
45
|
-
localedir = $(datarootdir)/locale
|
46
|
-
libdir = $(exec_prefix)/lib
|
47
|
-
psdir = $(docdir)
|
48
|
-
pdfdir = $(docdir)
|
49
|
-
dvidir = $(docdir)
|
50
|
-
htmldir = $(docdir)
|
51
|
-
infodir = $(datarootdir)/info
|
52
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
-
oldincludedir = $(DESTDIR)/usr/include
|
54
|
-
includedir = $(prefix)/include
|
55
|
-
localstatedir = $(prefix)/var
|
56
|
-
sharedstatedir = $(prefix)/com
|
57
|
-
sysconfdir = $(prefix)/etc
|
58
|
-
datadir = $(datarootdir)
|
59
|
-
datarootdir = $(prefix)/share
|
60
|
-
libexecdir = $(exec_prefix)/libexec
|
61
|
-
sbindir = $(exec_prefix)/sbin
|
62
|
-
bindir = $(exec_prefix)/bin
|
63
|
-
archdir = $(rubyarchdir)
|
64
|
-
|
65
|
-
|
66
|
-
CC = gcc
|
67
|
-
CXX = g++
|
68
|
-
LIBRUBY = $(LIBRUBY_SO)
|
69
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
70
|
-
LIBRUBYARG_SHARED = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)
|
71
|
-
LIBRUBYARG_STATIC = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
|
72
|
-
empty =
|
73
|
-
OUTFLAG = -o $(empty)
|
74
|
-
COUTFLAG = -o $(empty)
|
75
|
-
CSRCFLAG = $(empty)
|
76
|
-
|
77
|
-
RUBY_EXTCONF_H = extconf.h
|
78
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
79
|
-
cxxflags = $(optflags) $(debugflags) $(warnflags)
|
80
|
-
optflags = -O3 -fno-fast-math
|
81
|
-
debugflags = -ggdb3
|
82
|
-
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format
|
83
|
-
CCDLFLAGS = -fPIC
|
84
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) -fPIC $(ARCH_FLAG)
|
85
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
86
|
-
DEFS =
|
87
|
-
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -I/source/ext/xcellus $(DEFS) $(cppflags)
|
88
|
-
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
89
|
-
ldflags = -L. -fstack-protector -rdynamic -Wl,-export-dynamic -L/source/ext/xcellus
|
90
|
-
dldflags =
|
91
|
-
ARCH_FLAG =
|
92
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
93
|
-
LDSHARED = $(CC) -shared
|
94
|
-
LDSHAREDXX = $(CXX) -shared
|
95
|
-
AR = ar
|
96
|
-
EXEEXT =
|
97
|
-
|
98
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
99
|
-
RUBY_SO_NAME = ruby
|
100
|
-
RUBYW_INSTALL_NAME =
|
101
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
102
|
-
RUBYW_BASE_NAME = rubyw
|
103
|
-
RUBY_BASE_NAME = ruby
|
104
|
-
|
105
|
-
arch = x86_64-linux
|
106
|
-
sitearch = $(arch)
|
107
|
-
ruby_version = 2.4.0
|
108
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
109
|
-
RUBY = $(ruby)
|
110
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H)
|
111
|
-
|
112
|
-
RM = rm -f
|
113
|
-
RM_RF = $(RUBY) -run -e rm -- -rf
|
114
|
-
RMDIRS = rmdir --ignore-fail-on-non-empty -p
|
115
|
-
MAKEDIRS = /bin/mkdir -p
|
116
|
-
INSTALL = /usr/bin/install -c
|
117
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
118
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
119
|
-
COPY = cp
|
120
|
-
TOUCH = exit >
|
121
|
-
|
122
|
-
#### End of system configuration section. ####
|
123
|
-
|
124
|
-
preload =
|
125
|
-
libpath = . $(libdir) /source/ext/xcellus
|
126
|
-
LIBPATH = -L. -L$(libdir) -Wl,-rpath,$(libdir) -L/source/ext/xcellus -Wl,-rpath,/source/ext/xcellus
|
127
|
-
DEFFILE =
|
128
|
-
|
129
|
-
CLEANFILES = mkmf.log
|
130
|
-
DISTCLEANFILES =
|
131
|
-
DISTCLEANDIRS =
|
132
|
-
|
133
|
-
extout =
|
134
|
-
extout_prefix =
|
135
|
-
target_prefix =
|
136
|
-
LOCAL_LIBS =
|
137
|
-
LIBS = $(LIBRUBYARG_SHARED) -lxcbindings -lpthread -ldl -lcrypt -lm -lc
|
138
|
-
ORIG_SRCS = xcellus.c
|
139
|
-
SRCS = $(ORIG_SRCS)
|
140
|
-
OBJS = xcellus.o
|
141
|
-
HDRS = $(srcdir)/extconf.h $(srcdir)/libxcbindings.h
|
142
|
-
LOCAL_HDRS =
|
143
|
-
TARGET = xcellus
|
144
|
-
TARGET_NAME = xcellus
|
145
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
146
|
-
DLLIB = $(TARGET).so
|
147
|
-
EXTSTATIC =
|
148
|
-
STATIC_LIB =
|
149
|
-
|
150
|
-
TIMESTAMP_DIR = .
|
151
|
-
BINDIR = $(bindir)
|
152
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
153
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
154
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
155
|
-
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
156
|
-
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
157
|
-
TARGET_SO_DIR =
|
158
|
-
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
159
|
-
CLEANLIBS = $(TARGET_SO)
|
160
|
-
CLEANOBJS = *.o *.bak
|
161
|
-
|
162
|
-
all: $(DLLIB)
|
163
|
-
static: $(STATIC_LIB)
|
164
|
-
.PHONY: all install static install-so install-rb
|
165
|
-
.PHONY: clean clean-so clean-static clean-rb
|
166
|
-
|
167
|
-
clean-static::
|
168
|
-
clean-rb-default::
|
169
|
-
clean-rb::
|
170
|
-
clean-so::
|
171
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
172
|
-
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
173
|
-
|
174
|
-
distclean-rb-default::
|
175
|
-
distclean-rb::
|
176
|
-
distclean-so::
|
177
|
-
distclean-static::
|
178
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
179
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
180
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
181
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
182
|
-
|
183
|
-
realclean: distclean
|
184
|
-
install: install-so install-rb
|
185
|
-
|
186
|
-
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
|
187
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
188
|
-
clean-static::
|
189
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
190
|
-
install-rb: pre-install-rb do-install-rb install-rb-default
|
191
|
-
install-rb-default: pre-install-rb-default do-install-rb-default
|
192
|
-
pre-install-rb: Makefile
|
193
|
-
pre-install-rb-default: Makefile
|
194
|
-
do-install-rb:
|
195
|
-
do-install-rb-default:
|
196
|
-
pre-install-rb-default:
|
197
|
-
@$(NULLCMD)
|
198
|
-
$(TIMESTAMP_DIR)/.sitearchdir.time:
|
199
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
200
|
-
$(Q) $(TOUCH) $@
|
201
|
-
|
202
|
-
site-install: site-install-so site-install-rb
|
203
|
-
site-install-so: install-so
|
204
|
-
site-install-rb: install-rb
|
205
|
-
|
206
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
207
|
-
|
208
|
-
.cc.o:
|
209
|
-
$(ECHO) compiling $(<)
|
210
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
211
|
-
|
212
|
-
.cc.S:
|
213
|
-
$(ECHO) translating $(<)
|
214
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
215
|
-
|
216
|
-
.mm.o:
|
217
|
-
$(ECHO) compiling $(<)
|
218
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
219
|
-
|
220
|
-
.mm.S:
|
221
|
-
$(ECHO) translating $(<)
|
222
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
223
|
-
|
224
|
-
.cxx.o:
|
225
|
-
$(ECHO) compiling $(<)
|
226
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
227
|
-
|
228
|
-
.cxx.S:
|
229
|
-
$(ECHO) translating $(<)
|
230
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
231
|
-
|
232
|
-
.cpp.o:
|
233
|
-
$(ECHO) compiling $(<)
|
234
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
235
|
-
|
236
|
-
.cpp.S:
|
237
|
-
$(ECHO) translating $(<)
|
238
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
239
|
-
|
240
|
-
.c.o:
|
241
|
-
$(ECHO) compiling $(<)
|
242
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
243
|
-
|
244
|
-
.c.S:
|
245
|
-
$(ECHO) translating $(<)
|
246
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
247
|
-
|
248
|
-
.m.o:
|
249
|
-
$(ECHO) compiling $(<)
|
250
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
251
|
-
|
252
|
-
.m.S:
|
253
|
-
$(ECHO) translating $(<)
|
254
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
255
|
-
|
256
|
-
$(TARGET_SO): $(OBJS) Makefile
|
257
|
-
$(ECHO) linking shared-object $(DLLIB)
|
258
|
-
-$(Q)$(RM) $(@)
|
259
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|
data/ext/xcellus/extconf.h
DELETED
data/ext/xcellus/extconf.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'mkmf'
|
2
|
-
|
3
|
-
def darwin?
|
4
|
-
RbConfig::CONFIG['target_os'] =~ /darwin/
|
5
|
-
end
|
6
|
-
|
7
|
-
unless have_header 'libxcbindings.h'
|
8
|
-
abort 'missing libxcbindings. Did you build the go project?'
|
9
|
-
end
|
10
|
-
|
11
|
-
$LDFLAGS << " -L#{Dir.pwd} "
|
12
|
-
dir_config('xcbindings', Dir.pwd, Dir.pwd)
|
13
|
-
|
14
|
-
# if darwin?
|
15
|
-
|
16
|
-
# else
|
17
|
-
# $LDFLAGS = '-Wl,-rpath \'-Wl,$$ORIGIN\''
|
18
|
-
# end
|
19
|
-
|
20
|
-
have_library 'xcbindings'
|
21
|
-
|
22
|
-
create_header
|
23
|
-
create_makefile 'xcellus'
|
data/ext/xcellus/xcellus.c
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#include <stdbool.h>
|
2
|
-
#include <ruby.h>
|
3
|
-
#include "extconf.h"
|
4
|
-
#include "libxcbindings.h"
|
5
|
-
|
6
|
-
VALUE rb_process(VALUE self, VALUE str) {
|
7
|
-
if (RB_TYPE_P(str, T_STRING) == 0) return Qnil;
|
8
|
-
struct go_xcellus_process_return result = go_xcellus_process(RSTRING_PTR(str));
|
9
|
-
bool failed = result.r0 == 1;
|
10
|
-
char *error_description = result.r1;
|
11
|
-
GoInt buffer_len = result.r2;
|
12
|
-
char *buffer = result.r3;
|
13
|
-
if(failed) {
|
14
|
-
VALUE errObj = rb_exc_new2(rb_eStandardError, error_description);
|
15
|
-
free(error_description);
|
16
|
-
rb_exc_raise(errObj);
|
17
|
-
}
|
18
|
-
|
19
|
-
VALUE retval = rb_str_new(buffer, buffer_len);
|
20
|
-
free(buffer);
|
21
|
-
return retval;
|
22
|
-
}
|
23
|
-
|
24
|
-
void Init_xcellus() {
|
25
|
-
VALUE module = rb_define_module("Xcellus");
|
26
|
-
rb_define_singleton_method(module, "process", rb_process, 1);
|
27
|
-
}
|
data/golang/xcellus.go
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
package main
|
2
|
-
|
3
|
-
/*
|
4
|
-
#include <stdlib.h>
|
5
|
-
*/
|
6
|
-
import "C"
|
7
|
-
|
8
|
-
import (
|
9
|
-
"bufio"
|
10
|
-
"bytes"
|
11
|
-
"encoding/json"
|
12
|
-
"fmt"
|
13
|
-
|
14
|
-
"github.com/tealeg/xlsx"
|
15
|
-
)
|
16
|
-
|
17
|
-
func main() {}
|
18
|
-
|
19
|
-
type worksheet struct {
|
20
|
-
Title string `json:"title"`
|
21
|
-
Headers []string `json:"headers"`
|
22
|
-
Rows [][]interface{} `json:"rows"`
|
23
|
-
}
|
24
|
-
|
25
|
-
//export go_xcellus_process
|
26
|
-
func go_xcellus_process(data *C.char) (failed bool, err *C.char, len int, buf *C.char) {
|
27
|
-
synthesizedData := C.GoString(data)
|
28
|
-
var wb []*worksheet
|
29
|
-
goErr := json.Unmarshal([]byte(synthesizedData), &wb)
|
30
|
-
|
31
|
-
if goErr != nil {
|
32
|
-
return true, C.CString(fmt.Sprintf("%s\x00", goErr)), 0, nil
|
33
|
-
}
|
34
|
-
|
35
|
-
file := xlsx.NewFile()
|
36
|
-
var sheetPtr *xlsx.Sheet
|
37
|
-
var rowPtr *xlsx.Row
|
38
|
-
var cellPtr *xlsx.Cell
|
39
|
-
|
40
|
-
for _, sheet := range wb {
|
41
|
-
sheetPtr, goErr = file.AddSheet(sheet.Title)
|
42
|
-
if goErr != nil {
|
43
|
-
return true, C.CString(fmt.Sprintf("%s\x00", goErr)), 0, nil
|
44
|
-
}
|
45
|
-
rowPtr = sheetPtr.AddRow()
|
46
|
-
for _, v := range sheet.Headers {
|
47
|
-
cellPtr = rowPtr.AddCell()
|
48
|
-
cellPtr.SetValue(v)
|
49
|
-
}
|
50
|
-
for _, r := range sheet.Rows {
|
51
|
-
rowPtr = sheetPtr.AddRow()
|
52
|
-
for _, c := range r {
|
53
|
-
cellPtr = rowPtr.AddCell()
|
54
|
-
cellPtr.SetValue(c)
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
tmpBuffer := &bytes.Buffer{}
|
60
|
-
writer := bufio.NewWriter(tmpBuffer)
|
61
|
-
goErr = file.Write(writer)
|
62
|
-
|
63
|
-
if goErr != nil {
|
64
|
-
return true, C.CString(fmt.Sprintf("%s\x00", goErr)), 0, nil
|
65
|
-
}
|
66
|
-
|
67
|
-
len = tmpBuffer.Len()
|
68
|
-
p := C.malloc(C.size_t(len))
|
69
|
-
|
70
|
-
// copy the data into the buffer, by converting it to a Go array
|
71
|
-
cBuf := (*[1 << 30]byte)(p)
|
72
|
-
copy(cBuf[:], tmpBuffer.Bytes())
|
73
|
-
|
74
|
-
failed = false
|
75
|
-
err = nil
|
76
|
-
buf = (*C.char)(p) // Ownership of P will be changed to Ruby's after
|
77
|
-
// being received from the counterpart C code.
|
78
|
-
// DO NOT free IT.
|
79
|
-
return
|
80
|
-
}
|
data/script/build-golang
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
set -e
|
3
|
-
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
4
|
-
mkdir -p /go/src/app
|
5
|
-
cd /go/src/app && \
|
6
|
-
cp /source/Gopkg* /go/src/app && \
|
7
|
-
cp /source/golang/* /go/src/app && \
|
8
|
-
dep ensure && \
|
9
|
-
go build -o /source/ext/xcellus/libxcbindings.so -buildmode=c-shared /go/src/app/xcellus.go
|
data/script/build-ruby
DELETED
data/xcellus.gemspec
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'xcellus'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'xcellus'
|
9
|
-
spec.version = Xcellus::VERSION
|
10
|
-
spec.authors = ['Victor Gama']
|
11
|
-
spec.email = ['hey@vito.io']
|
12
|
-
|
13
|
-
spec.summary = %q{Xcellus is an ugly XLSX generator}
|
14
|
-
spec.description = <<-description
|
15
|
-
Xcellus leverages a native extension to create XLSX files. It is an 'ugly'
|
16
|
-
generator because it lacks all styling mechanisms to make your XLSX pretty.
|
17
|
-
description
|
18
|
-
spec.homepage = 'https://github.com/victorgama/xcellus'
|
19
|
-
spec.license = 'MIT'
|
20
|
-
|
21
|
-
spec.files = (`git ls-files -z`.split("\x0").reject do |f|
|
22
|
-
f.match(%r{^(test|spec|features|coverage)/})
|
23
|
-
end + ['ext/xcellus/xcellus.so'])
|
24
|
-
spec.bindir = 'ext/xcellus'
|
25
|
-
spec.executables = spec.files.grep(%r{^ext/xcellus/}) { |f| File.basename(f) }
|
26
|
-
spec.require_paths = ['lib']
|
27
|
-
|
28
|
-
spec.add_development_dependency 'bundler', '~> 1.16'
|
29
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
|
-
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
32
|
-
spec.add_development_dependency 'rubocop', '~> 0.55.0'
|
33
|
-
spec.add_development_dependency 'codecov'
|
34
|
-
end
|