script_core 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4bb4023e54672be935b36da0220bf02b21587deef921521c487a366934d7093
4
- data.tar.gz: 806d9df9fdc4deb8225600323eab35804bf51d09418054eb33188f236a78a1cf
3
+ metadata.gz: e0f2086b850c4deeb38dc6fc3ca55efcf179633446b0fc39345f8bc7a7f17ce5
4
+ data.tar.gz: d58f2f9cafb8e47ac0f9d216c83114efd7fc99d0ea9a3df354cad61722023f9f
5
5
  SHA512:
6
- metadata.gz: d7b2eb5ea5282465afc626a282efa8bd632097c2a6d73d680a115087849eae27e6ace1ab57873d15d143277765cbe94f4b8d9fe41c307b89906dace8111e62c2
7
- data.tar.gz: 4e347f5a0f781c786db12422012c4c12be52fcf2aad7e5a88d662c148e8bd2153cafb023d9040867f4199b4b51ed6f64e36e48f82eb6652e4494d6b3388c0e6f
6
+ metadata.gz: '09cea8f698d1a28cfef9bcfb5b44e1ccf0256b6abe36e4f92d319c897a68aa9365d7bb42aea043bcdcf3dcd78dd3448470ed1d9ad78afbf39e3eea8a28f8f198'
7
+ data.tar.gz: 6a3ace78a146a29033aed57f85ce0493d25c4e25c8c23798c95bd9482ee3600664d51597015dfe7f641cb9b20de2611caab4f9de00c9920f1a530f621f0b4132
@@ -0,0 +1,3 @@
1
+ *.rb diff=ruby
2
+ *.gemspec diff=ruby
3
+
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  .idea
2
2
  .vagrant
3
3
  .bundle
4
+ *.gem
4
5
  Gemfile.lock
5
6
  tmp
6
7
  bin/enterprise_script_service
data/Gemfile CHANGED
@@ -1,9 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  source("https://rubygems.org")
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4
5
 
5
6
  gemspec
6
- group :deployment do
7
- gem "package_cloud"
8
- gem "rake"
9
- end
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "pathname"
4
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
5
+ Pathname.new(__FILE__).realpath)
6
+
7
+ require "rubygems"
8
+ require "bundler/setup"
9
+ require "pry"
10
+ require "script_core"
11
+
12
+ Pry.start
@@ -4,9 +4,7 @@
4
4
 
5
5
  mruby_engine_gembox_path =
6
6
  if ENV["MRUBY_ENGINE_GEMBOX_PATH"] && File.exist?(ENV["MRUBY_ENGINE_GEMBOX_PATH"])
7
- unless ENV["MRUBY_ENGINE_GEMBOX_PATH"].end_with?(".gembox")
8
- raise "`#{ENV["MRUBY_ENGINE_GEMBOX_PATH"]}` require `.gembox` extension"
9
- end
7
+ raise "`#{ENV['MRUBY_ENGINE_GEMBOX_PATH']}` require `.gembox` extension" unless ENV["MRUBY_ENGINE_GEMBOX_PATH"].end_with?(".gembox")
10
8
  Pathname.new ENV["MRUBY_ENGINE_GEMBOX_PATH"][0..-8]
11
9
  else
12
10
  Pathname.new(__FILE__).dirname.join("mruby_engine")
@@ -4,7 +4,8 @@ module ScriptCore
4
4
  class Engine
5
5
  attr_accessor :timeout, :instruction_quota, :instruction_quota_start, :memory_quota, :instructions
6
6
 
