https://github.com/hfm/mruby-test-mysqld
Setting up a mysqld instance in tmpdir, and destroying it when a mruby program exits.
https://github.com/hfm/mruby-test-mysqld
mruby mysql test test-mysqld
Last synced: 28 days ago
JSON representation
Setting up a mysqld instance in tmpdir, and destroying it when a mruby program exits.
- Host: GitHub
- URL: https://github.com/hfm/mruby-test-mysqld
- Owner: hfm
- License: other
- Created: 2016-09-02T05:47:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-13T08:41:19.000Z (about 7 years ago)
- Last Synced: 2025-06-04T20:08:46.771Z (9 months ago)
- Topics: mruby, mysql, test, test-mysqld
- Language: Ruby
- Homepage:
- Size: 20.5 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mruby-test-mysqld [](https://travis-ci.org/hfm/mruby-test-mysqld)
Setting up a mysqld instance in tmpdir, and destroying it when a mruby program exits. The aim for this project is a port of [Test::mysqld](http://search.cpan.org/~kazuho/Test-mysqld/) to [mruby](https://github.com/mruby/mruby).
## install by mrbgems
- add conf.gem line to `build_config.rb`
```ruby
MRuby::Build.new do |conf|
# ... (snip) ...
conf.gem :github => 'hfm/mruby-test-mysqld'
end
```
## example
```ruby
mysqld = TestMysqld.new
# ... Initialize mysqld ...
# ... Starting mysqld ...
# => #"/tmp/mruby_testmysqld_1472791284/tmp/mysql.sock", :datadir=>"/tmp/mruby_testmysqld_1472791284/var", :pid_file=>"/tmp/mruby_testmysqld_1472791284/tmp/mysqld.pid"}, @base_dir="/tmp/mruby_testmysqld_1472791284", @mysqld="/usr/local/bin/mysqld">
db = MySQL::Database.new 'localhost', 'root', '', 'test', 3306, mysqld.socket
# => #>
# ... Execute db query...
db.close
# => nil
mysqld.stop
# ... Shutting down mysqld ...
# => nil
```
## License
under the MIT License:
- see [LICENSE](./LICENSE) file