sample-template-generator 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c39abfbf9dcfd2fef15473ddd25d989918c1f7f3
4
+ data.tar.gz: b4fe52ccf5ba84fff6f0e5af834ffc9fd9ff23a9
5
+ SHA512:
6
+ metadata.gz: b8d5ce348811e40411fa455b17b70e1ad3124083c86bf3722371d5a0965d2335543fae0929e7f78d99845b2df2f78153e197d89f8057ec0b2327bcee2cb148d3
7
+ data.tar.gz: a4f1a410c476b8b2bfb5b8e32423a6f5c81edd180d9a6341e597a676bd78ff24fa12362abe7414610e39a72e719687696725b34449ab015bf70ffbc2121b0a8e
@@ -0,0 +1,25 @@
1
+ ---
2
+ engines:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ - ruby
8
+ - javascript
9
+ - python
10
+ - php
11
+ fixme:
12
+ enabled: true
13
+ rubocop:
14
+ enabled: true
15
+ ratings:
16
+ paths:
17
+ - "**.inc"
18
+ - "**.js"
19
+ - "**.jsx"
20
+ - "**.module"
21
+ - "**.php"
22
+ - "**.py"
23
+ - "**.rb"
24
+ exclude_paths:
25
+ - test/
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea/
11
+ *~
File without changes
@@ -0,0 +1 @@
1
+ sample-template-generator
@@ -0,0 +1 @@
1
+ ruby-2.1.9
@@ -0,0 +1,10 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.1.9
5
+ - 2.2.5
6
+ - 2.3.1
7
+
8
+ cache: bundler
9
+
10
+ before_install: gem install bundler -v 1.12.5
@@ -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
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sample-template-generator-gem.gemspec
4
+ gemspec
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.
@@ -0,0 +1,14 @@
1
+ # Sample Template Generator
2
+
3
+ [![Code Climate](https://codeclimate.com/github/seek4science/sample-template-generator-gem/badges/gpa.svg)](https://codeclimate.com/github/seek4science/sample-template-generator-gem) [![Build Status](https://travis-ci.org/seek4science/sample-template-generator-gem.svg?branch=master)](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
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
Binary file
Binary file
@@ -0,0 +1,22 @@
1
+ require 'seek/sample_templates/column'
2
+ require 'seek/sample_templates/generator'
3
+
4
+ module Seek
5
+ # Main entry point for generating templates
6
+ module SampleTemplates
7
+ # generates a template at the specific path
8
+ def self.generate(sheet_name, sheet_index, columns, path)
9
+ Seek::SampleTemplates::Generator.new(
10
+ path, create_json(columns, sheet_index, sheet_name)
11
+ ).generate
12
+ end
13
+
14
+ def self.create_json(columns, sheet_index, sheet_name)
15
+ { sheet_name: sheet_name,
16
+ sheet_index: sheet_index,
17
+ columns: columns.collect(&:as_json) }.to_json
18
+ end
19
+
20
+ private_class_method :create_json
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ module Seek
2
+ module SampleTemplates
3
+ # Describes a column in the template.
4
+ # The name is the text put in the top row,
5
+ # and contents will create a dropdown in the row below unless empty
6
+ class Column
7
+ attr_reader :name, :contents
8
+
9
+ def initialize(name, contents = [])
10
+ @name = name
11
+ @contents = contents
12
+ end
13
+
14
+ def as_json
15
+ { @name => @contents }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+ require 'cocaine'
2
+
3
+ module Seek
4
+ module SampleTemplates
5
+ # Generator class for creating templates.
6
+ # Generally this shouldn't be used directly, but instead should be used
7
+ # through Seek::SampleTemplates.generate(..)
8
+ class Generator
9
+ JAR_VERSION = '0.3'.freeze
10
+ JAR_PATH = File.dirname(__FILE__) +
11
+ "/../../../jars/sample-template-generator-#{JAR_VERSION}.jar"
12
+ DEFAULT_MEMORY_ALLOCATION = '512M'.freeze
13
+ BUFFER_SIZE = 250_000 # 1/4 a megabyte
14
+
15
+ attr_reader :json, :path, :memory_allocation
16
+
17
+ def initialize(path, json, memory_allocation = DEFAULT_MEMORY_ALLOCATION)
18
+ @path = path
19
+ @json = json
20
+ @memory_allocation = memory_allocation
21
+ end
22
+
23
+ def generate
24
+ run_with_cocaine
25
+ end
26
+
27
+ private
28
+
29
+ def command
30
+ command = "java -Xmx#{@memory_allocation} -jar #{JAR_PATH}"
31
+ command += " -f '#{path}'"
32
+ command += " -j '#{json}'"
33
+ command
34
+ end
35
+
36
+ def run_with_cocaine
37
+ output = Cocaine::CommandLine.new(command).run
38
+ output.strip
39
+ rescue Cocaine::ExitStatusError => exception
40
+ raise exception.message
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ module Seek
2
+ module SampleTemplates
3
+ VERSION = '0.3.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,30 @@
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'
8
+ spec.version = Seek::SampleTemplates::VERSION
9
+ spec.authors = ['Stuart Owen']
10
+ spec.email = ['stuart.owen@manchester.ac.uk']
11
+
12
+ spec.summary = 'Bespoke tool for generating spreadsheet templates from Sample Types for use with SEEK.'
13
+ spec.homepage = 'http://seek4science.org'
14
+ spec.license = 'BSD-3-Clause'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency('rdoc', ['>= 0'])
22
+ spec.add_dependency('cocaine', ['>= 0'])
23
+
24
+ spec.add_development_dependency('rubocop', ['>= 0'])
25
+ spec.add_development_dependency('rubycritic', ['>= 0'])
26
+ spec.add_development_dependency 'bundler', '~> 1.12'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'minitest', '~> 5.0'
29
+ spec.add_development_dependency('activesupport', ">= 3.0.0", "< 5.0")
30
+ end
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sample-template-generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Stuart Owen
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rdoc
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: cocaine
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
+ - !ruby/object:Gem::Dependency
112
+ name: activesupport
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 3.0.0
118
+ - - "<"
119
+ - !ruby/object:Gem::Version
120
+ version: '5.0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 3.0.0
128
+ - - "<"
129
+ - !ruby/object:Gem::Version
130
+ version: '5.0'
131
+ description:
132
+ email:
133
+ - stuart.owen@manchester.ac.uk
134
+ executables: []
135
+ extensions: []
136
+ extra_rdoc_files: []
137
+ files:
138
+ - ".codeclimate.yml"
139
+ - ".gitignore"
140
+ - ".rubocop.yml"
141
+ - ".ruby-gemset"
142
+ - ".ruby-version"
143
+ - ".travis.yml"
144
+ - CODE_OF_CONDUCT.md
145
+ - Gemfile
146
+ - LICENSE
147
+ - README.md
148
+ - Rakefile
149
+ - bin/console
150
+ - bin/setup
151
+ - jars/lib/commons-codec-1.10.jar
152
+ - jars/lib/curvesapi-1.03.jar
153
+ - jars/lib/json-simple-1.1.1.jar
154
+ - jars/lib/junit-4.8.2.jar
155
+ - jars/lib/poi-3.14.jar
156
+ - jars/lib/poi-ooxml-3.14.jar
157
+ - jars/lib/poi-ooxml-schemas-3.14.jar
158
+ - jars/lib/stax-api-1.0.1.jar
159
+ - jars/lib/xmlbeans-2.6.0.jar
160
+ - jars/sample-template-generator-0.3.jar
161
+ - lib/seek/sample_templates.rb
162
+ - lib/seek/sample_templates/column.rb
163
+ - lib/seek/sample_templates/generator.rb
164
+ - lib/seek/sample_templates/version.rb
165
+ - sample-template-generator-gem.gemspec
166
+ homepage: http://seek4science.org
167
+ licenses:
168
+ - BSD-3-Clause
169
+ metadata: {}
170
+ post_install_message:
171
+ rdoc_options: []
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ requirements: []
185
+ rubyforge_project:
186
+ rubygems_version: 2.4.8
187
+ signing_key:
188
+ specification_version: 4
189
+ summary: Bespoke tool for generating spreadsheet templates from Sample Types for use
190
+ with SEEK.
191
+ test_files: []