mrubyudf 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.
@@ -0,0 +1,16 @@
1
+ require 'erb'
2
+
3
+ class MrubyUdf
4
+ class Template
5
+ attr_reader :func
6
+
7
+ def initialize(func)
8
+ @func = func
9
+ end
10
+
11
+ def result
12
+ template = File.read("#{__dir__}/template.erb")
13
+ ERB.new(template).result(func.context)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ class MrubyUdf
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,40 @@
1
+ diff --git a/build_config.rb b/build_config.rb
2
+ index 254a28ce..310191e3 100644
3
+ --- a/build_config.rb
4
+ +++ b/build_config.rb
5
+ @@ -35,6 +35,10 @@ MRuby::Build.new do |conf|
6
+ # cc.compile_options = %Q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
7
+ # end
8
+
9
+ + conf.cc do |cc|
10
+ + cc.flags = '-fPIC'
11
+ + end
12
+ +
13
+ # mrbc settings
14
+ # conf.mrbc do |mrbc|
15
+ # mrbc.compile_options = "-g -B%{funcname} -o-" # The -g option is required for line numbers
16
+ @@ -59,6 +63,11 @@ MRuby::Build.new do |conf|
17
+ # archiver.archive_options = 'rs "%{outfile}" %{objs}'
18
+ # end
19
+
20
+ + conf.archiver do |archiver|
21
+ + archiver.command = 'gcc'
22
+ + archiver.archive_options = '-shared -o %{outfile} %{objs}'
23
+ + end
24
+ +
25
+ # Parser generator settings
26
+ # conf.yacc do |yacc|
27
+ # yacc.command = ENV['YACC'] || 'bison'
28
+ diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb
29
+ index 8154b2b1..80f0b782 100644
30
+ --- a/lib/mruby/build.rb
31
+ +++ b/lib/mruby/build.rb
32
+ @@ -61,7 +61,7 @@ module MRuby
33
+ if ENV['OS'] == 'Windows_NT'
34
+ @exts = Exts.new('.o', '.exe', '.a')
35
+ else
36
+ - @exts = Exts.new('.o', '', '.a')
37
+ + @exts = Exts.new('.o', '', '.so')
38
+ end
39
+
40
+ build_dir = build_dir || ENV['MRUBY_BUILD_DIR'] || "#{MRUBY_ROOT}/build"
data/mrubyudf.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ require_relative 'lib/mrubyudf/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "mrubyudf"
5
+ spec.version = MrubyUdf::VERSION
6
+ spec.authors = ["TOMITA Masahiro"]
7
+ spec.email = ["tommy@tmtm.org"]
8
+
9
+ spec.summary = 'Create MySQL UDF using mruby'
10
+ spec.description = 'Create MySQL UDF using mruby'
11
+ spec.homepage = 'https://github.com/tmtm/mrubyudf'
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = 'https://github.com/tmtm/mrubyudf'
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mrubyudf
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - TOMITA Masahiro
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-05-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Create MySQL UDF using mruby
14
+ email:
15
+ - tommy@tmtm.org
16
+ executables:
17
+ - mrubyudf
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".gitignore"
22
+ - Gemfile
23
+ - LICENSE
24
+ - README.md
25
+ - Rakefile
26
+ - bin/console
27
+ - bin/setup
28
+ - example/circumference.rb
29
+ - example/circumference.spec
30
+ - example/fib.rb
31
+ - example/fib.spec
32
+ - example/repeat_str.rb
33
+ - example/repeat_str.spec
34
+ - example/rownum.rb
35
+ - example/rownum.spec
36
+ - example/swapcase.rb
37
+ - example/swapcase.spec
38
+ - exe/mrubyudf
39
+ - lib/mrubyudf.rb
40
+ - lib/mrubyudf/command.rb
41
+ - lib/mrubyudf/function.rb
42
+ - lib/mrubyudf/template.erb
43
+ - lib/mrubyudf/template.rb
44
+ - lib/mrubyudf/version.rb
45
+ - misc/mruby-shared.patch
46
+ - mrubyudf.gemspec
47
+ homepage: https://github.com/tmtm/mrubyudf
48
+ licenses: []
49
+ metadata:
50
+ homepage_uri: https://github.com/tmtm/mrubyudf
51
+ source_code_uri: https://github.com/tmtm/mrubyudf
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.3.0
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.1.2
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Create MySQL UDF using mruby
71
+ test_files: []