sample-template-generator-gem 0.1.0
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 +7 -0
- data/.codeclimate.yml +25 -0
- data/.gitignore +11 -0
- data/.rubocop.yml +1156 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +10 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE +29 -0
- data/README.md +14 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/jars/lib/commons-codec-1.10.jar +0 -0
- data/jars/lib/curvesapi-1.03.jar +0 -0
- data/jars/lib/json-simple-1.1.1.jar +0 -0
- data/jars/lib/junit-4.8.2.jar +0 -0
- data/jars/lib/poi-3.14.jar +0 -0
- data/jars/lib/poi-ooxml-3.14.jar +0 -0
- data/jars/lib/poi-ooxml-schemas-3.14.jar +0 -0
- data/jars/lib/stax-api-1.0.1.jar +0 -0
- data/jars/lib/xmlbeans-2.6.0.jar +0 -0
- data/jars/sample-template-generator-0.1.jar +0 -0
- data/lib/seek/sample_templates/generator.rb +79 -0
- data/lib/seek/sample_templates/version.rb +5 -0
- data/sample-template-generator-gem.gemspec +37 -0
- metadata +168 -0
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
sample-template-generator
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.9
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at stuart.owen@manchester.ac.uk. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Copyright (c) 2010-2016, The University of Manchester, UK.
|
2
|
+
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
9
|
+
this list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
13
|
+
and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
* Neither the names of The University of Manchester nor the names of its
|
16
|
+
contributors may be used to endorse or promote products derived from this
|
17
|
+
software without specific prior written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
23
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
24
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29
|
+
POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Sample Template Generator
|
2
|
+
|
3
|
+
[](https://codeclimate.com/github/seek4science/sample-template-generator-gem) [](https://travis-ci.org/seek4science/sample-template-generator-gem)
|
4
|
+
|
5
|
+
|
6
|
+
A very simple prototype of generating an Excel Template based upon Sample Type information in [SEEK](http://seekscience.org)
|
7
|
+
|
8
|
+
This is currently very basic and scruffy prototyping work.
|
9
|
+
|
10
|
+
SEEK is developed as part of [FAIRDOM](http://fair-dom.org)
|
11
|
+
|
12
|
+
SEEK github repository can be found at https://github.com/seek4science/seek
|
13
|
+
|
14
|
+
FAIRDOM runs the [FAIRDOMHub](https://fairdomhub.org) which is a public instance of SEEK for scientific research
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "seek/sample_template_generator"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'open4'
|
2
|
+
|
3
|
+
module Seek
|
4
|
+
module SampleTemplates
|
5
|
+
def self.generate(sheet_name, sheet_index, columns, path)
|
6
|
+
Seek::SampleTemplates::Generator.new(path, create_json(columns, sheet_index, sheet_name)).generate
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.create_json(columns, sheet_index, sheet_name)
|
10
|
+
{ sheet_name: sheet_name, sheet_index: sheet_index, columns: columns.collect(&:as_json) }.to_json
|
11
|
+
end
|
12
|
+
|
13
|
+
class Column
|
14
|
+
attr_accessor :name, :contents
|
15
|
+
def initialize(name, contents = [])
|
16
|
+
@name = name
|
17
|
+
@contents = contents
|
18
|
+
end
|
19
|
+
|
20
|
+
def as_json
|
21
|
+
{ @name => @contents }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Generator
|
26
|
+
JAR_VERSION = '0.1'.freeze
|
27
|
+
JAR_PATH = File.dirname(__FILE__) + "/../../../jars/sample-template-generator-#{JAR_VERSION}.jar"
|
28
|
+
DEFAULT_MEMORY_ALLOCATION = '512M'.freeze
|
29
|
+
BUFFER_SIZE = 250_000 # 1/4 a megabyte
|
30
|
+
|
31
|
+
attr_accessor :json, :path, :memory_allocation
|
32
|
+
|
33
|
+
def initialize(path, json, memory_allocation = DEFAULT_MEMORY_ALLOCATION)
|
34
|
+
@path = path
|
35
|
+
@json = json
|
36
|
+
@memory_allocation = memory_allocation
|
37
|
+
raise Exception, 'Windows is not currently supported' if windows?
|
38
|
+
end
|
39
|
+
|
40
|
+
def generate
|
41
|
+
run_with_open4
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def command
|
47
|
+
command = "java -Xmx#{@memory_allocation} -jar #{JAR_PATH}"
|
48
|
+
command += " -f '#{path}'"
|
49
|
+
command += " -j '#{json}'"
|
50
|
+
command
|
51
|
+
end
|
52
|
+
|
53
|
+
def run_with_open4
|
54
|
+
output = ''
|
55
|
+
err_message = ''
|
56
|
+
command = command()
|
57
|
+
status = Open4.popen4(command) do |_pid, _stdin, stdout, stderr|
|
58
|
+
until (line = stdout.gets(BUFFER_SIZE)).nil?
|
59
|
+
output << line
|
60
|
+
end
|
61
|
+
stdout.close
|
62
|
+
|
63
|
+
until (line = stderr.gets(BUFFER_SIZE)).nil?
|
64
|
+
err_message << line
|
65
|
+
end
|
66
|
+
stderr.close
|
67
|
+
end
|
68
|
+
|
69
|
+
raise err_message if status.to_i.nonzero?
|
70
|
+
|
71
|
+
output.strip
|
72
|
+
end
|
73
|
+
|
74
|
+
def windows?
|
75
|
+
!(RUBY_PLATFORM =~ /mswin32/ || RUBY_PLATFORM =~ /mingw32/).nil?
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'seek/sample_templates/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'sample-template-generator-gem'
|
8
|
+
spec.version = Seek::SampleTemplates::VERSION
|
9
|
+
spec.authors = ['Stuart Owen']
|
10
|
+
spec.email = ['stuart.owen@manchester.ac.uk']
|
11
|
+
|
12
|
+
spec.summary = 'Prototype for generating spreadsheet templates for use with SEEK.'
|
13
|
+
spec.homepage = 'http://seek4science.org'
|
14
|
+
spec.license = 'BSD-3-Clause' # https://spdx.org/licenses/BSD-3-Clause.html#licenseText
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
# if spec.respond_to?(:metadata)
|
19
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
# else
|
21
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
# end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = 'exe'
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ['lib']
|
28
|
+
|
29
|
+
spec.add_dependency('open4', ['= 1.3.0'])
|
30
|
+
spec.add_dependency('rdoc', ['>= 0'])
|
31
|
+
|
32
|
+
spec.add_development_dependency('rubocop', ['>= 0'])
|
33
|
+
spec.add_development_dependency('rubycritic', ['>= 0'])
|
34
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
35
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
36
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sample-template-generator-gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stuart Owen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: open4
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubycritic
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.12'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.12'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '5.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '5.0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- stuart.owen@manchester.ac.uk
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".codeclimate.yml"
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rubocop.yml"
|
121
|
+
- ".ruby-gemset"
|
122
|
+
- ".ruby-version"
|
123
|
+
- ".travis.yml"
|
124
|
+
- CODE_OF_CONDUCT.md
|
125
|
+
- Gemfile
|
126
|
+
- LICENSE
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- bin/console
|
130
|
+
- bin/setup
|
131
|
+
- jars/lib/commons-codec-1.10.jar
|
132
|
+
- jars/lib/curvesapi-1.03.jar
|
133
|
+
- jars/lib/json-simple-1.1.1.jar
|
134
|
+
- jars/lib/junit-4.8.2.jar
|
135
|
+
- jars/lib/poi-3.14.jar
|
136
|
+
- jars/lib/poi-ooxml-3.14.jar
|
137
|
+
- jars/lib/poi-ooxml-schemas-3.14.jar
|
138
|
+
- jars/lib/stax-api-1.0.1.jar
|
139
|
+
- jars/lib/xmlbeans-2.6.0.jar
|
140
|
+
- jars/sample-template-generator-0.1.jar
|
141
|
+
- lib/seek/sample_templates/generator.rb
|
142
|
+
- lib/seek/sample_templates/version.rb
|
143
|
+
- sample-template-generator-gem.gemspec
|
144
|
+
homepage: http://seek4science.org
|
145
|
+
licenses:
|
146
|
+
- BSD-3-Clause
|
147
|
+
metadata: {}
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubyforge_project:
|
164
|
+
rubygems_version: 2.4.8
|
165
|
+
signing_key:
|
166
|
+
specification_version: 4
|
167
|
+
summary: Prototype for generating spreadsheet templates for use with SEEK.
|
168
|
+
test_files: []
|