7
- def initialize(bin_path = ScriptCore::DEFAULT_BIN_PATH, executable_name: "enterprise_script_service",
7
+ def initialize(bin_path = ScriptCore::DEFAULT_BIN_PATH,
8
+ executable_name: "enterprise_script_service",
8
9
  instructions_name: "enterprise_script_service.mrb")
9
10
  raise Errno::ENOENT, "No such directory - #{bin_path}" unless File.directory?(bin_path)
10
11
  @bin_path = bin_path
@@ -19,14 +20,14 @@ def initialize(bin_path = ScriptCore::DEFAULT_BIN_PATH, executable_name: "enterp
19
20
  @instructions = File.exist?(preload_instructions_path) ? File.binread(preload_instructions_path) : nil
20
21
  end
21
22
 
22
- def eval(sources, payload: nil)
23
+ def eval(sources, input: nil, instruction_quota_start: nil)
23
24
  @executable.run(
24
- input: payload || {},
25
- sources: sources || [],
25
+ input: input || {},
26
+ sources: sources,
26
27
  instructions: @instructions,
27
28
  timeout: @timeout,
28
29
  instruction_quota: @instruction_quota,
29
- instruction_quota_start: @instruction_quota_start,
30
+ instruction_quota_start: instruction_quota_start || @instruction_quota_start,
30
31
  memory_quota: @memory_quota
31
32
  )
32
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ScriptCore
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
@@ -33,14 +33,16 @@
33
33
  end
34
34
 
35
35
  spec.extensions = ["ext/enterprise_script_service/Rakefile"]
36
- spec.homepage = "https://github.com/jasl-lab/script_core"
36
+ spec.homepage = "https://github.com/rails-engine/script_core"
37
37
  spec.license = "MIT"
38
38
  spec.required_ruby_version = ">= 2.3"
39
39
 
40
40
  spec.add_dependency("msgpack", "~> 1.0")
41
+ spec.add_dependency("rake-compiler", "~> 1.0")
42
+
41
43
  spec.add_development_dependency("bundler", "~> 1.6")
44
+ spec.add_development_dependency("pry", "~> 0.11")
42
45
  spec.add_development_dependency("pry-byebug", "~> 3.4")
43
- spec.add_development_dependency("rake", "~> 11.3")
44
- spec.add_development_dependency("rake-compiler", "~> 0.9")
46
+ spec.add_development_dependency("rake", "~> 12.0")
45
47
  spec.add_development_dependency("rspec", "~> 3.5")
46
48
  end
@@ -60,7 +60,7 @@
60
60
  end
61
61
 
62
62
  SCRIPT_SETUP_INSTRUCTION_COUNT = 15
63
- INSTRUCTION_COUNT_PER_LOOP = 13 #For .times {}
63
+ INSTRUCTION_COUNT_PER_LOOP = 13 # For .times {}
64
64
 
65
65
  def expected_instructions(loops)
66
66
  SCRIPT_SETUP_INSTRUCTION_COUNT + INSTRUCTION_COUNT_PER_LOOP * loops
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: script_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-10 00:00:00.000000000 Z
11
+ date: 2018-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake-compiler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -39,47 +53,47 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '1.6'
41
55
  - !ruby/object:Gem::Dependency
42
- name: pry-byebug
56
+ name: pry
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '3.4'
61
+ version: '0.11'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '3.4'
68
+ version: '0.11'
55
69
  - !ruby/object:Gem::Dependency
56
- name: rake
70
+ name: pry-byebug
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '11.3'
75
+ version: '3.4'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '11.3'
82
+ version: '3.4'
69
83
  - !ruby/object:Gem::Dependency
70
- name: rake-compiler
84
+ name: rake
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '0.9'
89
+ version: '12.0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '0.9'
96
+ version: '12.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +115,7 @@ extensions:
101
115
  - ext/enterprise_script_service/Rakefile
102
116
  extra_rdoc_files: []
103
117
  files:
118
+ - ".gitattributes"
104
119
  - ".gitignore"
105
120
  - ".gitmodules"
106
121
  - ".rspec"
@@ -113,6 +128,7 @@ files:
113
128
  - Rakefile
114
129
  - Vagrantfile
115
130
  - bin/bundler
131
+ - bin/console
116
132
  - bin/pry
117
133
  - bin/rake
118
134
  - bin/rspec
@@ -3561,7 +3577,7 @@ files:
3561
3577
  - tests/script_data_test.cpp
3562
3578
  - tests/script_runner_test.cpp
3563
3579
  - tests/timer_test.cpp
3564
- homepage: https://github.com/jasl-lab/script_core
3580
+ homepage: https://github.com/rails-engine/script_core
3565
3581
  licenses:
3566
3582
  - MIT
3567
3583
  metadata: {}