inci_score 3.1.3 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/config.ru DELETED
@@ -1,3 +0,0 @@
1
- require "inci_score/api"
2
-
3
- run InciScore::Api
data/ext/levenshtein.c DELETED
@@ -1,43 +0,0 @@
1
- static int call(const char* word1, int len1, const char* word2, int len2) {
2
- int matrix[len1 + 1][len2 + 1];
3
- int i;
4
- for (i = 0; i <= len1; i++) {
5
- matrix[i][0] = i;
6
- }
7
- for (i = 0; i <= len2; i++) {
8
- matrix[0][i] = i;
9
- }
10
- for (i = 1; i <= len1; i++) {
11
- int j;
12
- char c1;
13
-
14
- c1 = word1[i-1];
15
- for (j = 1; j <= len2; j++) {
16
- char c2;
17
-
18
- c2 = word2[j-1];
19
- if (c1 == c2) {
20
- matrix[i][j] = matrix[i-1][j-1];
21
- }
22
- else {
23
- int delete;
24
- int insert;
25
- int substitute;
26
- int minimum;
27
-
28
- delete = matrix[i-1][j] + 1;
29
- insert = matrix[i][j-1] + 1;
30
- substitute = matrix[i-1][j-1] + 1;
31
- minimum = delete;
32
- if (insert < minimum) {
33
- minimum = insert;
34
- }
35
- if (substitute < minimum) {
36
- minimum = substitute;
37
- }
38
- matrix[i][j] = minimum;
39
- }
40
- }
41
- }
42
- return matrix[len1][len2];
43
- }
data/inci_score.gemspec DELETED
@@ -1,28 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "inci_score/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "inci_score"
7
- s.version = InciScore::VERSION
8
- s.authors = ["costajob"]
9
- s.email = ["costajob@gmail.com"]
10
- s.summary = %q{A library that computes the hazard of cosmetic products components, based on the Biodizionario data.}
11
- s.homepage = "https://github.com/costajob/inci_score.git"
12
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
13
- s.bindir = "bin"
14
- s.executables << "inci_score"
15
- s.require_paths = ["lib"]
16
- s.license = "MIT"
17
- s.required_ruby_version = ">= 2.2.2"
18
-
19
- s.add_runtime_dependency "puma", "~> 3"
20
- s.add_runtime_dependency "rack", "~> 2"
21
- s.add_runtime_dependency "RubyInline", "~> 3"
22
-
23
- s.add_development_dependency "bundler", "~> 1.11"
24
- s.add_development_dependency "rake", "~> 10.0"
25
- s.add_development_dependency "minitest", "~> 5.0"
26
- s.add_development_dependency "rack-test", "~> 0.6"
27
- s.add_development_dependency "benchmark-ips", "~> 2"
28
- end
@@ -1,19 +0,0 @@
1
- require "rack"
2
- require "inci_score"
3
-
4
- module InciScore
5
- module Api
6
- extend self
7
-
8
- def catalog
9
- @catalog ||= Catalog.fetch
10
- end
11
-
12
- def call(env)
13
- req = Rack::Request.new(env)
14
- src = req.params["src"]
15
- json = src ? Computer.new(src: src, catalog: catalog).call.to_json : %q({"error": "no valid source"})
16
- ["200", {"Content-Type" => "application/json"}, [json]]
17
- end
18
- end
19
- end
@@ -1,13 +0,0 @@
1
- require "yaml"
2
-
3
- module InciScore
4
- module Catalog
5
- extend self
6
-
7
- YAML_PATH = File::expand_path("../../../config/catalog.yml", __FILE__)
8
-
9
- def fetch(src = File.read(YAML_PATH))
10
- YAML::load(src)
11
- end
12
- end
13
- end
@@ -1,51 +0,0 @@
1
- require "etc"
2
- require "puma/launcher"
3
- require "puma/configuration"
4
-
5
- module InciScore
6
- class Server
7
- RACKUP_FILE = File.expand_path("../../../config.ru", __FILE__)
8
- DEFAULT_HOST = "0.0.0.0"
9
- CPUs = Etc.nprocessors
10
-
11
- def initialize(port: 9292, threads: "0:#{CPUs*4}", workers: CPUs, preload: false,
12
- config_klass: Puma::Configuration, launcher_klass: Puma::Launcher)
13
- @port = port
14
- @workers = workers
15
- @threads = threads.split(":")
16
- @preload = preload
17
- @config_klass = config_klass
18
- @launcher_klass = launcher_klass
19
- end
20
-
21
- def run
22
- launcher.run
23
- end
24
-
25
- private def launcher
26
- @launcher_klass.new(config)
27
- end
28
-
29
- private def config
30
- @config_klass.new do |c|
31
- c.rackup RACKUP_FILE
32
- c.bind "tcp://#{DEFAULT_HOST}:#{@port}"
33
- c.workers @workers if workers?
34
- c.threads(*@threads)
35
- c.preload_app! if @preload
36
- end
37
- end
38
-
39
- private def workers?
40
- @workers > 1 && !java? && !windows?
41
- end
42
-
43
- private def java?
44
- RUBY_VERSION == "java"
45
- end
46
-
47
- private def windows?
48
- Gem.win_platform?
49
- end
50
- end
51
- end
data/log/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- # Ignore everything in this directory
2
- *
3
- # Except this file
4
- !.gitignore